/* unzip.c -- IO for uncompress .zip files using zlib
Version 1.01, May 8th, 2004
Copyright (C) 1998-2004 Gilles Vollant
Read unzip.h for more info
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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
/* 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 (32768)
#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)
/* unz_file_info_interntal contain internal info about a file in zipfile*/
typedef struct unz_file_info_internal_s
{
DWORD offset_curfile; /* relative offset of local header 4 bytes */
} unz_file_info_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 */
DWORD pos_in_zipfile; /* position in byte on the zipfile, for fseek*/
DWORD stream_initialised; /* flag set if stream structure is initialised*/
DWORD offset_local_extrafield; /* offset of the local extra field */
DWORD size_local_extrafield; /* size of the local extra field */
DWORD pos_local_extrafield; /* position in the local extra field in read*/
DWORD crc32; /* crc32 of all data uncompressed */
DWORD crc32_wait; /* crc32 we must obtain after decompress all */
DWORD rest_read_compressed; /* number of byte to be decompressed */
DWORD rest_read_uncompressed; /*number of byte to be obtained after decomp*/
zlib_filefunc_def z_filefunc;
void *filestream; /* io structore of the zipfile */
DWORD compression_method; /* compression method (0==store) */
DWORD byte_before_the_zipfile; /* byte before the zipfile, (>0 for sfx)*/
int raw;
} file_in_zip_read_info_s;
/* unz_s contain internal information about the zipfile
*/
typedef struct
{
zlib_filefunc_def z_filefunc;
void *filestream; /* io structore of the zipfile */
unz_global_info gi; /* public global information */
DWORD byte_before_the_zipfile; /* byte before the zipfile, (>0 for sfx)*/
DWORD num_file; /* number of the current file in the zipfile*/
DWORD pos_in_central_dir; /* pos of the current file in the central dir*/
DWORD current_file_ok; /* flag about the usability of the current file*/
DWORD central_pos; /* position of the beginning of the central dir*/
DWORD size_central_dir; /* size of the central directory */
DWORD offset_central_dir; /* offset of start of central directory with respect to the starting disk number */
unz_file_info cur_file_info; /* public info about the current file in zip*/
unz_file_info_internal cur_file_info_internal; /* private info about it*/
file_in_zip_read_info_s *pfile_in_zip_read; /* structure about the current file if we are decompressing it */
int encrypted;
#ifndef NOUNCRYPT
DWORD keys[3]; /* keys defining the pseudo-random sequence */
const DWORD *pcrc_32_tab;
#endif
} unz_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.
*/
static int unzlocal_getByte(const zlib_filefunc_def *pzlib_filefunc_def, void *filestream, int *pi)
{
BYTE c;
int err = (int)ZREAD(*pzlib_filefunc_def, filestream, &c, 1);
if (err == 1)
{
*pi = (int)c;
return UNZ_OK;
}
else
{
if (ZERROR(*pzlib_filefunc_def, filestream))
{
return UNZ_ERRNO;
}
else
{
return UNZ_EOF;
}
}
}
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
*/
static int unzlocal_getShort(const zlib_filefunc_def *pzlib_filefunc_def, void *filestream, DWORD *pX)
{
DWORD x;
int i;
int err;
err = unzlocal_getByte(pzlib_filefunc_def, filestream, &i);
x = (DWORD)i;
if (err == UNZ_OK)
{
err = unzlocal_getByte(pzlib_filefunc_def, filestream, &i);
}
x += ((DWORD)i) << 8;
if (err == UNZ_OK)
{
*pX = x;
}
else
{
*pX = 0;
}
return err;
}
//-------------------------------------------------------------------------
static int unzlocal_getLong(const zlib_filefunc_def *pzlib_filefunc_def, void *filestream, DWORD *pX)
{
DWORD x;
int i;
int err;
err = unzlocal_getByte(pzlib_filefunc_def, filestream, &i);
x = (DWORD)i;
if (err == UNZ_OK)
{
err = unzlocal_getByte(pzlib_filefunc_def, filestream, &i);
}
x += ((DWORD)i) << 8;
if (err == UNZ_OK)
{
err = unzlocal_getByte(pzlib_filefunc_def, filestream, &i);
}
x += ((DWORD)i) << 16;
if (err == UNZ_OK)
{
err = unzlocal_getByte(pzlib_filefunc_def, filestream, &i);
}
x += ((DWORD)i) << 24;
if (err == UNZ_OK)
{
*pX = x;
}
else
{
*pX = 0;
}
return err;
}
//-------------------------------------------------------------------------
#ifdef CASESENSITIVITYDEFAULT_NO
#define CASESENSITIVITYDEFAULTVALUE 2
#else
#define CASESENSITIVITYDEFAULTVALUE 1
#endif
#ifndef STRCMPCASENOSENTIVEFUNCTION
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
#endif
/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
or strcasecmp)
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
(like 1 on Unix, 2 on Windows)
*/
/*
extern int ZEXPORT unzStringFileNameCompare(const char *fileName1, const char *fileName2, int iCaseSensitivity)
{
if (iCaseSensitivity == 0)
{
iCaseSensitivity = CASESENSITIVITYDEFAULTVALUE;
}
if (iCaseSensitivity == 1)
{
return strcmp(fileName1, fileName2);
}
return stricmp(fileName1, fileName2);
}
*/
//-------------------------------------------------------------------------
#ifndef BUFREADCOMMENT
#define BUFREADCOMMENT (0x400)
#endif
/*
Locate the Central directory of a zipfile (at the end, just before
the global comment)
*/
static DWORD unzlocal_SearchCentralDir(const zlib_filefunc_def *pzlib_filefunc_def, void *filestream)
{
BYTE *buf;
DWORD uSizeFile;
DWORD uBackRead;
DWORD uMaxBack = 0xffff; /* maximum size of global comment */
DWORD uPosFound = 0;
if (ZSEEK(*pzlib_filefunc_def, filestream, 0, SEEK_END) != 0)
{
return 0;
}
uSizeFile = ZTELL(*pzlib_filefunc_def, filestream);
if (uMaxBack > uSizeFile)
{
uMaxBack = uSizeFile;
}
buf = (BYTE*)ALLOC(BUFREADCOMMENT + 4);
if (buf == NULL)
{
return 0;
}
uBackRead = 4;
while (uBackRead < uMaxBack)
{
DWORD uReadSize, uReadPos;
int i;
if (uBackRead + BUFREADCOMMENT > uMaxBack)
{
uBackRead = uMaxBack;
}
else
{
uBackRead += BUFREADCOMMENT;
}
uReadPos = uSizeFile - uBackRead;
uReadSize = ((BUFREADCOMMENT + 4) < (uSizeFile - uReadPos)) ? (BUFREADCOMMENT + 4): (uSizeFile - uReadPos);
if (ZSEEK(*pzlib_filefunc_def, filestream, uReadPos, SEEK_SET) != 0)
{
brea
没有合适的资源?快使用搜索试试~ 我知道了~
HGE dx9.0 引擎 2D
共134个文件
obj:37个
h:33个
cpp:27个
4星 · 超过85%的资源 需积分: 13 49 下载量 69 浏览量
2011-10-11
14:55:06
上传
评论
收藏 5.19MB RAR 举报
温馨提示
HGE dx9.0 引擎 2D 对原来使用dx8.0的hge引擎改写的。
资源推荐
资源详情
资源评论
收起资源包目录
HGE dx9.0 引擎 2D (134个子文件)
unzip.c 39KB
inflate.c 35KB
trees.c 32KB
crc32.c 26KB
inftrees.c 12KB
inffast.c 7KB
zutil.c 3KB
ioapi.c 3KB
uncompr.c 2KB
adler32.c 1KB
graphics.cpp 24KB
resources.cpp 23KB
system.cpp 20KB
sound.cpp 12KB
demo.cpp 10KB
hgegui.cpp 7KB
hgeparticle.cpp 7KB
hgeguictrls.cpp 7KB
menuitem.cpp 6KB
hgesprite.cpp 6KB
hgefont.cpp 6KB
hgeresource.cpp 6KB
resource.cpp 6KB
input.cpp 6KB
hgedistort.cpp 5KB
parser.cpp 5KB
hge_tut01.cpp 4KB
hgestrings.cpp 3KB
hgeanim.cpp 3KB
hgecolor.cpp 2KB
ini.cpp 2KB
hgepmanager.cpp 2KB
hgevector.cpp 1KB
power.cpp 928B
hgerect.cpp 781B
random.cpp 666B
timer.cpp 367B
mt.dep 67B
hge.dll 163KB
hge.dll 163KB
bass.dll 91KB
hge_tut01.dsp 4KB
hge_tut01.dsw 541B
hge_tut01.exe 784KB
font1.fnt 2KB
zlib.h 57KB
bass.h 38KB
trees.h 25KB
hge.h 17KB
inffixed.h 16KB
unzip.h 12KB
deflate.h 12KB
hge_impl.h 11KB
zconf.in.h 10KB
zconf.h 9KB
zip.h 7KB
inflate.h 5KB
crypt.h 5KB
resources.h 4KB
zutil.h 4KB
hgeguictrls.h 4KB
hgecolor.h 4KB
hgeparticle.h 3KB
hgegui.h 3KB
ioapi.h 2KB
hgefont.h 2KB
inftrees.h 2KB
hgesprite.h 2KB
parser.h 2KB
hgeresource.h 2KB
hgevector.h 2KB
hgedistort.h 2KB
hgeanim.h 2KB
menuitem.h 1KB
hgerect.h 804B
hgestrings.h 697B
inffast.h 404B
crc32.h 2B
BuildLog.htm 9KB
vc90.idb 683KB
hge_tut01.ilk 1.53MB
zazaka.jpg 46KB
Ferrari17.jpg 41KB
hge_tut06.log 383B
hge_tut01.exe.embed.manifest 406B
hge_tut01.exe.intermediate.manifest 381B
hge_tut01.ncb 13.57MB
resources.obj 145KB
system.obj 91KB
sound.obj 89KB
graphics.obj 84KB
hgeguictrls.obj 77KB
input.obj 62KB
hgeresource.obj 60KB
menuitem.obj 55KB
hgeparticle.obj 50KB
hge_tut01.obj 45KB
resource.obj 42KB
hgefont.obj 41KB
trees.obj 41KB
共 134 条
- 1
- 2
fei980089
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页