diff options
Diffstat (limited to '')
-rw-r--r-- | deflate.3 | 173 |
1 files changed, 6 insertions, 167 deletions
diff --git a/deflate.3 b/deflate.3 index 96b2921..2195cdf 100644 --- a/deflate.3 +++ b/deflate.3 @@ -3,9 +3,7 @@ .Os . .Sh NAME -.Nm deflate , -.Nm deflateInit , -.Nm deflateEnd +.Nm deflate .Nd deflate compression . .Sh LIBRARY @@ -14,129 +12,9 @@ .Sh SYNOPSIS .In zlib.h .Ft int -.Fn deflateInit "z_streamp strm" "int level" -.Ft int .Fn deflate "z_streamp strm" "int flush" -.Ft int -.Fn deflateEnd "z_streamp strm" . .Sh DESCRIPTION -The -.Vt z_streamp -type is defined as follows: -. -.Bd -literal -offset indent -typedef voidpf (*alloc_func) (voidpf opaque, uInt items, uInt size); -typedef void (*free_func) (voidpf opaque, voidpf address); - -typedef struct z_stream_s { - z_const Bytef *next_in; - uInt avail_in; - uLong total_in; - - Bytef *next_out; - uInt avail_out; - uLong total_out; - - z_const char *msg; - struct internal_state FAR *state; - - alloc_func zalloc; - free_func zfree; - voidpf opaque; - - int data_type; - uLong adler; - uLong reserved; -} z_stream; - -typedef z_stream FAR *z_streamp; -.Ed -. -.Pp -The fields of -.Vt z_stream -are as follows: -. -.Bl -tag -width "data_type" -.It Fa next_in -next input byte -.It Fa avail_in -number of bytes available at -.Fa next_in -.It Fa total_in -total number of input bytes read so far -.It Fa next_out -next output byte will go here -.It Fa avail_out -remaining free space at -.Fa next_out -.It Fa total_out -total number of bytes output so far -.It Fa msg -last error message, -.Dv NULL -if no error -.It Fa state -not visible by applications -.It Fa zalloc -used to allocate the internal state -.It Fa zfree -used to free the internal state -.It Fa opaque -private data object passed to -.Fa zalloc -and -.Fa zfree -.It data_type -best guess about the data type: -binary or text for -.Fn deflate , -or the decoding state for -.Xr inflate 3 -.It adler -Adler-32 or CRC-32 value of the uncompressed data -.It reserved -reserved for future use -.El -. -.Pp -.Fn deflateInit -initializes the internal stream state for compression. -The fields -.Fa zalloc , -.Fa zfree -and -.Fa opaque -must be initialized before by the caller. -If -.Fa zalloc -and -.Fa zfree -are set to -.Dv Z_NULL , -.Fn deflateInit -updates them to use default allocation functions. -.Fn deflateInit -does not perform any compression: -this will be done by -.Fn deflate . -. -.Pp -The compression -.Fa level -must be -.Dv Z_DEFAULT_COMPRESSION , -or between 0 and 9: -1 gives best speed, -9 gives best compression, -0 gives no compression at all -(the input data is simply copied a block at a time). -.Dv Z_DEFAULT_COMPRESSION -requests a default compromise between speed and compression -(currently equivalent to level 6). -. -.Pp .Fn deflate compresses as much data as possible, and stops when the input buffer becomes empty @@ -373,14 +251,14 @@ has returned the only possible operations on the stream are .Xr deflateReset 3 or -.Fn deflateEnd . +.Xr deflateEnd 3 . . .Pp .Dv Z_FINISH can be used in the first .Fn deflate call after -.Fn deflateInit +.Xr deflateInit 3 if all the compression is to be done in a single step. In order to complete in one call, .Fa avail_out @@ -430,35 +308,7 @@ the date is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. . -.Pp -.Fn deflateEnd -causes all dynamically allocated data structures -for this stream to be freed. -This function discards any unprocessed input -and does not flush any pending output. -. .Sh RETURN VALUES -.Fn deflateInit -returns -.Dv Z_OK -if success, -.Dv Z_MEM_ERROR -if there was not enough memory, -.Dv Z_STREAM_ERROR -if -.Fa level -is not a valid compression level, -or -.Dv Z_VERSION_ERROR -if the zlib library version -.Pq Xr zlibVersion 3 -is incompatible with the version assumed by the caller -.Pq Dv ZLIB_VERSION . -.Fa msg -is set to null -if there is no error message. -. -.Pp .Fn deflate returns .Dv Z_OK @@ -503,17 +353,6 @@ and can be called again with more input and more output space to continue compressing. . -.Pp -.Fn deflateEnd -returns -.Dv Z_OK -if success, -.Dv Z_STREAM_ERROR -if the stream state was inconsistent, -.Dv Z_DATA_ERROR -if the stream was freed prematurely -(some input or output was discarded). -In the error case, -.Fa msg -may be set but then points to a static string -(which must not be deallocated). +.Sh SEE ALSO +.Xr deflateEnd 3 , +.Xr deflateInit 3 |