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

     
    2727#include "zlib.h"
    2828#include "cpl_minizip_ioapi.h"
    2929
    30 
    3130static
    32 voidpf ZCALLBACK fopen_file_func OF((
    33    voidpf opaque,
    34    const char* filename,
    35    int mode));
    36 
    37 static
    38 uLong ZCALLBACK fread_file_func OF((
    39    voidpf opaque,
    40    voidpf stream,
    41    void* buf,
    42    uLong size));
    43 
    44 static
    45 uLong ZCALLBACK fwrite_file_func OF((
    46    voidpf opaque,
    47    voidpf stream,
    48    const void* buf,
    49    uLong size));
    50 
    51 static
    52 uLong64 ZCALLBACK ftell_file_func OF((
    53    voidpf opaque,
    54    voidpf stream));
    55 
    56 static
    57 long ZCALLBACK fseek_file_func OF((
    58    voidpf opaque,
    59    voidpf stream,
    60    uLong64 offset,
    61    int origin));
    62 
    63 static
    64 int ZCALLBACK fclose_file_func OF((
    65    voidpf opaque,
    66    voidpf stream));
    67 
    68 static
    69 int ZCALLBACK ferror_file_func OF((
    70    voidpf opaque,
    71    voidpf stream));
    72 
    73 static
    7431voidpf ZCALLBACK fopen_file_func (CPL_UNUSED voidpf opaque, const char* filename, int mode)
    7532{
    7633    VSILFILE* file = NULL;
  • cpl_minizip_ioapi.h

     
    2121#include "cpl_vsi.h"
    2222#define uLong64 vsi_l_offset
    2323
    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 OF
    27 #define OF(args) args
    28 #endif
    29 
    3024#define ZLIB_FILEFUNC_SEEK_CUR (1)
    3125#define ZLIB_FILEFUNC_SEEK_END (2)
    3226#define ZLIB_FILEFUNC_SEEK_SET (0)
     
    5145extern "C" {
    5246#endif
    5347
    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));
     48typedef voidpf (ZCALLBACK *open_file_func) (voidpf opaque, const char* filename, int mode);
     49typedef uLong  (ZCALLBACK *read_file_func) (voidpf opaque, voidpf stream, void* buf, uLong size);
     50typedef uLong  (ZCALLBACK *write_file_func) (voidpf opaque, voidpf stream, const void* buf, uLong size);
     51typedef uLong64   (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream);
     52typedef long   (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong64 offset, int origin);
     53typedef int    (ZCALLBACK *close_file_func) (voidpf opaque, voidpf stream);
     54typedef int    (ZCALLBACK *testerror_file_func) (voidpf opaque, voidpf stream);
    6155
    6256typedef struct zlib_filefunc_def_s
    6357{
     
    7367
    7468
    7569
    76 void cpl_fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
     70void cpl_fill_fopen_filefunc (zlib_filefunc_def* pzlib_filefunc_def);
    7771
    7872#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
    7973#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
  • cpl_minizip_unzip.cpp

     
    7070#   include <errno.h>
    7171#endif
    7272
    73 
    74 #ifndef local
    75 #  define local static
    76 #endif
    77 /* compile with -Dlocal if your debugger can't find static symbols */
    78 
    79 
    8073#ifndef CASESENSITIVITYDEFAULT_NO
    8174#  if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES)
    8275#    define CASESENSITIVITYDEFAULT_NO
     
    180173   for end of file.
    181174   IN assertion: the stream s has been sucessfully opened for reading.
    182175*/
    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)
     176static int unzlocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def, voidpf filestream, int *pi)
    191177{
    192178    unsigned char c;
    193179    int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
     
    209195/* ===========================================================================
    210196   Reads a long in LSB order from the given gz_stream. Sets
    211197*/
    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,
     198static int unzlocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def,
    218199                             voidpf filestream,
    219200                             uLong *pX)
    220201{
     
    236217    return err;
    237218}
    238219
    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,
     220static int unzlocal_getLong (const zlib_filefunc_def* pzlib_filefunc_def,
    245221                            voidpf filestream,
    246222                            uLong *pX)
    247223{
     
    271247    return err;
    272248}
    273249
    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,
     250static int unzlocal_getLong64 (const zlib_filefunc_def* pzlib_filefunc_def,
    281251                            voidpf filestream,
    282252                            uLong64 *pX)
    283253{
     
    324294}
    325295
    326296/* My own strcmpi / strcasecmp */
    327 local int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)
     297static int strcmpcasenosensitive_internal (const char* fileName1, const char* fileName2)
    328298{
    329299    for (;;)
    330300    {
     
    387357  Locate the Central directory of a zipfile (at the end, just before
    388358    the global comment)
    389359*/
    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,
     360static uLong64 unzlocal_SearchCentralDir(const zlib_filefunc_def* pzlib_filefunc_def,
    395361                                      voidpf filestream)
    396362{
    397363    unsigned char* buf;
     
    453419  Locate the Central directory 64 of a zipfile (at the end, just before
    454420    the global comment)
    455421*/
    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,
     422static uLong64 unzlocal_SearchCentralDir64(const zlib_filefunc_def* pzlib_filefunc_def,
    461423                                      voidpf filestream)
    462424{
    463425    unsigned char* buf;
     
    783745/*
    784746   Translate date/time from Dos format to tm_unz (readable more easilty)
    785747*/
    786 local void unzlocal_DosDateToTmuDate (uLong64 ulDosDate, tm_unz* ptm)
     748static void unzlocal_DosDateToTmuDate (uLong64 ulDosDate, tm_unz* ptm)
    787749{
    788750    uLong64 uDate;
    789751    uDate = (uLong64)(ulDosDate>>16);
     
    799761/*
    800762  Get Info about the current file in the zipfile, with internal only info
    801763*/
    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,
     764static int unzlocal_GetCurrentFileInfoInternal (unzFile file,
    814765                                               unz_file_info *pfile_info,
    815766                                               unz_file_info_internal
    816767                                               *pfile_info_internal,
     
    13211272  store in *piSizeVar the size of extra info in local header
    13221273        (filename and size of extra field data)
    13231274*/
    1324 local int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
     1275static int unzlocal_CheckCurrentFileCoherencyHeader (unz_s* s, uInt* piSizeVar,
    13251276                                                    uLong64 * poffset_local_extrafield,
    13261277                                                    uInt  * psize_local_extrafield)
    13271278{
  • cpl_minizip_unzip.h

     
    138138    tm_unz tmu_date;
    139139} unz_file_info;
    140140
    141 extern int ZEXPORT cpl_unzStringFileNameCompare OF ((const char* fileName1,
    142                                                  const char* fileName2,
    143                                                  int iCaseSensitivity));
     141extern int ZEXPORT cpl_unzStringFileNameCompare ( const char* fileName1,
     142                                                  const char* fileName2,
     143                                                  int iCaseSensitivity );
    144144/*
    145145   Compare two filename (fileName1,fileName2).
    146146   If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
     
    151151*/
    152152
    153153
    154 extern unzFile ZEXPORT cpl_unzOpen OF((const char *path));
     154extern unzFile ZEXPORT cpl_unzOpen( const char *path );
    155155/*
    156156  Open a Zip file. path contain the full pathname (by example,
    157157     on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
     
    162162       of this unzip package.
    163163*/
    164164
    165 extern unzFile ZEXPORT cpl_unzOpen2 OF((const char *path,
    166                                     zlib_filefunc_def* pzlib_filefunc_def));
     165extern unzFile ZEXPORT cpl_unzOpen2( const char *path,
     166                                     zlib_filefunc_def* pzlib_filefunc_def );
    167167/*
    168168   Open a Zip file, like unzOpen, but provide a set of file low level API
    169169      for read/write the zip file (see ioapi.h)
    170170*/
    171171
    172 extern int ZEXPORT cpl_unzClose OF((unzFile file));
     172extern int ZEXPORT cpl_unzClose( unzFile file);
    173173/*
    174174  Close a ZipFile opened with unzipOpen.
    175175  If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
     
    176176    these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
    177177  return UNZ_OK if there is no problem. */
    178178
    179 extern int ZEXPORT cpl_unzGetGlobalInfo OF((unzFile file,
    180                                         unz_global_info *pglobal_info));
     179extern int ZEXPORT cpl_unzGetGlobalInfo( unzFile file,
     180                                         unz_global_info *pglobal_info);
    181181/*
    182182  Write info about the ZipFile in the *pglobal_info structure.
    183183  No preparation of the structure is needed
     
    184184  return UNZ_OK if there is no problem. */
    185185
    186186
    187 extern int ZEXPORT cpl_unzGetGlobalComment OF((unzFile file,
    188                                            char *szComment,
    189                                            uLong uSizeBuf));
     187extern int ZEXPORT cpl_unzGetGlobalComment( unzFile file,
     188                                            char *szComment,
     189                                            uLong uSizeBuf );
    190190/*
    191191  Get the global comment string of the ZipFile, in the szComment buffer.
    192192  uSizeBuf is the size of the szComment buffer.
     
    197197/***************************************************************************/
    198198/* Unzip package allow you browse the directory of the zipfile */
    199199
    200 extern int ZEXPORT cpl_unzGoToFirstFile OF((unzFile file));
     200extern int ZEXPORT cpl_unzGoToFirstFile( unzFile file );
    201201/*
    202202  Set the current file of the zipfile to the first file.
    203203  return UNZ_OK if there is no problem
    204204*/
    205205
    206 extern int ZEXPORT cpl_unzGoToNextFile OF((unzFile file));
     206extern int ZEXPORT cpl_unzGoToNextFile( unzFile file );
    207207/*
    208208  Set the current file of the zipfile to the next file.
    209209  return UNZ_OK if there is no problem
     
    210210  return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
    211211*/
    212212
    213 extern int ZEXPORT cpl_unzLocateFile OF((unzFile file,
    214                      const char *szFileName,
    215                      int iCaseSensitivity));
     213extern int ZEXPORT cpl_unzLocateFile( unzFile file,
     214                                      const char *szFileName,
     215                                      int iCaseSensitivity );
    216216/*
    217217  Try locate the file szFileName in the zipfile.
    218218  For the iCaseSensitivity signification, see unzStringFileNameCompare
     
    242242
    243243/* ****************************************** */
    244244
    245 extern int ZEXPORT cpl_unzGetCurrentFileInfo OF((unzFile file,
     245extern int ZEXPORT cpl_unzGetCurrentFileInfo( unzFile file,
    246246                         unz_file_info *pfile_info,
    247247                         char *szFileName,
    248248                         uLong fileNameBufferSize,
     
    249249                         void *extraField,
    250250                         uLong extraFieldBufferSize,
    251251                         char *szComment,
    252                          uLong commentBufferSize));
     252                         uLong commentBufferSize );
    253253/*
    254254  Get Info about the current file
    255255  if pfile_info!=NULL, the *pfile_info structure will contain somes info about
     
    266266
    267267/** Addition for GDAL : START */
    268268
    269 extern uLong64 ZEXPORT cpl_unzGetCurrentFileZStreamPos OF(( unzFile file));
     269extern uLong64 ZEXPORT cpl_unzGetCurrentFileZStreamPos( unzFile file );
    270270
    271271/** Addition for GDAL : END */
    272272
     
    276276   from it, and close it (you can close it before reading all the file)
    277277   */
    278278
    279 extern int ZEXPORT cpl_unzOpenCurrentFile OF((unzFile file));
     279extern int ZEXPORT cpl_unzOpenCurrentFile( unzFile file );
    280280/*
    281281  Open for reading data the current file in the zipfile.
    282282  If there is no error, the return value is UNZ_OK.
    283283*/
    284284
    285 extern int ZEXPORT cpl_unzOpenCurrentFilePassword OF((unzFile file,
    286                                                   const char* password));
     285extern int ZEXPORT cpl_unzOpenCurrentFilePassword( unzFile file,
     286                                                   const char* password );
    287287/*
    288288  Open for reading data the current file in the zipfile.
    289289  password is a crypting password
     
    290290  If there is no error, the return value is UNZ_OK.
    291291*/
    292292
    293 extern int ZEXPORT cpl_unzOpenCurrentFile2 OF((unzFile file,
    294                                            int* method,
    295                                            int* level,
    296                                            int raw));
     293extern int ZEXPORT cpl_unzOpenCurrentFile2( unzFile file,
     294                                            int* method,
     295                                            int* level,
     296                                            int raw );
    297297/*
    298298  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
    299299    if raw==1
     
    303303         but you CANNOT set method parameter as NULL
    304304*/
    305305
    306 extern int ZEXPORT cpl_unzOpenCurrentFile3 OF((unzFile file,
    307                                            int* method,
    308                                            int* level,
    309                                            int raw,
    310                                            const char* password));
     306extern int ZEXPORT cpl_unzOpenCurrentFile3( unzFile file,
     307                                            int* method,
     308                                            int* level,
     309                                            int raw,
     310                                            const char* password );
    311311/*
    312312  Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
    313313    if raw==1
     
    318318*/
    319319
    320320
    321 extern int ZEXPORT cpl_unzCloseCurrentFile OF((unzFile file));
     321extern int ZEXPORT cpl_unzCloseCurrentFile( unzFile file );
    322322/*
    323323  Close the file in zip opened with unzOpenCurrentFile
    324324  Return UNZ_CRCERROR if all the file was read but the CRC is not good
    325325*/
    326326
    327 extern int ZEXPORT cpl_unzReadCurrentFile OF((unzFile file,
    328                       voidp buf,
    329                       unsigned len));
     327extern int ZEXPORT cpl_unzReadCurrentFile( unzFile file,
     328                                           voidp buf,
     329                                           unsigned len );
    330330/*
    331331  Read bytes from the current file (opened by unzOpenCurrentFile)
    332332  buf contain buffer where data must be copied
     
    338338    (UNZ_ERRNO for IO error, or zLib error for uncompress error)
    339339*/
    340340
    341 extern z_off_t ZEXPORT cpl_unztell OF((unzFile file));
     341extern z_off_t ZEXPORT cpl_unztell( unzFile file );
    342342/*
    343343  Give the current position in uncompressed data
    344344*/
    345345
    346 extern int ZEXPORT cpl_unzeof OF((unzFile file));
     346extern int ZEXPORT cpl_unzeof( unzFile file );
    347347/*
    348348  return 1 if the end of file was reached, 0 elsewhere
    349349*/
    350350
    351 extern int ZEXPORT cpl_unzGetLocalExtrafield OF((unzFile file,
    352                                              voidp buf,
    353                                              unsigned len));
     351extern int ZEXPORT cpl_unzGetLocalExtrafield( unzFile file,
     352                                              voidp buf,
     353                                              unsigned len );
    354354/*
    355355  Read extra field from the current file (opened by unzOpenCurrentFile)
    356356  This is the local-header version of the extra field (sometimes, there is
  • cpl_minizip_zip.cpp

     
    180180#include "crypt.h"
    181181#endif
    182182
    183 local linkedlist_datablock_internal* allocate_new_datablock()
     183static linkedlist_datablock_internal* allocate_new_datablock()
    184184{
    185185    linkedlist_datablock_internal* ldi;
    186186    ldi = (linkedlist_datablock_internal*)
     
    194194    return ldi;
    195195}
    196196
    197 local void free_datablock(linkedlist_datablock_internal*ldi)
     197static void free_datablock(linkedlist_datablock_internal*ldi)
    198198{
    199199    while (ldi!=NULL)
    200200    {
     
    204204    }
    205205}
    206206
    207 local void init_linkedlist(linkedlist_data*ll)
     207static void init_linkedlist(linkedlist_data*ll)
    208208{
    209209    ll->first_block = ll->last_block = NULL;
    210210}
    211211
    212 local int add_data_in_datablock(linkedlist_data*ll,
     212static int add_data_in_datablock(linkedlist_data*ll,
    213213                                const void *buf, uLong len)
    214214{
    215215    linkedlist_datablock_internal* ldi;
     
    271271   nbByte == 1, 2 or 4 (byte, short or long)
    272272*/
    273273
    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,
     274static int ziplocal_putValue (const zlib_filefunc_def*pzlib_filefunc_def,
    278275                             voidpf filestream, uLong x, int nbByte)
    279276{
    280277    unsigned char buf[4];
     
    297294        return ZIP_OK;
    298295}
    299296
    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)
     297static void ziplocal_putValue_inmemory (void *dest, uLong x, int nbByte)
    302298{
    303299    unsigned char* buf=(unsigned char*)dest;
    304300    for (int n = 0; n < nbByte; n++) {
     
    318314/****************************************************************************/
    319315
    320316
    321 local uLong ziplocal_TmzDateToDosDate(const tm_zip *ptm,
     317static uLong ziplocal_TmzDateToDosDate(const tm_zip *ptm,
    322318                                      CPL_UNUSED uLong dosDate)
    323319{
    324320    uLong year = (uLong)ptm->tm_year;
     
    334330
    335331/****************************************************************************/
    336332
    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,
     333static int ziplocal_getByte(const zlib_filefunc_def* pzlib_filefunc_def,
    343334                           voidpf filestream, int *pi)
    344335{
    345336    unsigned char c;
     
    362353/* ===========================================================================
    363354   Reads a long in LSB order from the given gz_stream. Sets
    364355*/
    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,
     356static int ziplocal_getShort (const zlib_filefunc_def* pzlib_filefunc_def,
    371357                             voidpf filestream, uLong *pX)
    372358{
    373359    int i;
     
    385371    return err;
    386372}
    387373
    388 local int ziplocal_getLong OF((
     374static int ziplocal_getLong (
    389375    const zlib_filefunc_def* pzlib_filefunc_def,
    390376    voidpf filestream,
    391     uLong *pX));
    392 
    393 local int ziplocal_getLong (
    394     const zlib_filefunc_def* pzlib_filefunc_def,
    395     voidpf filestream,
    396377    uLong *pX )
    397378{
    398379    int i;
     
    425406  Locate the Central directory of a zipfile (at the end, just before
    426407    the global comment)
    427408*/
    428 local uLong ziplocal_SearchCentralDir OF((
     409static uLong ziplocal_SearchCentralDir(
    429410    const zlib_filefunc_def* pzlib_filefunc_def,
    430     voidpf filestream));
    431 
    432 local uLong ziplocal_SearchCentralDir(
    433     const zlib_filefunc_def* pzlib_filefunc_def,
    434411    voidpf filestream )
    435412{
    436413    uLong uMaxBack=0xffff; /* maximum size of global comment */
     
    915892                                 comment, method, level, 0);
    916893}
    917894
    918 local int zipFlushWriteBuffer(
     895static int zipFlushWriteBuffer(
    919896    zip_internal* zi )
    920897{
    921898    int err=ZIP_OK;
  • cpl_minizip_zip.h

     
    135135#define APPEND_STATUS_CREATEAFTER   (1)
    136136#define APPEND_STATUS_ADDINZIP      (2)
    137137
    138 extern zipFile ZEXPORT cpl_zipOpen OF((const char *pathname, int append));
     138extern zipFile ZEXPORT cpl_zipOpen( const char *pathname, int append );
    139139/*
    140140  Create a zipfile.
    141141     pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
     
    155155   Of couse, you can use RAW reading and writing to copy the file you did not want delte
    156156*/
    157157
    158 extern zipFile ZEXPORT cpl_zipOpen2 OF((const char *pathname,
    159                                    int append,
    160                                    zipcharpc* globalcomment,
    161                                    zlib_filefunc_def* pzlib_filefunc_def));
     158extern zipFile ZEXPORT cpl_zipOpen2( const char *pathname,
     159                                     int append,
     160                                     zipcharpc* globalcomment,
     161                                     zlib_filefunc_def* pzlib_filefunc_def );
    162162
    163 extern int ZEXPORT cpl_zipOpenNewFileInZip OF((zipFile file,
     163extern int ZEXPORT cpl_zipOpenNewFileInZip( zipFile file,
    164164                       const char* filename,
    165165                       const zip_fileinfo* zipfi,
    166166                       const void* extrafield_local,
     
    169169                       uInt size_extrafield_global,
    170170                       const char* comment,
    171171                       int method,
    172                        int level));
     172                                            int level );
    173173/*
    174174  Open a file in the ZIP for writing.
    175175  filename : the filename in zip (if NULL, '-' without quote will be used
     
    184184*/
    185185
    186186
    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));
     187extern 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 );
    198198
    199199/*
    200200  Same than zipOpenNewFileInZip, except if raw=1, we write raw file
    201201 */
    202202
    203 extern int ZEXPORT cpl_zipOpenNewFileInZip3 OF((zipFile file,
     203extern int ZEXPORT cpl_zipOpenNewFileInZip3( zipFile file,
    204204                                            const char* filename,
    205205                                            const zip_fileinfo* zipfi,
    206206                                            const void* extrafield_local,
     
    215215                                            int memLevel,
    216216                                            int strategy,
    217217                                            const char* password,
    218                                             uLong crcForCtypting));
     218                                             uLong crcForCtypting );
    219219
    220220/*
    221221  Same than zipOpenNewFileInZip2, except
     
    225225 */
    226226
    227227
    228 extern int ZEXPORT cpl_zipWriteInFileInZip OF((zipFile file,
    229                        const void* buf,
    230                        unsigned len));
     228extern int ZEXPORT cpl_zipWriteInFileInZip( zipFile file,
     229                                            const void* buf,
     230                                            unsigned len );
    231231/*
    232232  Write data in the zipfile
    233233*/
    234234
    235 extern int ZEXPORT cpl_zipCloseFileInZip OF((zipFile file));
     235extern int ZEXPORT cpl_zipCloseFileInZip( zipFile file );
    236236/*
    237237  Close the current file in the zipfile
    238238*/
    239239
    240 extern int ZEXPORT cpl_zipCloseFileInZipRaw OF((zipFile file,
    241                                             uLong uncompressed_size,
    242                                             uLong crc32));
     240extern int ZEXPORT cpl_zipCloseFileInZipRaw( zipFile file,
     241                                             uLong uncompressed_size,
     242                                             uLong crc32 );
    243243/*
    244244  Close the current file in the zipfile, for fiel opened with
    245245    parameter raw=1 in zipOpenNewFileInZip2
     
    246246  uncompressed_size and crc32 are value for the uncompressed size
    247247*/
    248248
    249 extern int ZEXPORT cpl_zipClose OF((zipFile file,
    250                 const char* global_comment));
     249extern int ZEXPORT cpl_zipClose( zipFile file, const char* global_comment );
    251250/*
    252251  Close the zipfile
    253252*/

Change History (7)

comment:1 by Even Rouault, 8 years ago

One reason would be to avoid to diverge too much from upstream minizip in case we want to resync at some point.

comment:2 by Kurt Schwehr, 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,

in reply to:  2 comment:3 by Even Rouault, 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 Kurt Schwehr, 8 years ago

rouault, Thanks for the info! Submitted r31508 to trunk. Will notify upstream.

comment:5 by Kurt Schwehr, 8 years ago

Let upstreams know. minizip by emailing Gilles Vollant and https://github.com/madler/zlib/issues/117 for zlib

comment:6 by Kurt Schwehr, 8 years ago

#6222 for updating zlib to develop post 1.2.8

comment:7 by Kurt Schwehr, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.