aboutsummaryrefslogtreecommitdiff
path: root/zlib/contrib/minizip/minizip.c
diff options
context:
space:
mode:
Diffstat (limited to 'zlib/contrib/minizip/minizip.c')
-rw-r--r--zlib/contrib/minizip/minizip.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/zlib/contrib/minizip/minizip.c b/zlib/contrib/minizip/minizip.c
index 4288962..7f937aa 100644
--- a/zlib/contrib/minizip/minizip.c
+++ b/zlib/contrib/minizip/minizip.c
@@ -71,8 +71,8 @@
#define MAXFILENAME (256)
#ifdef _WIN32
-uLong filetime(f, tmzip, dt)
- char *f; /* name of file to get info on */
+static int filetime(f, tmzip, dt)
+ const char *f; /* name of file to get info on */
tm_zip *tmzip; /* return value: access, modific. and creation times */
uLong *dt; /* dostime */
{
@@ -94,12 +94,13 @@ uLong filetime(f, tmzip, dt)
return ret;
}
#else
-#ifdef unix || __APPLE__
-uLong filetime(f, tmzip, dt)
- char *f; /* name of file to get info on */
+#if defined(unix) || defined(__APPLE__)
+static int filetime(f, tmzip, dt)
+ const char *f; /* name of file to get info on */
tm_zip *tmzip; /* return value: access, modific. and creation times */
uLong *dt; /* dostime */
{
+ (void)dt;
int ret=0;
struct stat s; /* results of stat() */
struct tm* filedate;
@@ -108,7 +109,7 @@ uLong filetime(f, tmzip, dt)
if (strcmp(f,"-")!=0)
{
char name[MAXFILENAME+1];
- int len = strlen(f);
+ size_t len = strlen(f);
if (len > MAXFILENAME)
len = MAXFILENAME;
@@ -138,7 +139,7 @@ uLong filetime(f, tmzip, dt)
}
#else
uLong filetime(f, tmzip, dt)
- char *f; /* name of file to get info on */
+ const char *f; /* name of file to get info on */
tm_zip *tmzip; /* return value: access, modific. and creation times */
uLong *dt; /* dostime */
{
@@ -150,7 +151,7 @@ uLong filetime(f, tmzip, dt)
-int check_exist_file(filename)
+static int check_exist_file(filename)
const char* filename;
{
FILE* ftestexist;
@@ -163,13 +164,13 @@ int check_exist_file(filename)
return ret;
}
-void do_banner()
+static void do_banner()
{
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
printf("more info on MiniZip at http://www.winimage.com/zLibDll/minizip.html\n\n");
}
-void do_help()
+static void do_help()
{
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \
" -o Overwrite existing file.zip\n" \
@@ -182,7 +183,7 @@ void do_help()
/* calculate the CRC32 of a file,
because to encrypt a file, we need known the CRC32 of the file before */
-int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
+static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
{
unsigned long calculate_crc=0;
int err=ZIP_OK;
@@ -199,7 +200,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
do
{
err = ZIP_OK;
- size_read = (int)fread(buf,1,size_buf,fin);
+ size_read = fread(buf,1,size_buf,fin);
if (size_read < size_buf)
if (feof(fin)==0)
{
@@ -208,7 +209,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
}
if (size_read>0)
- calculate_crc = crc32(calculate_crc,buf,size_read);
+ calculate_crc = crc32_z(calculate_crc,buf,size_read);
total_read += size_read;
} while ((err == ZIP_OK) && (size_read>0));
@@ -221,7 +222,7 @@ int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigne
return err;
}
-int isLargeFile(const char* filename)
+static int isLargeFile(const char* filename)
{
int largeFile = 0;
ZPOS64_T pos = 0;
@@ -229,8 +230,8 @@ int isLargeFile(const char* filename)
if(pFile != NULL)
{
- int n = FSEEKO_FUNC(pFile, 0, SEEK_END);
- pos = FTELLO_FUNC(pFile);
+ FSEEKO_FUNC(pFile, 0, SEEK_END);
+ pos = (ZPOS64_T)FTELLO_FUNC(pFile);
printf("File : %s is %lld bytes\n", filename, pos);
@@ -255,7 +256,7 @@ int main(argc,argv)
char filename_try[MAXFILENAME+16];
int zipok;
int err=0;
- int size_buf=0;
+ size_t size_buf=0;
void* buf=NULL;
const char* password=NULL;
@@ -396,7 +397,7 @@ int main(argc,argv)
(strlen(argv[i]) == 2)))
{
FILE * fin;
- int size_read;
+ size_t size_read;
const char* filenameinzip = argv[i];
const char *savefilenameinzip;
zip_fileinfo zi;
@@ -472,7 +473,7 @@ int main(argc,argv)
do
{
err = ZIP_OK;
- size_read = (int)fread(buf,1,size_buf,fin);
+ size_read = fread(buf,1,size_buf,fin);
if (size_read < size_buf)
if (feof(fin)==0)
{
@@ -482,7 +483,7 @@ int main(argc,argv)
if (size_read>0)
{
- err = zipWriteInFileInZip (zf,buf,size_read);
+ err = zipWriteInFileInZip (zf,buf,(unsigned)size_read);
if (err<0)
{
printf("error in writing %s in the zipfile\n",