# Paths to static and dynamic zlib and zstd libraries
ifneq (,$(filter Windows%,$(OS)))
-STATICLIB = ../../zlib/libz.a ../lib/libzstd.a
-IMPLIB = ../../zlib/libz.dll.a ../lib/libzstd.a
+ZLIBDIR = ../../zlib1.2.8
+STATICLIB = $(ZLIBDIR)/libz.a ../lib/libzstd.a
+IMPLIB = $(ZLIBDIR)/libz.dll.a ../lib/libzstd.a
else
STATICLIB = -static -lz ../lib/libzstd.a
IMPLIB = -lz ../lib/libzstd.a
ZLIBWRAPPER_PATH = .
EXAMPLE_PATH = examples
CC = gcc
-CFLAGS = $(LOC) -I../lib/common -I$(ZLIBWRAPPER_PATH) -O3 -Wall -std=gnu89
+CFLAGS = $(LOC) -I../lib/common -I$(ZLIBDIR) -I$(ZLIBWRAPPER_PATH) -O3 -Wall -std=gnu89
LDFLAGS = $(LOC)
RM = rm -f
-all: clean test testdll testzstd
+all: clean test testzstd
test: example
./example
#include <stdio.h> /* fprintf */
#include <stdlib.h> /* malloc */
+#include <stdarg.h> /* va_list */
#include <zlib.h>
#include "zstd_zlibwrapper.h"
#include "zstd.h"
}
+#if ZLIB_VERNUM >= 0x1260
ZEXTERN int ZEXPORT z_deflatePending OF((z_streamp strm,
unsigned *pending,
int *bits))
return deflatePending(strm, pending, bits);
FINISH_WITH_ERR("deflatePending is not supported!");
}
+#endif
ZEXTERN int ZEXPORT z_deflatePrime OF((z_streamp strm,
/* Advanced compression functions */
+#if ZLIB_VERNUM >= 0x1280
ZEXTERN int ZEXPORT z_inflateGetDictionary OF((z_streamp strm,
Bytef *dictionary,
uInt *dictLength))
return inflateGetDictionary(strm, dictionary, dictLength);
FINISH_WITH_ERR("inflateGetDictionary is not supported!");
}
-
+#endif
ZEXTERN int ZEXPORT z_inflateCopy OF((z_streamp dest,
}
+#if ZLIB_VERNUM >= 0x1240
ZEXTERN int ZEXPORT z_inflateReset2 OF((z_streamp strm,
int windowBits))
{
return inflateReset2(strm, windowBits);
FINISH_WITH_ERR("inflateReset2 is not supported!");
}
+#endif
-ZEXTERN int ZEXPORT z_inflatePrime OF((z_streamp strm,
- int bits,
- int value))
+#if ZLIB_VERNUM >= 0x1240
+ZEXTERN long ZEXPORT z_inflateMark OF((z_streamp strm))
{
if (!strm->reserved)
- return inflatePrime(strm, bits, value);
- FINISH_WITH_ERR("inflatePrime is not supported!");
+ return inflateMark(strm);
+ FINISH_WITH_ERR("inflateMark is not supported!");
}
+#endif
-ZEXTERN long ZEXPORT z_inflateMark OF((z_streamp strm))
+ZEXTERN int ZEXPORT z_inflatePrime OF((z_streamp strm,
+ int bits,
+ int value))
{
if (!strm->reserved)
- return inflateMark(strm);
- FINISH_WITH_ERR("inflateMark is not supported!");
+ return inflatePrime(strm, bits, value);
+ FINISH_WITH_ERR("inflatePrime is not supported!");
}
}
+#if ZLIB_VERNUM >= 0x1240
ZEXTERN int ZEXPORT z_gzbuffer OF((gzFile file, unsigned size))
{
if (!g_useZSTD)
}
+ZEXTERN z_off_t ZEXPORT z_gzoffset OF((gzFile file))
+{
+ if (!g_useZSTD)
+ return gzoffset(file);
+ FINISH_WITH_ERR("gzoffset is not supported!");
+}
+
+
+ZEXTERN int ZEXPORT z_gzclose_r OF((gzFile file))
+{
+ if (!g_useZSTD)
+ return gzclose_r(file);
+ FINISH_WITH_ERR("gzclose_r is not supported!");
+}
+
+
+ZEXTERN int ZEXPORT z_gzclose_w OF((gzFile file))
+{
+ if (!g_useZSTD)
+ return gzclose_w(file);
+ FINISH_WITH_ERR("gzclose_w is not supported!");
+}
+#endif
+
+
ZEXTERN int ZEXPORT z_gzsetparams OF((gzFile file, int level, int strategy))
{
if (!g_useZSTD)
}
+#if ZLIB_VERNUM >= 0x1260
ZEXTERN int ZEXPORTVA z_gzprintf Z_ARG((gzFile file, const char *format, ...))
+#else
+ZEXTERN int ZEXPORTVA z_gzprintf OF((gzFile file, const char *format, ...))
+#endif
{
if (!g_useZSTD) {
int ret;
}
+#if ZLIB_VERNUM == 0x1260
+ZEXTERN int ZEXPORT z_gzgetc_ OF((gzFile file))
+#else
ZEXTERN int ZEXPORT z_gzgetc OF((gzFile file))
+#endif
{
if (!g_useZSTD)
return gzgetc(file);
}
-ZEXTERN z_off_t ZEXPORT z_gzoffset OF((gzFile file))
-{
- if (!g_useZSTD)
- return gzoffset(file);
- FINISH_WITH_ERR("gzoffset is not supported!");
-}
-
-
ZEXTERN int ZEXPORT z_gzeof OF((gzFile file))
{
if (!g_useZSTD)
}
-ZEXTERN int ZEXPORT z_gzclose_r OF((gzFile file))
-{
- if (!g_useZSTD)
- return gzclose_r(file);
- FINISH_WITH_ERR("gzclose_r is not supported!");
-}
-
-
-ZEXTERN int ZEXPORT z_gzclose_w OF((gzFile file))
-{
- if (!g_useZSTD)
- return gzclose_w(file);
- FINISH_WITH_ERR("gzclose_w is not supported!");
-}
-
-
ZEXTERN const char * ZEXPORT z_gzerror OF((gzFile file, int *errnum))
{
if (!g_useZSTD)