[zlib] Repeat local changes from zlib-1.2.3

This commit is contained in:
Sergey Konovalov
2018-10-10 18:39:00 +03:00
parent 2feb1ac8e8
commit 13900daf08
4 changed files with 37 additions and 18 deletions

View File

@ -1,5 +0,0 @@
all:
-@echo "Please use ./configure first. Thank you."
distclean:
make -f Makefile.in distclean

View File

@ -12,7 +12,7 @@
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
*/
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(_WIN64)) && (!defined(__APPLE__))
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64
#endif
@ -46,7 +46,7 @@
#include <errno.h>
#include <fcntl.h>
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
# include <direct.h>
# include <io.h>
#else
@ -61,7 +61,7 @@
#define WRITEBUFFERSIZE (8192)
#define MAXFILENAME (256)
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
#define USEWIN32IOAPI
#include "iowin32.h"
#endif
@ -85,7 +85,7 @@ void change_file_date(filename,dosdate,tmu_date)
uLong dosdate;
tm_unz tmu_date;
{
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
HANDLE hFile;
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
@ -97,7 +97,7 @@ void change_file_date(filename,dosdate,tmu_date)
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
CloseHandle(hFile);
#else
#ifdef unix || __APPLE__
#if defined(unix) || defined(_LINUX) || defined(__APPLE__)
struct utimbuf ut;
struct tm newdate;
newdate.tm_sec = tmu_date.tm_sec;
@ -120,12 +120,27 @@ 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 */
#ifdef __APPLE__
#if defined(_IOS) || defined(_MAC)
#include <sys/stat.h>
#endif
int mymkdir(const char* dirname)
{
#if defined(_IOS) || defined(_MAC)
return mkdir (dirname, (mode_t)0775);
#else
return sys_mkdir (dirname);
#endif
}
#else
int mymkdir(dirname)
const char* dirname;
{
int ret=0;
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
ret = _mkdir(dirname);
#elif unix
ret = mkdir (dirname,0775);
@ -134,6 +149,7 @@ int mymkdir(dirname)
#endif
return ret;
}
#endif
int makedir (newdir)
char *newdir;
@ -185,6 +201,7 @@ int makedir (newdir)
return 1;
}
#ifndef BUILD_ZLIB_AS_SOURCES
void do_banner()
{
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
@ -202,6 +219,7 @@ void do_help()
" -o overwrite files without prompting\n" \
" -p extract crypted file using password\n\n");
}
#endif
void Display64BitsSize(ZPOS64_T n, int size_char)
{
@ -531,6 +549,7 @@ int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,passwo
}
#ifndef BUILD_ZLIB_AS_SOURCES
int main(argc,argv)
int argc;
char *argv[];
@ -638,7 +657,7 @@ int main(argc,argv)
ret_value = do_list(uf);
else if (opt_do_extract==1)
{
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
if (opt_extractdir && _chdir(dirname))
#else
if (opt_extractdir && chdir(dirname))
@ -658,3 +677,4 @@ int main(argc,argv)
return ret_value;
}
#endif

View File

@ -13,7 +13,7 @@
*/
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(_WIN64)) && (!defined(__APPLE__))
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64
#endif
@ -48,7 +48,7 @@
#include <errno.h>
#include <fcntl.h>
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
# include <direct.h>
# include <io.h>
#else
@ -60,7 +60,7 @@
#include "zip.h"
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
#define USEWIN32IOAPI
#include "iowin32.h"
#endif
@ -70,7 +70,7 @@
#define WRITEBUFFERSIZE (16384)
#define MAXFILENAME (256)
#ifdef _WIN32
#if defined(_WIN32) || defined (_WIN64)
uLong filetime(f, tmzip, dt)
char *f; /* name of file to get info on */
tm_zip *tmzip; /* return value: access, modific. and creation times */
@ -94,7 +94,7 @@ uLong filetime(f, tmzip, dt)
return ret;
}
#else
#ifdef unix || __APPLE__
#if defined(unix) || defined(_LINUX) || 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 */
@ -163,6 +163,7 @@ int check_exist_file(filename)
return ret;
}
#ifndef BUILD_ZLIB_AS_SOURCES
void do_banner()
{
printf("MiniZip 1.1, demo of zLib + MiniZip64 package, written by Gilles Vollant\n");
@ -179,6 +180,7 @@ void do_help()
" -9 Compress better\n\n" \
" -j exclude path. store only the file name.\n\n");
}
#endif
/* calculate the CRC32 of a file,
because to encrypt a file, we need known the CRC32 of the file before */
@ -243,6 +245,7 @@ int isLargeFile(const char* filename)
return largeFile;
}
#ifndef BUILD_ZLIB_AS_SOURCES
int main(argc,argv)
int argc;
char *argv[];
@ -518,3 +521,4 @@ int main(argc,argv)
free(buf);
return 0;
}
#endif

View File

@ -147,7 +147,7 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define OS_CODE 13
#endif
#if defined(WIN32) && !defined(__CYGWIN__)
#if (defined(WIN32) || defined(_WIN32) || defined (_WIN64)) && !defined(__CYGWIN__)
# define OS_CODE 10
#endif