From: Hans Kristian Rosbach Date: Wed, 1 Feb 2017 10:50:29 +0000 (+0100) Subject: Add inflateCodesUsed() function X-Git-Tag: 1.9.9-b1~740 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebc4db2f736881805100895b66ba2f2183380baf;p=thirdparty%2Fzlib-ng.git Add inflateCodesUsed() function Based on upstream commit 5370d99a2affe0b040550cffbc0ba8fa790594b3 --- diff --git a/inflate.c b/inflate.c index 1f715db56..f0a341501 100644 --- a/inflate.c +++ b/inflate.c @@ -1478,3 +1478,11 @@ long ZEXPORT inflateMark(z_stream *strm) { return ((long)(state->back) << 16) + (state->mode == COPY ? state->length : (state->mode == MATCH ? state->was - state->length : 0)); } + +unsigned long ZEXPORT inflateCodesUsed(z_stream *strm) { + struct inflate_state *state; + if (strm == NULL || strm->state == NULL) + return (unsigned long)0 - 1; + state = (struct inflate_state *)strm->state; + return (unsigned long)(state->next - state->codes); +} diff --git a/zlib.h b/zlib.h index 92e84e889..91bd18e9f 100644 --- a/zlib.h +++ b/zlib.h @@ -1712,6 +1712,7 @@ ZEXTERN int ZEXPORT inflateSyncPoint (z_stream *); ZEXTERN const uint32_t * ZEXPORT get_crc_table (void); ZEXTERN int ZEXPORT inflateUndermine (z_stream *, int); ZEXTERN int ZEXPORT inflateValidate (z_stream *, int); +ZEXTERN unsigned long ZEXPORT inflateCodesUsed (z_stream *); ZEXTERN int ZEXPORT inflateResetKeep (z_stream *); ZEXTERN int ZEXPORT deflateResetKeep (z_stream *);