Opened 8 years ago
Closed 8 years ago
#6220 closed task (fixed)
Remove "local" and "OF" macros from ports/cpl_minizip*
Reported by: | Kurt Schwehr | Owned by: | Kurt Schwehr |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | cleanup |
Cc: | Even Rouault |
Description
Any reason not to apply this patch? This looks like pre-ANSI C stuff that should no longer be needed.
r24160 brought the OF macro in GDAL when removed externally.
https://bugs.gentoo.org/show_bug.cgi?id=383179
-
cpl_minizip_ioapi.cpp
27 27 #include "zlib.h" 28 28 #include "cpl_minizip_ioapi.h" 29 29 30 31 30 static 32 voidpf ZCALLBACK fopen_file_func OF((33 voidpf opaque,34 const char* filename,35 int mode));36 37 static38 uLong ZCALLBACK fread_file_func OF((39 voidpf opaque,40 voidpf stream,41 void* buf,42 uLong size));43 44 static45 uLong ZCALLBACK fwrite_file_func OF((46 voidpf opaque,47 voidpf stream,48 const void* buf,49 uLong size));50 51 static52 uLong64 ZCALLBACK ftell_file_func OF((53 voidpf opaque,54 voidpf stream));55 56 static57 long ZCALLBACK fseek_file_func OF((58 voidpf opaque,59 voidpf stream,60 uLong64 offset,61 int origin));62 63 static64 int ZCALLBACK fclose_file_func OF((65 voidpf opaque,66 voidpf stream));67 68 static69 int ZCALLBACK ferror_file_func OF((70 voidpf opaque,71 voidpf stream));72 73 static74 31 voidpf ZCALLBACK fopen_file_func (CPL_UNUSED voidpf opaque, const char* filename, int mode) 75 32 { 76 33 VSILFILE* file = NULL; -
cpl_minizip_ioapi.h
21 21 #include "cpl_vsi.h" 22 22 #define uLong64 vsi_l_offset 23 23 24 /* Gentoo removed OF from their copy of zconf.h (https://bugs.gentoo.org/show_bug.cgi?id=383179) */25 /* but our copy of minizip needs it. */26 #ifndef OF27 #define OF(args) args28 #endif29 30 24 #define ZLIB_FILEFUNC_SEEK_CUR (1) 31 25 #define ZLIB_FILEFUNC_SEEK_END (2) 32 26 #define ZLIB_FILEFUNC_SEEK_SET (0) … … 51 45 extern "C" { 52 46 #endif 53 47 54 typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));55 typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));56 typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));57 typedef uLong64 (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));58 typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong64 offset, int origin));59 typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));60 typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));48 typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode); 49 typedef uLong (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size); 50 typedef uLong (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size); 51 typedef uLong64 (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream); 52 typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong64 offset, int origin); 53 typedef int (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream); 54 typedef int (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream); 61 55 62 56 typedef struct zlib_filefunc_def_s 63 57 { … … 73 67 74 68 75 69 76 void cpl_fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));70 void cpl_fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def); 77 71 78 72 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size)) 79 73 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size)) -
cpl_minizip_unzip.cpp
70 70 # include <errno.h> 71 71 #endif 72 72 73 74 #ifndef local75 # define local static76 #endif77 /* compile with -Dlocal if your debugger can't find static symbols */78 79 80 73 #ifndef CASESENSITIVITYDEFAULT_NO 81 74 # if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) 82 75 # define CASESENSITIVITYDEFAULT_NO … … 180 173 for end of file. 181 174 IN assertion: the stream s has been sucessfully opened for reading. 182 175 */ 183 184 185 local int unzlocal_getByte OF(( 186 const zlib_filefunc_def* pzlib_filefunc_def, 187 voidpf filestream, 188 int *pi)); 189 190 local int unzlocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def, voidpf filestream, int *pi) 176 static int unzlocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def, voidpf filestream, int *pi) 191 177 { 192 178 unsigned char c; 193 179 int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1); … … 209 195 /* =========================================================================== 210 196 Reads a long in LSB order from the given gz_stream. Sets 211 197 */ 212 local int unzlocal_getShort OF(( 213 const zlib_filefunc_def* pzlib_filefunc_def, 214 voidpf filestream, 215 uLong *pX)); 216 217 local int unzlocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def, 198 static int unzlocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def, 218 199 voidpf filestream, 219 200 uLong *pX) 220 201 { … … 236 217 return err; 237 218 } 238 219 239 local int unzlocal_getLong OF(( 240 const zlib_filefunc_def* pzlib_filefunc_def, 241 voidpf filestream, 242 uLong *pX)); 243 244 local int unzlocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def, 220 static int unzlocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def, 245 221 voidpf filestream, 246 222 uLong *pX) 247 223 { … … 271 247 return err; 272 248 } 273 249 274 local int unzlocal_getLong64 OF(( 275 const zlib_filefunc_def* pzlib_filefunc_def, 276 voidpf filestream, 277 uLong64 *pX)); 278 279 280 local int unzlocal_getLong64 (const zlib_filefunc_def* pzlib_filefunc_def, 250 static int unzlocal_getLong64 (const zlib_filefunc_def* pzlib_filefunc_def, 281 251 voidpf filestream, 282 252 uLong64 *pX) 283 253 { … … 324 294 } 325 295 326 296 /* My own strcmpi / strcasecmp */ 327 localint strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)297 static int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2) 328 298 { 329 299 for (;;) 330 300 { … … 387 357 Locate the Central directory of a zipfile (at the end, just before 388 358 the global comment) 389 359 */ 390 local uLong64 unzlocal_SearchCentralDir OF(( 391 const zlib_filefunc_def* pzlib_filefunc_def, 392 voidpf filestream)); 393 394 local uLong64 unzlocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_def, 360 static uLong64 unzlocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_def, 395 361 voidpf filestream) 396 362 { 397 363 unsigned char* buf; … … 453 419 Locate the Central directory 64 of a zipfile (at the end, just before 454 420 the global comment) 455 421 */ 456 local uLong64 unzlocal_SearchCentralDir64 OF(( 457 const zlib_filefunc_def* pzlib_filefunc_def, 458 voidpf filestream)); 459 460 local uLong64 unzlocal_SearchCentralDir64(const zlib_filefunc_def* pzlib_filefunc_def, 422 static uLong64 unzlocal_SearchCentralDir64(const zlib_filefunc_def* pzlib_filefunc_def, 461 423 voidpf filestream) 462 424 { 463 425 unsigned char* buf; … … 783 745 /* 784 746 Translate date/time from Dos format to tm_unz (readable more easilty) 785 747 */ 786 localvoid unzlocal_DosDateToTmuDate (uLong64 ulDosDate, tm_unz* ptm)748 static void unzlocal_DosDateToTmuDate (uLong64 ulDosDate, tm_unz* ptm) 787 749 { 788 750 uLong64 uDate; 789 751 uDate = (uLong64)(ulDosDate>>16); … … 799 761 /* 800 762 Get Info about the current file in the zipfile, with internal only info 801 763 */ 802 local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file, 803 unz_file_info *pfile_info, 804 unz_file_info_internal 805 *pfile_info_internal, 806 char *szFileName, 807 uLong fileNameBufferSize, 808 void *extraField, 809 uLong extraFieldBufferSize, 810 char *szComment, 811 uLong commentBufferSize)); 812 813 local int unzlocal_GetCurrentFileInfoInternal (unzFile file, 764 static int unzlocal_GetCurrentFileInfoInternal (unzFile file, 814 765 unz_file_info *pfile_info, 815 766 unz_file_info_internal 816 767 *pfile_info_internal, … … 1321 1272 store in *piSizeVar the size of extra info in local header 1322 1273 (filename and size of extra field data) 1323 1274 */ 1324 localint unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,1275 static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar, 1325 1276 uLong64 * poffset_local_extrafield, 1326 1277 uInt * psize_local_extrafield) 1327 1278 { -
cpl_minizip_unzip.h
138 138 tm_unz tmu_date; 139 139 } unz_file_info; 140 140 141 extern int ZEXPORT cpl_unzStringFileNameCompare OF ((const char* fileName1,142 const char* fileName2,143 int iCaseSensitivity));141 extern int ZEXPORT cpl_unzStringFileNameCompare ( const char* fileName1, 142 const char* fileName2, 143 int iCaseSensitivity ); 144 144 /* 145 145 Compare two filename (fileName1,fileName2). 146 146 If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) … … 151 151 */ 152 152 153 153 154 extern unzFile ZEXPORT cpl_unzOpen OF((const char *path));154 extern unzFile ZEXPORT cpl_unzOpen( const char *path ); 155 155 /* 156 156 Open a Zip file. path contain the full pathname (by example, 157 157 on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer … … 162 162 of this unzip package. 163 163 */ 164 164 165 extern unzFile ZEXPORT cpl_unzOpen2 OF((const char *path,166 zlib_filefunc_def* pzlib_filefunc_def));165 extern unzFile ZEXPORT cpl_unzOpen2( const char *path, 166 zlib_filefunc_def* pzlib_filefunc_def ); 167 167 /* 168 168 Open a Zip file, like unzOpen, but provide a set of file low level API 169 169 for read/write the zip file (see ioapi.h) 170 170 */ 171 171 172 extern int ZEXPORT cpl_unzClose OF((unzFile file));172 extern int ZEXPORT cpl_unzClose( unzFile file); 173 173 /* 174 174 Close a ZipFile opened with unzipOpen. 175 175 If there is files inside the .Zip opened with unzOpenCurrentFile (see later), … … 176 176 these files MUST be closed with unzipCloseCurrentFile before call unzipClose. 177 177 return UNZ_OK if there is no problem. */ 178 178 179 extern int ZEXPORT cpl_unzGetGlobalInfo OF((unzFile file,180 unz_global_info *pglobal_info));179 extern int ZEXPORT cpl_unzGetGlobalInfo( unzFile file, 180 unz_global_info *pglobal_info); 181 181 /* 182 182 Write info about the ZipFile in the *pglobal_info structure. 183 183 No preparation of the structure is needed … … 184 184 return UNZ_OK if there is no problem. */ 185 185 186 186 187 extern int ZEXPORT cpl_unzGetGlobalComment OF((unzFile file,188 char *szComment,189 uLong uSizeBuf));187 extern int ZEXPORT cpl_unzGetGlobalComment( unzFile file, 188 char *szComment, 189 uLong uSizeBuf ); 190 190 /* 191 191 Get the global comment string of the ZipFile, in the szComment buffer. 192 192 uSizeBuf is the size of the szComment buffer. … … 197 197 /***************************************************************************/ 198 198 /* Unzip package allow you browse the directory of the zipfile */ 199 199 200 extern int ZEXPORT cpl_unzGoToFirstFile OF((unzFile file));200 extern int ZEXPORT cpl_unzGoToFirstFile( unzFile file ); 201 201 /* 202 202 Set the current file of the zipfile to the first file. 203 203 return UNZ_OK if there is no problem 204 204 */ 205 205 206 extern int ZEXPORT cpl_unzGoToNextFile OF((unzFile file));206 extern int ZEXPORT cpl_unzGoToNextFile( unzFile file ); 207 207 /* 208 208 Set the current file of the zipfile to the next file. 209 209 return UNZ_OK if there is no problem … … 210 210 return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest. 211 211 */ 212 212 213 extern int ZEXPORT cpl_unzLocateFile OF((unzFile file,214 const char *szFileName,215 int iCaseSensitivity));213 extern int ZEXPORT cpl_unzLocateFile( unzFile file, 214 const char *szFileName, 215 int iCaseSensitivity ); 216 216 /* 217 217 Try locate the file szFileName in the zipfile. 218 218 For the iCaseSensitivity signification, see unzStringFileNameCompare … … 242 242 243 243 /* ****************************************** */ 244 244 245 extern int ZEXPORT cpl_unzGetCurrentFileInfo OF((unzFile file,245 extern int ZEXPORT cpl_unzGetCurrentFileInfo( unzFile file, 246 246 unz_file_info *pfile_info, 247 247 char *szFileName, 248 248 uLong fileNameBufferSize, … … 249 249 void *extraField, 250 250 uLong extraFieldBufferSize, 251 251 char *szComment, 252 uLong commentBufferSize ));252 uLong commentBufferSize ); 253 253 /* 254 254 Get Info about the current file 255 255 if pfile_info!=NULL, the *pfile_info structure will contain somes info about … … 266 266 267 267 /** Addition for GDAL : START */ 268 268 269 extern uLong64 ZEXPORT cpl_unzGetCurrentFileZStreamPos OF(( unzFile file));269 extern uLong64 ZEXPORT cpl_unzGetCurrentFileZStreamPos( unzFile file ); 270 270 271 271 /** Addition for GDAL : END */ 272 272 … … 276 276 from it, and close it (you can close it before reading all the file) 277 277 */ 278 278 279 extern int ZEXPORT cpl_unzOpenCurrentFile OF((unzFile file));279 extern int ZEXPORT cpl_unzOpenCurrentFile( unzFile file ); 280 280 /* 281 281 Open for reading data the current file in the zipfile. 282 282 If there is no error, the return value is UNZ_OK. 283 283 */ 284 284 285 extern int ZEXPORT cpl_unzOpenCurrentFilePassword OF((unzFile file,286 const char* password));285 extern int ZEXPORT cpl_unzOpenCurrentFilePassword( unzFile file, 286 const char* password ); 287 287 /* 288 288 Open for reading data the current file in the zipfile. 289 289 password is a crypting password … … 290 290 If there is no error, the return value is UNZ_OK. 291 291 */ 292 292 293 extern int ZEXPORT cpl_unzOpenCurrentFile2 OF((unzFile file,294 int* method,295 int* level,296 int raw));293 extern int ZEXPORT cpl_unzOpenCurrentFile2( unzFile file, 294 int* method, 295 int* level, 296 int raw ); 297 297 /* 298 298 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 299 299 if raw==1 … … 303 303 but you CANNOT set method parameter as NULL 304 304 */ 305 305 306 extern int ZEXPORT cpl_unzOpenCurrentFile3 OF((unzFile file,307 int* method,308 int* level,309 int raw,310 const char* password));306 extern int ZEXPORT cpl_unzOpenCurrentFile3( unzFile file, 307 int* method, 308 int* level, 309 int raw, 310 const char* password ); 311 311 /* 312 312 Same than unzOpenCurrentFile, but open for read raw the file (not uncompress) 313 313 if raw==1 … … 318 318 */ 319 319 320 320 321 extern int ZEXPORT cpl_unzCloseCurrentFile OF((unzFile file));321 extern int ZEXPORT cpl_unzCloseCurrentFile( unzFile file ); 322 322 /* 323 323 Close the file in zip opened with unzOpenCurrentFile 324 324 Return UNZ_CRCERROR if all the file was read but the CRC is not good 325 325 */ 326 326 327 extern int ZEXPORT cpl_unzReadCurrentFile OF((unzFile file,328 voidp buf,329 unsigned len));327 extern int ZEXPORT cpl_unzReadCurrentFile( unzFile file, 328 voidp buf, 329 unsigned len ); 330 330 /* 331 331 Read bytes from the current file (opened by unzOpenCurrentFile) 332 332 buf contain buffer where data must be copied … … 338 338 (UNZ_ERRNO for IO error, or zLib error for uncompress error) 339 339 */ 340 340 341 extern z_off_t ZEXPORT cpl_unztell OF((unzFile file));341 extern z_off_t ZEXPORT cpl_unztell( unzFile file ); 342 342 /* 343 343 Give the current position in uncompressed data 344 344 */ 345 345 346 extern int ZEXPORT cpl_unzeof OF((unzFile file));346 extern int ZEXPORT cpl_unzeof( unzFile file ); 347 347 /* 348 348 return 1 if the end of file was reached, 0 elsewhere 349 349 */ 350 350 351 extern int ZEXPORT cpl_unzGetLocalExtrafield OF((unzFile file,352 voidp buf,353 unsigned len));351 extern int ZEXPORT cpl_unzGetLocalExtrafield( unzFile file, 352 voidp buf, 353 unsigned len ); 354 354 /* 355 355 Read extra field from the current file (opened by unzOpenCurrentFile) 356 356 This is the local-header version of the extra field (sometimes, there is -
cpl_minizip_zip.cpp
180 180 #include "crypt.h" 181 181 #endif 182 182 183 locallinkedlist_datablock_internal* allocate_new_datablock()183 static linkedlist_datablock_internal* allocate_new_datablock() 184 184 { 185 185 linkedlist_datablock_internal* ldi; 186 186 ldi = (linkedlist_datablock_internal*) … … 194 194 return ldi; 195 195 } 196 196 197 localvoid free_datablock(linkedlist_datablock_internal*ldi)197 static void free_datablock(linkedlist_datablock_internal*ldi) 198 198 { 199 199 while (ldi!=NULL) 200 200 { … … 204 204 } 205 205 } 206 206 207 localvoid init_linkedlist(linkedlist_data*ll)207 static void init_linkedlist(linkedlist_data*ll) 208 208 { 209 209 ll->first_block = ll->last_block = NULL; 210 210 } 211 211 212 localint add_data_in_datablock(linkedlist_data*ll,212 static int add_data_in_datablock(linkedlist_data*ll, 213 213 const void *buf, uLong len) 214 214 { 215 215 linkedlist_datablock_internal* ldi; … … 271 271 nbByte == 1, 2 or 4 (byte, short or long) 272 272 */ 273 273 274 local int ziplocal_putValue OF((const zlib_filefunc_def* pzlib_filefunc_def, 275 voidpf filestream, uLong x, int nbByte)); 276 277 local int ziplocal_putValue (const zlib_filefunc_def*pzlib_filefunc_def, 274 static int ziplocal_putValue (const zlib_filefunc_def*pzlib_filefunc_def, 278 275 voidpf filestream, uLong x, int nbByte) 279 276 { 280 277 unsigned char buf[4]; … … 297 294 return ZIP_OK; 298 295 } 299 296 300 local void ziplocal_putValue_inmemory OF((void* dest, uLong x, int nbByte)); 301 local void ziplocal_putValue_inmemory (void *dest, uLong x, int nbByte) 297 static void ziplocal_putValue_inmemory (void *dest, uLong x, int nbByte) 302 298 { 303 299 unsigned char* buf=(unsigned char*)dest; 304 300 for (int n = 0; n < nbByte; n++) { … … 318 314 /****************************************************************************/ 319 315 320 316 321 localuLong ziplocal_TmzDateToDosDate(const tm_zip *ptm,317 static uLong ziplocal_TmzDateToDosDate(const tm_zip *ptm, 322 318 CPL_UNUSED uLong dosDate) 323 319 { 324 320 uLong year = (uLong)ptm->tm_year; … … 334 330 335 331 /****************************************************************************/ 336 332 337 local int ziplocal_getByte OF(( 338 const zlib_filefunc_def* pzlib_filefunc_def, 339 voidpf filestream, 340 int *pi)); 341 342 local int ziplocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def, 333 static int ziplocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def, 343 334 voidpf filestream, int *pi) 344 335 { 345 336 unsigned char c; … … 362 353 /* =========================================================================== 363 354 Reads a long in LSB order from the given gz_stream. Sets 364 355 */ 365 local int ziplocal_getShort OF(( 366 const zlib_filefunc_def* pzlib_filefunc_def, 367 voidpf filestream, 368 uLong *pX)); 369 370 local int ziplocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def, 356 static int ziplocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def, 371 357 voidpf filestream, uLong *pX) 372 358 { 373 359 int i; … … 385 371 return err; 386 372 } 387 373 388 local int ziplocal_getLong OF((374 static int ziplocal_getLong ( 389 375 const zlib_filefunc_def* pzlib_filefunc_def, 390 376 voidpf filestream, 391 uLong *pX));392 393 local int ziplocal_getLong (394 const zlib_filefunc_def* pzlib_filefunc_def,395 voidpf filestream,396 377 uLong *pX ) 397 378 { 398 379 int i; … … 425 406 Locate the Central directory of a zipfile (at the end, just before 426 407 the global comment) 427 408 */ 428 local uLong ziplocal_SearchCentralDir OF((409 static uLong ziplocal_SearchCentralDir( 429 410 const zlib_filefunc_def* pzlib_filefunc_def, 430 voidpf filestream));431 432 local uLong ziplocal_SearchCentralDir(433 const zlib_filefunc_def* pzlib_filefunc_def,434 411 voidpf filestream ) 435 412 { 436 413 uLong uMaxBack=0xffff; /* maximum size of global comment */ … … 915 892 comment, method, level, 0); 916 893 } 917 894 918 localint zipFlushWriteBuffer(895 static int zipFlushWriteBuffer( 919 896 zip_internal* zi ) 920 897 { 921 898 int err=ZIP_OK; -
cpl_minizip_zip.h
135 135 #define APPEND_STATUS_CREATEAFTER (1) 136 136 #define APPEND_STATUS_ADDINZIP (2) 137 137 138 extern zipFile ZEXPORT cpl_zipOpen OF((const char *pathname, int append));138 extern zipFile ZEXPORT cpl_zipOpen( const char *pathname, int append ); 139 139 /* 140 140 Create a zipfile. 141 141 pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on … … 155 155 Of couse, you can use RAW reading and writing to copy the file you did not want delte 156 156 */ 157 157 158 extern zipFile ZEXPORT cpl_zipOpen2 OF((const char *pathname,159 int append,160 zipcharpc* globalcomment,161 zlib_filefunc_def* pzlib_filefunc_def));158 extern zipFile ZEXPORT cpl_zipOpen2( const char *pathname, 159 int append, 160 zipcharpc* globalcomment, 161 zlib_filefunc_def* pzlib_filefunc_def ); 162 162 163 extern int ZEXPORT cpl_zipOpenNewFileInZip OF((zipFile file,163 extern int ZEXPORT cpl_zipOpenNewFileInZip( zipFile file, 164 164 const char* filename, 165 165 const zip_fileinfo* zipfi, 166 166 const void* extrafield_local, … … 169 169 uInt size_extrafield_global, 170 170 const char* comment, 171 171 int method, 172 int level));172 int level ); 173 173 /* 174 174 Open a file in the ZIP for writing. 175 175 filename : the filename in zip (if NULL, '-' without quote will be used … … 184 184 */ 185 185 186 186 187 extern int ZEXPORT cpl_zipOpenNewFileInZip2 OF((zipFile file,188 const char* filename,189 const zip_fileinfo* zipfi,190 const void* extrafield_local,191 uInt size_extrafield_local,192 const void* extrafield_global,193 uInt size_extrafield_global,194 const char* comment,195 int method,196 int level,197 int raw));187 extern int ZEXPORT cpl_zipOpenNewFileInZip2( zipFile file, 188 const char* filename, 189 const zip_fileinfo* zipfi, 190 const void* extrafield_local, 191 uInt size_extrafield_local, 192 const void* extrafield_global, 193 uInt size_extrafield_global, 194 const char* comment, 195 int method, 196 int level, 197 int raw ); 198 198 199 199 /* 200 200 Same than zipOpenNewFileInZip, except if raw=1, we write raw file 201 201 */ 202 202 203 extern int ZEXPORT cpl_zipOpenNewFileInZip3 OF((zipFile file,203 extern int ZEXPORT cpl_zipOpenNewFileInZip3( zipFile file, 204 204 const char* filename, 205 205 const zip_fileinfo* zipfi, 206 206 const void* extrafield_local, … … 215 215 int memLevel, 216 216 int strategy, 217 217 const char* password, 218 uLong crcForCtypting));218 uLong crcForCtypting ); 219 219 220 220 /* 221 221 Same than zipOpenNewFileInZip2, except … … 225 225 */ 226 226 227 227 228 extern int ZEXPORT cpl_zipWriteInFileInZip OF((zipFile file,229 const void* buf,230 unsigned len));228 extern int ZEXPORT cpl_zipWriteInFileInZip( zipFile file, 229 const void* buf, 230 unsigned len ); 231 231 /* 232 232 Write data in the zipfile 233 233 */ 234 234 235 extern int ZEXPORT cpl_zipCloseFileInZip OF((zipFile file));235 extern int ZEXPORT cpl_zipCloseFileInZip( zipFile file ); 236 236 /* 237 237 Close the current file in the zipfile 238 238 */ 239 239 240 extern int ZEXPORT cpl_zipCloseFileInZipRaw OF((zipFile file,241 uLong uncompressed_size,242 uLong crc32));240 extern int ZEXPORT cpl_zipCloseFileInZipRaw( zipFile file, 241 uLong uncompressed_size, 242 uLong crc32 ); 243 243 /* 244 244 Close the current file in the zipfile, for fiel opened with 245 245 parameter raw=1 in zipOpenNewFileInZip2 … … 246 246 uncompressed_size and crc32 are value for the uncompressed size 247 247 */ 248 248 249 extern int ZEXPORT cpl_zipClose OF((zipFile file, 250 const char* global_comment)); 249 extern int ZEXPORT cpl_zipClose( zipFile file, const char* global_comment ); 251 250 /* 252 251 Close the zipfile 253 252 */
Change History (7)
comment:1 by , 8 years ago
follow-up: 3 comment:2 by , 8 years ago
Where exactly is the upstream? Is it: http://www.winimage.com/zLibDll/minizip.html and http://www.winimage.com/zLibDll/unzip101h.zip? And if we resynced, it would be from http://www.winimage.com/zLibDll/unzip11.zip ? Is there a better location to track as the upstream that might have CI and/or a place o track bugs?
Looking at the latest upstream, I would be pretty quick to make the same changes... Just remove the unnecessary static function declarations, remove the OF( ) wrappings in the header and
perl -pi -e 's|^local |static |g' *zip.c*
I would argue that these changes are pretty minor and wouldn't make merging very difficult. They would remove an extra macro layer for analysis tools to go through. Thought?
I will hold off on switching C casts to C++ casts. This part of the lib definitely needs some C++ tests and fuzzing that I'll put on my list of things to try to get to some day.
unzip -v -l unzip11.zip Archive: unzip11.zip Length Method Size Cmpr Date Time CRC-32 Name -------- ------ ------- ---- ---------- ----- -------- ---- 4759 Defl:N 1810 62% 10-25-2009 22:49 01022956 crypt.h 7651 Defl:N 1416 82% 01-04-2010 10:31 cee6877f ioapi.c 6837 Defl:N 1866 73% 02-15-2010 04:59 2610b22c ioapi.h 11903 Defl:N 1896 84% 02-15-2010 04:58 ed361685 iowin32.c 851 Defl:N 381 55% 02-15-2010 04:58 0502be6b iowin32.h 457 Defl:N 218 52% 01-04-2010 00:39 bd5dec70 Makefile 901 Defl:N 350 61% 02-15-2010 04:48 1c40b81f make_vms.com 17150 Defl:N 4412 74% 02-15-2010 04:58 7f5c69da miniunz.c 14445 Defl:N 3739 74% 02-15-2010 04:59 5baccc41 minizip.c 109 Defl:N 99 9% 02-15-2010 04:53 99cf0392 MiniZip64_Changes.txt 3048 Defl:N 1271 58% 02-15-2010 04:53 b0f23d7e MiniZip64_info.txt 7859 Defl:N 1801 77% 01-01-2010 22:46 7f8eba3d mztools.c 677 Defl:N 331 51% 07-13-2005 02:08 cc7f07ac mztools.h 71122 Defl:N 12044 83% 02-15-2010 04:59 2d97026f unzip.c 16358 Defl:N 3954 76% 02-15-2010 04:58 6acc0fc3 unzip.h 65673 Defl:N 11121 83% 02-15-2010 04:59 a2d176aa zip.c 15366 Defl:N 3092 80% 02-15-2010 04:58 12938aaf zip.h -------- ------- --- ------- 245166 49801 80% 17 files
egrep '[^_A-Z]OF' ioapi.[ch] ioapi.c:static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); ioapi.c:static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); ioapi.c:static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); ioapi.c:static ZPOS64_T ZCALLBACK ftell64_file_func OF((voidpf opaque, voidpf stream)); ioapi.c:static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); ioapi.c:static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream)); ioapi.c:static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream)); ioapi.h:typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); ioapi.h:typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); ioapi.h:typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); ioapi.h:typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream)); ioapi.h:typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream)); ioapi.h:typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); ioapi.h:typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); ioapi.h:typedef ZPOS64_T (ZCALLBACK *tell64_file_func) OF((voidpf opaque, voidpf stream)); ioapi.h:typedef long (ZCALLBACK *seek64_file_func) OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)); ioapi.h:typedef voidpf (ZCALLBACK *open64_file_func) OF((voidpf opaque, const void* filename, int mode)); ioapi.h:void fill_fopen64_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def)); ioapi.h:void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def)); ioapi.h:voidpf call_zopen64 OF((const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode)); ioapi.h:long call_zseek64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream, ZPOS64_T offset, int origin)); ioapi.h:ZPOS64_T call_ztell64 OF((const zlib_filefunc64_32_def* pfilefunc,voidpf filestream));
grep '^local' unzip.[ch] unzip.c:local int unz64local_getByte OF(( unzip.c:local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, int *pi) unzip.c:local int unz64local_getShort OF(( unzip.c:local int unz64local_getShort (const zlib_filefunc64_32_def* pzlib_filefunc_def, unzip.c:local int unz64local_getLong OF(( unzip.c:local int unz64local_getLong (const zlib_filefunc64_32_def* pzlib_filefunc_def, unzip.c:local int unz64local_getLong64 OF(( unzip.c:local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, unzip.c:local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2) unzip.c:local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)); unzip.c:local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream) unzip.c:local ZPOS64_T unz64local_SearchCentralDir64 OF(( unzip.c:local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib_filefunc_def, unzip.c:local unzFile unzOpenInternal (const void *path, unzip.c:local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm) unzip.c:local int unz64local_GetCurrentFileInfoInternal OF((unzFile file, unzip.c:local int unz64local_GetCurrentFileInfoInternal (unzFile file, unzip.c:local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,
comment:3 by , 8 years ago
Replying to goatbar:
Where exactly is the upstream? Is it: http://www.winimage.com/zLibDll/minizip.html and http://www.winimage.com/zLibDll/unzip101h.zip? And if we resynced, it would be from http://www.winimage.com/zLibDll/unzip11.zip ? Is there a better location to track as the upstream that might have CI and/or a place o track bugs?
Not sure which site is the most authoritative, but I believe I had initially extracted the source from the source/minizip directory of the zlib sources at http://www.zlib.net/
Looking at the latest upstream, I would be pretty quick to make the same changes... Just remove the unnecessary static function declarations, remove the OF( ) wrappings in the header and
perl -pi -e 's|^local |static |g' *zip.c*I would argue that these changes are pretty minor and wouldn't make merging very difficult. They would remove an extra macro layer for analysis tools to go through. Thought?
Well, this was just to warn you about a potential issue. If you feel it will not be a problem, then go for it. You might also propose it to upstream since I doubt they still want to support K&R C only compilers.
comment:4 by , 8 years ago
rouault, Thanks for the info! Submitted r31508 to trunk. Will notify upstream.
comment:5 by , 8 years ago
Let upstreams know. minizip by emailing Gilles Vollant and https://github.com/madler/zlib/issues/117 for zlib
comment:7 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
One reason would be to avoid to diverge too much from upstream minizip in case we want to resync at some point.