]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Note the use of gzungetc() to run a deferred seek while reading.
authorMark Adler <madler@alumni.caltech.edu>
Sat, 4 Apr 2026 01:32:14 +0000 (18:32 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 29 Jul 2026 09:47:18 +0000 (11:47 +0200)
Upstream: https://github.com/madler/zlib/commit/a9bb8c48

zlib-ng.h.in
zlib.h.in

index fe6b6d88df2d68241674a27efd634aa47d3bb24d..4e44c4f4c610847f1e03f8ca4fa195f14b94d1e8 100644 (file)
@@ -1552,6 +1552,11 @@ int32_t zng_gzungetc(int32_t c, gzFile file);
    output buffer size of pushed characters is allowed.  (See gzbuffer above.)
    The pushed character will be discarded if the stream is repositioned with
    gzseek() or gzrewind().
+
+     gzungetc(-1, file) will force any pending seek to execute. Then gztell()
+   will report the position, even if the requested seek reached end of file.
+   This can be used to determine the number of uncompressed bytes in a gzip
+   file without having to read it into a buffer.
 */
 
 Z_EXTERN Z_EXPORT
index 25a80c4ef44dd52a7a0c88bbedbba3a100a2e2d5..188d25a2c64f438ea1a1b43e28b875de316669e2 100644 (file)
--- a/zlib.h.in
+++ b/zlib.h.in
@@ -1532,6 +1532,11 @@ Z_EXTERN int Z_EXPORT gzungetc(int c, gzFile file);
    output buffer size of pushed characters is allowed.  (See gzbuffer above.)
    The pushed character will be discarded if the stream is repositioned with
    gzseek() or gzrewind().
+
+     gzungetc(-1, file) will force any pending seek to execute. Then gztell()
+   will report the position, even if the requested seek reached end of file.
+   This can be used to determine the number of uncompressed bytes in a gzip
+   file without having to read it into a buffer.
 */
 
 Z_EXTERN int Z_EXPORT gzflush(gzFile file, int flush);