fix some warnings

This commit is contained in:
Garux 2020-02-07 23:00:19 +03:00
parent 1805e42582
commit 64f6b4a4ac
16 changed files with 263 additions and 265 deletions

View File

@ -1823,7 +1823,7 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
break; break;
} //end if } //end if
} //end case } //end case
// fall through
case P_MUL: case P_MUL:
case P_DIV: case P_DIV:
case P_MOD: case P_MOD:

View File

@ -414,7 +414,6 @@ quakefile_t *FindQuakeFilesWithPakFilter(char *pakfilter, char *filter)
#else #else
glob_t globbuf; glob_t globbuf;
struct stat statbuf; struct stat statbuf;
int j;
#endif #endif
quakefile_t *qfiles, *lastqf, *qf; quakefile_t *qfiles, *lastqf, *qf;
char pakfile[_MAX_PATH], filename[_MAX_PATH], *str; char pakfile[_MAX_PATH], filename[_MAX_PATH], *str;
@ -435,7 +434,7 @@ quakefile_t *FindQuakeFilesWithPakFilter(char *pakfilter, char *filter)
_stat(pakfile, &statbuf); _stat(pakfile, &statbuf);
#else #else
glob(pakfilter, 0, NULL, &globbuf); glob(pakfilter, 0, NULL, &globbuf);
for (j = 0; j < globbuf.gl_pathc; j++) for (size_t j = 0; j < globbuf.gl_pathc; j++)
{ {
strcpy(pakfile, globbuf.gl_pathv[j]); strcpy(pakfile, globbuf.gl_pathv[j]);
stat(pakfile, &statbuf); stat(pakfile, &statbuf);
@ -499,7 +498,7 @@ quakefile_t *FindQuakeFilesWithPakFilter(char *pakfilter, char *filter)
strcat(filename, filedata.cFileName); strcat(filename, filedata.cFileName);
#else #else
glob(filter, 0, NULL, &globbuf); glob(filter, 0, NULL, &globbuf);
for (j = 0; j < globbuf.gl_pathc; j++) for (size_t j = 0; j < globbuf.gl_pathc; j++)
{ {
strcpy(filename, globbuf.gl_pathv[j]); strcpy(filename, globbuf.gl_pathv[j]);
#endif #endif

View File

@ -132,10 +132,10 @@ void EmitLeaf (node_t *node)
// //
// write bounding box info // write bounding box info
// //
VectorCopy (node->mins, leaf_p->mins); VectorCopy (node->mins, leaf_p->mins);
VectorCopy (node->maxs, leaf_p->maxs); VectorCopy (node->maxs, leaf_p->maxs);
// //
// write the leafbrushes // write the leafbrushes
// //
@ -165,7 +165,7 @@ void EmitLeaf (node_t *node)
leaf_p->firstleafface = numleaffaces; leaf_p->firstleafface = numleaffaces;
for (p = node->portals ; p ; p = p->next[s]) for (p = node->portals ; p ; p = p->next[s])
{ {
s = (p->nodes[1] == node); s = (p->nodes[1] == node);
f = p->face[s]; f = p->face[s];
@ -174,7 +174,7 @@ void EmitLeaf (node_t *node)
EmitMarkFace (leaf_p, f); EmitMarkFace (leaf_p, f);
} }
leaf_p->numleaffaces = numleaffaces - leaf_p->firstleafface; leaf_p->numleaffaces = numleaffaces - leaf_p->firstleafface;
} }
@ -244,7 +244,7 @@ int EmitDrawNode_r (node_t *node)
return -numleafs; return -numleafs;
} }
// emit a node // emit a node
if (numnodes == MAX_MAP_NODES) if (numnodes == MAX_MAP_NODES)
Error ("MAX_MAP_NODES"); Error ("MAX_MAP_NODES");
n = &dnodes[numnodes]; n = &dnodes[numnodes];
@ -274,7 +274,7 @@ int EmitDrawNode_r (node_t *node)
// //
// recursively output the other nodes // recursively output the other nodes
// //
for (i=0 ; i<2 ; i++) for (i=0 ; i<2 ; i++)
{ {
if (node->children[i]->planenum == PLANENUM_LEAF) if (node->children[i]->planenum == PLANENUM_LEAF)
@ -284,7 +284,7 @@ int EmitDrawNode_r (node_t *node)
} }
else else
{ {
n->children[i] = numnodes; n->children[i] = numnodes;
EmitDrawNode_r (node->children[i]); EmitDrawNode_r (node->children[i]);
} }
} }
@ -329,7 +329,7 @@ void SetModelNumbers (void)
{ {
int i; int i;
int models; int models;
char value[10]; char value[16];
models = 1; models = 1;
for (i=1 ; i<num_entities ; i++) for (i=1 ; i<num_entities ; i++)
@ -356,7 +356,7 @@ void SetLightStyles (void)
char *t; char *t;
entity_t *e; entity_t *e;
int i, j; int i, j;
char value[10]; char value[16];
char lighttargets[MAX_SWITCHED_LIGHTS][64]; char lighttargets[MAX_SWITCHED_LIGHTS][64];
@ -374,7 +374,7 @@ void SetLightStyles (void)
t = ValueForKey (e, "targetname"); t = ValueForKey (e, "targetname");
if (!t[0]) if (!t[0])
continue; continue;
// find this targetname // find this targetname
for (j=0 ; j<stylenum ; j++) for (j=0 ; j<stylenum ; j++)
if (!strcmp (lighttargets[j], t)) if (!strcmp (lighttargets[j], t))

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
* name: unzip.c * name: unzip.c
* *
* desc: IO on .zip files using portions of zlib * desc: IO on .zip files using portions of zlib
* *
* $Archive: /MissionPack/code/qcommon/unzip.c $ * $Archive: /MissionPack/code/qcommon/unzip.c $
* *
@ -11,7 +11,7 @@
#include "qcommon.h" #include "qcommon.h"
#include "unzip.h" #include "unzip.h"
/* unzip.h -- IO for uncompress .zip files using zlib /* unzip.h -- IO for uncompress .zip files using zlib
Version 0.15 beta, Mar 19th, 1998, Version 0.15 beta, Mar 19th, 1998,
Copyright (C) 1998 Gilles Vollant Copyright (C) 1998 Gilles Vollant
@ -46,7 +46,7 @@
*/ */
/* for more info about .ZIP format, see /* for more info about .ZIP format, see
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
PkWare has also a specification at : PkWare has also a specification at :
ftp://ftp.pkware.com/probdesc.zip */ ftp://ftp.pkware.com/probdesc.zip */
@ -83,7 +83,7 @@
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -142,7 +142,7 @@ typedef Byte *voidp;
#define ZLIB_VERSION "1.1.3" #define ZLIB_VERSION "1.1.3"
/* /*
The 'zlib' compression library provides in-memory compression and The 'zlib' compression library provides in-memory compression and
decompression functions, including integrity checks of the uncompressed decompression functions, including integrity checks of the uncompressed
data. This version of the library supports only one compression method data. This version of the library supports only one compression method
@ -250,7 +250,7 @@ typedef Byte *voidp;
This check is automatically made by deflateInit and inflateInit. This check is automatically made by deflateInit and inflateInit.
*/ */
/* /*
int deflateInit OF((z_streamp strm, int level)); int deflateInit OF((z_streamp strm, int level));
Initializes the internal stream state for compression. The fields Initializes the internal stream state for compression. The fields
@ -328,7 +328,7 @@ int deflateInit OF((z_streamp strm, int level));
more input data, until it returns with Z_STREAM_END or an error. After more input data, until it returns with Z_STREAM_END or an error. After
deflate has returned Z_STREAM_END, the only possible operations on the deflate has returned Z_STREAM_END, the only possible operations on the
stream are deflateReset or deflateEnd. stream are deflateReset or deflateEnd.
Z_FINISH can be used immediately after deflateInit if all the compression Z_FINISH can be used immediately after deflateInit if all the compression
is to be done in a single step. In this case, avail_out must be at least is to be done in a single step. In this case, avail_out must be at least
0.1% larger than avail_in plus 12 bytes. If deflate does not return 0.1% larger than avail_in plus 12 bytes. If deflate does not return
@ -365,7 +365,7 @@ int deflateInit OF((z_streamp strm, int level));
*/ */
/* /*
int inflateInit OF((z_streamp strm)); int inflateInit OF((z_streamp strm));
Initializes the internal stream state for decompression. The fields Initializes the internal stream state for decompression. The fields
@ -434,7 +434,7 @@ static int inflate OF((z_streamp strm, int flush));
If a preset dictionary is needed at this point (see inflateSetDictionary If a preset dictionary is needed at this point (see inflateSetDictionary
below), inflate sets strm-adler to the adler32 checksum of the below), inflate sets strm-adler to the adler32 checksum of the
dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
it sets strm->adler to the adler32 checksum of all output produced it sets strm->adler to the adler32 checksum of all output produced
so (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or so (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
an error code as described below. At the end of the stream, inflate() an error code as described below. At the end of the stream, inflate()
@ -472,7 +472,7 @@ static int inflateEnd OF((z_streamp strm));
The following functions are needed only in some special applications. The following functions are needed only in some special applications.
*/ */
/* /*
int deflateInit2 OF((z_streamp strm, int deflateInit2 OF((z_streamp strm,
int level, int level,
int method, int method,
@ -515,7 +515,7 @@ int deflateInit2 OF((z_streamp strm,
method). msg is set to null if there is no error message. deflateInit2 does method). msg is set to null if there is no error message. deflateInit2 does
not perform any compression: this will be done by deflate(). not perform any compression: this will be done by deflate().
*/ */
/* /*
static int deflateSetDictionary OF((z_streamp strm, static int deflateSetDictionary OF((z_streamp strm,
const Byte *dictionary, const Byte *dictionary,
@ -608,7 +608,7 @@ static int deflateParams OF((z_streamp strm,
if strm->avail_out was zero. if strm->avail_out was zero.
*/ */
/* /*
int inflateInit2 OF((z_streamp strm, int inflateInit2 OF((z_streamp strm,
int windowBits)); int windowBits));
@ -653,7 +653,7 @@ static int inflateSetDictionary OF((z_streamp strm,
*/ */
// static int inflateSync OF((z_streamp strm)); // static int inflateSync OF((z_streamp strm));
/* /*
Skips invalid compressed data until a full flush point (see above the Skips invalid compressed data until a full flush point (see above the
description of deflate with Z_FULL_FLUSH) can be found, or until all description of deflate with Z_FULL_FLUSH) can be found, or until all
available input is skipped. No output is provided. available input is skipped. No output is provided.
@ -725,7 +725,7 @@ static int compress2 OF((Byte *dest, uLong *destLen,
/* /*
static int uncompress OF((Byte *dest, uLong *destLen, static int uncompress OF((Byte *dest, uLong *destLen,
const Byte *source, uLong sourceLen)); const Byte *source, uLong sourceLen));
*/ */
/* /*
Decompresses the source buffer into the destination buffer. sourceLen is Decompresses the source buffer into the destination buffer. sourceLen is
the byte length of the source buffer. Upon entry, destLen is the total the byte length of the source buffer. Upon entry, destLen is the total
@ -790,7 +790,7 @@ int gzread OF((gzFile file, voidp buf, unsigned len));
gzread returns the number of uncompressed bytes actually read (0 for gzread returns the number of uncompressed bytes actually read (0 for
end of file, -1 for error). */ end of file, -1 for error). */
int gzwrite OF((gzFile file, int gzwrite OF((gzFile file,
const voidp buf, unsigned len)); const voidp buf, unsigned len));
/* /*
Writes the given number of uncompressed bytes into the compressed file. Writes the given number of uncompressed bytes into the compressed file.
@ -845,7 +845,7 @@ int gzflush OF((gzFile file, int flush));
long gzseek OF((gzFile file, long gzseek OF((gzFile file,
long offset, int whence)); long offset, int whence));
/* /*
Sets the starting position for the next gzread or gzwrite on the Sets the starting position for the next gzread or gzwrite on the
given compressed file. The offset represents a number of bytes in the given compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2); uncompressed data stream. The whence parameter is defined as in lseek(2);
@ -1094,7 +1094,7 @@ static int unzlocal_getByte(FILE *fin,int *pi)
} }
else else
{ {
if (ferror(fin)) if (ferror(fin))
return UNZ_ERRNO; return UNZ_ERRNO;
else else
return UNZ_EOF; return UNZ_EOF;
@ -1103,7 +1103,7 @@ static int unzlocal_getByte(FILE *fin,int *pi)
*/ */
/* =========================================================================== /* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets Reads a long in LSB order from the given gz_stream. Sets
*/ */
static int unzlocal_getShort (FILE* fin, uLong *pX) static int unzlocal_getShort (FILE* fin, uLong *pX)
{ {
@ -1161,7 +1161,7 @@ static int strcmpcasenosensitive_internal (const char* fileName1,const char* fil
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
#endif #endif
/* /*
Compare two filename (fileName1,fileName2). Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
@ -1179,7 +1179,7 @@ extern int unzStringFileNameCompare (const char* fileName1,const char* fileName
return strcmp(fileName1,fileName2); return strcmp(fileName1,fileName2);
return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
} }
#define BUFREADCOMMENT (0x400) #define BUFREADCOMMENT (0x400)
@ -1194,13 +1194,13 @@ extern uLong unzlocal_SearchCentralDir(FILE *fin)
uLong uBackRead; uLong uBackRead;
uLong uMaxBack=0xffff; /* maximum size of global comment */ uLong uMaxBack=0xffff; /* maximum size of global comment */
uLong uPosFound=0; uLong uPosFound=0;
if (fseek(fin,0,SEEK_END) != 0) if (fseek(fin,0,SEEK_END) != 0)
return 0; return 0;
uSizeFile = ftell( fin ); uSizeFile = ftell( fin );
if (uMaxBack>uSizeFile) if (uMaxBack>uSizeFile)
uMaxBack = uSizeFile; uMaxBack = uSizeFile;
@ -1213,13 +1213,13 @@ extern uLong unzlocal_SearchCentralDir(FILE *fin)
{ {
uLong uReadSize,uReadPos ; uLong uReadSize,uReadPos ;
int i; int i;
if (uBackRead+BUFREADCOMMENT>uMaxBack) if (uBackRead+BUFREADCOMMENT>uMaxBack)
uBackRead = uMaxBack; uBackRead = uMaxBack;
else else
uBackRead+=BUFREADCOMMENT; uBackRead+=BUFREADCOMMENT;
uReadPos = uSizeFile-uBackRead ; uReadPos = uSizeFile-uBackRead ;
uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
(BUFREADCOMMENT+4) : (uSizeFile-uReadPos); (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
if (fseek(fin,uReadPos,SEEK_SET)!=0) if (fseek(fin,uReadPos,SEEK_SET)!=0)
break; break;
@ -1228,7 +1228,7 @@ extern uLong unzlocal_SearchCentralDir(FILE *fin)
break; break;
for (i=(int)uReadSize-3; (i--)>0;) for (i=(int)uReadSize-3; (i--)>0;)
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{ {
uPosFound = uReadPos+i; uPosFound = uReadPos+i;
@ -1255,7 +1255,7 @@ extern unzFile unzReOpen (const char* path, unzFile file)
Com_Memcpy(s, (unz_s*)file, sizeof(unz_s)); Com_Memcpy(s, (unz_s*)file, sizeof(unz_s));
s->file = fin; s->file = fin;
return (unzFile)s; return (unzFile)s;
} }
/* /*
@ -1274,12 +1274,12 @@ extern unzFile unzOpen (const char* path)
uLong central_pos,uL; uLong central_pos,uL;
FILE * fin ; FILE * fin ;
uLong number_disk; /* number of the current dist, used for uLong number_disk; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/ spaning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number the the disk with central dir, used uLong number_disk_with_CD; /* number the the disk with central dir, used
for spaning ZIP, unsupported, always 0*/ for spaning ZIP, unsupported, always 0*/
uLong number_entry_CD; /* total number of entries in uLong number_entry_CD; /* total number of entries in
the central dir the central dir
(same than number_entry on nospan) */ (same than number_entry on nospan) */
int err=UNZ_OK; int err=UNZ_OK;
@ -1324,7 +1324,7 @@ extern unzFile unzOpen (const char* path)
if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
/* offset of start of central directory with respect to the /* offset of start of central directory with respect to the
starting disk number */ starting disk number */
if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -1333,7 +1333,7 @@ extern unzFile unzOpen (const char* path)
if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
if ((central_pos<us.offset_central_dir+us.size_central_dir) && if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
(err==UNZ_OK)) (err==UNZ_OK))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -1348,12 +1348,12 @@ extern unzFile unzOpen (const char* path)
(us.offset_central_dir+us.size_central_dir); (us.offset_central_dir+us.size_central_dir);
us.central_pos = central_pos; us.central_pos = central_pos;
us.pfile_in_zip_read = NULL; us.pfile_in_zip_read = NULL;
s=(unz_s*)ALLOC(sizeof(unz_s)); s=(unz_s*)ALLOC(sizeof(unz_s));
*s=us; *s=us;
// unzGoToFirstFile((unzFile)s); // unzGoToFirstFile((unzFile)s);
return (unzFile)s; return (unzFile)s;
} }
@ -1369,8 +1369,8 @@ extern int unzClose (unzFile file)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
s=(unz_s*)file; s=(unz_s*)file;
if (s->pfile_in_zip_read!=NULL) if (s->pfile_in_zip_read!=NULL)
unzCloseCurrentFile(file); unzCloseCurrentFile(file);
fclose(s->file); fclose(s->file);
TRYFREE(s); TRYFREE(s);
@ -1414,7 +1414,7 @@ static void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz* ptm)
*/ */
static int unzlocal_GetCurrentFileInfoInternal (unzFile file, static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
unz_file_info *pfile_info, unz_file_info *pfile_info,
unz_file_info_internal unz_file_info_internal
*pfile_info_internal, *pfile_info_internal,
char *szFileName, char *szFileName,
uLong fileNameBufferSize, uLong fileNameBufferSize,
@ -1509,7 +1509,7 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
lSeek -= uSizeRead; lSeek -= uSizeRead;
} }
if ((err==UNZ_OK) && (extraField!=NULL)) if ((err==UNZ_OK) && (extraField!=NULL))
{ {
uLong uSizeRead ; uLong uSizeRead ;
@ -1531,9 +1531,9 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
lSeek += file_info.size_file_extra - uSizeRead; lSeek += file_info.size_file_extra - uSizeRead;
} }
else else
lSeek+=file_info.size_file_extra; lSeek+=file_info.size_file_extra;
if ((err==UNZ_OK) && (szComment!=NULL)) if ((err==UNZ_OK) && (szComment!=NULL))
{ {
uLong uSizeRead ; uLong uSizeRead ;
@ -1615,7 +1615,7 @@ extern int unzGoToFirstFile (unzFile file)
*/ */
extern int unzGoToNextFile (unzFile file) extern int unzGoToNextFile (unzFile file)
{ {
unz_s* s; unz_s* s;
int err; int err;
if (file==NULL) if (file==NULL)
@ -1642,7 +1642,7 @@ extern int unzGoToNextFile (unzFile file)
*/ */
extern int unzGetCurrentFileInfoPosition (unzFile file, unsigned long *pos ) extern int unzGetCurrentFileInfoPosition (unzFile file, unsigned long *pos )
{ {
unz_s* s; unz_s* s;
if (file==NULL) if (file==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
@ -1658,7 +1658,7 @@ extern int unzGetCurrentFileInfoPosition (unzFile file, unsigned long *pos )
*/ */
extern int unzSetCurrentFileInfoPosition (unzFile file, unsigned long pos ) extern int unzSetCurrentFileInfoPosition (unzFile file, unsigned long pos )
{ {
unz_s* s; unz_s* s;
int err; int err;
if (file==NULL) if (file==NULL)
@ -1683,10 +1683,10 @@ extern int unzSetCurrentFileInfoPosition (unzFile file, unsigned long pos )
*/ */
extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
{ {
unz_s* s; unz_s* s;
int err; int err;
uLong num_fileSaved; uLong num_fileSaved;
uLong pos_in_central_dirSaved; uLong pos_in_central_dirSaved;
@ -1694,8 +1694,8 @@ extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensiti
if (file==NULL) if (file==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
s=(unz_s*)file; s=(unz_s*)file;
if (!s->current_file_ok) if (!s->current_file_ok)
@ -1769,9 +1769,9 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
(s->cur_file_info.compression_method!=Z_DEFLATED)) (s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -1790,7 +1790,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
err=UNZ_ERRNO; err=UNZ_ERRNO;
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
((uFlags & 8)==0)) ((uFlags & 8)==0))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -1812,7 +1812,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
return err; return err;
} }
/* /*
Open for reading data the current file in the zipfile. 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. If there is no error and the file is opened, the return value is UNZ_OK.
@ -1833,8 +1833,8 @@ extern int unzOpenCurrentFile (unzFile file)
if (!s->current_file_ok) if (!s->current_file_ok)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if (s->pfile_in_zip_read != NULL) if (s->pfile_in_zip_read != NULL)
unzCloseCurrentFile(file); unzCloseCurrentFile(file);
if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
&offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
@ -1857,7 +1857,7 @@ extern int unzOpenCurrentFile (unzFile file)
} }
pfile_in_zip_read_info->stream_initialised=0; pfile_in_zip_read_info->stream_initialised=0;
if ((s->cur_file_info.compression_method!=0) && if ((s->cur_file_info.compression_method!=0) &&
(s->cur_file_info.compression_method!=Z_DEFLATED)) (s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -1876,29 +1876,29 @@ extern int unzOpenCurrentFile (unzFile file)
{ {
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; 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.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidp)0; pfile_in_zip_read_info->stream.opaque = (voidp)0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
if (err == Z_OK) if (err == Z_OK)
pfile_in_zip_read_info->stream_initialised=1; pfile_in_zip_read_info->stream_initialised=1;
/* windowBits is passed < 0 to tell that there is no zlib header. /* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte * Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and * after the compressed stream in order to complete decompression and
* return Z_STREAM_END. * return Z_STREAM_END.
* In unzip, i don't wait absolutely Z_STREAM_END because I known the * In unzip, i don't wait absolutely Z_STREAM_END because I known the
* size of both compressed and uncompressed data * size of both compressed and uncompressed data
*/ */
} }
pfile_in_zip_read_info->rest_read_compressed = pfile_in_zip_read_info->rest_read_compressed =
s->cur_file_info.compressed_size ; s->cur_file_info.compressed_size ;
pfile_in_zip_read_info->rest_read_uncompressed = pfile_in_zip_read_info->rest_read_uncompressed =
s->cur_file_info.uncompressed_size ; s->cur_file_info.uncompressed_size ;
pfile_in_zip_read_info->pos_in_zipfile = pfile_in_zip_read_info->pos_in_zipfile =
s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
iSizeVar; iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0; pfile_in_zip_read_info->stream.avail_in = (uInt)0;
@ -1940,9 +1940,9 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
pfile_in_zip_read_info->stream.next_out = (Byte*)buf; pfile_in_zip_read_info->stream.next_out = (Byte*)buf;
pfile_in_zip_read_info->stream.avail_out = (uInt)len; pfile_in_zip_read_info->stream.avail_out = (uInt)len;
if (len>pfile_in_zip_read_info->rest_read_uncompressed) if (len>pfile_in_zip_read_info->rest_read_uncompressed)
pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->stream.avail_out =
(uInt)pfile_in_zip_read_info->rest_read_uncompressed; (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
while (pfile_in_zip_read_info->stream.avail_out>0) while (pfile_in_zip_read_info->stream.avail_out>0)
@ -1957,7 +1957,7 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
return UNZ_EOF; return UNZ_EOF;
if (s->cur_file_info.compressed_size == pfile_in_zip_read_info->rest_read_compressed) if (s->cur_file_info.compressed_size == pfile_in_zip_read_info->rest_read_compressed)
if (fseek(pfile_in_zip_read_info->file, if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->pos_in_zipfile + pfile_in_zip_read_info->pos_in_zipfile +
pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
return UNZ_ERRNO; return UNZ_ERRNO;
if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
@ -1966,8 +1966,8 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
pfile_in_zip_read_info->rest_read_compressed-=uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
pfile_in_zip_read_info->stream.next_in = pfile_in_zip_read_info->stream.next_in =
(Byte*)pfile_in_zip_read_info->read_buffer; (Byte*)pfile_in_zip_read_info->read_buffer;
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
} }
@ -1975,16 +1975,16 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
if (pfile_in_zip_read_info->compression_method==0) if (pfile_in_zip_read_info->compression_method==0)
{ {
uInt uDoCopy,i ; uInt uDoCopy,i ;
if (pfile_in_zip_read_info->stream.avail_out < if (pfile_in_zip_read_info->stream.avail_out <
pfile_in_zip_read_info->stream.avail_in) pfile_in_zip_read_info->stream.avail_in)
uDoCopy = pfile_in_zip_read_info->stream.avail_out ; uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
else else
uDoCopy = pfile_in_zip_read_info->stream.avail_in ; uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
for (i=0;i<uDoCopy;i++) for (i=0;i<uDoCopy;i++)
*(pfile_in_zip_read_info->stream.next_out+i) = *(pfile_in_zip_read_info->stream.next_out+i) =
*(pfile_in_zip_read_info->stream.next_in+i); *(pfile_in_zip_read_info->stream.next_in+i);
// pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, // pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
// pfile_in_zip_read_info->stream.next_out, // pfile_in_zip_read_info->stream.next_out,
// uDoCopy); // uDoCopy);
@ -2008,14 +2008,14 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
uOutThis = uTotalOutAfter-uTotalOutBefore; uOutThis = uTotalOutAfter-uTotalOutBefore;
pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis; pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis;
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
if (err==Z_STREAM_END) if (err==Z_STREAM_END)
return (iRead==0) ? UNZ_EOF : iRead; return (iRead==0) ? UNZ_EOF : iRead;
if (err!=Z_OK) if (err!=Z_OK)
break; break;
} }
} }
@ -2046,7 +2046,7 @@ extern long unztell (unzFile file)
/* /*
return 1 if the end of file was reached, 0 elsewhere return 1 if the end of file was reached, 0 elsewhere
*/ */
extern int unzeof (unzFile file) extern int unzeof (unzFile file)
{ {
@ -2059,7 +2059,7 @@ extern int unzeof (unzFile file)
if (pfile_in_zip_read_info==NULL) if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if (pfile_in_zip_read_info->rest_read_uncompressed == 0) if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
return 1; return 1;
else else
@ -2077,7 +2077,7 @@ extern int unzeof (unzFile file)
if buf!=NULL, len is the size of the buffer, the extra header is copied in if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf. buf.
the return value is the number of bytes copied in buf, or (if <0) the return value is the number of bytes copied in buf, or (if <0)
the error code the error code
*/ */
extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len) extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len)
@ -2095,12 +2095,12 @@ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len)
if (pfile_in_zip_read_info==NULL) if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
size_to_read = (pfile_in_zip_read_info->size_local_extrafield - size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
pfile_in_zip_read_info->pos_local_extrafield); pfile_in_zip_read_info->pos_local_extrafield);
if (buf==NULL) if (buf==NULL)
return (int)size_to_read; return (int)size_to_read;
if (len>size_to_read) if (len>size_to_read)
read_now = (uInt)size_to_read; read_now = (uInt)size_to_read;
else else
@ -2108,9 +2108,9 @@ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len)
if (read_now==0) if (read_now==0)
return 0; return 0;
if (fseek(pfile_in_zip_read_info->file, if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->offset_local_extrafield + pfile_in_zip_read_info->offset_local_extrafield +
pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
return UNZ_ERRNO; return UNZ_ERRNO;
@ -2194,7 +2194,7 @@ extern int unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf)
/* infblock.h -- header to use infblock.c /* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2244,7 +2244,7 @@ static const uInt border[] = { /* Order of the bit length code lengths */
/* inftrees.h -- header to use inftrees.c /* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2304,7 +2304,7 @@ static int inflate_trees_fixed OF((
/* infcodes.h -- header to use infcodes.c /* infcodes.h -- header to use infcodes.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2331,7 +2331,7 @@ static void inflate_codes_free OF((
/* infutil.h -- types and macros common to blocks and codes /* infutil.h -- types and macros common to blocks and codes
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2372,7 +2372,7 @@ struct inflate_blocks_state {
inflate_huft *tb; /* bit length decoding tree */ inflate_huft *tb; /* bit length decoding tree */
} trees; /* if DTREE, decoding info for trees */ } trees; /* if DTREE, decoding info for trees */
struct { struct {
inflate_codes_statef inflate_codes_statef
*codes; *codes;
} decode; /* if CODES, current state */ } decode; /* if CODES, current state */
} sub; /* submode */ } sub; /* submode */
@ -2426,7 +2426,7 @@ static int inflate_flush OF((
#endif #endif
/* /*
Notes beyond the 1.93a appnote.txt: Notes beyond the 1.93a appnote.txt:
@ -2729,7 +2729,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
} }
s->sub.decode.codes = c; s->sub.decode.codes = c;
} }
s->mode = CODES; s->mode = CODES; // fall through
case CODES: case CODES:
UPDATE UPDATE
if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
@ -2745,12 +2745,12 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
s->mode = TYPE; s->mode = TYPE;
break; break;
} }
s->mode = DRY; s->mode = DRY; // fall through
case DRY: case DRY:
FLUSH FLUSH
if (s->read != s->write) if (s->read != s->write)
LEAVE LEAVE
s->mode = DONE; s->mode = DONE; // fall through
case DONE: case DONE:
r = Z_STREAM_END; r = Z_STREAM_END;
LEAVE LEAVE
@ -2782,7 +2782,7 @@ void inflate_set_dictionary(inflate_blocks_statef *s, const Byte *d, uInt n)
} }
/* Returns true if inflate is currently at the end of a block generated /* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH. * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL * IN assertion: s != Z_NULL
*/ */
int inflate_blocks_sync_point(inflate_blocks_statef *s) int inflate_blocks_sync_point(inflate_blocks_statef *s)
@ -2866,7 +2866,7 @@ int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r)
/* inftrees.c -- generate Huffman trees for efficient decoding /* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* /*
@ -2976,7 +2976,7 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e, inf
uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */ uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */
register uInt *p; /* pointer into c[], b[], or v[] */ register uInt *p; /* pointer into c[], b[], or v[] */
inflate_huft *q; /* points to current table */ inflate_huft *q; /* points to current table */
struct inflate_huft_s r = { {{0, 0}} }; /* table entry for structure assignment */ struct inflate_huft_s r = { {{0, 0}}, 0 }; /* table entry for structure assignment */
inflate_huft *u[BMAX]; /* table stack */ inflate_huft *u[BMAX]; /* table stack */
register int w; /* bits before this table == (l * h) */ register int w; /* bits before this table == (l * h) */
uInt x[BMAX+1]; /* bit offsets, then code stack */ uInt x[BMAX+1]; /* bit offsets, then code stack */
@ -3070,7 +3070,7 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e, inf
/* compute minimum size table less than or equal to l bits */ /* compute minimum size table less than or equal to l bits */
z = g - w; z = g - w;
z = z > (uInt)l ? l : z; /* table size upper limit */ z = z > (uInt)l ? (uInt)l : z; /* table size upper limit */
if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
{ /* too few codes for k-w bit table */ { /* too few codes for k-w bit table */
f -= a + 1; /* deduct codes from patterns left */ f -= a + 1; /* deduct codes from patterns left */
@ -3557,7 +3557,7 @@ static int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, in
/* infcodes.c -- process literals and length/distance pairs /* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* simplify the use of the inflate_huft type with some defines */ /* simplify the use of the inflate_huft type with some defines */
@ -3660,7 +3660,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
#endif /* !SLOW */ #endif /* !SLOW */
c->sub.code.need = c->lbits; c->sub.code.need = c->lbits;
c->sub.code.tree = c->ltree; c->sub.code.tree = c->ltree;
c->mode = LEN; c->mode = LEN; // fall through
case LEN: /* i: get length/literal/eob next */ case LEN: /* i: get length/literal/eob next */
j = c->sub.code.need; j = c->sub.code.need;
NEEDBITS(j) NEEDBITS(j)
@ -3707,7 +3707,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
c->sub.code.need = c->dbits; c->sub.code.need = c->dbits;
c->sub.code.tree = c->dtree; c->sub.code.tree = c->dtree;
Tracevv(("inflate: length %u\n", c->len)); Tracevv(("inflate: length %u\n", c->len));
c->mode = DIST; c->mode = DIST; // fall through
case DIST: /* i: get distance next */ case DIST: /* i: get distance next */
j = c->sub.code.need; j = c->sub.code.need;
NEEDBITS(j) NEEDBITS(j)
@ -3737,7 +3737,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
c->sub.copy.dist += (uInt)b & inflate_mask[j]; c->sub.copy.dist += (uInt)b & inflate_mask[j];
DUMPBITS(j) DUMPBITS(j)
Tracevv(("inflate: distance %u\n", c->sub.copy.dist)); Tracevv(("inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY; c->mode = COPY; // fall through
case COPY: /* o: copying bytes in window, waiting for space */ case COPY: /* o: copying bytes in window, waiting for space */
#ifndef __TURBOC__ /* Turbo C bug for following expression */ #ifndef __TURBOC__ /* Turbo C bug for following expression */
f = (uInt)(q - s->window) < c->sub.copy.dist ? f = (uInt)(q - s->window) < c->sub.copy.dist ?
@ -3774,7 +3774,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
FLUSH FLUSH
if (s->read != s->write) if (s->read != s->write)
LEAVE LEAVE
c->mode = END; c->mode = END; // fall through
case END: case END:
r = Z_STREAM_END; r = Z_STREAM_END;
LEAVE LEAVE
@ -3799,7 +3799,7 @@ void inflate_codes_free(inflate_codes_statef *c, z_streamp z)
/* adler32.c -- compute the Adler-32 checksum of a data stream /* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#define BASE 65521L /* largest prime smaller than 65536 */ #define BASE 65521L /* largest prime smaller than 65536 */
@ -3847,7 +3847,7 @@ static uLong adler32(uLong adler, const Byte *buf, uInt len)
/* infblock.h -- header to use infblock.c /* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -3920,7 +3920,7 @@ struct internal_state {
/* mode independent information */ /* mode independent information */
int nowrap; /* flag for no wrapper */ int nowrap; /* flag for no wrapper */
uInt wbits; /* log2(window size) (8..15, defaults to 15) */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */
inflate_blocks_statef inflate_blocks_statef
*blocks; /* current inflate_blocks state */ *blocks; /* current inflate_blocks state */
}; };
@ -4042,7 +4042,7 @@ int inflate(z_streamp z, int f)
z->state->sub.marker = 5; /* can't try inflateSync */ z->state->sub.marker = 5; /* can't try inflateSync */
break; break;
} }
z->state->mode = imFLAG; z->state->mode = imFLAG; // fall through
case imFLAG: case imFLAG:
iNEEDBYTE iNEEDBYTE
b = iNEXTBYTE; b = iNEXTBYTE;
@ -4059,19 +4059,19 @@ int inflate(z_streamp z, int f)
z->state->mode = imBLOCKS; z->state->mode = imBLOCKS;
break; break;
} }
z->state->mode = imDICT4; z->state->mode = imDICT4; // fall through
case imDICT4: case imDICT4:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need = (uLong)iNEXTBYTE << 24; z->state->sub.check.need = (uLong)iNEXTBYTE << 24;
z->state->mode = imDICT3; z->state->mode = imDICT3; // fall through
case imDICT3: case imDICT3:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 16; z->state->sub.check.need += (uLong)iNEXTBYTE << 16;
z->state->mode = imDICT2; z->state->mode = imDICT2; // fall through
case imDICT2: case imDICT2:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 8; z->state->sub.check.need += (uLong)iNEXTBYTE << 8;
z->state->mode = imDICT1; z->state->mode = imDICT1; // fall through
case imDICT1: case imDICT1:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE; z->state->sub.check.need += (uLong)iNEXTBYTE;
@ -4102,19 +4102,19 @@ int inflate(z_streamp z, int f)
z->state->mode = imDONE; z->state->mode = imDONE;
break; break;
} }
z->state->mode = imCHECK4; z->state->mode = imCHECK4; // fall through
case imCHECK4: case imCHECK4:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need = (uLong)iNEXTBYTE << 24; z->state->sub.check.need = (uLong)iNEXTBYTE << 24;
z->state->mode = imCHECK3; z->state->mode = imCHECK3; // fall through
case imCHECK3: case imCHECK3:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 16; z->state->sub.check.need += (uLong)iNEXTBYTE << 16;
z->state->mode = imCHECK2; z->state->mode = imCHECK2; // fall through
case imCHECK2: case imCHECK2:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 8; z->state->sub.check.need += (uLong)iNEXTBYTE << 8;
z->state->mode = imCHECK1; z->state->mode = imCHECK1; // fall through
case imCHECK1: case imCHECK1:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE; z->state->sub.check.need += (uLong)iNEXTBYTE;
@ -4127,7 +4127,7 @@ int inflate(z_streamp z, int f)
break; break;
} }
Tracev(("inflate: zlib check ok\n")); Tracev(("inflate: zlib check ok\n"));
z->state->mode = imDONE; z->state->mode = imDONE; // fall through
case imDONE: case imDONE:
return Z_STREAM_END; return Z_STREAM_END;
case imBAD: case imBAD:

View File

@ -221,7 +221,7 @@ int ParseChunk( FILE *input ){
w--; w--;
bytesread++; bytesread++;
} while ( temp[i - 1] ); } while ( temp[i - 1] );
// fall through
case MAIN3DS: case MAIN3DS:
case OBJ_TRIMESH: case OBJ_TRIMESH:
case EDIT3DS: case EDIT3DS:

View File

@ -323,8 +323,9 @@ void InitPaths( int *argc, char **argv ){
/* remove processed arguments */ /* remove processed arguments */
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ ) for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{ {
for ( ; j < *argc && argv[ j ] == NULL; j++ ); for ( ; j < *argc && argv[ j ] == NULL; j++ ){
argv[ i ] = argv[ j ]; }
argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) { if ( argv[ i ] != NULL ) {
k++; k++;
} }

View File

@ -161,7 +161,6 @@ void ProcessWorldModel( void ){
entity_t *e; entity_t *e;
tree_t *tree; tree_t *tree;
qboolean leaked; qboolean leaked;
qboolean optimize;
xmlNodePtr polyline, leaknode; xmlNodePtr polyline, leaknode;
char level[ 2 ]; char level[ 2 ];
@ -200,7 +199,7 @@ void ProcessWorldModel( void ){
block_yh = 3; block_yh = 3;
} }
for ( optimize = false ; optimize <= true ; optimize++ ) for ( int optimize = 0; optimize <= 1; optimize++ )
{ {
Sys_FPrintf( SYS_VRB, "--------------------------------------------\n" ); Sys_FPrintf( SYS_VRB, "--------------------------------------------\n" );

View File

@ -324,7 +324,7 @@ void WriteBSP( node_t *headnode ){
void SetModelNumbers( void ){ void SetModelNumbers( void ){
int i; int i;
int models; int models;
char value[10]; char value[16];
models = 1; models = 1;
for ( i = 1 ; i < num_entities ; i++ ) for ( i = 1 ; i < num_entities ; i++ )
@ -349,7 +349,7 @@ void SetLightStyles( void ){
char *t; char *t;
entity_t *e; entity_t *e;
int i, j; int i, j;
char value[10]; char value[16];
char lighttargets[MAX_SWITCHED_LIGHTS][64]; char lighttargets[MAX_SWITCHED_LIGHTS][64];

View File

@ -252,7 +252,6 @@ void PackDirectory_r( char *dir ){
int count; int count;
struct stat st; struct stat st;
int i; int i;
int len;
char fullname[1024]; char fullname[1024];
char dirstring[1024]; char dirstring[1024];
char *name; char *name;

View File

@ -246,7 +246,7 @@ int ParseChunk( FILE *input ){
w--; w--;
bytesread++; bytesread++;
} while ( temp[i - 1] ); } while ( temp[i - 1] );
// fall through
case MAIN3DS: case MAIN3DS:
case OBJ_TRIMESH: case OBJ_TRIMESH:
case EDIT3DS: case EDIT3DS:

View File

@ -167,7 +167,7 @@ void LokiInitPaths( char *argv0 ){
/* verify the path */ /* verify the path */
if ( access( temp, X_OK ) == 0 ) { if ( access( temp, X_OK ) == 0 ) {
found++; found = true;
} }
path = last + 1; path = last + 1;
} }
@ -324,8 +324,9 @@ void InitPaths( int *argc, char **argv ){
/* remove processed arguments */ /* remove processed arguments */
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ ) for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{ {
for ( ; j < *argc && argv[ j ] == NULL; j++ ); for ( ; j < *argc && argv[ j ] == NULL; j++ ){
argv[ i ] = argv[ j ]; }
argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) { if ( argv[ i ] != NULL ) {
k++; k++;
} }

View File

@ -242,7 +242,6 @@ void PackDirectory_r( char *dir ){
int count; int count;
struct stat st; struct stat st;
int i; int i;
int len;
char fullname[1024]; char fullname[1024];
char dirstring[1024]; char dirstring[1024];
char *name; char *name;

View File

@ -222,7 +222,7 @@ int ParseChunk( FILE *input ){
w--; w--;
bytesread++; bytesread++;
} while ( temp[i - 1] ); } while ( temp[i - 1] );
// fall through
case MAIN3DS: case MAIN3DS:
case OBJ_TRIMESH: case OBJ_TRIMESH:
case EDIT3DS: case EDIT3DS:

View File

@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/***************************************************************************** /*****************************************************************************
* name: unzip.c * name: unzip.c
* *
* desc: IO on .zip files using portions of zlib * desc: IO on .zip files using portions of zlib
* *
* *
*****************************************************************************/ *****************************************************************************/
@ -41,7 +41,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// TTimo added for safe_malloc wrapping // TTimo added for safe_malloc wrapping
#include "cmdlib.h" #include "cmdlib.h"
/* unzip.h -- IO for uncompress .zip files using zlib /* unzip.h -- IO for uncompress .zip files using zlib
Version 0.15 beta, Mar 19th, 1998, Version 0.15 beta, Mar 19th, 1998,
Copyright (C) 1998 Gilles Vollant Copyright (C) 1998 Gilles Vollant
@ -76,7 +76,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/* for more info about .ZIP format, see /* for more info about .ZIP format, see
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
PkWare has also a specification at : PkWare has also a specification at :
ftp://ftp.pkware.com/probdesc.zip */ ftp://ftp.pkware.com/probdesc.zip */
@ -113,7 +113,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
/* zconf.h -- configuration of the zlib compression library /* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-1998 Jean-loup Gailly. * Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -172,7 +172,7 @@ typedef Byte *voidp;
#define ZLIB_VERSION "1.1.3" #define ZLIB_VERSION "1.1.3"
/* /*
The 'zlib' compression library provides in-memory compression and The 'zlib' compression library provides in-memory compression and
decompression functions, including integrity checks of the uncompressed decompression functions, including integrity checks of the uncompressed
data. This version of the library supports only one compression method data. This version of the library supports only one compression method
@ -280,7 +280,7 @@ const char * zlibVersion OF((void));
This check is automatically made by deflateInit and inflateInit. This check is automatically made by deflateInit and inflateInit.
*/ */
/* /*
int deflateInit OF((z_streamp strm, int level)); int deflateInit OF((z_streamp strm, int level));
Initializes the internal stream state for compression. The fields Initializes the internal stream state for compression. The fields
@ -358,7 +358,7 @@ int deflate OF((z_streamp strm, int flush));
more input data, until it returns with Z_STREAM_END or an error. After more input data, until it returns with Z_STREAM_END or an error. After
deflate has returned Z_STREAM_END, the only possible operations on the deflate has returned Z_STREAM_END, the only possible operations on the
stream are deflateReset or deflateEnd. stream are deflateReset or deflateEnd.
Z_FINISH can be used immediately after deflateInit if all the compression Z_FINISH can be used immediately after deflateInit if all the compression
is to be done in a single step. In this case, avail_out must be at least is to be done in a single step. In this case, avail_out must be at least
0.1% larger than avail_in plus 12 bytes. If deflate does not return 0.1% larger than avail_in plus 12 bytes. If deflate does not return
@ -395,7 +395,7 @@ int deflateEnd OF((z_streamp strm));
*/ */
/* /*
int inflateInit OF((z_streamp strm)); int inflateInit OF((z_streamp strm));
Initializes the internal stream state for decompression. The fields Initializes the internal stream state for decompression. The fields
@ -464,7 +464,7 @@ int inflate OF((z_streamp strm, int flush));
If a preset dictionary is needed at this point (see inflateSetDictionary If a preset dictionary is needed at this point (see inflateSetDictionary
below), inflate sets strm-adler to the adler32 checksum of the below), inflate sets strm-adler to the adler32 checksum of the
dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
it sets strm->adler to the adler32 checksum of all output produced it sets strm->adler to the adler32 checksum of all output produced
so (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or so (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
an error code as described below. At the end of the stream, inflate() an error code as described below. At the end of the stream, inflate()
@ -502,7 +502,7 @@ int inflateEnd OF((z_streamp strm));
The following functions are needed only in some special applications. The following functions are needed only in some special applications.
*/ */
/* /*
int deflateInit2 OF((z_streamp strm, int deflateInit2 OF((z_streamp strm,
int level, int level,
int method, int method,
@ -545,7 +545,7 @@ int deflateInit2 OF((z_streamp strm,
method). msg is set to null if there is no error message. deflateInit2 does method). msg is set to null if there is no error message. deflateInit2 does
not perform any compression: this will be done by deflate(). not perform any compression: this will be done by deflate().
*/ */
int deflateSetDictionary OF((z_streamp strm, int deflateSetDictionary OF((z_streamp strm,
const Byte *dictionary, const Byte *dictionary,
uInt dictLength)); uInt dictLength));
@ -632,7 +632,7 @@ int deflateParams OF((z_streamp strm,
if strm->avail_out was zero. if strm->avail_out was zero.
*/ */
/* /*
int inflateInit2 OF((z_streamp strm, int inflateInit2 OF((z_streamp strm,
int windowBits)); int windowBits));
@ -675,7 +675,7 @@ int inflateSetDictionary OF((z_streamp strm,
*/ */
int inflateSync OF((z_streamp strm)); int inflateSync OF((z_streamp strm));
/* /*
Skips invalid compressed data until a full flush point (see above the Skips invalid compressed data until a full flush point (see above the
description of deflate with Z_FULL_FLUSH) can be found, or until all description of deflate with Z_FULL_FLUSH) can be found, or until all
available input is skipped. No output is provided. available input is skipped. No output is provided.
@ -806,7 +806,7 @@ int gzread OF((gzFile file, voidp buf, unsigned len));
gzread returns the number of uncompressed bytes actually read (0 for gzread returns the number of uncompressed bytes actually read (0 for
end of file, -1 for error). */ end of file, -1 for error). */
int gzwrite OF((gzFile file, int gzwrite OF((gzFile file,
const voidp buf, unsigned len)); const voidp buf, unsigned len));
/* /*
Writes the given number of uncompressed bytes into the compressed file. Writes the given number of uncompressed bytes into the compressed file.
@ -861,7 +861,7 @@ int gzflush OF((gzFile file, int flush));
long gzseek OF((gzFile file, long gzseek OF((gzFile file,
long offset, int whence)); long offset, int whence));
/* /*
Sets the starting position for the next gzread or gzwrite on the Sets the starting position for the next gzread or gzwrite on the
given compressed file. The offset represents a number of bytes in the given compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2); uncompressed data stream. The whence parameter is defined as in lseek(2);
@ -1008,13 +1008,13 @@ int __BigLong (int l)
float __LittleFloat (float l) float __LittleFloat (float l)
{ {
union {byte b[4]; float f;} in, out; union {byte b[4]; float f;} in, out;
in.f = l; in.f = l;
out.b[0] = in.b[3]; out.b[0] = in.b[3];
out.b[1] = in.b[2]; out.b[1] = in.b[2];
out.b[2] = in.b[1]; out.b[2] = in.b[1];
out.b[3] = in.b[0]; out.b[3] = in.b[0];
return out.f; return out.f;
} }
@ -1063,13 +1063,13 @@ int __LittleLong (int l)
float __BigFloat (float l) float __BigFloat (float l)
{ {
union {byte b[4]; float f;} in, out; union {byte b[4]; float f;} in, out;
in.f = l; in.f = l;
out.b[0] = in.b[3]; out.b[0] = in.b[3];
out.b[1] = in.b[2]; out.b[1] = in.b[2];
out.b[2] = in.b[1]; out.b[2] = in.b[1];
out.b[3] = in.b[0]; out.b[3] = in.b[0];
return out.f; return out.f;
} }
@ -1252,7 +1252,7 @@ static int unzlocal_getByte(FILE *fin,int *pi)
} }
else else
{ {
if (ferror(fin)) if (ferror(fin))
return UNZ_ERRNO; return UNZ_ERRNO;
else else
return UNZ_EOF; return UNZ_EOF;
@ -1261,7 +1261,7 @@ static int unzlocal_getByte(FILE *fin,int *pi)
*/ */
/* =========================================================================== /* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets Reads a long in LSB order from the given gz_stream. Sets
*/ */
static int unzlocal_getShort (FILE* fin, uLong *pX) static int unzlocal_getShort (FILE* fin, uLong *pX)
{ {
@ -1281,11 +1281,11 @@ static int unzlocal_getShort (FILE* fin, uLong *pX)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x = (uLong)i; x = (uLong)i;
if (err==UNZ_OK) if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8; x += ((uLong)i)<<8;
if (err==UNZ_OK) if (err==UNZ_OK)
*pX = x; *pX = x;
else else
@ -1312,7 +1312,7 @@ static int unzlocal_getLong (FILE *fin, uLong *pX)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x = (uLong)i; x = (uLong)i;
if (err==UNZ_OK) if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8; x += ((uLong)i)<<8;
@ -1324,7 +1324,7 @@ static int unzlocal_getLong (FILE *fin, uLong *pX)
if (err==UNZ_OK) if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i); err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<24; x += ((uLong)i)<<24;
if (err==UNZ_OK) if (err==UNZ_OK)
*pX = x; *pX = x;
else else
@ -1367,7 +1367,7 @@ static int strcmpcasenosensitive_internal (const char* fileName1,const char* fil
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal #define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
#endif #endif
/* /*
Compare two filename (fileName1,fileName2). Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
@ -1385,7 +1385,7 @@ extern int unzStringFileNameCompare (const char* fileName1,const char* fileName2
return strcmp(fileName1,fileName2); return strcmp(fileName1,fileName2);
return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2); return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
} }
#define BUFREADCOMMENT (0x400) #define BUFREADCOMMENT (0x400)
@ -1400,13 +1400,13 @@ static uLong unzlocal_SearchCentralDir(FILE *fin)
uLong uBackRead; uLong uBackRead;
uLong uMaxBack=0xffff; /* maximum size of global comment */ uLong uMaxBack=0xffff; /* maximum size of global comment */
uLong uPosFound=0; uLong uPosFound=0;
if (fseek(fin,0,SEEK_END) != 0) if (fseek(fin,0,SEEK_END) != 0)
return 0; return 0;
uSizeFile = ftell( fin ); uSizeFile = ftell( fin );
if (uMaxBack>uSizeFile) if (uMaxBack>uSizeFile)
uMaxBack = uSizeFile; uMaxBack = uSizeFile;
@ -1419,13 +1419,13 @@ static uLong unzlocal_SearchCentralDir(FILE *fin)
{ {
uLong uReadSize,uReadPos ; uLong uReadSize,uReadPos ;
int i; int i;
if (uBackRead+BUFREADCOMMENT>uMaxBack) if (uBackRead+BUFREADCOMMENT>uMaxBack)
uBackRead = uMaxBack; uBackRead = uMaxBack;
else else
uBackRead+=BUFREADCOMMENT; uBackRead+=BUFREADCOMMENT;
uReadPos = uSizeFile-uBackRead ; uReadPos = uSizeFile-uBackRead ;
uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
(BUFREADCOMMENT+4) : (uSizeFile-uReadPos); (BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
if (fseek(fin,uReadPos,SEEK_SET)!=0) if (fseek(fin,uReadPos,SEEK_SET)!=0)
break; break;
@ -1434,7 +1434,7 @@ static uLong unzlocal_SearchCentralDir(FILE *fin)
break; break;
for (i=(int)uReadSize-3; (i--)>0;) for (i=(int)uReadSize-3; (i--)>0;)
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{ {
uPosFound = uReadPos+i; uPosFound = uReadPos+i;
@ -1461,7 +1461,7 @@ extern unzFile unzReOpen (const char* path, unzFile file)
memcpy(s, (unz_s*)file, sizeof(unz_s)); memcpy(s, (unz_s*)file, sizeof(unz_s));
s->file = fin; s->file = fin;
return (unzFile)s; return (unzFile)s;
} }
/* /*
@ -1480,12 +1480,12 @@ extern unzFile unzOpen (const char* path)
uLong central_pos,uL; uLong central_pos,uL;
FILE * fin ; FILE * fin ;
uLong number_disk; /* number of the current dist, used for uLong number_disk; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/ spaning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number the the disk with central dir, used uLong number_disk_with_CD; /* number the the disk with central dir, used
for spaning ZIP, unsupported, always 0*/ for spaning ZIP, unsupported, always 0*/
uLong number_entry_CD; /* total number of entries in uLong number_entry_CD; /* total number of entries in
the central dir the central dir
(same than number_entry on nospan) */ (same than number_entry on nospan) */
int err=UNZ_OK; int err=UNZ_OK;
@ -1530,7 +1530,7 @@ extern unzFile unzOpen (const char* path)
if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK) if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
/* offset of start of central directory with respect to the /* offset of start of central directory with respect to the
starting disk number */ starting disk number */
if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK) if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -1539,7 +1539,7 @@ extern unzFile unzOpen (const char* path)
if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK) if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
err=UNZ_ERRNO; err=UNZ_ERRNO;
if ((central_pos<us.offset_central_dir+us.size_central_dir) && if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
(err==UNZ_OK)) (err==UNZ_OK))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -1554,12 +1554,12 @@ extern unzFile unzOpen (const char* path)
(us.offset_central_dir+us.size_central_dir); (us.offset_central_dir+us.size_central_dir);
us.central_pos = central_pos; us.central_pos = central_pos;
us.pfile_in_zip_read = NULL; us.pfile_in_zip_read = NULL;
s=(unz_s*)safe_malloc(sizeof(unz_s)); s=(unz_s*)safe_malloc(sizeof(unz_s));
*s=us; *s=us;
// unzGoToFirstFile((unzFile)s); // unzGoToFirstFile((unzFile)s);
return (unzFile)s; return (unzFile)s;
} }
@ -1575,8 +1575,8 @@ extern int unzClose (unzFile file)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
s=(unz_s*)file; s=(unz_s*)file;
if (s->pfile_in_zip_read!=NULL) if (s->pfile_in_zip_read!=NULL)
unzCloseCurrentFile(file); unzCloseCurrentFile(file);
fclose(s->file); fclose(s->file);
free(s); free(s);
@ -1620,7 +1620,7 @@ static void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz* ptm)
*/ */
static int unzlocal_GetCurrentFileInfoInternal (unzFile file, static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
unz_file_info *pfile_info, unz_file_info *pfile_info,
unz_file_info_internal unz_file_info_internal
*pfile_info_internal, *pfile_info_internal,
char *szFileName, char *szFileName,
uLong fileNameBufferSize, uLong fileNameBufferSize,
@ -1716,7 +1716,7 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
lSeek -= uSizeRead; lSeek -= uSizeRead;
} }
if ((err==UNZ_OK) && (extraField!=NULL)) if ((err==UNZ_OK) && (extraField!=NULL))
{ {
uLong uSizeRead ; uLong uSizeRead ;
@ -1737,9 +1737,9 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
lSeek += file_info.size_file_extra - uSizeRead; lSeek += file_info.size_file_extra - uSizeRead;
} }
else else
lSeek+=file_info.size_file_extra; lSeek+=file_info.size_file_extra;
if ((err==UNZ_OK) && (szComment!=NULL)) if ((err==UNZ_OK) && (szComment!=NULL))
{ {
uLong uSizeRead ; uLong uSizeRead ;
@ -1820,7 +1820,7 @@ extern int unzGoToFirstFile (unzFile file)
*/ */
extern int unzGoToNextFile (unzFile file) extern int unzGoToNextFile (unzFile file)
{ {
unz_s* s; unz_s* s;
int err; int err;
if (file==NULL) if (file==NULL)
@ -1852,10 +1852,10 @@ extern int unzGoToNextFile (unzFile file)
*/ */
extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
{ {
unz_s* s; unz_s* s;
int err; int err;
uLong num_fileSaved; uLong num_fileSaved;
uLong pos_in_central_dirSaved; uLong pos_in_central_dirSaved;
@ -1863,8 +1863,8 @@ extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensiti
if (file==NULL) if (file==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP) if (strlen(szFileName)>=UNZ_MAXFILENAMEINZIP)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
s=(unz_s*)file; s=(unz_s*)file;
if (!s->current_file_ok) if (!s->current_file_ok)
@ -1939,9 +1939,9 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method)) else if ((err==UNZ_OK) && (uData!=s->cur_file_info.compression_method))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
(s->cur_file_info.compression_method!=Z_DEFLATED)) (s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* date/time */
err=UNZ_ERRNO; err=UNZ_ERRNO;
@ -1960,7 +1960,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */ if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
err=UNZ_ERRNO; err=UNZ_ERRNO;
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) && else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
((uFlags & 8)==0)) ((uFlags & 8)==0))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -1982,7 +1982,7 @@ static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
return err; return err;
} }
/* /*
Open for reading data the current file in the zipfile. 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. If there is no error and the file is opened, the return value is UNZ_OK.
@ -2003,8 +2003,8 @@ extern int unzOpenCurrentFile (unzFile file)
if (!s->current_file_ok) if (!s->current_file_ok)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if (s->pfile_in_zip_read != NULL) if (s->pfile_in_zip_read != NULL)
unzCloseCurrentFile(file); unzCloseCurrentFile(file);
if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar, if (unzlocal_CheckCurrentFileCoherencyHeader(s,&iSizeVar,
&offset_local_extrafield,&size_local_extrafield)!=UNZ_OK) &offset_local_extrafield,&size_local_extrafield)!=UNZ_OK)
@ -2027,7 +2027,7 @@ extern int unzOpenCurrentFile (unzFile file)
} }
pfile_in_zip_read_info->stream_initialised=0; pfile_in_zip_read_info->stream_initialised=0;
if ((s->cur_file_info.compression_method!=0) && if ((s->cur_file_info.compression_method!=0) &&
(s->cur_file_info.compression_method!=Z_DEFLATED)) (s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -2046,29 +2046,29 @@ extern int unzOpenCurrentFile (unzFile file)
{ {
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0; 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.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidp)0; pfile_in_zip_read_info->stream.opaque = (voidp)0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS); err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
if (err == Z_OK) if (err == Z_OK)
pfile_in_zip_read_info->stream_initialised=1; pfile_in_zip_read_info->stream_initialised=1;
/* windowBits is passed < 0 to tell that there is no zlib header. /* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte * Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and * after the compressed stream in order to complete decompression and
* return Z_STREAM_END. * return Z_STREAM_END.
* In unzip, i don't wait absolutely Z_STREAM_END because I known the * In unzip, i don't wait absolutely Z_STREAM_END because I known the
* size of both compressed and uncompressed data * size of both compressed and uncompressed data
*/ */
} }
pfile_in_zip_read_info->rest_read_compressed = pfile_in_zip_read_info->rest_read_compressed =
s->cur_file_info.compressed_size ; s->cur_file_info.compressed_size ;
pfile_in_zip_read_info->rest_read_uncompressed = pfile_in_zip_read_info->rest_read_uncompressed =
s->cur_file_info.uncompressed_size ; s->cur_file_info.uncompressed_size ;
pfile_in_zip_read_info->pos_in_zipfile = pfile_in_zip_read_info->pos_in_zipfile =
s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
iSizeVar; iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0; pfile_in_zip_read_info->stream.avail_in = (uInt)0;
@ -2110,9 +2110,9 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
pfile_in_zip_read_info->stream.next_out = (Byte*)buf; pfile_in_zip_read_info->stream.next_out = (Byte*)buf;
pfile_in_zip_read_info->stream.avail_out = (uInt)len; pfile_in_zip_read_info->stream.avail_out = (uInt)len;
if (len>pfile_in_zip_read_info->rest_read_uncompressed) if (len>pfile_in_zip_read_info->rest_read_uncompressed)
pfile_in_zip_read_info->stream.avail_out = pfile_in_zip_read_info->stream.avail_out =
(uInt)pfile_in_zip_read_info->rest_read_uncompressed; (uInt)pfile_in_zip_read_info->rest_read_uncompressed;
while (pfile_in_zip_read_info->stream.avail_out>0) while (pfile_in_zip_read_info->stream.avail_out>0)
@ -2127,7 +2127,7 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
return UNZ_EOF; return UNZ_EOF;
if (s->cur_file_info.compressed_size == pfile_in_zip_read_info->rest_read_compressed) if (s->cur_file_info.compressed_size == pfile_in_zip_read_info->rest_read_compressed)
if (fseek(pfile_in_zip_read_info->file, if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->pos_in_zipfile + pfile_in_zip_read_info->pos_in_zipfile +
pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0) pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
return UNZ_ERRNO; return UNZ_ERRNO;
if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1, if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
@ -2136,8 +2136,8 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
pfile_in_zip_read_info->rest_read_compressed-=uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
pfile_in_zip_read_info->stream.next_in = pfile_in_zip_read_info->stream.next_in =
(Byte*)pfile_in_zip_read_info->read_buffer; (Byte*)pfile_in_zip_read_info->read_buffer;
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis; pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
} }
@ -2145,16 +2145,16 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
if (pfile_in_zip_read_info->compression_method==0) if (pfile_in_zip_read_info->compression_method==0)
{ {
uInt uDoCopy,i ; uInt uDoCopy,i ;
if (pfile_in_zip_read_info->stream.avail_out < if (pfile_in_zip_read_info->stream.avail_out <
pfile_in_zip_read_info->stream.avail_in) pfile_in_zip_read_info->stream.avail_in)
uDoCopy = pfile_in_zip_read_info->stream.avail_out ; uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
else else
uDoCopy = pfile_in_zip_read_info->stream.avail_in ; uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
for (i=0;i<uDoCopy;i++) for (i=0;i<uDoCopy;i++)
*(pfile_in_zip_read_info->stream.next_out+i) = *(pfile_in_zip_read_info->stream.next_out+i) =
*(pfile_in_zip_read_info->stream.next_in+i); *(pfile_in_zip_read_info->stream.next_in+i);
pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32, pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
pfile_in_zip_read_info->stream.next_out, pfile_in_zip_read_info->stream.next_out,
uDoCopy); uDoCopy);
@ -2186,8 +2186,8 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out; uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
uOutThis = uTotalOutAfter-uTotalOutBefore; uOutThis = uTotalOutAfter-uTotalOutBefore;
pfile_in_zip_read_info->crc32 = pfile_in_zip_read_info->crc32 =
crc32(pfile_in_zip_read_info->crc32,bufBefore, crc32(pfile_in_zip_read_info->crc32,bufBefore,
(uInt)(uOutThis)); (uInt)(uOutThis));
@ -2195,10 +2195,10 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len)
uOutThis; uOutThis;
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore); iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
if (err==Z_STREAM_END) if (err==Z_STREAM_END)
return (iRead==0) ? UNZ_EOF : iRead; return (iRead==0) ? UNZ_EOF : iRead;
if (err!=Z_OK) if (err!=Z_OK)
break; break;
} }
} }
@ -2229,7 +2229,7 @@ extern long unztell (unzFile file)
/* /*
return 1 if the end of file was reached, 0 elsewhere return 1 if the end of file was reached, 0 elsewhere
*/ */
extern int unzeof (unzFile file) extern int unzeof (unzFile file)
{ {
@ -2242,7 +2242,7 @@ extern int unzeof (unzFile file)
if (pfile_in_zip_read_info==NULL) if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
if (pfile_in_zip_read_info->rest_read_uncompressed == 0) if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
return 1; return 1;
else else
@ -2260,7 +2260,7 @@ extern int unzeof (unzFile file)
if buf!=NULL, len is the size of the buffer, the extra header is copied in if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf. buf.
the return value is the number of bytes copied in buf, or (if <0) the return value is the number of bytes copied in buf, or (if <0)
the error code the error code
*/ */
extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len) extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len)
@ -2278,12 +2278,12 @@ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len)
if (pfile_in_zip_read_info==NULL) if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR; return UNZ_PARAMERROR;
size_to_read = (pfile_in_zip_read_info->size_local_extrafield - size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
pfile_in_zip_read_info->pos_local_extrafield); pfile_in_zip_read_info->pos_local_extrafield);
if (buf==NULL) if (buf==NULL)
return (int)size_to_read; return (int)size_to_read;
if (len>size_to_read) if (len>size_to_read)
read_now = (uInt)size_to_read; read_now = (uInt)size_to_read;
else else
@ -2291,9 +2291,9 @@ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len)
if (read_now==0) if (read_now==0)
return 0; return 0;
if (fseek(pfile_in_zip_read_info->file, if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->offset_local_extrafield + pfile_in_zip_read_info->offset_local_extrafield +
pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0) pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
return UNZ_ERRNO; return UNZ_ERRNO;
@ -2377,7 +2377,7 @@ extern int unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf)
/* crc32.c -- compute the CRC-32 of a data stream /* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
@ -2423,7 +2423,7 @@ static void make_crc_table()
poly = 0L; poly = 0L;
for (n = 0; n < sizeof(p)/sizeof(Byte); n++) for (n = 0; n < sizeof(p)/sizeof(Byte); n++)
poly |= 1L << (31 - p[n]); poly |= 1L << (31 - p[n]);
for (n = 0; n < 256; n++) for (n = 0; n < 256; n++)
{ {
c = (uLong)n; c = (uLong)n;
@ -2536,7 +2536,7 @@ uLong crc32(uLong crc, const Byte *buf, uInt len)
/* infblock.h -- header to use infblock.c /* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2584,7 +2584,7 @@ static const uInt border[] = { /* Order of the bit length code lengths */
/* inftrees.h -- header to use inftrees.c /* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2644,7 +2644,7 @@ extern int inflate_trees_fixed OF((
/* infcodes.h -- header to use infcodes.c /* infcodes.h -- header to use infcodes.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2671,7 +2671,7 @@ extern void inflate_codes_free OF((
/* infutil.h -- types and macros common to blocks and codes /* infutil.h -- types and macros common to blocks and codes
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -2712,7 +2712,7 @@ struct inflate_blocks_state {
inflate_huft *tb; /* bit length decoding tree */ inflate_huft *tb; /* bit length decoding tree */
} trees; /* if DTREE, decoding info for trees */ } trees; /* if DTREE, decoding info for trees */
struct { struct {
inflate_codes_statef inflate_codes_statef
*codes; *codes;
} decode; /* if CODES, current state */ } decode; /* if CODES, current state */
} sub; /* submode */ } sub; /* submode */
@ -2766,7 +2766,7 @@ extern int inflate_flush OF((
#endif #endif
/* /*
Notes beyond the 1.93a appnote.txt: Notes beyond the 1.93a appnote.txt:
@ -3071,7 +3071,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
} }
s->sub.decode.codes = c; s->sub.decode.codes = c;
} }
s->mode = CODES; s->mode = CODES; // fall through
case CODES: case CODES:
UPDATE UPDATE
if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
@ -3087,12 +3087,12 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
s->mode = TYPE; s->mode = TYPE;
break; break;
} }
s->mode = DRY; s->mode = DRY; // fall through
case DRY: case DRY:
FLUSH FLUSH
if (s->read != s->write) if (s->read != s->write)
LEAVE LEAVE
s->mode = DONE; s->mode = DONE; // fall through
case DONE: case DONE:
r = Z_STREAM_END; r = Z_STREAM_END;
LEAVE LEAVE
@ -3127,7 +3127,7 @@ void inflate_set_dictionary(inflate_blocks_statef *s, const Byte *d, uInt n)
#endif #endif
/* Returns true if inflate is currently at the end of a block generated /* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH. * by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL * IN assertion: s != Z_NULL
*/ */
#ifndef __APPLE__ #ifndef __APPLE__
@ -3212,7 +3212,7 @@ int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r)
/* inftrees.c -- generate Huffman trees for efficient decoding /* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#ifndef __APPLE__ #ifndef __APPLE__
@ -3915,7 +3915,7 @@ int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, inflate_b
/* infcodes.c -- process literals and length/distance pairs /* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* simplify the use of the inflate_huft type with some defines */ /* simplify the use of the inflate_huft type with some defines */
@ -4019,7 +4019,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
#endif /* !SLOW */ #endif /* !SLOW */
c->sub.code.need = c->lbits; c->sub.code.need = c->lbits;
c->sub.code.tree = c->ltree; c->sub.code.tree = c->ltree;
c->mode = LEN; c->mode = LEN; // fall through
case LEN: /* i: get length/literal/eob next */ case LEN: /* i: get length/literal/eob next */
j = c->sub.code.need; j = c->sub.code.need;
NEEDBITS(j) NEEDBITS(j)
@ -4066,7 +4066,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
c->sub.code.need = c->dbits; c->sub.code.need = c->dbits;
c->sub.code.tree = c->dtree; c->sub.code.tree = c->dtree;
Tracevv(("inflate: length %u\n", c->len)); Tracevv(("inflate: length %u\n", c->len));
c->mode = DIST; c->mode = DIST; // fall through
case DIST: /* i: get distance next */ case DIST: /* i: get distance next */
j = c->sub.code.need; j = c->sub.code.need;
NEEDBITS(j) NEEDBITS(j)
@ -4096,7 +4096,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
c->sub.copy.dist += (uInt)b & inflate_mask[j]; c->sub.copy.dist += (uInt)b & inflate_mask[j];
DUMPBITS(j) DUMPBITS(j)
Tracevv(("inflate: distance %u\n", c->sub.copy.dist)); Tracevv(("inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY; c->mode = COPY; // fall through
case COPY: /* o: copying bytes in window, waiting for space */ case COPY: /* o: copying bytes in window, waiting for space */
#ifndef __TURBOC__ /* Turbo C bug for following expression */ #ifndef __TURBOC__ /* Turbo C bug for following expression */
f = (uInt)(q - s->window) < c->sub.copy.dist ? f = (uInt)(q - s->window) < c->sub.copy.dist ?
@ -4133,7 +4133,7 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
FLUSH FLUSH
if (s->read != s->write) if (s->read != s->write)
LEAVE LEAVE
c->mode = END; c->mode = END; // fall through
case END: case END:
r = Z_STREAM_END; r = Z_STREAM_END;
LEAVE LEAVE
@ -4160,7 +4160,7 @@ void inflate_codes_free(inflate_codes_statef *c, z_streamp z)
/* adler32.c -- compute the Adler-32 checksum of a data stream /* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
#define BASE 65521L /* largest prime smaller than 65536 */ #define BASE 65521L /* largest prime smaller than 65536 */
@ -4210,7 +4210,7 @@ uLong adler32(uLong adler, const Byte *buf, uInt len)
/* infblock.h -- header to use infblock.c /* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler * Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h * For conditions of distribution and use, see copyright notice in zlib.h
*/ */
/* WARNING: this file should *not* be used by applications. It is /* WARNING: this file should *not* be used by applications. It is
@ -4281,7 +4281,7 @@ struct internal_state {
/* mode independent information */ /* mode independent information */
int nowrap; /* flag for no wrapper */ int nowrap; /* flag for no wrapper */
uInt wbits; /* log2(window size) (8..15, defaults to 15) */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */
inflate_blocks_statef inflate_blocks_statef
*blocks; /* current inflate_blocks state */ *blocks; /* current inflate_blocks state */
}; };
@ -4407,7 +4407,7 @@ int inflate(z_streamp z, int f)
z->state->sub.marker = 5; /* can't try inflateSync */ z->state->sub.marker = 5; /* can't try inflateSync */
break; break;
} }
z->state->mode = imFLAG; z->state->mode = imFLAG; // fall through
case imFLAG: case imFLAG:
iNEEDBYTE iNEEDBYTE
b = iNEXTBYTE; b = iNEXTBYTE;
@ -4424,19 +4424,19 @@ int inflate(z_streamp z, int f)
z->state->mode = imBLOCKS; z->state->mode = imBLOCKS;
break; break;
} }
z->state->mode = imDICT4; z->state->mode = imDICT4; // fall through
case imDICT4: case imDICT4:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need = (uLong)iNEXTBYTE << 24; z->state->sub.check.need = (uLong)iNEXTBYTE << 24;
z->state->mode = imDICT3; z->state->mode = imDICT3; // fall through
case imDICT3: case imDICT3:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 16; z->state->sub.check.need += (uLong)iNEXTBYTE << 16;
z->state->mode = imDICT2; z->state->mode = imDICT2; // fall through
case imDICT2: case imDICT2:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 8; z->state->sub.check.need += (uLong)iNEXTBYTE << 8;
z->state->mode = imDICT1; z->state->mode = imDICT1; // fall through
case imDICT1: case imDICT1:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE; z->state->sub.check.need += (uLong)iNEXTBYTE;
@ -4467,19 +4467,19 @@ int inflate(z_streamp z, int f)
z->state->mode = imDONE; z->state->mode = imDONE;
break; break;
} }
z->state->mode = imCHECK4; z->state->mode = imCHECK4; // fall through
case imCHECK4: case imCHECK4:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need = (uLong)iNEXTBYTE << 24; z->state->sub.check.need = (uLong)iNEXTBYTE << 24;
z->state->mode = imCHECK3; z->state->mode = imCHECK3; // fall through
case imCHECK3: case imCHECK3:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 16; z->state->sub.check.need += (uLong)iNEXTBYTE << 16;
z->state->mode = imCHECK2; z->state->mode = imCHECK2; // fall through
case imCHECK2: case imCHECK2:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE << 8; z->state->sub.check.need += (uLong)iNEXTBYTE << 8;
z->state->mode = imCHECK1; z->state->mode = imCHECK1; // fall through
case imCHECK1: case imCHECK1:
iNEEDBYTE iNEEDBYTE
z->state->sub.check.need += (uLong)iNEXTBYTE; z->state->sub.check.need += (uLong)iNEXTBYTE;
@ -4492,7 +4492,7 @@ int inflate(z_streamp z, int f)
break; break;
} }
Tracev(("inflate: zlib check ok\n")); Tracev(("inflate: zlib check ok\n"));
z->state->mode = imDONE; z->state->mode = imDONE; // fall through
case imDONE: case imDONE:
return Z_STREAM_END; return Z_STREAM_END;
case imBAD: case imBAD:

View File

@ -327,7 +327,6 @@ void PackDirectory_r( char *dir ){
int count; int count;
struct stat st; struct stat st;
int i; int i;
int len;
char fullname[1024]; char fullname[1024];
char dirstring[1024]; char dirstring[1024];
char *name; char *name;

View File

@ -484,8 +484,9 @@ void InitPaths( int *argc, char **argv ){
/* remove processed arguments */ /* remove processed arguments */
for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ ) for ( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
{ {
for ( ; j < *argc && argv[ j ] == NULL; j++ ) ; for ( ; j < *argc && argv[ j ] == NULL; j++ ){
argv[ i ] = argv[ j ]; }
argv[ i ] = argv[ j ];
if ( argv[ i ] != NULL ) { if ( argv[ i ] != NULL ) {
k++; k++;
} }