From b8e3800b549b46fd9d2c27c41fde3e993e47ad7a Mon Sep 17 00:00:00 2001 From: Ladislav Zezula Date: Wed, 13 May 2020 08:07:19 +0200 Subject: Minox fixes --- StormLib.bat | 23 ------ StormLib_vs08.vcproj | 32 ++++---- StormLib_vs17.bat | 44 ++++++++++ StormLib_vs17.vcxproj | 32 ++++---- src/zlib/gzguts.h | 218 ++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 294 insertions(+), 55 deletions(-) delete mode 100644 StormLib.bat create mode 100644 StormLib_vs17.bat create mode 100644 src/zlib/gzguts.h diff --git a/StormLib.bat b/StormLib.bat deleted file mode 100644 index c2cc7de..0000000 --- a/StormLib.bat +++ /dev/null @@ -1,23 +0,0 @@ -@echo off -rem Post-build batch for StormLib project -rem Called as StormLib.bat $(PlatformName) $(ConfigurationName) -rem Example: StormLib.bat x64 Debug - -if not exist ..\aaa goto exit - -copy src\StormPort.h ..\aaa\inc -copy src\StormLib.h ..\aaa\inc - -if x%1 == xWin32 goto PlatformWin32 -if x%1 == xx64 goto PlatformWin64 -goto exit - -:PlatformWin32 -copy .\bin\StormLib\%1\%2\*.lib ..\aaa\lib32 -goto exit - -:PlatformWin64 -copy .\bin\StormLib\%1\%2\*.lib ..\aaa\lib64 -goto exit - -:exit diff --git a/StormLib_vs08.vcproj b/StormLib_vs08.vcproj index dce22e1..3945360 100644 --- a/StormLib_vs08.vcproj +++ b/StormLib_vs08.vcproj @@ -80,7 +80,7 @@ /> diff --git a/StormLib_vs17.bat b/StormLib_vs17.bat new file mode 100644 index 0000000..153a276 --- /dev/null +++ b/StormLib_vs17.bat @@ -0,0 +1,44 @@ +@echo off +rem Build file for VS 2017 (expected in %ProgramFiles%\Microsoft Visual Studio\2017) + +rem Save the values of INCLUDE, LIB and PATH +set SAVE_INCLUDE=%INCLUDE% +set SAVE_LIB=%LIB% +set SAVE_PATH=%PATH% + +rem Determine where the program files are, both for 64-bit and 32-bit Windows +if exist "%ProgramFiles%" set PROGRAM_FILES_DIR=%ProgramFiles% +if exist "%ProgramFiles(x86)%" set PROGRAM_FILES_DIR=%ProgramFiles(x86)% + +rem Determine the installed version of Visual Studio (Professional/Enterprise) +if exist "%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" set VCVARS_BAT=%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat +if exist "%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" set VCVARS_BAT=%PROGRAM_FILES_DIR%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat + +:BUILD_32BIT +call "%VCVARS_BAT%" x86 +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugAD|Win32" +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugAS|Win32" +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugUD|Win32" +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugUS|Win32" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseAD|Win32" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseAS|Win32" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseUD|Win32" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseUS|Win32" +call :RestoreEnvVars + +:BUILD_64BIT +call "%VCVARS_BAT%" x64 +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugAD|x64" +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugAS|x64" +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugUD|x64" +devenv.com StormLib_vs17.sln /project "StormLib" /build "DebugUS|x64" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseAD|x64" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseAS|x64" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseUD|x64" +devenv.com StormLib_vs17.sln /project "StormLib" /build "ReleaseUS|x64" +call :RestoreEnvVars + +:RestoreEnvVars +set INCLUDE=%SAVE_INCLUDE% +set LIB=%SAVE_LIB% +set PATH=%SAVE_PATH% diff --git a/StormLib_vs17.vcxproj b/StormLib_vs17.vcxproj index 6e9cd3f..c86a44a 100644 --- a/StormLib_vs17.vcxproj +++ b/StormLib_vs17.vcxproj @@ -318,7 +318,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -338,7 +338,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -355,7 +355,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -375,7 +375,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -391,7 +391,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -410,7 +410,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -426,7 +426,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -445,7 +445,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -462,7 +462,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -482,7 +482,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -499,7 +499,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -519,7 +519,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -535,7 +535,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -554,7 +554,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -570,7 +570,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) @@ -589,7 +589,7 @@ ./bin/$(ProjectName)/$(Platform)/$(Configuration)/$(TargetName).lib - StormLib.bat $(Platform) $(Configuration) + PostBuild.bat $(Platform) $(Configuration) diff --git a/src/zlib/gzguts.h b/src/zlib/gzguts.h new file mode 100644 index 0000000..990a4d2 --- /dev/null +++ b/src/zlib/gzguts.h @@ -0,0 +1,218 @@ +/* gzguts.h -- zlib internal header definitions for gz* operations + * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#ifdef _LARGEFILE64_SOURCE +# ifndef _LARGEFILE_SOURCE +# define _LARGEFILE_SOURCE 1 +# endif +# ifdef _FILE_OFFSET_BITS +# undef _FILE_OFFSET_BITS +# endif +#endif + +#ifdef HAVE_HIDDEN +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include +#include "zlib.h" +#ifdef STDC +# include +# include +# include +#endif + +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE +#endif +#include + +#ifdef _WIN32 +# include +#endif + +#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) +# include +#endif + +#if defined(_WIN32) || defined(__CYGWIN__) +# define WIDECHAR +#endif + +#ifdef WINAPI_FAMILY +# define open _open +# define read _read +# define write _write +# define close _close +#endif + +#ifdef NO_DEFLATE /* for compatibility with old definition */ +# define NO_GZCOMPRESS +#endif + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif + +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS +/* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 +/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) +# define vsnprintf _vsnprintf +# endif +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +# ifdef VMS +# define NO_vsnprintf +# endif +# ifdef __OS400__ +# define NO_vsnprintf +# endif +# ifdef __MVS__ +# define NO_vsnprintf +# endif +#endif + +/* unlike snprintf (which is required in C99), _snprintf does not guarantee + null termination of the result -- however this is only used in gzlib.c where + the result is assured to fit in the space provided */ +#if defined(_MSC_VER) && _MSC_VER < 1900 +# define snprintf _snprintf +#endif + +#ifndef local +# define local static +#endif +/* since "static" is used to mean two completely different things in C, we + define "local" for the non-static meaning of "static", for readability + (compile with -Dlocal if your debugger can't find static symbols) */ + +/* gz* functions always use library allocation functions */ +#ifndef STDC + extern voidp malloc OF((uInt size)); + extern void free OF((voidpf ptr)); +#endif + +/* get errno and strerror definition */ +#if defined UNDER_CE +# include +# define zstrerror() gz_strwinerror((DWORD)GetLastError()) +#else +# ifndef NO_STRERROR +# include +# define zstrerror() strerror(errno) +# else +# define zstrerror() "stdio error (consult errno)" +# endif +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); +#endif + +/* default memLevel */ +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif + +/* default i/o buffer size -- double this for output when reading (this and + twice this must be able to fit in an unsigned type) */ +#define GZBUFSIZE 8192 + +/* gzip modes, also provide a little integrity check on the passed structure */ +#define GZ_NONE 0 +#define GZ_READ 7247 +#define GZ_WRITE 31153 +#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ + +/* values for gz_state how */ +#define LOOK 0 /* look for a gzip header */ +#define COPY 1 /* copy input directly */ +#define GZIP 2 /* decompress a gzip stream */ + +/* internal gzip file state data structure */ +typedef struct { + /* exposed contents for gzgetc() macro */ + struct gzFile_s x; /* "x" for exposed */ + /* x.have: number of bytes available at x.next */ + /* x.next: next output data to deliver or write */ + /* x.pos: current position in uncompressed data */ + /* used for both reading and writing */ + int mode; /* see gzip modes above */ + int fd; /* file descriptor */ + char *path; /* path or fd for error messages */ + unsigned size; /* buffer size, zero if not allocated yet */ + unsigned want; /* requested buffer size, default is GZBUFSIZE */ + unsigned char *in; /* input buffer (double-sized when writing) */ + unsigned char *out; /* output buffer (double-sized when reading) */ + int direct; /* 0 if processing gzip, 1 if transparent */ + /* just for reading */ + int how; /* 0: get header, 1: copy, 2: decompress */ + z_off64_t start; /* where the gzip data started, for rewinding */ + int eof; /* true if end of input file reached */ + int past; /* true if read requested past end */ + /* just for writing */ + int level; /* compression level */ + int strategy; /* compression strategy */ + /* seek request */ + z_off64_t skip; /* amount to skip (already rewound if backwards) */ + int seek; /* true if seek request pending */ + /* error information */ + int err; /* error code */ + char *msg; /* error message */ + /* zlib inflate or deflate stream */ + z_stream strm; /* stream structure in-place (not a pointer) */ +} gz_state; +typedef gz_state FAR *gz_statep; + +/* shared functions */ +void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); +#if defined UNDER_CE +char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); +#endif + +/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t + value -- needed when comparing unsigned to z_off64_t, which is signed + (possible z_off64_t types off_t, off64_t, and long are all signed) */ +#ifdef INT_MAX +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) +#else +unsigned ZLIB_INTERNAL gz_intmax OF((void)); +# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) +#endif -- cgit v1.2.3