From 3d85f02a098baeede07c7d8fcc5b147e805f127b Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Sun, 18 Dec 2011 14:47:08 -0800 Subject: [PATCH] Restore gzgetc function for binary compatibility. Newly compiled applications will use the gzgetc macro. --- as400/bndsrc | 1 + as400/zlib.inc | 3 +++ contrib/vstudio/vc10/zlibvc.def | 1 + contrib/vstudio/vc9/zlibvc.def | 1 + gzread.c | 12 ++++++++---- win32/zlib.def | 1 + zlib.h | 2 +- 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/as400/bndsrc b/as400/bndsrc index 3e26283d..a7df67bb 100644 --- a/as400/bndsrc +++ b/as400/bndsrc @@ -53,6 +53,7 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB') EXPORT SYMBOL("gzputs") EXPORT SYMBOL("gzgets") EXPORT SYMBOL("gzputc") + EXPORT SYMBOL("gzgetc") EXPORT SYMBOL("gzflush") EXPORT SYMBOL("gzseek") EXPORT SYMBOL("gzrewind") diff --git a/as400/zlib.inc b/as400/zlib.inc index d710e13d..20e32282 100644 --- a/as400/zlib.inc +++ b/as400/zlib.inc @@ -186,6 +186,9 @@ D file value like(gzFile) File pointer D c 10I 0 value Character to write * + D gzgetc PR 10i 0 extproc('gzgetc') + D file value like(gzFile) File pointer + * D gzgetc_ PR 10i 0 extproc('gzgetc_') D file value like(gzFile) File pointer * diff --git a/contrib/vstudio/vc10/zlibvc.def b/contrib/vstudio/vc10/zlibvc.def index 55218854..6bc1e602 100644 --- a/contrib/vstudio/vc10/zlibvc.def +++ b/contrib/vstudio/vc10/zlibvc.def @@ -33,6 +33,7 @@ EXPORTS zlibVersion @27 gzprintf @28 gzputc @29 + gzgetc @30 gzseek @31 gzrewind @32 gztell @33 diff --git a/contrib/vstudio/vc9/zlibvc.def b/contrib/vstudio/vc9/zlibvc.def index 55218854..6bc1e602 100644 --- a/contrib/vstudio/vc9/zlibvc.def +++ b/contrib/vstudio/vc9/zlibvc.def @@ -33,6 +33,7 @@ EXPORTS zlibVersion @27 gzprintf @28 gzputc @29 + gzgetc @30 gzseek @31 gzrewind @32 gztell @33 diff --git a/gzread.c b/gzread.c index 09e58636..46d40e0b 100644 --- a/gzread.c +++ b/gzread.c @@ -390,10 +390,7 @@ int ZEXPORT gzgetc_(file) (state->err != Z_OK && state->err != Z_BUF_ERROR)) return -1; - /* try output buffer (no need to check for skip request) -- while - this check really isn't required since the gzgetc() macro has - already determined that x.have is zero, we leave it in for - completeness. */ + /* try output buffer (no need to check for skip request) */ if (state->x.have) { state->x.have--; state->x.pos++; @@ -405,6 +402,13 @@ int ZEXPORT gzgetc_(file) return ret < 1 ? -1 : buf[0]; } +#undef gzgetc +int ZEXPORT gzgetc(file) +gzFile file; +{ + return gzgetc_(file); +} + /* -- see zlib.h -- */ int ZEXPORT gzungetc(c, file) int c; diff --git a/win32/zlib.def b/win32/zlib.def index 21bff1f8..d96c18ae 100644 --- a/win32/zlib.def +++ b/win32/zlib.def @@ -42,6 +42,7 @@ EXPORTS gzputs gzgets gzputc + gzgetc gzungetc gzflush gzseek diff --git a/zlib.h b/zlib.h index 4364ccfc..9ca20d73 100644 --- a/zlib.h +++ b/zlib.h @@ -1363,8 +1363,8 @@ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); returns the value that was written, or -1 in case of error. */ -/* ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. This is implemented as a macro for speed. As such, it does not do all of the checking the other functions do. I.e.