summaryrefslogtreecommitdiff
path: root/backend/epub/minizip/unzip.c
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-10-27 17:30:36 +0200
committerlukefromdc <[email protected]>2024-01-08 23:02:46 -0500
commit658fab1f008bff7e1ec147d95baa04bc44c2fbcd (patch)
tree6cca2b00e83224a53df2bcca3f021c4d5c223c2a /backend/epub/minizip/unzip.c
parentec957cf18919166ca8b8335475ef06f9fd5f2e67 (diff)
downloadatril-658fab1f008bff7e1ec147d95baa04bc44c2fbcd.tar.bz2
atril-658fab1f008bff7e1ec147d95baa04bc44c2fbcd.tar.xz
Use a blank line at most
Diffstat (limited to 'backend/epub/minizip/unzip.c')
-rw-r--r--backend/epub/minizip/unzip.c45
1 files changed, 0 insertions, 45 deletions
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.