2 ============================================================================
3 LZO -- a real-time data compression library LIBRARY REFERENCE
4 ============================================================================
7 [ please read LZO.FAQ first ]
13 1 Introduction to the LZO Library Reference
18 2.2 Public integral types
19 2.3 Public pointer types
20 2.4 Public function types
27 3.6 Checksum functions
33 1 Introduction to the LZO Library Reference
34 =============================================
40 - 'C90' is short for ISO 9899-1990, the ANSI/ISO standard for the C
47 This section briefly describes the headers.
51 Contains definitions for the basic integral and pointer types,
52 provides wrappers for the library calling conventions, defines
53 error codes and contains prototypes for the generic functions.
54 This file is automatically included by all LZO headers.
66 These files provide definitions and prototypes for the
67 actual (de-)compression functions.
78 The documentation indicates that LZO requires 32-bit integers. It's
79 not the integer size that really matters, though, but the memory
80 model. If your memory model allows to access pointers at 32-bit
81 offsets, then there is no problem at all - LZO works fine on my
82 old Atari ST, which has 16 bit integers and a flat 32-bit memory model.
83 Using 'huge' 32-bit pointers under 16-bit DOS is a workaround for this.
85 While LZO also works with a strict 16-bit memory model, I don't officially
86 support this because this limits the maximum block size to 64 KiB - and this
87 makes the library incompatible with other platforms, i.e. you cannot
88 decompress larger blocks compressed on those platforms.
91 2.2 Public integral types
92 -------------------------
96 used as size_t, must be 32 bits or more for compatibility reasons
100 *must* be 32 bits or more
104 can store the values 0 ("false") and 1 ("true")
108 unsigned char (memory model specific)
111 2.3 Public pointer types
112 ------------------------
114 All pointer types are memory model specific.
122 pointer to unsigned char
126 array of pointers to unsigned char
129 2.4 Public function types
130 -------------------------
149 int lzo_init ( void );
151 This function initializes the LZO library. It must be the first LZO
152 function you call, and you cannot use any of the other LZO library
153 functions if the call fails.
156 Returns LZO_E_OK on success, error code otherwise.
159 This function is actually implemented using a macro.
165 All compressors compress the memory block at 'src' with the uncompressed
166 length 'src_len' to the address given by 'dst'.
167 The length of the compressed blocked will be returned in the variable
168 pointed by 'dst_len'.
170 The two blocks may overlap under certain conditions (see examples/overlap.c),
171 thereby allowing "in-place" compression.
174 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175 #include <lzo/lzo1x.h>
177 int lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
178 lzo_bytep dst, lzo_uintp dst_len,
182 Compression level: LZO1X-1
183 Memory requirements: LZO1X_1_MEM_COMPRESS (64 KiB on 32-bit machines)
185 This compressor is pretty fast.
188 Always returns LZO_E_OK (this function can never fail).
190 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191 #include <lzo/lzo1x.h>
193 int lzo1x_999_compress ( const lzo_bytep src, lzo_uint src_len,
194 lzo_bytep dst, lzo_uintp dst_len,
198 Compression level: LZO1X-999
199 Memory requirements: LZO1X_999_MEM_COMPRESS (448 KiB on 32-bit machines)
201 This compressor is quite slow but achieves a good compression
202 ratio. It is mainly intended for generating pre-compressed data.
205 Always returns LZO_E_OK (this function can never fail).
208 [ ... lots of other compressors which all follow the same principle ... ]
215 All decompressors decompress the memory block at 'src' with the compressed
216 length 'src_len' to the address given by 'dst'.
217 The length of the decompressed block will be returned in the variable
218 pointed by 'dst_len' - on error the number of bytes that have
219 been decompressed so far will be returned.
221 The safe decompressors expect that the number of bytes available in
222 the 'dst' block is passed via the variable pointed by 'dst_len'.
224 The two blocks may overlap under certain conditions (see examples/overlap.c),
225 thereby allowing "in-place" decompression.
228 Description of return values:
233 LZO_E_INPUT_NOT_CONSUMED
234 The end of the compressed block has been detected before all
235 bytes in the compressed block have been used.
236 This may actually not be an error (if 'src_len' is too large).
239 The decompressor requested more bytes from the compressed
240 block than available.
241 Your data is corrupted (or 'src_len' is too small).
244 The decompressor requested to write more bytes to the uncompressed
245 block than available.
246 Either your data is corrupted, or you should increase the number of
247 available bytes passed in the variable pointed by 'dst_len'.
249 LZO_E_LOOKBEHIND_OVERRUN
250 Your data is corrupted.
253 No EOF code was found in the compressed block.
254 Your data is corrupted (or 'src_len' is too small).
257 Any other error (data corrupted).
260 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263 int lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
264 lzo_bytep dst, lzo_uintp dst_len,
268 Memory requirements: 0
271 [ ... lots of other decompressors which all follow the same principle ... ]
278 The variables are listed alphabetically.
280 [ no public variables yet ]
284 --------------------------- END OF LZOAPI.TXT ------------------------------