(minizip) Fix most of the remaining issues that precludes building

with MSVC
This commit is contained in:
twinaphex 2013-02-16 20:42:05 +01:00
parent 07b242f851
commit b1f9d39f4c
2 changed files with 23 additions and 69 deletions

38
deps/minizip/ioapi.c vendored
View File

@ -41,10 +41,7 @@ long fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin);
int fclose_file_func (voidpf opaque, voidpf stream);
int ferror_file_func (voidpf opaque, voidpf stream);
voidpf fopen_file_func (opaque, filename, mode)
voidpf opaque;
const char* filename;
int mode;
voidpf fopen_file_func (voidpf opaque, const char *filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
@ -63,11 +60,7 @@ voidpf fopen_file_func (opaque, filename, mode)
}
uLong fread_file_func (opaque, stream, buf, size)
voidpf opaque;
voidpf stream;
void* buf;
uLong size;
uLong fread_file_func (voidpf opaque, voidpf stream, void *buf, uLong size)
{
uLong ret;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
@ -75,31 +68,21 @@ uLong fread_file_func (opaque, stream, buf, size)
}
uLong fwrite_file_func (opaque, stream, buf, size)
voidpf opaque;
voidpf stream;
const void* buf;
uLong size;
uLong fwrite_file_func (voidpf opaque, voidpf stream, const void *buf, uLong size)
{
uLong ret;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
long ftell_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
long ftell_file_func (voidpf opaque, voidpf stream)
{
long ret;
ret = ftell((FILE *)stream);
return ret;
}
long fseek_file_func (opaque, stream, offset, origin)
voidpf opaque;
voidpf stream;
uLong offset;
int origin;
long fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
{
int fseek_origin=0;
long ret;
@ -121,26 +104,21 @@ long fseek_file_func (opaque, stream, offset, origin)
return ret;
}
int fclose_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
int fclose_file_func (voidpf opaque, voidpf stream)
{
int ret;
ret = fclose((FILE *)stream);
return ret;
}
int ferror_file_func (opaque, stream)
voidpf opaque;
voidpf stream;
int ferror_file_func (voidpf opaque, voidpf stream)
{
int ret;
ret = ferror((FILE *)stream);
return ret;
}
void fill_fopen_filefunc (pzlib_filefunc_def)
zlib_filefunc_def* pzlib_filefunc_def;
void fill_fopen_filefunc (zlib_filefunc_def*pzlib_filefunc_def)
{
pzlib_filefunc_def->zopen_file = fopen_file_func;
pzlib_filefunc_def->zread_file = fread_file_func;

54
deps/minizip/unzip.c vendored
View File

@ -180,10 +180,8 @@ static int unzlocal_getByte (
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
*/
static int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
static int unzlocal_getShort (const zlib_filefunc_def *pzlib_filefunc_def,
voidpf filestream, uLong *pX)
{
uLong x ;
int i = 0;
@ -203,10 +201,8 @@ static int unzlocal_getShort (pzlib_filefunc_def,filestream,pX)
return err;
}
static int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
static int unzlocal_getLong (const zlib_filefunc_def *pzlib_filefunc_def,
voidpf filestream, uLong *pX)
{
uLong x ;
int i = 0;
@ -236,9 +232,7 @@ static int unzlocal_getLong (pzlib_filefunc_def,filestream,pX)
/* My own strcmpi / strcasecmp */
static int strcmpcasenosensitive_internal (fileName1,fileName2)
const char* fileName1;
const char* fileName2;
static int strcmpcasenosensitive_internal (const char *fileName1, const char *fileName2)
{
for (;;)
{
@ -279,10 +273,7 @@ static int strcmpcasenosensitive_internal (fileName1,fileName2)
(like 1 on Unix, 2 on Windows)
*/
extern int unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
const char* fileName1;
const char* fileName2;
int iCaseSensitivity;
int unzStringFileNameCompare (const char *fileName1, const char *fileName2, int iCaseSensitivity)
{
if (iCaseSensitivity==0)
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
@ -301,9 +292,8 @@ extern int unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivity)
Locate the Central directory of a zipfile (at the end, just before
the global comment)
*/
static uLong unzlocal_SearchCentralDir(pzlib_filefunc_def,filestream)
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
static uLong unzlocal_SearchCentralDir(const zlib_filefunc_def *pzlib_filefunc_def,
voidpf filestream)
{
unsigned char* buf;
uLong uSizeFile;
@ -712,19 +702,10 @@ int unzGetGlobalInfo (unzFile file, unz_global_info *pglobal_info)
No preparation of the structure is needed
return UNZ_OK if there is no problem.
*/
extern int unzGetCurrentFileInfo (file,
pfile_info,
szFileName, fileNameBufferSize,
extraField, extraFieldBufferSize,
szComment, commentBufferSize)
unzFile file;
unz_file_info *pfile_info;
char *szFileName;
uLong fileNameBufferSize;
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
int unzGetCurrentFileInfo (unzFile file, unz_file_info * pfile_info,
char * szFileName, uLong fileNameBufferSize,
void *extraField, uLong extraFieldBufferSize,
char *szComment, uLong commentBufferSize)
{
return unzlocal_GetCurrentFileInfoInternal(file,pfile_info,NULL,
szFileName,fileNameBufferSize,
@ -895,13 +876,8 @@ int unzGoToFilePos(unzFile file, unz_file_pos *file_pos)
store in *piSizeVar the size of extra info in local header
(filename and size of extra field data)
*/
static int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
poffset_local_extrafield,
psize_local_extrafield)
unz_s* s;
uInt* piSizeVar;
uLong *poffset_local_extrafield;
uInt *psize_local_extrafield;
static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s *s,
uInt *piSizeVar, uLong *poffset_local_extrafield, uInt *psize_local_extrafield)
{
uLong uMagic,uData,uFlags;
uLong size_filename;
@ -1063,7 +1039,7 @@ int unzOpenCurrentFile3 (unzFile file, int *method, int *level, int raw, const c
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = (const unsigned char*)0;
pfile_in_zip_read_info->stream.avail_in = 0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);