summaryrefslogtreecommitdiff
path: root/contrib/minizip/unzip.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2023-04-15 11:16:17 -0700
committerMark Adler <madler@alumni.caltech.edu>2023-04-15 22:56:37 -0700
commitbf2578be2d0566dc3ee47655d56b62063fe6bae6 (patch)
treebcd69242c3cda836d7f146d44008be4f1b99fe56 /contrib/minizip/unzip.c
parentc4aa356742e03af6670c043905cd2c96f515ad72 (diff)
downloadzlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.tar.gz
zlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.tar.bz2
zlib-bf2578be2d0566dc3ee47655d56b62063fe6bae6.zip
Remove K&R function definitions from contrib/minizip.
Diffstat (limited to 'contrib/minizip/unzip.c')
-rw-r--r--contrib/minizip/unzip.c294
1 files changed, 105 insertions, 189 deletions
diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c
index 3036b47..ad2eb3b 100644
--- a/contrib/minizip/unzip.c
+++ b/contrib/minizip/unzip.c
@@ -204,13 +204,7 @@ typedef struct
204*/ 204*/
205 205
206 206
207local int unz64local_getByte OF(( 207local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) {
208 const zlib_filefunc64_32_def* pzlib_filefunc_def,
209 voidpf filestream,
210 int *pi));
211
212local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi)
213{
214 unsigned char c; 208 unsigned char c;
215 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1); 209 int err = (int)ZREAD64(*pzlib_filefunc_def,filestream,&c,1);
216 if (err==1) 210 if (err==1)
@@ -231,15 +225,10 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v
231/* =========================================================================== 225/* ===========================================================================
232 Reads a long in LSB order from the given gz_stream. Sets 226 Reads a long in LSB order from the given gz_stream. Sets
233*/ 227*/
234local int unz64local_getShort OF((
235 const zlib_filefunc64_32_def* pzlib_filefunc_def,
236 voidpf filestream,
237 uLong *pX));
238 228
239local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, 229local int unz64local_getShort(const zlib_filefunc64_32_def* pzlib_filefunc_def,
240 voidpf filestream, 230 voidpf filestream,
241 uLong *pX) 231 uLong *pX) {
242{
243 uLong x ; 232 uLong x ;
244 int i = 0; 233 int i = 0;
245 int err; 234 int err;
@@ -258,15 +247,9 @@ local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def,
258 return err; 247 return err;
259} 248}
260 249
261local int unz64local_getLong OF(( 250local int unz64local_getLong(const zlib_filefunc64_32_def* pzlib_filefunc_def,
262 const zlib_filefunc64_32_def* pzlib_filefunc_def, 251 voidpf filestream,
263 voidpf filestream, 252 uLong *pX) {
264 uLong *pX));
265
266local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
267 voidpf filestream,
268 uLong *pX)
269{
270 uLong x ; 253 uLong x ;
271 int i = 0; 254 int i = 0;
272 int err; 255 int err;
@@ -293,16 +276,10 @@ local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def,
293 return err; 276 return err;
294} 277}
295 278
296local int unz64local_getLong64 OF((
297 const zlib_filefunc64_32_def* pzlib_filefunc_def,
298 voidpf filestream,
299 ZPOS64_T *pX));
300 279
301 280local int unz64local_getLong64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
302local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, 281 voidpf filestream,
303 voidpf filestream, 282 ZPOS64_T *pX) {
304 ZPOS64_T *pX)
305{
306 ZPOS64_T x ; 283 ZPOS64_T x ;
307 int i = 0; 284 int i = 0;
308 int err; 285 int err;
@@ -346,8 +323,7 @@ local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def
346} 323}
347 324
348/* My own strcmpi / strcasecmp */ 325/* My own strcmpi / strcasecmp */
349local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2) 326local int strcmpcasenosensitive_internal(const char* fileName1, const char* fileName2) {
350{
351 for (;;) 327 for (;;)
352 { 328 {
353 char c1=*(fileName1++); 329 char c1=*(fileName1++);
@@ -388,10 +364,8 @@ local int strcmpcasenosensitive_internal (const char* fileName1, const char* fil
388 364
389*/ 365*/
390extern int ZEXPORT unzStringFileNameCompare (const char* fileName1, 366extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
391 const char* fileName2, 367 const char* fileName2,
392 int iCaseSensitivity) 368 int iCaseSensitivity) {
393
394{
395 if (iCaseSensitivity==0) 369 if (iCaseSensitivity==0)
396 iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE; 370 iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
397 371
@@ -409,9 +383,7 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
409 Locate the Central directory of a zipfile (at the end, just before 383 Locate the Central directory of a zipfile (at the end, just before
410 the global comment) 384 the global comment)
411*/ 385*/
412local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); 386local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) {
413local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
414{
415 unsigned char* buf; 387 unsigned char* buf;
416 ZPOS64_T uSizeFile; 388 ZPOS64_T uSizeFile;
417 ZPOS64_T uBackRead; 389 ZPOS64_T uBackRead;
@@ -471,13 +443,8 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
471 Locate the Central directory 64 of a zipfile (at the end, just before 443 Locate the Central directory 64 of a zipfile (at the end, just before
472 the global comment) 444 the global comment)
473*/ 445*/
474local ZPOS64_T unz64local_SearchCentralDir64 OF((
475 const zlib_filefunc64_32_def* pzlib_filefunc_def,
476 voidpf filestream));
477
478local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, 446local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def,
479 voidpf filestream) 447 voidpf filestream) {
480{
481 unsigned char* buf; 448 unsigned char* buf;
482 ZPOS64_T uSizeFile; 449 ZPOS64_T uSizeFile;
483 ZPOS64_T uBackRead; 450 ZPOS64_T uBackRead;
@@ -581,10 +548,9 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
581 Else, the return value is a unzFile Handle, usable with other function 548 Else, the return value is a unzFile Handle, usable with other function
582 of this unzip package. 549 of this unzip package.
583*/ 550*/
584local unzFile unzOpenInternal (const void *path, 551local unzFile unzOpenInternal(const void *path,
585 zlib_filefunc64_32_def* pzlib_filefunc64_32_def, 552 zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
586 int is64bitOpenFunction) 553 int is64bitOpenFunction) {
587{
588 unz64_s us; 554 unz64_s us;
589 unz64_s *s; 555 unz64_s *s;
590 ZPOS64_T central_pos; 556 ZPOS64_T central_pos;
@@ -762,9 +728,8 @@ local unzFile unzOpenInternal (const void *path,
762} 728}
763 729
764 730
765extern unzFile ZEXPORT unzOpen2 (const char *path, 731extern unzFile ZEXPORT unzOpen2(const char *path,
766 zlib_filefunc_def* pzlib_filefunc32_def) 732 zlib_filefunc_def* pzlib_filefunc32_def) {
767{
768 if (pzlib_filefunc32_def != NULL) 733 if (pzlib_filefunc32_def != NULL)
769 { 734 {
770 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; 735 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
@@ -775,9 +740,8 @@ extern unzFile ZEXPORT unzOpen2 (const char *path,
775 return unzOpenInternal(path, NULL, 0); 740 return unzOpenInternal(path, NULL, 0);
776} 741}
777 742
778extern unzFile ZEXPORT unzOpen2_64 (const void *path, 743extern unzFile ZEXPORT unzOpen2_64(const void *path,
779 zlib_filefunc64_def* pzlib_filefunc_def) 744 zlib_filefunc64_def* pzlib_filefunc_def) {
780{
781 if (pzlib_filefunc_def != NULL) 745 if (pzlib_filefunc_def != NULL)
782 { 746 {
783 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; 747 zlib_filefunc64_32_def zlib_filefunc64_32_def_fill;
@@ -790,13 +754,11 @@ extern unzFile ZEXPORT unzOpen2_64 (const void *path,
790 return unzOpenInternal(path, NULL, 1); 754 return unzOpenInternal(path, NULL, 1);
791} 755}
792 756
793extern unzFile ZEXPORT unzOpen (const char *path) 757extern unzFile ZEXPORT unzOpen(const char *path) {
794{
795 return unzOpenInternal(path, NULL, 0); 758 return unzOpenInternal(path, NULL, 0);
796} 759}
797 760
798extern unzFile ZEXPORT unzOpen64 (const void *path) 761extern unzFile ZEXPORT unzOpen64(const void *path) {
799{
800 return unzOpenInternal(path, NULL, 1); 762 return unzOpenInternal(path, NULL, 1);
801} 763}
802 764
@@ -805,8 +767,7 @@ extern unzFile ZEXPORT unzOpen64 (const void *path)
805 If there is files inside the .Zip opened with unzOpenCurrentFile (see later), 767 If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
806 these files MUST be closed with unzCloseCurrentFile before call unzClose. 768 these files MUST be closed with unzCloseCurrentFile before call unzClose.
807 return UNZ_OK if there is no problem. */ 769 return UNZ_OK if there is no problem. */
808extern int ZEXPORT unzClose (unzFile file) 770extern int ZEXPORT unzClose(unzFile file) {
809{
810 unz64_s* s; 771 unz64_s* s;
811 if (file==NULL) 772 if (file==NULL)
812 return UNZ_PARAMERROR; 773 return UNZ_PARAMERROR;
@@ -825,8 +786,7 @@ extern int ZEXPORT unzClose (unzFile file)
825 Write info about the ZipFile in the *pglobal_info structure. 786 Write info about the ZipFile in the *pglobal_info structure.
826 No preparation of the structure is needed 787 No preparation of the structure is needed
827 return UNZ_OK if there is no problem. */ 788 return UNZ_OK if there is no problem. */
828extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_info) 789extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64* pglobal_info) {
829{
830 unz64_s* s; 790 unz64_s* s;
831 if (file==NULL) 791 if (file==NULL)
832 return UNZ_PARAMERROR; 792 return UNZ_PARAMERROR;
@@ -835,8 +795,7 @@ extern int ZEXPORT unzGetGlobalInfo64 (unzFile file, unz_global_info64* pglobal_
835 return UNZ_OK; 795 return UNZ_OK;
836} 796}
837 797
838extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info32) 798extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) {
839{
840 unz64_s* s; 799 unz64_s* s;
841 if (file==NULL) 800 if (file==NULL)
842 return UNZ_PARAMERROR; 801 return UNZ_PARAMERROR;
@@ -849,8 +808,7 @@ extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info
849/* 808/*
850 Translate date/time from Dos format to tm_unz (readable more easilty) 809 Translate date/time from Dos format to tm_unz (readable more easilty)
851*/ 810*/
852local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) 811local void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz* ptm) {
853{
854 ZPOS64_T uDate; 812 ZPOS64_T uDate;
855 uDate = (ZPOS64_T)(ulDosDate>>16); 813 uDate = (ZPOS64_T)(ulDosDate>>16);
856 ptm->tm_mday = (int)(uDate&0x1f) ; 814 ptm->tm_mday = (int)(uDate&0x1f) ;
@@ -865,28 +823,16 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
865/* 823/*
866 Get Info about the current file in the zipfile, with internal only info 824 Get Info about the current file in the zipfile, with internal only info
867*/ 825*/
868local int unz64local_GetCurrentFileInfoInternal OF((unzFile file, 826local int unz64local_GetCurrentFileInfoInternal(unzFile file,
869 unz_file_info64 *pfile_info, 827 unz_file_info64 *pfile_info,
870 unz_file_info64_internal 828 unz_file_info64_internal
871 *pfile_info_internal, 829 *pfile_info_internal,
872 char *szFileName, 830 char *szFileName,
873 uLong fileNameBufferSize, 831 uLong fileNameBufferSize,
874 void *extraField, 832 void *extraField,
875 uLong extraFieldBufferSize, 833 uLong extraFieldBufferSize,
876 char *szComment, 834 char *szComment,
877 uLong commentBufferSize)); 835 uLong commentBufferSize) {
878
879local int unz64local_GetCurrentFileInfoInternal (unzFile file,
880 unz_file_info64 *pfile_info,
881 unz_file_info64_internal
882 *pfile_info_internal,
883 char *szFileName,
884 uLong fileNameBufferSize,
885 void *extraField,
886 uLong extraFieldBufferSize,
887 char *szComment,
888 uLong commentBufferSize)
889{
890 unz64_s* s; 836 unz64_s* s;
891 unz_file_info64 file_info; 837 unz_file_info64 file_info;
892 unz_file_info64_internal file_info_internal; 838 unz_file_info64_internal file_info_internal;
@@ -1038,33 +984,33 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
1038 /* ZIP64 extra fields */ 984 /* ZIP64 extra fields */
1039 if (headerId == 0x0001) 985 if (headerId == 0x0001)
1040 { 986 {
1041 uLong uL; 987 uLong uL;
1042 988
1043 if(file_info.uncompressed_size == MAXU32) 989 if(file_info.uncompressed_size == MAXU32)
1044 { 990 {
1045 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) 991 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
1046 err=UNZ_ERRNO; 992 err=UNZ_ERRNO;
1047 } 993 }
1048 994
1049 if(file_info.compressed_size == MAXU32) 995 if(file_info.compressed_size == MAXU32)
1050 { 996 {
1051 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK) 997 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
1052 err=UNZ_ERRNO; 998 err=UNZ_ERRNO;
1053 } 999 }
1054 1000
1055 if(file_info_internal.offset_curfile == MAXU32) 1001 if(file_info_internal.offset_curfile == MAXU32)
1056 { 1002 {
1057 /* Relative Header offset */ 1003 /* Relative Header offset */
1058 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK) 1004 if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
1059 err=UNZ_ERRNO; 1005 err=UNZ_ERRNO;
1060 } 1006 }
1061 1007
1062 if(file_info.disk_num_start == MAXU32) 1008 if(file_info.disk_num_start == MAXU32)
1063 { 1009 {
1064 /* Disk Start Number */ 1010 /* Disk Start Number */
1065 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK) 1011 if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
1066 err=UNZ_ERRNO; 1012 err=UNZ_ERRNO;
1067 } 1013 }
1068 1014
1069 } 1015 }
1070 else 1016 else
@@ -1121,24 +1067,22 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
1121 No preparation of the structure is needed 1067 No preparation of the structure is needed
1122 return UNZ_OK if there is no problem. 1068 return UNZ_OK if there is no problem.
1123*/ 1069*/
1124extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file, 1070extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file,
1125 unz_file_info64 * pfile_info, 1071 unz_file_info64 * pfile_info,
1126 char * szFileName, uLong fileNameBufferSize, 1072 char * szFileName, uLong fileNameBufferSize,
1127 void *extraField, uLong extraFieldBufferSize, 1073 void *extraField, uLong extraFieldBufferSize,
1128 char* szComment, uLong commentBufferSize) 1074 char* szComment, uLong commentBufferSize) {
1129{
1130 return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL, 1075 return unz64local_GetCurrentFileInfoInternal(file,pfile_info,NULL,
1131 szFileName,fileNameBufferSize, 1076 szFileName,fileNameBufferSize,
1132 extraField,extraFieldBufferSize, 1077 extraField,extraFieldBufferSize,
1133 szComment,commentBufferSize); 1078 szComment,commentBufferSize);
1134} 1079}
1135 1080
1136extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, 1081extern int ZEXPORT unzGetCurrentFileInfo(unzFile file,
1137 unz_file_info * pfile_info, 1082 unz_file_info * pfile_info,
1138 char * szFileName, uLong fileNameBufferSize, 1083 char * szFileName, uLong fileNameBufferSize,
1139 void *extraField, uLong extraFieldBufferSize, 1084 void *extraField, uLong extraFieldBufferSize,
1140 char* szComment, uLong commentBufferSize) 1085 char* szComment, uLong commentBufferSize) {
1141{
1142 int err; 1086 int err;
1143 unz_file_info64 file_info64; 1087 unz_file_info64 file_info64;
1144 err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL, 1088 err = unz64local_GetCurrentFileInfoInternal(file,&file_info64,NULL,
@@ -1175,8 +1119,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
1175 Set the current file of the zipfile to the first file. 1119 Set the current file of the zipfile to the first file.
1176 return UNZ_OK if there is no problem 1120 return UNZ_OK if there is no problem
1177*/ 1121*/
1178extern int ZEXPORT unzGoToFirstFile (unzFile file) 1122extern int ZEXPORT unzGoToFirstFile(unzFile file) {
1179{
1180 int err=UNZ_OK; 1123 int err=UNZ_OK;
1181 unz64_s* s; 1124 unz64_s* s;
1182 if (file==NULL) 1125 if (file==NULL)
@@ -1196,8 +1139,7 @@ extern int ZEXPORT unzGoToFirstFile (unzFile file)
1196 return UNZ_OK if there is no problem 1139 return UNZ_OK if there is no problem
1197 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 1140 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
1198*/ 1141*/
1199extern int ZEXPORT unzGoToNextFile (unzFile file) 1142extern int ZEXPORT unzGoToNextFile(unzFile file) {
1200{
1201 unz64_s* s; 1143 unz64_s* s;
1202 int err; 1144 int err;
1203 1145
@@ -1229,8 +1171,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file)
1229 UNZ_OK if the file is found. It becomes the current file. 1171 UNZ_OK if the file is found. It becomes the current file.
1230 UNZ_END_OF_LIST_OF_FILE if the file is not found 1172 UNZ_END_OF_LIST_OF_FILE if the file is not found
1231*/ 1173*/
1232extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity) 1174extern int ZEXPORT unzLocateFile(unzFile file, const char *szFileName, int iCaseSensitivity) {
1233{
1234 unz64_s* s; 1175 unz64_s* s;
1235 int err; 1176 int err;
1236 1177
@@ -1305,8 +1246,7 @@ typedef struct unz_file_pos_s
1305} unz_file_pos; 1246} unz_file_pos;
1306*/ 1247*/
1307 1248
1308extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) 1249extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos) {
1309{
1310 unz64_s* s; 1250 unz64_s* s;
1311 1251
1312 if (file==NULL || file_pos==NULL) 1252 if (file==NULL || file_pos==NULL)
@@ -1321,10 +1261,7 @@ extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
1321 return UNZ_OK; 1261 return UNZ_OK;
1322} 1262}
1323 1263
1324extern int ZEXPORT unzGetFilePos( 1264extern int ZEXPORT unzGetFilePos(unzFile file, unz_file_pos* file_pos) {
1325 unzFile file,
1326 unz_file_pos* file_pos)
1327{
1328 unz64_file_pos file_pos64; 1265 unz64_file_pos file_pos64;
1329 int err = unzGetFilePos64(file,&file_pos64); 1266 int err = unzGetFilePos64(file,&file_pos64);
1330 if (err==UNZ_OK) 1267 if (err==UNZ_OK)
@@ -1335,8 +1272,7 @@ extern int ZEXPORT unzGetFilePos(
1335 return err; 1272 return err;
1336} 1273}
1337 1274
1338extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) 1275extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos) {
1339{
1340 unz64_s* s; 1276 unz64_s* s;
1341 int err; 1277 int err;
1342 1278
@@ -1357,10 +1293,7 @@ extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos* file_pos
1357 return err; 1293 return err;
1358} 1294}
1359 1295
1360extern int ZEXPORT unzGoToFilePos( 1296extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos* file_pos) {
1361 unzFile file,
1362 unz_file_pos* file_pos)
1363{
1364 unz64_file_pos file_pos64; 1297 unz64_file_pos file_pos64;
1365 if (file_pos == NULL) 1298 if (file_pos == NULL)
1366 return UNZ_PARAMERROR; 1299 return UNZ_PARAMERROR;
@@ -1382,10 +1315,9 @@ extern int ZEXPORT unzGoToFilePos(
1382 store in *piSizeVar the size of extra info in local header 1315 store in *piSizeVar the size of extra info in local header
1383 (filename and size of extra field data) 1316 (filename and size of extra field data)
1384*/ 1317*/
1385local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar, 1318local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar,
1386 ZPOS64_T * poffset_local_extrafield, 1319 ZPOS64_T * poffset_local_extrafield,
1387 uInt * psize_local_extrafield) 1320 uInt * psize_local_extrafield) {
1388{
1389 uLong uMagic,uData,uFlags; 1321 uLong uMagic,uData,uFlags;
1390 uLong size_filename; 1322 uLong size_filename;
1391 uLong size_extra_field; 1323 uLong size_extra_field;
@@ -1469,9 +1401,8 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa
1469 Open for reading data the current file in the zipfile. 1401 Open for reading data the current file in the zipfile.
1470 If there is no error and the file is opened, the return value is UNZ_OK. 1402 If there is no error and the file is opened, the return value is UNZ_OK.
1471*/ 1403*/
1472extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, 1404extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
1473 int* level, int raw, const char* password) 1405 int* level, int raw, const char* password) {
1474{
1475 int err=UNZ_OK; 1406 int err=UNZ_OK;
1476 uInt iSizeVar; 1407 uInt iSizeVar;
1477 unz64_s* s; 1408 unz64_s* s;
@@ -1640,25 +1571,21 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
1640 return UNZ_OK; 1571 return UNZ_OK;
1641} 1572}
1642 1573
1643extern int ZEXPORT unzOpenCurrentFile (unzFile file) 1574extern int ZEXPORT unzOpenCurrentFile(unzFile file) {
1644{
1645 return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); 1575 return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL);
1646} 1576}
1647 1577
1648extern int ZEXPORT unzOpenCurrentFilePassword (unzFile file, const char* password) 1578extern int ZEXPORT unzOpenCurrentFilePassword(unzFile file, const char* password) {
1649{
1650 return unzOpenCurrentFile3(file, NULL, NULL, 0, password); 1579 return unzOpenCurrentFile3(file, NULL, NULL, 0, password);
1651} 1580}
1652 1581
1653extern int ZEXPORT unzOpenCurrentFile2 (unzFile file, int* method, int* level, int raw) 1582extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int* method, int* level, int raw) {
1654{
1655 return unzOpenCurrentFile3(file, method, level, raw, NULL); 1583 return unzOpenCurrentFile3(file, method, level, raw, NULL);
1656} 1584}
1657 1585
1658/** Addition for GDAL : START */ 1586/** Addition for GDAL : START */
1659 1587
1660extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file) 1588extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64(unzFile file) {
1661{
1662 unz64_s* s; 1589 unz64_s* s;
1663 file_in_zip64_read_info_s* pfile_in_zip_read_info; 1590 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1664 s=(unz64_s*)file; 1591 s=(unz64_s*)file;
@@ -1683,8 +1610,7 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
1683 return <0 with error code if there is an error 1610 return <0 with error code if there is an error
1684 (UNZ_ERRNO for IO error, or zLib error for uncompress error) 1611 (UNZ_ERRNO for IO error, or zLib error for uncompress error)
1685*/ 1612*/
1686extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) 1613extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
1687{
1688 int err=UNZ_OK; 1614 int err=UNZ_OK;
1689 uInt iRead = 0; 1615 uInt iRead = 0;
1690 unz64_s* s; 1616 unz64_s* s;
@@ -1891,8 +1817,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
1891/* 1817/*
1892 Give the current position in uncompressed data 1818 Give the current position in uncompressed data
1893*/ 1819*/
1894extern z_off_t ZEXPORT unztell (unzFile file) 1820extern z_off_t ZEXPORT unztell(unzFile file) {
1895{
1896 unz64_s* s; 1821 unz64_s* s;
1897 file_in_zip64_read_info_s* pfile_in_zip_read_info; 1822 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1898 if (file==NULL) 1823 if (file==NULL)
@@ -1906,8 +1831,7 @@ extern z_off_t ZEXPORT unztell (unzFile file)
1906 return (z_off_t)pfile_in_zip_read_info->stream.total_out; 1831 return (z_off_t)pfile_in_zip_read_info->stream.total_out;
1907} 1832}
1908 1833
1909extern ZPOS64_T ZEXPORT unztell64 (unzFile file) 1834extern ZPOS64_T ZEXPORT unztell64(unzFile file) {
1910{
1911 1835
1912 unz64_s* s; 1836 unz64_s* s;
1913 file_in_zip64_read_info_s* pfile_in_zip_read_info; 1837 file_in_zip64_read_info_s* pfile_in_zip_read_info;
@@ -1926,8 +1850,7 @@ extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
1926/* 1850/*
1927 return 1 if the end of file was reached, 0 elsewhere 1851 return 1 if the end of file was reached, 0 elsewhere
1928*/ 1852*/
1929extern int ZEXPORT unzeof (unzFile file) 1853extern int ZEXPORT unzeof(unzFile file) {
1930{
1931 unz64_s* s; 1854 unz64_s* s;
1932 file_in_zip64_read_info_s* pfile_in_zip_read_info; 1855 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1933 if (file==NULL) 1856 if (file==NULL)
@@ -1958,8 +1881,7 @@ more info in the local-header version than in the central-header)
1958 the return value is the number of bytes copied in buf, or (if <0) 1881 the return value is the number of bytes copied in buf, or (if <0)
1959 the error code 1882 the error code
1960*/ 1883*/
1961extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len) 1884extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, unsigned len) {
1962{
1963 unz64_s* s; 1885 unz64_s* s;
1964 file_in_zip64_read_info_s* pfile_in_zip_read_info; 1886 file_in_zip64_read_info_s* pfile_in_zip_read_info;
1965 uInt read_now; 1887 uInt read_now;
@@ -2006,8 +1928,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
2006 Close the file in zip opened with unzOpenCurrentFile 1928 Close the file in zip opened with unzOpenCurrentFile
2007 Return UNZ_CRCERROR if all the file was read but the CRC is not good 1929 Return UNZ_CRCERROR if all the file was read but the CRC is not good
2008*/ 1930*/
2009extern int ZEXPORT unzCloseCurrentFile (unzFile file) 1931extern int ZEXPORT unzCloseCurrentFile(unzFile file) {
2010{
2011 int err=UNZ_OK; 1932 int err=UNZ_OK;
2012 1933
2013 unz64_s* s; 1934 unz64_s* s;
@@ -2053,8 +1974,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
2053 uSizeBuf is the size of the szComment buffer. 1974 uSizeBuf is the size of the szComment buffer.
2054 return the number of byte copied or an error code <0 1975 return the number of byte copied or an error code <0
2055*/ 1976*/
2056extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf) 1977extern int ZEXPORT unzGetGlobalComment(unzFile file, char * szComment, uLong uSizeBuf) {
2057{
2058 unz64_s* s; 1978 unz64_s* s;
2059 uLong uReadThis ; 1979 uLong uReadThis ;
2060 if (file==NULL) 1980 if (file==NULL)
@@ -2081,8 +2001,7 @@ extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uS
2081} 2001}
2082 2002
2083/* Additions by RX '2004 */ 2003/* Additions by RX '2004 */
2084extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) 2004extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file) {
2085{
2086 unz64_s* s; 2005 unz64_s* s;
2087 2006
2088 if (file==NULL) 2007 if (file==NULL)
@@ -2096,8 +2015,7 @@ extern ZPOS64_T ZEXPORT unzGetOffset64(unzFile file)
2096 return s->pos_in_central_dir; 2015 return s->pos_in_central_dir;
2097} 2016}
2098 2017
2099extern uLong ZEXPORT unzGetOffset (unzFile file) 2018extern uLong ZEXPORT unzGetOffset(unzFile file) {
2100{
2101 ZPOS64_T offset64; 2019 ZPOS64_T offset64;
2102 2020
2103 if (file==NULL) 2021 if (file==NULL)
@@ -2106,8 +2024,7 @@ extern uLong ZEXPORT unzGetOffset (unzFile file)
2106 return (uLong)offset64; 2024 return (uLong)offset64;
2107} 2025}
2108 2026
2109extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) 2027extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos) {
2110{
2111 unz64_s* s; 2028 unz64_s* s;
2112 int err; 2029 int err;
2113 2030
@@ -2124,7 +2041,6 @@ extern int ZEXPORT unzSetOffset64(unzFile file, ZPOS64_T pos)
2124 return err; 2041 return err;
2125} 2042}
2126 2043
2127extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) 2044extern int ZEXPORT unzSetOffset (unzFile file, uLong pos) {
2128{
2129 return unzSetOffset64(file,pos); 2045 return unzSetOffset64(file,pos);
2130} 2046}