From 6edea1d9c718631c89e7bb44b6fb4d749750a360 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 28 Aug 2015 21:35:09 +0200 Subject: [PATCH] Create compat versions of zlib.h and zutil.h --- deps/zlib/adler32.c | 2 +- deps/zlib/compress.c | 2 +- deps/zlib/deflate.h | 2 +- deps/zlib/gzguts.h | 2 +- deps/zlib/infback.c | 2 +- deps/zlib/inffast.c | 2 +- deps/zlib/inflate.c | 2 +- deps/zlib/inftrees.c | 2 +- deps/zlib/ioapi.h | 2 +- deps/zlib/uncompr.c | 2 +- deps/zlib/unzip.c | 2 +- deps/zlib/unzip.h | 2 +- deps/zlib/zutil.c | 2 +- libretro-common/file/file_extract.c | 2 +- .../zlib => libretro-common/include/compat}/zlib.h | 11 +++++++++++ .../zlib => libretro-common/include/compat}/zutil.h | 13 ++++++++++++- libretro-common/utils/crc32.c | 3 ++- 17 files changed, 39 insertions(+), 16 deletions(-) rename {deps/zlib => libretro-common/include/compat}/zlib.h (99%) rename {deps/zlib => libretro-common/include/compat}/zutil.h (98%) diff --git a/deps/zlib/adler32.c b/deps/zlib/adler32.c index cccb3a2999..a7abb77725 100644 --- a/deps/zlib/adler32.c +++ b/deps/zlib/adler32.c @@ -8,7 +8,7 @@ #define ZLIB_INTERNAL #include #include -#include "zutil.h" +#include #define BASE 65521UL /* largest prime smaller than 65536 */ #define NMAX 5552 diff --git a/deps/zlib/compress.c b/deps/zlib/compress.c index 48465bd77a..b30cec47e9 100644 --- a/deps/zlib/compress.c +++ b/deps/zlib/compress.c @@ -6,7 +6,7 @@ /* @(#) $Id$ */ #define ZLIB_INTERNAL -#include "zlib.h" +#include /* =========================================================================== Compresses the source buffer into the destination buffer. The level diff --git a/deps/zlib/deflate.h b/deps/zlib/deflate.h index 82fe93e224..e284189775 100644 --- a/deps/zlib/deflate.h +++ b/deps/zlib/deflate.h @@ -13,7 +13,7 @@ #ifndef DEFLATE_H #define DEFLATE_H -#include "zutil.h" +#include /* define NO_GZIP when compiling if you want to disable gzip header and trailer creation by deflate(). NO_GZIP would be used to avoid linking in diff --git a/deps/zlib/gzguts.h b/deps/zlib/gzguts.h index 6068d41957..d0b51066bb 100644 --- a/deps/zlib/gzguts.h +++ b/deps/zlib/gzguts.h @@ -22,7 +22,7 @@ #endif #include -#include "zlib.h" +#include #ifdef STDC # include # include diff --git a/deps/zlib/infback.c b/deps/zlib/infback.c index 7206cde5c2..d8f91e3db5 100644 --- a/deps/zlib/infback.c +++ b/deps/zlib/infback.c @@ -10,7 +10,7 @@ inflate_fast() can be used with either inflate.c or infback.c. */ -#include "zutil.h" +#include #include "inftrees.h" #include "inflate.h" #include "inffast.h" diff --git a/deps/zlib/inffast.c b/deps/zlib/inffast.c index a88859f37d..01fe74a465 100644 --- a/deps/zlib/inffast.c +++ b/deps/zlib/inffast.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "zutil.h" +#include #include "inftrees.h" #include "inflate.h" #include "inffast.h" diff --git a/deps/zlib/inflate.c b/deps/zlib/inflate.c index 0b4f0b7825..dfef06ecc1 100644 --- a/deps/zlib/inflate.c +++ b/deps/zlib/inflate.c @@ -80,7 +80,7 @@ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. */ -#include "zutil.h" +#include #include "inftrees.h" #include "inflate.h" #include "inffast.h" diff --git a/deps/zlib/inftrees.c b/deps/zlib/inftrees.c index 8b8a9648f1..8ef80d6731 100644 --- a/deps/zlib/inftrees.c +++ b/deps/zlib/inftrees.c @@ -3,7 +3,7 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ -#include "zutil.h" +#include #include "inftrees.h" #define MAXBITS 15 diff --git a/deps/zlib/ioapi.h b/deps/zlib/ioapi.h index a6332ed3d9..daf2556634 100644 --- a/deps/zlib/ioapi.h +++ b/deps/zlib/ioapi.h @@ -42,7 +42,7 @@ #include #include -#include "zlib.h" +#include #if defined(USE_FILE32API) #define fopen64 fopen diff --git a/deps/zlib/uncompr.c b/deps/zlib/uncompr.c index c7e30b3c7a..0697ed8dc1 100644 --- a/deps/zlib/uncompr.c +++ b/deps/zlib/uncompr.c @@ -6,7 +6,7 @@ /* @(#) $Id$ */ #define ZLIB_INTERNAL -#include "zlib.h" +#include /* =========================================================================== Decompresses the source buffer into the destination buffer. sourceLen is diff --git a/deps/zlib/unzip.c b/deps/zlib/unzip.c index 8f5730d25b..873cb4d855 100644 --- a/deps/zlib/unzip.c +++ b/deps/zlib/unzip.c @@ -72,7 +72,7 @@ #define NOUNCRYPT #endif -#include "zlib.h" +#include #include "unzip.h" #ifdef STDC diff --git a/deps/zlib/unzip.h b/deps/zlib/unzip.h index 3183968b77..1ceb5846b7 100644 --- a/deps/zlib/unzip.h +++ b/deps/zlib/unzip.h @@ -48,7 +48,7 @@ extern "C" { #endif #ifndef _ZLIB_H -#include "zlib.h" +#include #endif #ifndef _ZLIBIOAPI_H diff --git a/deps/zlib/zutil.c b/deps/zlib/zutil.c index c9353fe56d..4bcceb536a 100644 --- a/deps/zlib/zutil.c +++ b/deps/zlib/zutil.c @@ -5,7 +5,7 @@ /* @(#) $Id$ */ -#include "zutil.h" +#include #ifndef Z_SOLO # include "gzguts.h" #endif diff --git a/libretro-common/file/file_extract.c b/libretro-common/file/file_extract.c index f682b6dfab..40105609df 100644 --- a/libretro-common/file/file_extract.c +++ b/libretro-common/file/file_extract.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include /* File backends. Can be fleshed out later, but keep it simple for now. * The file is mapped to memory directly (via mmap() or just diff --git a/deps/zlib/zlib.h b/libretro-common/include/compat/zlib.h similarity index 99% rename from deps/zlib/zlib.h rename to libretro-common/include/compat/zlib.h index aa5935d22f..bf3d53db40 100644 --- a/deps/zlib/zlib.h +++ b/libretro-common/include/compat/zlib.h @@ -1,3 +1,8 @@ +#ifndef _COMPAT_ZLIB_H +#define _COMPAT_ZLIB_H + +#ifdef WANT_ZLIB + /* zlib.h -- interface of the 'zlib' general purpose compression library version 1.2.8, April 28th, 2013 @@ -1761,3 +1766,9 @@ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, #endif #endif /* ZLIB_H */ + +#else +#include +#endif + +#endif diff --git a/deps/zlib/zutil.h b/libretro-common/include/compat/zutil.h similarity index 98% rename from deps/zlib/zutil.h rename to libretro-common/include/compat/zutil.h index 5c6929f40b..8aebee91f8 100644 --- a/deps/zlib/zutil.h +++ b/libretro-common/include/compat/zutil.h @@ -1,3 +1,8 @@ +#ifndef _COMPAT_ZUTIL_H +#define _COMPAT_ZUTIL_H + +#ifdef WANT_ZLIB + /* zutil.h -- internal interface and configuration of the compression library * Copyright (C) 1995-2013 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h @@ -19,7 +24,7 @@ # define ZLIB_INTERNAL #endif -#include "zlib.h" +#include #if defined(STDC) && !defined(Z_SOLO) # if !(defined(_WIN32_WCE) && defined(_MSC_VER)) @@ -251,3 +256,9 @@ extern char * const z_errmsg[10]; /* indexed by 2-zlib_error */ (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) #endif /* ZUTIL_H */ + +#else +#include +#endif + +#endif diff --git a/libretro-common/utils/crc32.c b/libretro-common/utils/crc32.c index 6ccb866bb0..d56c0702d3 100644 --- a/libretro-common/utils/crc32.c +++ b/libretro-common/utils/crc32.c @@ -1,10 +1,11 @@ /* gcc -O3 -o crc32 crc32.c -lz */ #include -#include #include #include +#include + int main(int argc, const char* argv[]) { if (argc != 2 )