fix zip library bugs (#508)

This commit is contained in:
water111
2021-05-20 14:50:52 -04:00
committed by GitHub
parent 9e2b49abaa
commit 0c751dd13e
4 changed files with 10 additions and 4 deletions
@@ -166,6 +166,10 @@ ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
#define COPY 1 /* copy input directly */
#define GZIP 2 /* decompress a gzip stream */
#ifdef __unix__
#include <unistd.h>
#endif
/* internal gzip file state data structure */
typedef struct
{
+2 -1
View File
@@ -52,6 +52,7 @@
#else
# include <unistd.h>
# include <utime.h>
#include <sys/stat.h>
#endif
@@ -99,7 +100,7 @@ tm_unz tmu_date;
SetFileTime(hFile, &ftm, &ftLastAcc, &ftm);
CloseHandle(hFile);
#else
#ifdef unix || __APPLE__
#if defined unix || defined __APPLE__
struct utimbuf ut;
struct tm newdate;
newdate.tm_sec = tmu_date.tm_sec;
+1 -1
View File
@@ -92,7 +92,7 @@ uLong* dt; /* dostime */
return ret;
}
#else
#ifdef unix || __APPLE__
#if defined unix || defined __APPLE__
uLong filetime(f, tmzip, dt)
char *f; /* name of file to get info on */
tm_zip *tmzip; /* return value: access, modific. and creation times */
+3 -2
View File
@@ -2,6 +2,7 @@
#include <algorithm>
#include <sstream>
#include <ctime>
#include <cstring>
#include <minizip/zlib.h>
@@ -74,7 +75,8 @@ namespace ziputils
}
//?? we dont need the stinking time
zip_fileinfo zi = {0};
zip_fileinfo zi;
memset(&zi, 0, sizeof(zi));
getTime(zi.tmz_date);
int err = zipOpenNewFileInZip(zipFile_, filename, &zi,
@@ -109,7 +111,6 @@ namespace ziputils
{
int err = ZIP_OK;
char buf[BUFSIZE];
unsigned long nRead = 0;
if (isOpenEntry())
{