diff options
author | rbuj <[email protected]> | 2021-10-27 17:30:36 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-11-20 18:31:11 +0100 |
commit | 816d2dc8226f8d271aa1a6cd30549614769d5267 (patch) | |
tree | b7bf882bb656964b9a919d4467fbde54fd9be867 /backend/epub/minizip | |
parent | 0c38b79c9556e475652d37556f0b2ffd73e0a4e4 (diff) | |
download | atril-816d2dc8226f8d271aa1a6cd30549614769d5267.tar.bz2 atril-816d2dc8226f8d271aa1a6cd30549614769d5267.tar.xz |
Use a blank line at most
Diffstat (limited to 'backend/epub/minizip')
-rw-r--r-- | backend/epub/minizip/ioapi.c | 6 | ||||
-rw-r--r-- | backend/epub/minizip/ioapi.h | 7 | ||||
-rw-r--r-- | backend/epub/minizip/unzip.c | 45 | ||||
-rw-r--r-- | backend/epub/minizip/unzip.h | 11 |
4 files changed, 0 insertions, 69 deletions
diff --git a/backend/epub/minizip/ioapi.c b/backend/epub/minizip/ioapi.c index 7f5c191b..c20d20e3 100644 --- a/backend/epub/minizip/ioapi.c +++ b/backend/epub/minizip/ioapi.c @@ -25,7 +25,6 @@ #define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) #endif - #include "ioapi.h" voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) @@ -82,8 +81,6 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; } - - static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); @@ -128,7 +125,6 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, return file; } - static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) { uLong ret; @@ -150,7 +146,6 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) return ret; } - static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) { ZPOS64_T ret; @@ -206,7 +201,6 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T return ret; } - static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) { int ret; diff --git a/backend/epub/minizip/ioapi.h b/backend/epub/minizip/ioapi.h index 7a0f44ad..eaf6b303 100644 --- a/backend/epub/minizip/ioapi.h +++ b/backend/epub/minizip/ioapi.h @@ -110,7 +110,6 @@ typedef unsigned long long int ZPOS64_T; extern "C" { #endif - #define ZLIB_FILEFUNC_SEEK_CUR (1) #define ZLIB_FILEFUNC_SEEK_END (2) #define ZLIB_FILEFUNC_SEEK_SET (0) @@ -122,7 +121,6 @@ extern "C" { #define ZLIB_FILEFUNC_MODE_EXISTING (4) #define ZLIB_FILEFUNC_MODE_CREATE (8) - #ifndef ZCALLBACK #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) #define ZCALLBACK CALLBACK @@ -131,9 +129,6 @@ extern "C" { #endif #endif - - - typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); @@ -143,7 +138,6 @@ typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stre typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); - /* here is the "old" 32 bits structure structure */ typedef struct zlib_filefunc_def_s { @@ -185,7 +179,6 @@ typedef struct zlib_filefunc64_32_def_s seek_file_func zseek32_file; } zlib_filefunc64_32_def; - #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) diff --git a/backend/epub/minizip/unzip.c b/backend/epub/minizip/unzip.c index 0a23c1e4..3c4a6415 100644 --- a/backend/epub/minizip/unzip.c +++ b/backend/epub/minizip/unzip.c @@ -12,7 +12,6 @@ For more info read MiniZip_info.txt - ------------------------------------------------------------------------------------ Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of compatibility with older software. The following is from the original crypt.c. @@ -48,7 +47,6 @@ Copyright (C) 2007-2008 Even Rouault - Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again). Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G should only read the compressed/uncompressed size from the Zip64 format if @@ -63,7 +61,6 @@ */ - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -86,20 +83,17 @@ # include <errno.h> #endif - #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ - #ifndef CASESENSITIVITYDEFAULT_NO # if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) # define CASESENSITIVITYDEFAULT_NO # endif #endif - #ifndef UNZ_BUFSIZE #define UNZ_BUFSIZE (16384) #endif @@ -118,14 +112,12 @@ #define SIZECENTRALDIRITEM (0x2e) #define SIZEZIPLOCALHEADER (0x1e) - /* unz_file_info_interntal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ } unz_file_info64_internal; - /* file_in_zip_read_info_s contain internal information about a file in zipfile, when reading and decompress it */ typedef struct @@ -156,7 +148,6 @@ typedef struct int raw; } file_in_zip64_read_info_s; - /* unz64_s contain internal information about the zipfile */ typedef struct @@ -189,7 +180,6 @@ typedef struct # endif } unz64_s; - #ifndef NOUNCRYPT #include "crypt.h" #endif @@ -200,7 +190,6 @@ typedef struct IN assertion: the stream s has been successfully opened for reading. */ - local int unz64local_getByte OF(( const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, @@ -224,7 +213,6 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v } } - /* =========================================================================== Reads a long in LSB order from the given gz_stream. Sets */ @@ -295,7 +283,6 @@ local int unz64local_getLong64 OF(( voidpf filestream, ZPOS64_T *pX)); - local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) @@ -364,7 +351,6 @@ local int strcmpcasenosensitive_internal (const char* fileName1, const char* fil } } - #ifdef CASESENSITIVITYDEFAULT_NO #define CASESENSITIVITYDEFAULTVALUE 2 #else @@ -418,7 +404,6 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) return 0; - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); if (uMaxBack>uSizeFile) @@ -463,7 +448,6 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f return uPosFound; } - /* Locate the Central directory 64 of a zipfile (at the end, just before the global comment) @@ -486,7 +470,6 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) return 0; - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); if (uMaxBack>uSizeFile) @@ -605,8 +588,6 @@ local unzFile unzOpenInternal (const void *path, us.z_filefunc = *pzlib_filefunc64_32_def; us.is64bitOpenFunction = is64bitOpenFunction; - - us.filestream = ZOPEN64(us.z_filefunc, path, ZLIB_FILEFUNC_MODE_READ | @@ -745,7 +726,6 @@ local unzFile unzOpenInternal (const void *path, us.pfile_in_zip_read = NULL; us.encrypted = 0; - s=(unz64_s*)ALLOC(sizeof(unz64_s)); if( s != NULL) { @@ -755,7 +735,6 @@ local unzFile unzOpenInternal (const void *path, return (unzFile)s; } - extern unzFile ZEXPORT unzOpen2 (const char *path, zlib_filefunc_def* pzlib_filefunc32_def) { @@ -814,7 +793,6 @@ extern int ZEXPORT unzClose (unzFile file) return UNZ_OK; } - /* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed @@ -897,7 +875,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, ZLIB_FILEFUNC_SEEK_SET)!=0) err=UNZ_ERRNO; - /* we check the magic */ if (err==UNZ_OK) { @@ -1002,7 +979,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, else lSeek += file_info.size_file_extra; - if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) { uLong acc = 0; @@ -1096,7 +1072,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, else lSeek+=file_info.size_file_comment; - if ((err==UNZ_OK) && (pfile_info!=NULL)) *pfile_info=file_info; @@ -1106,8 +1081,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, return err; } - - /* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed @@ -1156,7 +1129,6 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, pfile_info->tmu_date = file_info64.tmu_date, - pfile_info->compressed_size = (uLong)file_info64.compressed_size; pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; @@ -1212,7 +1184,6 @@ extern int ZEXPORT unzGoToNextFile (unzFile file) return err; } - /* Try locate the file szFileName in the zipfile. For the iCaseSensitivity signification, see unzStringFileNameCompare @@ -1234,7 +1205,6 @@ extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCas ZPOS64_T num_fileSaved; ZPOS64_T pos_in_central_dirSaved; - if (file==NULL) return UNZ_PARAMERROR; @@ -1278,7 +1248,6 @@ extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCas return err; } - /* /////////////////////////////////////////// // Contributed by Ryan Haksi (mailto://[email protected]) @@ -1391,7 +1360,6 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) return UNZ_ERRNO; - if (err==UNZ_OK) { if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) @@ -1594,7 +1562,6 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, pfile_in_zip_read_info->rest_read_uncompressed = s->cur_file_info.uncompressed_size ; - pfile_in_zip_read_info->pos_in_zipfile = s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + iSizeVar; @@ -1626,7 +1593,6 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, } # endif - return UNZ_OK; } @@ -1687,7 +1653,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - if (pfile_in_zip_read_info->read_buffer == NULL) return UNZ_END_OF_LIST_OF_FILE; if (len==0) @@ -1731,7 +1696,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) uReadThis)!=uReadThis) return UNZ_ERRNO; - # ifndef NOUNCRYPT if(s->encrypted) { @@ -1743,7 +1707,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) } # endif - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis; @@ -1874,7 +1837,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) return err; } - /* Give the current position in uncompressed data */ @@ -1909,7 +1871,6 @@ extern ZPOS64_T ZEXPORT unztell64 (unzFile file) return pfile_in_zip_read_info->total_out_64; } - /* return 1 if the end of file was reached, 0 elsewhere */ @@ -1931,8 +1892,6 @@ extern int ZEXPORT unzeof (unzFile file) return 0; } - - /* Read extra field from the current file (opened by unzOpenCurrentFile) This is the local-header version of the extra field (sometimes, there is @@ -2007,7 +1966,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && (!pfile_in_zip_read_info->raw)) { @@ -2015,7 +1973,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) err=UNZ_CRCERROR; } - TRYFREE(pfile_in_zip_read_info->read_buffer); pfile_in_zip_read_info->read_buffer = NULL; if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) @@ -2025,7 +1982,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); #endif - pfile_in_zip_read_info->stream_initialised = 0; TRYFREE(pfile_in_zip_read_info); @@ -2034,7 +1990,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) return err; } - /* Get the global comment string of the ZipFile, in the szComment buffer. uSizeBuf is the size of the szComment buffer. diff --git a/backend/epub/minizip/unzip.h b/backend/epub/minizip/unzip.h index 2104e391..5c5a3f99 100644 --- a/backend/epub/minizip/unzip.h +++ b/backend/epub/minizip/unzip.h @@ -70,7 +70,6 @@ typedef unzFile__ *unzFile; typedef voidp unzFile; #endif - #define UNZ_OK (0) #define UNZ_END_OF_LIST_OF_FILE (-100) #define UNZ_ERRNO (Z_ERRNO) @@ -162,7 +161,6 @@ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, (like 1 on Unix, 2 on Windows) */ - extern unzFile ZEXPORT unzOpen OF((const char *path)); extern unzFile ZEXPORT unzOpen64 OF((const void *path)); /* @@ -180,7 +178,6 @@ extern unzFile ZEXPORT unzOpen64 OF((const void *path)); does not describe the reality */ - extern unzFile ZEXPORT unzOpen2 OF((const char *path, zlib_filefunc_def* pzlib_filefunc_def)); /* @@ -212,7 +209,6 @@ extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, No preparation of the structure is needed return UNZ_OK if there is no problem. */ - extern int ZEXPORT unzGetGlobalComment OF((unzFile file, char *szComment, uLong uSizeBuf)); @@ -222,7 +218,6 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file, return the number of byte copied or an error code <0 */ - /***************************************************************************/ /* Unzip package allow you browse the directory of the zipfile */ @@ -251,7 +246,6 @@ extern int ZEXPORT unzLocateFile OF((unzFile file, UNZ_END_OF_LIST_OF_FILE if the file is not found */ - /* ****************************************** */ /* Ryan supplied functions */ /* unz_file_info contain information about a file in the zipfile */ @@ -315,14 +309,12 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, (commentBufferSize is the size of the buffer) */ - /** Addition for GDAL : START */ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); /** Addition for GDAL : END */ - /***************************************************************************/ /* for reading the content of the current zipfile, you can open it, read data from it, and close it (you can close it before reading all the file) @@ -369,7 +361,6 @@ extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, but you CANNOT set method parameter as NULL */ - extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); /* Close the file in zip opened with unzOpenCurrentFile @@ -428,8 +419,6 @@ extern uLong ZEXPORT unzGetOffset (unzFile file); extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); - - #ifdef __cplusplus } #endif |