196 changes: 51 additions & 145 deletions src/core/quazip/unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,10 @@ typedef struct
*/


local int unzlocal_getByte OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
int *pi ) );

local int unzlocal_getByte( pzlib_filefunc_def, filestream, pi )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
int *pi;
local int unzlocal_getByte(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
int *pi )
{
unsigned char c;
int err = ( int )ZREAD( *pzlib_filefunc_def, filestream, &c, 1 );
Expand All @@ -195,15 +190,10 @@ int *pi;
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
*/
local int unzlocal_getShort OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX ) );

local int unzlocal_getShort( pzlib_filefunc_def, filestream, pX )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int unzlocal_getShort(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX )
{
uLong x ;
int i;
Expand All @@ -223,15 +213,10 @@ uLong *pX;
return err;
}

local int unzlocal_getLong OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX ) );

local int unzlocal_getLong( pzlib_filefunc_def, filestream, pX )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int unzlocal_getLong(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX )
{
uLong x ;
int i;
Expand Down Expand Up @@ -261,9 +246,7 @@ uLong *pX;


/* My own strcmpi / strcasecmp */
local int strcmpcasenosensitive_internal( fileName1, fileName2 )
const char* fileName1;
const char* fileName2;
local int strcmpcasenosensitive_internal( const char* fileName1, const char* fileName2 )
{
for ( ;; )
{
Expand Down Expand Up @@ -304,10 +287,7 @@ const char* fileName2;
(like 1 on Unix, 2 on Windows)
*/
extern int ZEXPORT unzStringFileNameCompare( fileName1, fileName2, iCaseSensitivity )
const char* fileName1;
const char* fileName2;
int iCaseSensitivity;
extern int ZEXPORT unzStringFileNameCompare( const char* fileName1, const char* fileName2, int iCaseSensitivity )
{
if ( iCaseSensitivity == 0 )
iCaseSensitivity = CASESENSITIVITYDEFAULTVALUE;
Expand All @@ -326,13 +306,9 @@ int iCaseSensitivity;
Locate the Central directory of a zipfile (at the end, just before
the global comment)
*/
local uLong unzlocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream ) );

local uLong unzlocal_SearchCentralDir( pzlib_filefunc_def, filestream )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
local uLong unzlocal_SearchCentralDir(
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream )
{
unsigned char* buf;
uLong uSizeFile;
Expand Down Expand Up @@ -396,9 +372,7 @@ voidpf filestream;
Else, the return value is a unzFile Handle, usable with other function
of this unzip package.
*/
extern unzFile ZEXPORT unzOpen2( file, pzlib_filefunc_def )
voidpf file;
zlib_filefunc_def* pzlib_filefunc_def;
extern unzFile ZEXPORT unzOpen2( voidpf file, zlib_filefunc_def* pzlib_filefunc_def )
{
unz_s us;
unz_s *s;
Expand Down Expand Up @@ -499,8 +473,7 @@ zlib_filefunc_def* pzlib_filefunc_def;
}


extern unzFile ZEXPORT unzOpen( file )
voidpf file;
extern unzFile ZEXPORT unzOpen( voidpf file )
{
return unzOpen2( file, NULL );
}
Expand All @@ -510,8 +483,7 @@ extern unzFile ZEXPORT unzOpen( file )
If there is files inside the .Zip opened with unzipOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzClose( file )
unzFile file;
extern int ZEXPORT unzClose( unzFile file )
{
unz_s* s;
if ( file == NULL )
Expand All @@ -531,9 +503,7 @@ extern int ZEXPORT unzClose( file )
Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo( file, pglobal_info )
unzFile file;
unz_global_info *pglobal_info;
extern int ZEXPORT unzGetGlobalInfo( unzFile file, unz_global_info *pglobal_info )
{
unz_s* s;
if ( file == NULL )
Expand All @@ -547,9 +517,7 @@ unz_global_info *pglobal_info;
/*
Translate date/time from Dos format to tm_unz (readable more easilty)
*/
local void unzlocal_DosDateToTmuDate( ulDosDate, ptm )
uLong ulDosDate;
tm_unz* ptm;
local void unzlocal_DosDateToTmuDate( uLong ulDosDate, tm_unz* ptm )
{
uLong uDate;
uDate = ( uLong )( ulDosDate >> 16 );
Expand All @@ -565,7 +533,7 @@ tm_unz* ptm;
/*
Get Info about the current file in the zipfile, with internal only info
*/
local int unzlocal_GetCurrentFileInfoInternal OF(( unzFile file,
local int unzlocal_GetCurrentFileInfoInternal( unzFile file,
unz_file_info *pfile_info,
unz_file_info_internal
*pfile_info_internal,
Expand All @@ -574,23 +542,7 @@ local int unzlocal_GetCurrentFileInfoInternal OF(( unzFile file,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize ) );

local int unzlocal_GetCurrentFileInfoInternal( file,
pfile_info,
pfile_info_internal,
szFileName, fileNameBufferSize,
extraField, extraFieldBufferSize,
szComment, commentBufferSize )
unzFile file;
unz_file_info *pfile_info;
unz_file_info_internal *pfile_info_internal;
char *szFileName;
uLong fileNameBufferSize;
void *extraField;
uLong extraFieldBufferSize;
char *szComment;
uLong commentBufferSize;
uLong commentBufferSize )
{
unz_s* s;
unz_file_info file_info;
Expand Down Expand Up @@ -749,19 +701,15 @@ uLong commentBufferSize;
No preparation of the structure is needed
return UNZ_OK if there is no problem.
*/
extern int ZEXPORT 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;
extern int ZEXPORT 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,
Expand All @@ -773,8 +721,7 @@ uLong commentBufferSize;
Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem
*/
extern int ZEXPORT unzGoToFirstFile( file )
unzFile file;
extern int ZEXPORT unzGoToFirstFile( unzFile file )
{
int err = UNZ_OK;
unz_s* s;
Expand All @@ -795,8 +742,7 @@ extern int ZEXPORT unzGoToFirstFile( file )
return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/
extern int ZEXPORT unzGoToNextFile( file )
unzFile file;
extern int ZEXPORT unzGoToNextFile( unzFile file )
{
unz_s* s;
int err;
Expand Down Expand Up @@ -829,10 +775,7 @@ extern int ZEXPORT unzGoToNextFile( file )
UNZ_OK if the file is found. It becomes the current file.
UNZ_END_OF_LIST_OF_FILE if the file is not found
*/
extern int ZEXPORT unzLocateFile( file, szFileName, iCaseSensitivity )
unzFile file;
const char *szFileName;
int iCaseSensitivity;
extern int ZEXPORT unzLocateFile( unzFile file, const char *szFileName, int iCaseSensitivity )
{
unz_s* s;
int err;
Expand Down Expand Up @@ -908,9 +851,7 @@ typedef struct unz_file_pos_s
} unz_file_pos;
*/

extern int ZEXPORT unzGetFilePos( file, file_pos )
unzFile file;
unz_file_pos* file_pos;
extern int ZEXPORT unzGetFilePos( unzFile file, unz_file_pos* file_pos )
{
unz_s* s;

Expand All @@ -926,9 +867,7 @@ unz_file_pos* file_pos;
return UNZ_OK;
}

extern int ZEXPORT unzGoToFilePos( file, file_pos )
unzFile file;
unz_file_pos* file_pos;
extern int ZEXPORT unzGoToFilePos( unzFile file, unz_file_pos* file_pos )
{
unz_s* s;
int err;
Expand Down Expand Up @@ -962,13 +901,7 @@ unz_file_pos* file_pos;
store in *piSizeVar the size of extra info in local header
(filename and size of extra field data)
*/
local int unzlocal_CheckCurrentFileCoherencyHeader( s, piSizeVar,
poffset_local_extrafield,
psize_local_extrafield )
unz_s* s;
uInt* piSizeVar;
uLong *poffset_local_extrafield;
uInt *psize_local_extrafield;
local int unzlocal_CheckCurrentFileCoherencyHeader( unz_s* s, uInt* piSizeVar, uLong *poffset_local_extrafield, uInt *psize_local_extrafield )
{
uLong uMagic, uData, uFlags;
uLong size_filename;
Expand Down Expand Up @@ -1054,12 +987,7 @@ uInt *psize_local_extrafield;
Open for reading data the current file in the zipfile.
If there is no error and the file is opened, the return value is UNZ_OK.
*/
extern int ZEXPORT unzOpenCurrentFile3( file, method, level, raw, password )
unzFile file;
int* method;
int* level;
int raw;
const char* password;
extern int ZEXPORT unzOpenCurrentFile3( unzFile file, int* method, int* level, int raw, const char* password )
{
int err = UNZ_OK;
uInt iSizeVar;
Expand Down Expand Up @@ -1199,24 +1127,17 @@ const char* password;
return UNZ_OK;
}

extern int ZEXPORT unzOpenCurrentFile( file )
unzFile file;
extern int ZEXPORT unzOpenCurrentFile( unzFile file )
{
return unzOpenCurrentFile3( file, NULL, NULL, 0, NULL );
}

extern int ZEXPORT unzOpenCurrentFilePassword( file, password )
unzFile file;
const char* password;
extern int ZEXPORT unzOpenCurrentFilePassword( unzFile file, const char* password )
{
return unzOpenCurrentFile3( file, NULL, NULL, 0, password );
}

extern int ZEXPORT unzOpenCurrentFile2( file, method, level, raw )
unzFile file;
int* method;
int* level;
int raw;
extern int ZEXPORT unzOpenCurrentFile2( unzFile file, int* method, int* level, int raw )
{
return unzOpenCurrentFile3( file, method, level, raw, NULL );
}
Expand All @@ -1231,10 +1152,7 @@ int raw;
return <0 with error code if there is an error
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
extern int ZEXPORT unzReadCurrentFile( file, buf, len )
unzFile file;
voidp buf;
unsigned len;
extern int ZEXPORT unzReadCurrentFile( unzFile file, voidp buf, unsigned len )
{
int err = UNZ_OK;
uInt iRead = 0;
Expand Down Expand Up @@ -1392,8 +1310,7 @@ unsigned len;
/*
Give the current position in uncompressed data
*/
extern z_off_t ZEXPORT unztell( file )
unzFile file;
extern z_off_t ZEXPORT unztell( unzFile file )
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
Expand All @@ -1412,8 +1329,7 @@ extern z_off_t ZEXPORT unztell( file )
/*
return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzeof( file )
unzFile file;
extern int ZEXPORT unzeof( unzFile file )
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
Expand Down Expand Up @@ -1445,10 +1361,7 @@ extern int ZEXPORT unzeof( file )
the return value is the number of bytes copied in buf, or (if <0)
the error code
*/
extern int ZEXPORT unzGetLocalExtrafield( file, buf, len )
unzFile file;
voidp buf;
unsigned len;
extern int ZEXPORT unzGetLocalExtrafield( unzFile file, voidp buf, unsigned len )
{
unz_s* s;
file_in_zip_read_info_s* pfile_in_zip_read_info;
Expand Down Expand Up @@ -1496,8 +1409,7 @@ unsigned len;
Close the file in zip opened with unzipOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzCloseCurrentFile( file )
unzFile file;
extern int ZEXPORT unzCloseCurrentFile( unzFile file )
{
int err = UNZ_OK;

Expand Down Expand Up @@ -1539,10 +1451,7 @@ extern int ZEXPORT unzCloseCurrentFile( file )
uSizeBuf is the size of the szComment buffer.
return the number of byte copied or an error code <0
*/
extern int ZEXPORT unzGetGlobalComment( file, szComment, uSizeBuf )
unzFile file;
char *szComment;
uLong uSizeBuf;
extern int ZEXPORT unzGetGlobalComment( unzFile file, char *szComment, uLong uSizeBuf )
{
unz_s* s;
uLong uReadThis ;
Expand Down Expand Up @@ -1570,8 +1479,7 @@ uLong uSizeBuf;
}

/* Additions by RX '2004 */
extern uLong ZEXPORT unzGetOffset( file )
unzFile file;
extern uLong ZEXPORT unzGetOffset( unzFile file )
{
unz_s* s;

Expand All @@ -1586,9 +1494,7 @@ extern uLong ZEXPORT unzGetOffset( file )
return s->pos_in_central_dir;
}

extern int ZEXPORT unzSetOffset( file, pos )
unzFile file;
uLong pos;
extern int ZEXPORT unzSetOffset( unzFile file, uLong pos )
{
unz_s* s;
int err;
Expand Down
76 changes: 38 additions & 38 deletions src/core/quazip/unzip.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ extern "C"
tm_unz tmu_date;
} unz_file_info;

extern int ZEXPORT unzStringFileNameCompare OF(( const char* fileName1,
extern int ZEXPORT unzStringFileNameCompare( const char* fileName1,
const char* fileName2,
int iCaseSensitivity ) );
int iCaseSensitivity );
/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
Expand All @@ -135,7 +135,7 @@ extern "C"
*/


extern unzFile ZEXPORT unzOpen OF(( voidpf file ) );
extern unzFile ZEXPORT unzOpen( voidpf file );
/*
Open a Zip file. path contain whatever zopen_file from the IO API
accepts. For Qt implementation it is a pointer to QIODevice, for
Expand All @@ -146,31 +146,31 @@ extern "C"
of this unzip package.
*/

extern unzFile ZEXPORT unzOpen2 OF(( voidpf file,
zlib_filefunc_def* pzlib_filefunc_def ) );
extern unzFile ZEXPORT unzOpen2( voidpf file,
zlib_filefunc_def* pzlib_filefunc_def );
/*
Open a Zip file, like unzOpen, but provide a set of file low level API
for read/write the zip file (see ioapi.h)
*/

extern int ZEXPORT unzClose OF(( unzFile file ) );
extern int ZEXPORT unzClose( unzFile file );
/*
Close a ZipFile opened with unzipOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no problem. */

extern int ZEXPORT unzGetGlobalInfo OF(( unzFile file,
unz_global_info *pglobal_info ) );
extern int ZEXPORT unzGetGlobalInfo( unzFile file,
unz_global_info *pglobal_info );
/*
Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed
return UNZ_OK if there is no problem. */


extern int ZEXPORT unzGetGlobalComment OF(( unzFile file,
char *szComment,
uLong uSizeBuf ) );
extern int ZEXPORT unzGetGlobalComment( unzFile file,
char *szComment,
uLong uSizeBuf );
/*
Get the global comment string of the ZipFile, in the szComment buffer.
uSizeBuf is the size of the szComment buffer.
Expand All @@ -181,22 +181,22 @@ extern "C"
/***************************************************************************/
/* Unzip package allow you browse the directory of the zipfile */

extern int ZEXPORT unzGoToFirstFile OF(( unzFile file ) );
extern int ZEXPORT unzGoToFirstFile( unzFile file );
/*
Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem
*/

extern int ZEXPORT unzGoToNextFile OF(( unzFile file ) );
extern int ZEXPORT unzGoToNextFile( unzFile file );
/*
Set the current file of the zipfile to the next file.
return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/

extern int ZEXPORT unzLocateFile OF(( unzFile file,
const char *szFileName,
int iCaseSensitivity ) );
extern int ZEXPORT unzLocateFile( unzFile file,
const char *szFileName,
int iCaseSensitivity );
/*
Try locate the file szFileName in the zipfile.
For the iCaseSensitivity signification, see unzStringFileNameCompare
Expand Down Expand Up @@ -226,14 +226,14 @@ extern "C"

/* ****************************************** */

extern int ZEXPORT unzGetCurrentFileInfo OF(( unzFile file,
extern int ZEXPORT unzGetCurrentFileInfo( unzFile file,
unz_file_info *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize ) );
uLong commentBufferSize );
/*
Get Info about the current file
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
Expand All @@ -252,24 +252,24 @@ extern "C"
from it, and close it (you can close it before reading all the file)
*/

extern int ZEXPORT unzOpenCurrentFile OF(( unzFile file ) );
extern int ZEXPORT unzOpenCurrentFile( unzFile file );
/*
Open for reading data the current file in the zipfile.
If there is no error, the return value is UNZ_OK.
*/

extern int ZEXPORT unzOpenCurrentFilePassword OF(( unzFile file,
const char* password ) );
extern int ZEXPORT unzOpenCurrentFilePassword( unzFile file,
const char* password );
/*
Open for reading data the current file in the zipfile.
password is a crypting password
If there is no error, the return value is UNZ_OK.
*/

extern int ZEXPORT unzOpenCurrentFile2 OF(( unzFile file,
int* method,
int* level,
int raw ) );
extern int ZEXPORT unzOpenCurrentFile2( unzFile file,
int* method,
int* level,
int raw );
/*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1
Expand All @@ -279,11 +279,11 @@ extern "C"
but you CANNOT set method parameter as NULL
*/

extern int ZEXPORT unzOpenCurrentFile3 OF(( unzFile file,
int* method,
int* level,
int raw,
const char* password ) );
extern int ZEXPORT unzOpenCurrentFile3( unzFile file,
int* method,
int* level,
int raw,
const char* password );
/*
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
if raw==1
Expand All @@ -294,15 +294,15 @@ extern "C"
*/


extern int ZEXPORT unzCloseCurrentFile OF(( unzFile file ) );
extern int ZEXPORT unzCloseCurrentFile( unzFile file );
/*
Close the file in zip opened with unzOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/

extern int ZEXPORT unzReadCurrentFile OF(( unzFile file,
voidp buf,
unsigned len ) );
extern int ZEXPORT unzReadCurrentFile( unzFile file,
voidp buf,
unsigned len );
/*
Read bytes from the current file (opened by unzOpenCurrentFile)
buf contain buffer where data must be copied
Expand All @@ -314,19 +314,19 @@ extern "C"
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/

extern z_off_t ZEXPORT unztell OF(( unzFile file ) );
extern z_off_t ZEXPORT unztell( unzFile file );
/*
Give the current position in uncompressed data
*/

extern int ZEXPORT unzeof OF(( unzFile file ) );
extern int ZEXPORT unzeof( unzFile file );
/*
return 1 if the end of file was reached, 0 elsewhere
*/

extern int ZEXPORT unzGetLocalExtrafield OF(( unzFile file,
extern int ZEXPORT unzGetLocalExtrafield( unzFile file,
voidp buf,
unsigned len ) );
unsigned len );
/*
Read extra field from the current file (opened by unzOpenCurrentFile)
This is the local-header version of the extra field (sometimes, there is
Expand Down
187 changes: 56 additions & 131 deletions src/core/quazip/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ local linkedlist_datablock_internal* allocate_new_datablock()
return ldi;
}

local void free_datablock( ldi )
linkedlist_datablock_internal* ldi;
local void free_datablock( linkedlist_datablock_internal* ldi )
{
while ( ldi != NULL )
{
Expand All @@ -188,8 +187,7 @@ linkedlist_datablock_internal* ldi;
}
}

local void init_linkedlist( ll )
linkedlist_data* ll;
local void init_linkedlist( linkedlist_data* ll )
{
ll->first_block = ll->last_block = NULL;
}
Expand All @@ -203,10 +201,7 @@ linkedlist_data* ll;
}
#endif

local int add_data_in_datablock( ll, buf, len )
linkedlist_data* ll;
const void* buf;
uLong len;
local int add_data_in_datablock( linkedlist_data* ll, const void* buf, uLong len )
{
linkedlist_datablock_internal* ldi;
const unsigned char* from_copy;
Expand Down Expand Up @@ -267,13 +262,8 @@ uLong len;
nbByte == 1, 2 or 4 (byte, short or long)
*/

local int ziplocal_putValue OF(( const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream, uLong x, int nbByte ) );
local int ziplocal_putValue( pzlib_filefunc_def, filestream, x, nbByte )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong x;
int nbByte;
local int ziplocal_putValue( const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream, uLong x, int nbByte )
{
unsigned char buf[4];
int n;
Expand All @@ -296,11 +286,7 @@ int nbByte;
return ZIP_OK;
}

local void ziplocal_putValue_inmemory OF(( void* dest, uLong x, int nbByte ) );
local void ziplocal_putValue_inmemory( dest, x, nbByte )
void* dest;
uLong x;
int nbByte;
local void ziplocal_putValue_inmemory( void* dest, uLong x, int nbByte )
{
unsigned char* buf = ( unsigned char* )dest;
int n;
Expand All @@ -322,9 +308,7 @@ int nbByte;
/****************************************************************************/


local uLong ziplocal_TmzDateToDosDate( ptm, dosDate )
const tm_zip* ptm;
uLong dosDate UNUSED;
local uLong ziplocal_TmzDateToDosDate( const tm_zip* ptm, uLong dosDate UNUSED )
{
uLong year = ( uLong )ptm->tm_year;
if ( year > 1980 )
Expand All @@ -339,15 +323,7 @@ uLong dosDate UNUSED;

/****************************************************************************/

local int ziplocal_getByte OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
int *pi ) );

local int ziplocal_getByte( pzlib_filefunc_def, filestream, pi )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
int *pi;
local int ziplocal_getByte( const zlib_filefunc_def* pzlib_filefunc_def, voidpf filestream, int *pi )
{
unsigned char c;
int err = ( int )ZREAD( *pzlib_filefunc_def, filestream, &c, 1 );
Expand All @@ -369,15 +345,7 @@ int *pi;
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
*/
local int ziplocal_getShort OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX ) );

local int ziplocal_getShort( pzlib_filefunc_def, filestream, pX )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int ziplocal_getShort( const zlib_filefunc_def* pzlib_filefunc_def, voidpf filestream, uLong *pX )
{
uLong x ;
int i;
Expand All @@ -397,15 +365,7 @@ uLong *pX;
return err;
}

local int ziplocal_getLong OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream,
uLong *pX ) );

local int ziplocal_getLong( pzlib_filefunc_def, filestream, pX )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
uLong *pX;
local int ziplocal_getLong( const zlib_filefunc_def* pzlib_filefunc_def, voidpf filestream, uLong *pX )
{
uLong x ;
int i;
Expand Down Expand Up @@ -440,13 +400,7 @@ uLong *pX;
Locate the Central directory of a zipfile (at the end, just before
the global comment)
*/
local uLong ziplocal_SearchCentralDir OF((
const zlib_filefunc_def* pzlib_filefunc_def,
voidpf filestream ) );

local uLong ziplocal_SearchCentralDir( pzlib_filefunc_def, filestream )
const zlib_filefunc_def* pzlib_filefunc_def;
voidpf filestream;
local uLong ziplocal_SearchCentralDir( const zlib_filefunc_def* pzlib_filefunc_def, voidpf filestream )
{
unsigned char* buf;
uLong uSizeFile;
Expand Down Expand Up @@ -503,11 +457,7 @@ voidpf filestream;
#endif /* !NO_ADDFILEINEXISTINGZIP*/

/************************************************************/
extern zipFile ZEXPORT zipOpen2( file, append, globalcomment, pzlib_filefunc_def )
voidpf file;
int append;
zipcharpc* globalcomment;
zlib_filefunc_def* pzlib_filefunc_def;
extern zipFile ZEXPORT zipOpen2( voidpf file, int append, zipcharpc* globalcomment, zlib_filefunc_def* pzlib_filefunc_def )
{
zip_internal ziinit;
zip_internal* zi;
Expand Down Expand Up @@ -689,35 +639,27 @@ zlib_filefunc_def* pzlib_filefunc_def;
}
}

extern zipFile ZEXPORT zipOpen( file, append )
voidpf file;
int append;
extern zipFile ZEXPORT zipOpen( voidpf file, int append )
{
return zipOpen2( file, append, NULL, NULL );
}

extern int ZEXPORT zipOpenNewFileInZip3( file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw,
windowBits, memLevel, strategy,
password, crcForCrypting )
zipFile file;
const char* filename;
const zip_fileinfo* zipfi;
const void* extrafield_local;
uInt size_extrafield_local;
const void* extrafield_global;
uInt size_extrafield_global;
const char* comment;
int method;
int level;
int raw;
int windowBits;
int memLevel;
int strategy;
const char* password;
uLong crcForCrypting;
extern int ZEXPORT zipOpenNewFileInZip3( zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw,
int windowBits,
int memLevel,
int strategy,
const char* password,
uLong crcForCrypting )
{
zip_internal* zi;
uInt size_filename;
Expand Down Expand Up @@ -922,21 +864,17 @@ uLong crcForCrypting;
return err;
}

extern int ZEXPORT zipOpenNewFileInZip2( file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, raw )
zipFile file;
const char* filename;
const zip_fileinfo* zipfi;
const void* extrafield_local;
uInt size_extrafield_local;
const void* extrafield_global;
uInt size_extrafield_global;
const char* comment;
int method;
int level;
int raw;
extern int ZEXPORT zipOpenNewFileInZip2( zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level,
int raw )
{
return zipOpenNewFileInZip3( file, filename, zipfi,
extrafield_local, size_extrafield_local,
Expand All @@ -946,29 +884,25 @@ int raw;
NULL, 0 );
}

extern int ZEXPORT zipOpenNewFileInZip( file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level )
zipFile file;
const char* filename;
const zip_fileinfo* zipfi;
const void* extrafield_local;
uInt size_extrafield_local;
const void* extrafield_global;
uInt size_extrafield_global;
const char* comment;
int method;
int level;
extern int ZEXPORT zipOpenNewFileInZip(
zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level )
{
return zipOpenNewFileInZip2( file, filename, zipfi,
extrafield_local, size_extrafield_local,
extrafield_global, size_extrafield_global,
comment, method, level, 0 );
}

local int zipFlushWriteBuffer( zi )
zip_internal* zi;
local int zipFlushWriteBuffer( zip_internal* zi )
{
int err = ZIP_OK;

Expand All @@ -989,10 +923,7 @@ zip_internal* zi;
return err;
}

extern int ZEXPORT zipWriteInFileInZip( file, buf, len )
zipFile file;
const void* buf;
unsigned len;
extern int ZEXPORT zipWriteInFileInZip( zipFile file, const void* buf, unsigned len )
{
zip_internal* zi;
int err = ZIP_OK;
Expand Down Expand Up @@ -1054,10 +985,7 @@ unsigned len;
return err;
}

extern int ZEXPORT zipCloseFileInZipRaw( file, uncompressed_size, crc32 )
zipFile file;
uLong uncompressed_size;
uLong crc32;
extern int ZEXPORT zipCloseFileInZipRaw( zipFile file, uLong uncompressed_size, uLong crc32 )
{
zip_internal* zi;
uLong compressed_size;
Expand Down Expand Up @@ -1168,15 +1096,12 @@ uLong crc32;
return err;
}

extern int ZEXPORT zipCloseFileInZip( file )
zipFile file;
extern int ZEXPORT zipCloseFileInZip( zipFile file )
{
return zipCloseFileInZipRaw( file, 0, 0 );
}

extern int ZEXPORT zipClose( file, global_comment )
zipFile file;
const char* global_comment;
extern int ZEXPORT zipClose( zipFile file, const char* global_comment )
{
zip_internal* zi;
int err = 0;
Expand Down
56 changes: 28 additions & 28 deletions src/core/quazip/zip.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ extern "C"
#define APPEND_STATUS_CREATEAFTER (1)
#define APPEND_STATUS_ADDINZIP (2)

extern zipFile ZEXPORT zipOpen OF(( voidpf file, int append ) );
extern zipFile ZEXPORT zipOpen( voidpf file, int append );
/*
Create a zipfile.
file is whatever the IO API accepts. For Qt IO API it's a pointer to
Expand All @@ -136,21 +136,21 @@ extern "C"
Of couse, you can use RAW reading and writing to copy the file you did not want delte
*/

extern zipFile ZEXPORT zipOpen2 OF(( voidpf file,
int append,
zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def ) );

extern int ZEXPORT zipOpenNewFileInZip OF(( zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level ) );
extern zipFile ZEXPORT zipOpen2( voidpf file,
int append,
zipcharpc* globalcomment,
zlib_filefunc_def* pzlib_filefunc_def );

extern int ZEXPORT zipOpenNewFileInZip( zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
uInt size_extrafield_local,
const void* extrafield_global,
uInt size_extrafield_global,
const char* comment,
int method,
int level );
/*
Open a file in the ZIP for writing.
filename : the filename in zip (if NULL, '-' without quote will be used
Expand All @@ -165,7 +165,7 @@ extern "C"
*/


extern int ZEXPORT zipOpenNewFileInZip2 OF(( zipFile file,
extern int ZEXPORT zipOpenNewFileInZip2( zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
Expand All @@ -175,13 +175,13 @@ extern "C"
const char* comment,
int method,
int level,
int raw ) );
int raw );

/*
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
*/

extern int ZEXPORT zipOpenNewFileInZip3 OF(( zipFile file,
extern int ZEXPORT zipOpenNewFileInZip3( zipFile file,
const char* filename,
const zip_fileinfo* zipfi,
const void* extrafield_local,
Expand All @@ -196,7 +196,7 @@ extern "C"
int memLevel,
int strategy,
const char* password,
uLong crcForCtypting ) );
uLong crcForCtypting );

/*
Same than zipOpenNewFileInZip2, except
Expand All @@ -206,29 +206,29 @@ extern "C"
*/


extern int ZEXPORT zipWriteInFileInZip OF(( zipFile file,
const void* buf,
unsigned len ) );
extern int ZEXPORT zipWriteInFileInZip( zipFile file,
const void* buf,
unsigned len );
/*
Write data in the zipfile
*/

extern int ZEXPORT zipCloseFileInZip OF(( zipFile file ) );
extern int ZEXPORT zipCloseFileInZip( zipFile file );
/*
Close the current file in the zipfile
*/

extern int ZEXPORT zipCloseFileInZipRaw OF(( zipFile file,
extern int ZEXPORT zipCloseFileInZipRaw( zipFile file,
uLong uncompressed_size,
uLong crc32 ) );
uLong crc32 );
/*
Close the current file in the zipfile, for fiel opened with
parameter raw=1 in zipOpenNewFileInZip2
uncompressed_size and crc32 are value for the uncompressed size
*/

extern int ZEXPORT zipClose OF(( zipFile file,
const char* global_comment ) );
extern int ZEXPORT zipClose( zipFile file,
const char* global_comment );
/*
Close the zipfile
*/
Expand Down