summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-11-08 04:44:32 -0800
committerSteve Kondik <steve@cyngn.com>2015-11-08 04:59:29 -0800
commit17bd251bea62b0440ce26b03ee275e8b6beba44a (patch)
tree6c091e8a792b1a3482b2c3e23d1fe91de450774d
parent80857fea86239d6627e53da3960771b64892a28d (diff)
downloadandroid_external_zlib-stable/cm-13.0-ZNH0E.tar.gz
android_external_zlib-stable/cm-13.0-ZNH0E.tar.bz2
android_external_zlib-stable/cm-13.0-ZNH0E.zip
minizip: Clean up the codestable/cm-13.0-ZNH0E
* Fix symbol visibility and unused code Change-Id: I8c299ca78b8be61ce6114d3bb621464fbd0171d4
-rw-r--r--src/contrib/minizip/crypt.h2
-rw-r--r--src/contrib/minizip/ioapi.c20
-rw-r--r--src/contrib/minizip/miniunz.c33
-rw-r--r--src/contrib/minizip/minizip.c28
4 files changed, 37 insertions, 46 deletions
diff --git a/src/contrib/minizip/crypt.h b/src/contrib/minizip/crypt.h
index 1e9e820..dcaa8e0 100644
--- a/src/contrib/minizip/crypt.h
+++ b/src/contrib/minizip/crypt.h
@@ -32,7 +32,7 @@
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
-static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
+static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab __unused)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
diff --git a/src/contrib/minizip/ioapi.c b/src/contrib/minizip/ioapi.c
index 7f5c191..8c2c4be 100644
--- a/src/contrib/minizip/ioapi.c
+++ b/src/contrib/minizip/ioapi.c
@@ -92,7 +92,7 @@ static long ZCALLBACK fseek64_file_func OF((voidpf opaque, voidpf stream, ZPO
static int ZCALLBACK fclose_file_func OF((voidpf opaque, voidpf stream));
static int ZCALLBACK ferror_file_func OF((voidpf opaque, voidpf stream));
-static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, int mode)
+static voidpf ZCALLBACK fopen_file_func (voidpf opaque __unused, const char* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
@@ -110,7 +110,7 @@ static voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char* filename, in
return file;
}
-static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, int mode)
+static voidpf ZCALLBACK fopen64_file_func (voidpf opaque __unused, const void* filename, int mode)
{
FILE* file = NULL;
const char* mode_fopen = NULL;
@@ -129,21 +129,21 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,
}
-static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size)
+static uLong ZCALLBACK fread_file_func (voidpf opaque __unused, voidpf stream, void* buf, uLong size)
{
uLong ret;
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
-static uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size)
+static uLong ZCALLBACK fwrite_file_func (voidpf opaque __unused, voidpf stream, const void* buf, uLong size)
{
uLong ret;
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
return ret;
}
-static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
+static long ZCALLBACK ftell_file_func (voidpf opaque __unused, voidpf stream)
{
long ret;
ret = ftell((FILE *)stream);
@@ -151,14 +151,14 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
}
-static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
+static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque __unused, voidpf stream)
{
ZPOS64_T ret;
ret = FTELLO_FUNC((FILE *)stream);
return ret;
}
-static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
+static long ZCALLBACK fseek_file_func (voidpf opaque __unused, voidpf stream, uLong offset, int origin)
{
int fseek_origin=0;
long ret;
@@ -181,7 +181,7 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs
return ret;
}
-static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
+static long ZCALLBACK fseek64_file_func (voidpf opaque __unused, voidpf stream, ZPOS64_T offset, int origin)
{
int fseek_origin=0;
long ret;
@@ -207,14 +207,14 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
}
-static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
+static int ZCALLBACK fclose_file_func (voidpf opaque __unused, voidpf stream)
{
int ret;
ret = fclose((FILE *)stream);
return ret;
}
-static int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
+static int ZCALLBACK ferror_file_func (voidpf opaque __unused, voidpf stream)
{
int ret;
ret = ferror((FILE *)stream);
diff --git a/src/contrib/minizip/miniunz.c b/src/contrib/minizip/miniunz.c
index 07bbe21..c37c79b 100644
--- a/src/contrib/minizip/miniunz.c
+++ b/src/contrib/minizip/miniunz.c
@@ -27,7 +27,7 @@
#endif
#endif
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(IOAPI_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
@@ -54,7 +54,7 @@
# include <utime.h>
#endif
-
+#include <sys/stat.h>
#include "unzip.h"
#define CASESENSITIVITY (0)
@@ -80,10 +80,8 @@
filename : the filename of the file where date/time must be modified
dosdate : the new date at the MSDos format (4 bytes)
tmu_date : the SAME new date at the tm_unz format */
-void change_file_date(filename,dosdate,tmu_date)
- const char *filename;
- uLong dosdate;
- tm_unz tmu_date;
+static void change_file_date(const char *filename,
+ uLong dosdate, tm_unz tmu_date)
{
#ifdef _WIN32
HANDLE hFile;
@@ -97,7 +95,8 @@ void change_file_date(filename,dosdate,tmu_date)
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
CloseHandle(hFile);
#else
-#ifdef unix || __APPLE__
+#if defined(unix) || defined(__APPLE__) || defined(__ANDROID__)
+ (void)dosdate;
struct utimbuf ut;
struct tm newdate;
newdate.tm_sec = tmu_date.tm_sec;
@@ -121,8 +120,7 @@ void change_file_date(filename,dosdate,tmu_date)
/* mymkdir and change_file_date are not 100 % portable
As I don't know well Unix, I wait feedback for the unix portion */
-int mymkdir(dirname)
- const char* dirname;
+static int mymkdir(const char* dirname)
{
int ret=0;
#ifdef _WIN32
@@ -135,8 +133,7 @@ int mymkdir(dirname)
return ret;
}
-int makedir (newdir)
- char *newdir;
+static int makedir(const char *newdir)
{
char *buffer ;
char *p;
@@ -185,13 +182,13 @@ int makedir (newdir)
return 1;
}
-void do_banner()
+static void do_banner()
{
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
}
-void do_help()
+static void do_help()
{
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
" -e Extract without pathname (junk paths)\n" \
@@ -203,7 +200,7 @@ void do_help()
" -p extract crypted file using password\n\n");
}
-void Display64BitsSize(ZPOS64_T n, int size_char)
+static void Display64BitsSize(ZPOS64_T n, int size_char)
{
/* to avoid compatibility problem , we do here the conversion */
char number[21];
@@ -231,7 +228,7 @@ void Display64BitsSize(ZPOS64_T n, int size_char)
printf("%s",&number[pos_string]);
}
-int do_list(uf)
+static int do_list(uf)
unzFile uf;
{
uLong i;
@@ -309,7 +306,7 @@ int do_list(uf)
}
-int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
+static int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
unzFile uf;
const int* popt_extract_without_path;
int* popt_overwrite;
@@ -472,7 +469,7 @@ int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
}
-int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
+static int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
unzFile uf;
int opt_extract_without_path;
int opt_overwrite;
@@ -508,7 +505,7 @@ int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
return 0;
}
-int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
+static int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
unzFile uf;
const char* filename;
int opt_extract_without_path;
diff --git a/src/contrib/minizip/minizip.c b/src/contrib/minizip/minizip.c
index a891af0..ab228c6 100644
--- a/src/contrib/minizip/minizip.c
+++ b/src/contrib/minizip/minizip.c
@@ -28,7 +28,7 @@
#endif
#endif
-#if defined(__APPLE__) || defined(__ANDROID__)
+#if defined(__APPLE__) || defined(IOAPI_NO_64)
// In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions
#define FOPEN_FUNC(filename, mode) fopen(filename, mode)
#define FTELLO_FUNC(stream) ftello(stream)
@@ -71,10 +71,7 @@
#define MAXFILENAME (256)
#ifdef _WIN32
-uLong filetime(f, tmzip, dt)
- char *f; /* name of file to get info on */
- tm_zip *tmzip; /* return value: access, modific. and creation times */
- uLong *dt; /* dostime */
+static uLong filetime(const char *f, tm_zip *tmzip, uLong *dt)
{
int ret = 0;
{
@@ -94,11 +91,8 @@ 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 */
- tm_zip *tmzip; /* return value: access, modific. and creation times */
- uLong *dt; /* dostime */
+#if defined(unix) || (__APPLE__) || defined(__ANDROID__)
+static uLong filetime(const char *f, tm_zip *tmzip, uLong *dt)
{
int ret=0;
struct stat s; /* results of stat() */
@@ -133,11 +127,11 @@ uLong filetime(f, tmzip, dt)
tmzip->tm_mday = filedate->tm_mday;
tmzip->tm_mon = filedate->tm_mon ;
tmzip->tm_year = filedate->tm_year;
-
+ (void)dt;
return ret;
}
#else
-uLong filetime(f, tmzip, dt)
+static uLong filetime(f, tmzip, dt)
char *f; /* name of file to get info on */
tm_zip *tmzip; /* return value: access, modific. and creation times */
uLong *dt; /* dostime */
@@ -150,7 +144,7 @@ uLong filetime(f, tmzip, dt)
-int check_exist_file(filename)
+static int check_exist_file(filename)
const char* filename;
{
FILE* ftestexist;
@@ -163,13 +157,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 +176,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;
@@ -221,7 +215,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;