X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=deps%2Flibchdr%2Fdeps%2Fzlib-1.3.1%2Fcontrib%2Fminizip%2Fminizip.c;fp=deps%2Flibchdr%2Fdeps%2Fzlib-1.2.13%2Fcontrib%2Fminizip%2Fminizip.c;h=26ee8d029efe696120938626de9e3804711aa304;hb=648db22b0750712da893c306efcc8e4b2d3a4e3c;hp=e8561b15f91f72c3c1cf76ef197dc07341253f00;hpb=e2fb1389dc12376acb84e4993ed3b08760257252;p=pcsx_rearmed.git diff --git a/deps/libchdr/deps/zlib-1.2.13/contrib/minizip/minizip.c b/deps/libchdr/deps/zlib-1.3.1/contrib/minizip/minizip.c similarity index 91% rename from deps/libchdr/deps/zlib-1.2.13/contrib/minizip/minizip.c rename to deps/libchdr/deps/zlib-1.3.1/contrib/minizip/minizip.c index e8561b15..26ee8d02 100644 --- a/deps/libchdr/deps/zlib-1.2.13/contrib/minizip/minizip.c +++ b/deps/libchdr/deps/zlib-1.3.1/contrib/minizip/minizip.c @@ -28,7 +28,7 @@ #endif #endif -#ifdef __APPLE__ +#if defined(__APPLE__) || defined(__HAIKU__) || defined(MINIZIP_FOPEN_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,11 +71,9 @@ #define MAXFILENAME (256) #ifdef _WIN32 -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 */ -{ +/* f: name of file to get info on, tmzip: return value: access, + modification and creation times, dt: dostime */ +static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { int ret = 0; { FILETIME ftLocal; @@ -95,11 +93,9 @@ static int filetime(f, tmzip, dt) } #else #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 */ -{ +/* f: name of file to get info on, tmzip: return value: access, + modification and creation times, dt: dostime */ +static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { (void)dt; int ret=0; struct stat s; /* results of stat() */ @@ -114,7 +110,7 @@ static int filetime(f, tmzip, dt) len = MAXFILENAME; strncpy(name, f,MAXFILENAME-1); - /* strncpy doesnt append the trailing NULL, of the string is too long. */ + /* strncpy doesn't append the trailing NULL, of the string is too long. */ name[ MAXFILENAME ] = '\0'; if (name[len - 1] == '/') @@ -138,11 +134,12 @@ static int filetime(f, tmzip, dt) return ret; } #else -uLong 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 */ -{ +/* f: name of file to get info on, tmzip: return value: access, + modification and creation times, dt: dostime */ +static int filetime(const char *f, tm_zip *tmzip, uLong *dt) { + (void)f; + (void)tmzip; + (void)dt; return 0; } #endif @@ -151,9 +148,7 @@ uLong filetime(f, tmzip, dt) -static int check_exist_file(filename) - const char* filename; -{ +static int check_exist_file(const char* filename) { FILE* ftestexist; int ret = 1; ftestexist = FOPEN_FUNC(filename,"rb"); @@ -164,14 +159,12 @@ static int check_exist_file(filename) return ret; } -static void do_banner() -{ +static void do_banner(void) { 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"); } -static void do_help() -{ +static void do_help(void) { printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] [-j] file.zip [files_to_add]\n\n" \ " -o Overwrite existing file.zip\n" \ " -a Append to existing file.zip\n" \ @@ -183,8 +176,7 @@ static void do_help() /* calculate the CRC32 of a file, because to encrypt a file, we need known the CRC32 of the file before */ -static 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; FILE * fin = FOPEN_FUNC(filenameinzip,"rb"); @@ -222,8 +214,7 @@ static int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf, return err; } -static int isLargeFile(const char* filename) -{ +static int isLargeFile(const char* filename) { int largeFile = 0; ZPOS64_T pos = 0; FILE* pFile = FOPEN_FUNC(filename, "rb"); @@ -233,7 +224,7 @@ static int isLargeFile(const char* filename) FSEEKO_FUNC(pFile, 0, SEEK_END); pos = (ZPOS64_T)FTELLO_FUNC(pFile); - printf("File : %s is %lld bytes\n", filename, pos); + printf("File : %s is %llu bytes\n", filename, pos); if(pos >= 0xffffffff) largeFile = 1; @@ -244,10 +235,7 @@ static int isLargeFile(const char* filename) return largeFile; } -int main(argc,argv) - int argc; - char *argv[]; -{ +int main(int argc, char *argv[]) { int i; int opt_overwrite=0; int opt_compress_level=Z_DEFAULT_COMPRESSION; @@ -323,7 +311,7 @@ int main(argc,argv) zipok = 1 ; strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1); - /* strncpy doesnt append the trailing NULL, of the string is too long. */ + /* strncpy doesn't append the trailing NULL, of the string is too long. */ filename_try[ MAXFILENAME ] = '\0'; len=(int)strlen(filename_try); @@ -393,10 +381,10 @@ int main(argc,argv) ((argv[i][1]=='o') || (argv[i][1]=='O') || (argv[i][1]=='a') || (argv[i][1]=='A') || (argv[i][1]=='p') || (argv[i][1]=='P') || - ((argv[i][1]>='0') || (argv[i][1]<='9'))) && + ((argv[i][1]>='0') && (argv[i][1]<='9'))) && (strlen(argv[i]) == 2))) { - FILE * fin; + FILE * fin = NULL; size_t size_read; const char* filenameinzip = argv[i]; const char *savefilenameinzip;