/* unzip.c -- IO for uncompress .zip files using zlib
Version 1.1, February 14h, 2010
part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html )
Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
Modifications of Unzip for Zip64
Copyright (C) 2007-2008 Even Rouault
Modifications for Zip64 support on both zip and unzip
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
For more info read MiniZip_info.txt
------------------------------------------------------------------------------------
Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
compatibility with older software. The following is from the original crypt.c.
Code woven in by Terry Thorsen 1/2003.
Copyright (c) 1990-2000 Info-ZIP. All rights reserved.
See the accompanying file LICENSE, version 2000-Apr-09 or later
(the contents of which are also included in zip.h) for terms of use.
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
The encryption/decryption parts of this source code (as opposed to the
non-echoing password parts) were originally written in Europe. The
whole source package can be freely distributed, including from the USA.
(Prior to January 2000, re-export from the US was a violation of US law.)
This encryption code is a direct transcription of the algorithm from
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
file (appnote.txt) is distributed with the PKZIP program (even in the
version without encryption capabilities).
------------------------------------------------------------------------------------
Changes in unzip.c
2007-2008 - Even Rouault - Addition of cpl_unzGetCurrentFileZStreamPos
2007-2008 - Even Rouault - Decoration of symbol names unz* -> cpl_unz*
2007-2008 - Even Rouault - Remove old C style function prototypes
2007-2008 - Even Rouault - Add unzip support for ZIP64
Copyright (C) 2007-2008 Even Rouault
Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again).
Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G
should only read the compressed/uncompressed size from the Zip64 format if
the size from normal header was 0xFFFFFFFF
Oct-2009 - Mathias Svensson - Applied some bug fixes from paches recived from Gilles Vollant
Oct-2009 - Mathias Svensson - Applied support to unzip files with compression mathod BZIP2 (bzip2 lib is required)
Patch created by Daniel Borca
Jan-2010 - back to unzip and minizip 1.0 name scheme, with compatibility layer
Copyright (C) 1998 - 2010 Gilles Vollant, Even Rouault, Mathias Svensson
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef NOUNCRYPT
#define NOUNCRYPT
#endif
#include "zlib.h"
#include "unzip.h"
#ifdef STDC
# include <stddef.h>
# include <string.h>
# include <stdlib.h>
#endif
#ifdef NO_ERRNO_H
extern int errno;
#else
# include <errno.h>
#endif
namespace cocos2d {
#ifndef local
# define local static
#endif
/* compile with -Dlocal if your debugger can't find static symbols */
#ifndef CASESENSITIVITYDEFAULT_NO
# if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
# define CASESENSITIVITYDEFAULT_NO
# endif
#endif
#ifndef UNZ_BUFSIZE
#define UNZ_BUFSIZE (16384)
#endif
#ifndef UNZ_MAXFILENAMEINZIP
#define UNZ_MAXFILENAMEINZIP (256)
#endif
#ifndef ALLOC
# define ALLOC(size) (malloc(size))
#endif
#ifndef TRYFREE
# define TRYFREE(p) {if (p) free(p);}
#endif
#define SIZECENTRALDIRITEM (0x2e)
#define SIZEZIPLOCALHEADER (0x1e)
const char unz_copyright[] =
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
/* unz_file_info_interntal contain internal info about a file in zipfile*/
typedef struct unz_file_info64_internal_s
{
ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */
} unz_file_info64_internal;
/* file_in_zip_read_info_s contain internal information about a file in zipfile,
when reading and decompress it */
typedef struct
{
char *read_buffer; /* internal buffer for compressed data */
z_stream stream; /* zLib stream structure for inflate */
#ifdef HAVE_BZIP2
bz_stream bstream; /* bzLib stream structure for bziped */
#endif
ZPOS64_T pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
uLong stream_initialised; /* flag set if stream structure is initialised*/
ZPOS64_T offset_local_extrafield;/* offset of the local extra field */
uInt size_local_extrafield;/* size of the local extra field */
ZPOS64_T pos_local_extrafield; /* position in the local extra field in read*/
ZPOS64_T total_out_64;
uLong crc32; /* crc32 of all data uncompressed */
uLong crc32_wait; /* crc32 we must obtain after decompress all */
ZPOS64_T rest_read_compressed; /* number of byte to be decompressed */
ZPOS64_T rest_read_uncompressed;/*number of byte to be obtained after decomp*/
zlib_filefunc64_32_def z_filefunc;
voidpf filestream; /* io structore of the zipfile */
uLong compression_method; /* compression method (0==store) */
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
int raw;
} file_in_zip64_read_info_s;
/* unz64_s contain internal information about the zipfile
*/
typedef struct
{
zlib_filefunc64_32_def z_filefunc;
int is64bitOpenFunction;
voidpf filestream; /* io structore of the zipfile */
unz_global_info64 gi; /* public global information */
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
ZPOS64_T num_file; /* number of the current file in the zipfile*/
ZPOS64_T pos_in_central_dir; /* pos of the current file in the central dir*/
ZPOS64_T current_file_ok; /* flag about the usability of the current file*/
ZPOS64_T central_pos; /* position of the beginning of the central dir*/
ZPOS64_T size_central_dir; /* size of the central directory */
ZPOS64_T offset_central_dir; /* offset of start of central directory with
respect to the starting disk number */
unz_file_info64 cur_file_info; /* public info about the current file in zip*/
unz_file_info64_internal cur_file_info_internal; /* private info about it*/
file_in_zip64_read_info_s* pfile_in_zip_read; /* structure about the current
file if we are decompressing it */
int encrypted;
int isZip64;
# ifndef NOUNCRYPT
unsigned long keys[3]; /* keys defining the pseudo-random sequence */
const unsigned long* pcrc_32_tab;
# endif
} unz64_s;
#ifndef NOUNCRYPT
#include "crypt.h"
#endif
/* ===========================================================================
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
for end of file.
IN assertion: the stream s has been sucessfully opened for reading.
*/
local int unz64local_getByte OF((
const zlib_filefunc64_32_def* pzlib_filefunc_def,
voidpf filestream,
int *pi));
local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
{
unsigned char c;
int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
if (err==1)
{
*pi = (int)c;
return UNZ_OK;
}
else
{
if (
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
PhysicsEditor-Cocos2d-x-Box2d-master.zip_box2D_cocos2d_cocos2d x (378个子文件)
unzip.cpp 69KB
CCActionInterval.cpp 43KB
CCTransition.cpp 32KB
CCParticleSystem.cpp 31KB
b2World.cpp 29KB
CCSprite.cpp 28KB
CCActionEase.cpp 27KB
CCNode.cpp 25KB
CCActionTiledGrid.cpp 23KB
b2ContactSolver.cpp 22KB
CCDirector.cpp 21KB
CCLabelBMFont.cpp 21KB
CCMenuItem.cpp 21KB
CCTextureCache.cpp 19KB
CCTMXXMLParser.cpp 19KB
CCTMXLayer.cpp 19KB
CCScheduler.cpp 19KB
CCTexture2D.cpp 19KB
CCParticleExamples.cpp 19KB
CCProgressTimer.cpp 19KB
CCActionGrid3D.cpp 18KB
CCLayer.cpp 17KB
CCSpriteBatchNode.cpp 17KB
b2PrismaticJoint.cpp 17KB
b2DynamicTree.cpp 16KB
b2Island.cpp 16KB
CCMenu.cpp 16KB
CCGrid.cpp 16KB
b2CollideEdge.cpp 15KB
CCTexturePVR.cpp 15KB
CCRenderTexture.cpp 14KB
CCActionInstant.cpp 13KB
b2Distance.cpp 13KB
b2RevoluteJoint.cpp 13KB
CCSpriteFrameCache.cpp 12KB
CCTextureAtlas.cpp 12KB
CCTouchDispatcher.cpp 12KB
CCRibbon.cpp 12KB
b2GearJoint.cpp 11KB
b2TimeOfImpact.cpp 11KB
b2Body.cpp 11KB
b2WheelJoint.cpp 10KB
CCParticleSystemQuad.cpp 10KB
CCDrawingPrimitives.cpp 10KB
CCActionManager.cpp 10KB
TGAlib.cpp 10KB
CCIMEDispatcher.cpp 9KB
b2PolygonShape.cpp 9KB
CCActionGrid.cpp 9KB
b2WeldJoint.cpp 9KB
CCTextFieldTTF.cpp 9KB
b2CollidePolygon.cpp 8KB
b2PulleyJoint.cpp 8KB
CCTileMapAtlas.cpp 8KB
GB2ShapeCache-x.cpp 8KB
b2Fixture.cpp 8KB
ioapi.cpp 8KB
CCAction.cpp 8KB
CCUserDefault.cpp 7KB
CCTMXTiledMap.cpp 7KB
b2DistanceJoint.cpp 7KB
b2Contact.cpp 7KB
ZipUtils.cpp 7KB
CCCommon.cpp 7KB
b2ContactManager.cpp 7KB
b2FrictionJoint.cpp 7KB
CCAtlasNode.cpp 7KB
CCParticleSystemPoint.cpp 6KB
b2RopeJoint.cpp 6KB
b2Collision.cpp 6KB
HelloWorldScene.cpp 6KB
CCNS.cpp 6KB
CCTouchHandler.cpp 5KB
b2MouseJoint.cpp 5KB
CCArray.cpp 5KB
CCLabelAtlas.cpp 5KB
CCAffineTransform.cpp 5KB
CCPointExtension.cpp 5KB
CCKeypadDispatcher.cpp 5KB
CCActionCamera.cpp 5KB
b2Rope.cpp 5KB
b2BlockAllocator.cpp 5KB
b2Joint.cpp 5KB
CCParallaxNode.cpp 5KB
CCAutoreleasePool.cpp 4KB
CCLabelTTF.cpp 4KB
CCConfiguration.cpp 4KB
CCTransitionRadial.cpp 4KB
b2ChainShape.cpp 4KB
b2CollideCircle.cpp 4KB
CCActionProgressTimer.cpp 4KB
CCGrabber.cpp 4KB
CCProfiling.cpp 4KB
CCMotionStreak.cpp 4KB
base64.cpp 4KB
CCGeometry.cpp 4KB
CCTransitionPageTurn.cpp 3KB
CCGL.cpp 3KB
CCSAXParser.cpp 3KB
AppDelegate.cpp 3KB
共 378 条
- 1
- 2
- 3
- 4
资源评论
Kinonoyomeo
- 粉丝: 74
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于matlab实现串口发送接收数据 可配置端口,波特率等 发送可选择ASCII方式或HEX方式
- matlab基于BP神经网络手写字母识别(单一).zip代码9
- 基于matlab实现编写的串口调试工具,数据接收部分采用中断方式,保证了实时的数据显示
- 基于matlab实现39节点电力系统合闸角调控过程中的机组和负荷的灵敏度计算.rar
- HBase数据库性能调优
- 原生微信小程序源码 - -首字母排序选择
- 基于QT+C++开发的保卫萝卜塔防游戏+源码(毕业设计&课程设计&项目开发)
- newapp.apk
- 项目申报管理系统论文Java项目
- 8数码、α-β搜索的博弈树算法编写一字棋游戏、Fisher线性分类器、感知器算法、SVM 分类器、卷积神经网络 CNN 框架
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功