summaryrefslogtreecommitdiff
path: root/lib/libz
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-07-25 17:29:52 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-07-25 17:29:52 +0000
commit17077cb78293de34a6883faf467e5e6c44dc0ae9 (patch)
treec530672ff5f4a9e4cf06be365d998d287c87c365 /lib/libz
parent6cd794485b453df35d9bb32e2335bafa35f572b4 (diff)
document deflateUsed()
text mostly from upstream, the function will soon be added to libz. ok jmc
Diffstat (limited to 'lib/libz')
-rw-r--r--lib/libz/compress.324
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/libz/compress.3 b/lib/libz/compress.3
index b5d1e74f1e2..18a8ac1ed6f 100644
--- a/lib/libz/compress.3
+++ b/lib/libz/compress.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: compress.3,v 1.30 2024/07/25 17:25:59 tb Exp $
+.\" $OpenBSD: compress.3,v 1.31 2024/07/25 17:29:51 tb Exp $
.\"
.\" Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
.\"
@@ -42,6 +42,7 @@
.Nm deflateTune ,
.Nm deflateBound ,
.Nm deflatePending ,
+.Nm deflateUsed ,
.Nm deflatePrime ,
.Nm deflateSetHeader ,
.Nm inflateInit2 ,
@@ -138,6 +139,8 @@ Advanced functions
.Ft int
.Fn deflatePending "z_streamp strm" "unsigned *pending" "int *bits"
.Ft int
+.Fn deflateUsed "z_streamp strm" "int *bits"
+.Ft int
.Fn deflatePrime "z_streamp strm" "int bits" "int value"
.Ft int
.Fn deflateSetHeader "z_streamp strm" "gz_headerp head"
@@ -1516,6 +1519,25 @@ if success, or
if the source stream state was inconsistent.
.It Xo
.Fa int
+.Fn deflateUsed "z_streamp strm" "int *bits" ;
+.Xc
+.Pp
+.Fn deflateUsed
+returns in
+.Pf * Fa bits
+the most recent number of deflate bits used in the last byte
+when flushing to a byte boundary.
+The result is in the range 1..8, or 0 if there has not yet been a flush.
+This helps determine the location of the last bit of a deflate stream.
+.Pp
+.Fn deflateUsed
+returns
+.Dv Z_OK
+if success, or
+.Dv Z_STREAM_ERROR
+if the source stream state was inconsistent.
+.It Xo
+.Fa int
.Fn deflatePrime "z_streamp strm" "int bits" "int value" ;
.Xc
.Pp