fix #315 by removing the size_filename test.

latest minizip.
This commit is contained in:
Antoine Cœur
2017-09-30 01:42:17 +08:00
parent d6eea31fea
commit 6f0bb4e9b4
3 changed files with 114 additions and 100 deletions
+4
View File
@@ -42,9 +42,13 @@ INLINE int has_aes_ni(void)
#elif defined( __GNUC__ )
#include <cpuid.h>
#if !defined(__clang__)
#pragma GCC target ("ssse3")
#pragma GCC target ("sse4.1")
#pragma GCC target ("aes")
#endif
#include <x86intrin.h>
#define INLINE static __inline
+23 -3
View File
@@ -143,7 +143,7 @@ time_t dosdate_to_time_t(uint64_t dos_date)
uint32_t tm_to_dosdate(const struct tm *ptm)
{
struct tm fixed_tm = { 0 };
struct tm fixed_tm;
/* Years supported:
* [00, 79] (assumed to be between 2000 and 2079)
@@ -220,9 +220,28 @@ int makedir(const char *newdir)
return 1;
}
FILE *get_file_handle(const char *path)
{
FILE *handle = NULL;
#if defined(WIN32)
wchar_t *pathWide = NULL;
int pathLength = 0;
pathLength = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0) + 1;
pathWide = (wchar_t*)calloc(pathLength, sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, path, -1, pathWide, pathLength);
handle = _wfopen((const wchar_t*)pathWide, L"rb");
free(pathWide);
#else
handle = fopen64(path, "rb");
#endif
return handle;
}
int check_file_exists(const char *path)
{
FILE* handle = fopen64(path, "rb");
FILE *handle = get_file_handle(path);
if (handle == NULL)
return 0;
fclose(handle);
@@ -231,9 +250,10 @@ int check_file_exists(const char *path)
int is_large_file(const char *path)
{
FILE* handle = NULL;
uint64_t pos = 0;
FILE* handle = fopen64(path, "rb");
handle = get_file_handle(path);
if (handle == NULL)
return 0;
+87 -97
View File
@@ -111,7 +111,7 @@ typedef struct
uint64_t total_out_64;
uint32_t crc32; /* crc32 of all data uncompressed */
uint32_t crc32_wait; /* crc32 we must obtain after decompress all */
uint32_t crc32_expected; /* crc32 we must obtain after decompress all */
uint64_t rest_read_compressed; /* number of byte to be decompressed */
uint64_t rest_read_uncompressed; /* number of byte to be obtained after decomp */
@@ -153,7 +153,7 @@ typedef struct
uint32_t keys[3]; /* keys defining the pseudo-random sequence */
const z_crc_t *pcrc_32_tab;
#endif
} unz64_s;
} unz64_internal;
/* Read a byte from a gz_stream; Return EOF for end of file. */
static int unzReadUInt8(const zlib_filefunc64_32_def *pzlib_filefunc_def, voidpf filestream, uint8_t *value)
@@ -343,8 +343,8 @@ static uint64_t unzSearchCentralDir64(const zlib_filefunc64_32_def *pzlib_filefu
static unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_filefunc64_32_def)
{
unz64_s us;
unz64_s *s = NULL;
unz64_internal us;
unz64_internal *s = NULL;
uint64_t central_pos = 0;
uint64_t central_pos64 = 0;
uint64_t number_entry_CD = 0;
@@ -490,7 +490,7 @@ static unzFile unzOpenInternal(const void *path, zlib_filefunc64_32_def *pzlib_f
us.central_pos = central_pos;
us.pfile_in_zip_read = NULL;
s = (unz64_s*)ALLOC(sizeof(unz64_s));
s = (unz64_internal*)ALLOC(sizeof(unz64_internal));
if (s != NULL)
{
*s = us;
@@ -535,10 +535,10 @@ extern unzFile ZEXPORT unzOpen64(const void *path)
extern int ZEXPORT unzClose(unzFile file)
{
unz64_s *s;
unz64_internal *s;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s->pfile_in_zip_read != NULL)
unzCloseCurrentFile(file);
@@ -557,10 +557,10 @@ extern int ZEXPORT unzClose(unzFile file)
/* Goto to the next available disk for spanned archives */
static int unzGoToNextDisk(unzFile file)
{
unz64_s *s;
unz64_internal *s;
uint32_t number_disk_next = 0;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s == NULL)
return UNZ_PARAMERROR;
number_disk_next = s->number_disk;
@@ -599,10 +599,10 @@ static int unzGoToNextDisk(unzFile file)
extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
pglobal_info32->number_entry = (uint32_t)s->gi.number_entry;
pglobal_info32->size_comment = s->gi.size_comment;
@@ -612,21 +612,21 @@ extern int ZEXPORT unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info3
extern int ZEXPORT unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
*pglobal_info = s->gi;
return UNZ_OK;
}
extern int ZEXPORT unzGetGlobalComment(unzFile file, char *comment, uint16_t comment_size)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
uint16_t bytes_to_read = comment_size;
if (file == NULL)
return (int)UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (bytes_to_read > s->gi.size_comment)
bytes_to_read = s->gi.size_comment;
@@ -649,13 +649,13 @@ extern int ZEXPORT unzGetGlobalComment(unzFile file, char *comment, uint16_t com
static int unzGetCurrentFileInfoField(unzFile file, uint32_t *seek, void *field, uint16_t field_size, uint16_t size_file_field, int null_terminated_field)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
uint32_t bytes_to_read = 0;
int err = UNZ_OK;
if (file == NULL)
return (int)UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
/* Read field */
if (field != NULL)
@@ -698,7 +698,7 @@ static int unzGetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_in
unz_file_info64_internal *pfile_info_internal, char *filename, uint16_t filename_size, void *extrafield,
uint16_t extrafield_size, char *comment, uint16_t comment_size)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
unz_file_info64 file_info;
unz_file_info64_internal file_info_internal;
uint32_t magic = 0;
@@ -714,7 +714,7 @@ static int unzGetCurrentFileInfoInternal(unzFile file, unz_file_info64 *pfile_in
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (ZSEEK64(s->z_filefunc, s->filestream_with_CD,
s->pos_in_central_dir + s->byte_before_the_zipfile, ZLIB_FILEFUNC_SEEK_SET) != 0)
@@ -938,7 +938,7 @@ extern int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 * pfile
/* Read the local header of the current zipfile. Check the coherency of the local header and info in the
end of central directory about this file store in *piSizeVar the size of extra info in local header
(filename and size of extra field data) */
static int unzCheckCurrentFileCoherencyHeader(unz64_s *s, uint32_t *psize_variable, uint64_t *poffset_local_extrafield,
static int unzCheckCurrentFileCoherencyHeader(unz64_internal *s, uint32_t *psize_variable, uint64_t *poffset_local_extrafield,
uint16_t *psize_local_extrafield)
{
uint32_t magic = 0;
@@ -1016,8 +1016,6 @@ static int unzCheckCurrentFileCoherencyHeader(unz64_s *s, uint32_t *psize_variab
err = UNZ_BADZIPFILE;
if (unzReadUInt16(&s->z_filefunc, s->filestream, &size_filename) != UNZ_OK)
err = UNZ_ERRNO;
else if ((err == UNZ_OK) && (size_filename != s->cur_file_info.size_filename))
err = UNZ_BADZIPFILE;
*psize_variable += size_filename;
@@ -1037,7 +1035,7 @@ static int unzCheckCurrentFileCoherencyHeader(unz64_s *s, uint32_t *psize_variab
*/
extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
file_in_zip64_read_info_s *pfile_in_zip_read_info = NULL;
uint16_t compression_method = 0;
uint64_t offset_local_extrafield = 0;
@@ -1052,7 +1050,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, in
#endif
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (!s->current_file_ok)
return UNZ_PARAMERROR;
@@ -1061,25 +1059,7 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, in
if (unzCheckCurrentFileCoherencyHeader(s, &size_variable, &offset_local_extrafield, &size_local_extrafield) != UNZ_OK)
return UNZ_BADZIPFILE;
pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));
if (pfile_in_zip_read_info == NULL)
return UNZ_INTERNALERROR;
pfile_in_zip_read_info->read_buffer = (uint8_t*)ALLOC(UNZ_BUFSIZE);
pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
pfile_in_zip_read_info->pos_local_extrafield = 0;
pfile_in_zip_read_info->raw = raw;
if (pfile_in_zip_read_info->read_buffer == NULL)
{
TRYFREE(pfile_in_zip_read_info);
return UNZ_INTERNALERROR;
}
pfile_in_zip_read_info->stream_initialised = 0;
compression_method = s->cur_file_info.compression_method;
#ifdef HAVE_AES
if (compression_method == AES_METHOD)
@@ -1087,7 +1067,6 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, in
compression_method = s->cur_file_info_internal.aes_compression_method;
if (password == NULL)
{
TRYFREE(pfile_in_zip_read_info);
return UNZ_PARAMERROR;
}
}
@@ -1113,24 +1092,52 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, in
if (compression_method != Z_BZIP2ED)
#endif
{
TRYFREE(pfile_in_zip_read_info);
return UNZ_BADZIPFILE;
}
}
pfile_in_zip_read_info = (file_in_zip64_read_info_s*)ALLOC(sizeof(file_in_zip64_read_info_s));
if (pfile_in_zip_read_info == NULL)
return UNZ_INTERNALERROR;
pfile_in_zip_read_info->read_buffer = (uint8_t*)ALLOC(UNZ_BUFSIZE);
if (pfile_in_zip_read_info->read_buffer == NULL)
{
TRYFREE(pfile_in_zip_read_info);
return UNZ_INTERNALERROR;
}
pfile_in_zip_read_info->stream_initialised = 0;
pfile_in_zip_read_info->crc32_wait = s->cur_file_info.crc;
pfile_in_zip_read_info->crc32 = 0;
pfile_in_zip_read_info->total_out_64 = 0;
pfile_in_zip_read_info->compression_method = compression_method;
pfile_in_zip_read_info->filestream = s->filestream;
pfile_in_zip_read_info->z_filefunc = s->z_filefunc;
pfile_in_zip_read_info->raw = raw;
pfile_in_zip_read_info->crc32 = 0;
pfile_in_zip_read_info->crc32_expected = s->cur_file_info.crc;
pfile_in_zip_read_info->total_out_64 = 0;
pfile_in_zip_read_info->compression_method = compression_method;
pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
pfile_in_zip_read_info->pos_local_extrafield = 0;
pfile_in_zip_read_info->rest_read_compressed = s->cur_file_info.compressed_size;
pfile_in_zip_read_info->rest_read_uncompressed = s->cur_file_info.uncompressed_size;
pfile_in_zip_read_info->byte_before_the_zipfile = 0;
if (s->number_disk == s->gi.number_disk_with_CD)
pfile_in_zip_read_info->byte_before_the_zipfile = s->byte_before_the_zipfile;
else
pfile_in_zip_read_info->byte_before_the_zipfile = 0;
pfile_in_zip_read_info->pos_in_zipfile = s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + size_variable;
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)s;
pfile_in_zip_read_info->stream.total_out = 0;
pfile_in_zip_read_info->stream.total_in = 0;
pfile_in_zip_read_info->stream.next_in = NULL;
pfile_in_zip_read_info->stream.avail_in = 0;
if (!raw)
{
@@ -1142,12 +1149,6 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, in
pfile_in_zip_read_info->bstream.opaque = (voidpf)0;
pfile_in_zip_read_info->bstream.state = (voidpf)0;
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.next_in = (voidpf)0;
pfile_in_zip_read_info->stream.avail_in = 0;
err = BZ2_bzDecompressInit(&pfile_in_zip_read_info->bstream, 0, 0);
if (err == Z_OK)
{
@@ -1164,12 +1165,6 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, in
}
else if (compression_method == Z_DEFLATED)
{
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)s;
pfile_in_zip_read_info->stream.next_in = 0;
pfile_in_zip_read_info->stream.avail_in = 0;
#ifdef HAVE_APPLE_COMPRESSION
err = compression_stream_init(&pfile_in_zip_read_info->astream, COMPRESSION_STREAM_DECODE, COMPRESSION_ZLIB);
if (err == COMPRESSION_STATUS_ERROR)
@@ -1198,11 +1193,6 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int *method, int *level, in
}
}
pfile_in_zip_read_info->rest_read_compressed = s->cur_file_info.compressed_size;
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 + size_variable;
pfile_in_zip_read_info->stream.avail_in = 0;
s->pfile_in_zip_read = pfile_in_zip_read_info;
#ifndef NOUNCRYPT
@@ -1290,13 +1280,13 @@ extern int ZEXPORT unzOpenCurrentFile2(unzFile file, int *method, int *level, in
return <0 with error code if there is an error (UNZ_ERRNO for IO error, or zLib error for uncompress error) */
extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, uint32_t len)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
uint32_t read = 0;
int err = UNZ_OK;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s->pfile_in_zip_read == NULL)
return UNZ_PARAMERROR;
@@ -1569,13 +1559,13 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, uint32_t len)
extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, uint32_t len)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
uint64_t size_to_read = 0;
uint32_t read_now = 0;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s->pfile_in_zip_read == NULL)
return UNZ_PARAMERROR;
@@ -1605,13 +1595,13 @@ extern int ZEXPORT unzGetLocalExtrafield(unzFile file, voidp buf, uint32_t len)
extern int ZEXPORT unzCloseCurrentFile(unzFile file)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
file_in_zip64_read_info_s *pfile_in_zip_read_info = NULL;
int err = UNZ_OK;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
pfile_in_zip_read_info = s->pfile_in_zip_read;
if (pfile_in_zip_read_info == NULL)
return UNZ_PARAMERROR;
@@ -1638,7 +1628,7 @@ extern int ZEXPORT unzCloseCurrentFile(unzFile file)
if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) &&
(!pfile_in_zip_read_info->raw))
{
if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_expected)
err = UNZ_CRCERROR;
}
}
@@ -1671,12 +1661,12 @@ extern int ZEXPORT unzCloseCurrentFile(unzFile file)
extern int ZEXPORT unzGoToFirstFile2(unzFile file, unz_file_info64 *pfile_info, char *filename,
uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, uint16_t comment_size)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
int err = UNZ_OK;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
s->pos_in_central_dir = s->offset_central_dir;
s->num_file = 0;
@@ -1699,12 +1689,12 @@ extern int ZEXPORT unzGoToFirstFile(unzFile file)
extern int ZEXPORT unzGoToNextFile2(unzFile file, unz_file_info64 *pfile_info, char *filename,
uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, uint16_t comment_size)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
int err = UNZ_OK;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (!s->current_file_ok)
return UNZ_END_OF_LIST_OF_FILE;
@@ -1735,7 +1725,7 @@ extern int ZEXPORT unzGoToNextFile(unzFile file)
extern int ZEXPORT unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
unz_file_info64 cur_file_info_saved;
unz_file_info64_internal cur_file_info_internal_saved;
uint64_t num_file_saved = 0;
@@ -1747,7 +1737,7 @@ extern int ZEXPORT unzLocateFile(unzFile file, const char *filename, unzFileName
return UNZ_PARAMERROR;
if (strlen(filename) >= UNZ_MAXFILENAMEINZIP)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (!s->current_file_ok)
return UNZ_END_OF_LIST_OF_FILE;
@@ -1802,11 +1792,11 @@ extern int ZEXPORT unzGoToFilePos(unzFile file, unz_file_pos *file_pos)
extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos *file_pos)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
if (file == NULL || file_pos == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (!s->current_file_ok)
return UNZ_END_OF_LIST_OF_FILE;
@@ -1817,12 +1807,12 @@ extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos *file_pos)
extern int ZEXPORT unzGoToFilePos64(unzFile file, const unz64_file_pos *file_pos)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
int err = UNZ_OK;
if (file == NULL || file_pos == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
/* Jump to the right spot */
s->pos_in_central_dir = file_pos->pos_in_zip_directory;
@@ -1847,11 +1837,11 @@ extern int32_t ZEXPORT unzGetOffset(unzFile file)
extern int64_t ZEXPORT unzGetOffset64(unzFile file)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (!s->current_file_ok)
return 0;
if (s->gi.number_entry != 0 && s->gi.number_entry != UINT16_MAX)
@@ -1869,12 +1859,12 @@ extern int ZEXPORT unzSetOffset(unzFile file, uint32_t pos)
extern int ZEXPORT unzSetOffset64(unzFile file, uint64_t pos)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
int err = UNZ_OK;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
s->pos_in_central_dir = pos;
s->num_file = s->gi.number_entry; /* hack */
@@ -1886,10 +1876,10 @@ extern int ZEXPORT unzSetOffset64(unzFile file, uint64_t pos)
extern int32_t ZEXPORT unzTell(unzFile file)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s->pfile_in_zip_read == NULL)
return UNZ_PARAMERROR;
return (int32_t)s->pfile_in_zip_read->stream.total_out;
@@ -1897,10 +1887,10 @@ extern int32_t ZEXPORT unzTell(unzFile file)
extern int64_t ZEXPORT unzTell64(unzFile file)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s->pfile_in_zip_read == NULL)
return UNZ_PARAMERROR;
return s->pfile_in_zip_read->total_out_64;
@@ -1913,7 +1903,7 @@ extern int ZEXPORT unzSeek(unzFile file, uint32_t offset, int origin)
extern int ZEXPORT unzSeek64(unzFile file, uint64_t offset, int origin)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
uint64_t stream_pos_begin = 0;
uint64_t stream_pos_end = 0;
uint64_t position = 0;
@@ -1921,7 +1911,7 @@ extern int ZEXPORT unzSeek64(unzFile file, uint64_t offset, int origin)
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s->pfile_in_zip_read == NULL)
return UNZ_ERRNO;
@@ -1976,10 +1966,10 @@ extern int ZEXPORT unzSeek64(unzFile file, uint64_t offset, int origin)
extern int ZEXPORT unzEndOfFile(unzFile file)
{
unz64_s *s = NULL;
unz64_internal *s = NULL;
if (file == NULL)
return UNZ_PARAMERROR;
s = (unz64_s*)file;
s = (unz64_internal*)file;
if (s->pfile_in_zip_read == NULL)
return UNZ_PARAMERROR;
if (s->pfile_in_zip_read->rest_read_uncompressed == 0)