1 /* wrap.h -- wrapper functions
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
6 Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
7 Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
8 Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
9 Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
10 Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
11 Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
12 Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
13 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
14 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
15 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
16 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
17 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
20 The LZO library is free software; you can redistribute it and/or
21 modify it under the terms of the GNU General Public License as
22 published by the Free Software Foundation; either version 2 of
23 the License, or (at your option) any later version.
25 The LZO library is distributed in the hope that it will be useful,
26 but WITHOUT ANY WARRANTY; without even the implied warranty of
27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 GNU General Public License for more details.
30 You should have received a copy of the GNU General Public License
31 along with the LZO library; see the file COPYING.
32 If not, write to the Free Software Foundation, Inc.,
33 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
35 Markus F.X.J. Oberhumer
36 <markus@oberhumer.com>
37 http://www.oberhumer.com/opensource/lzo/
41 /*************************************************************************
42 // compression levels of LZO1X-999 and LZO1Y-999
43 **************************************************************************/
45 #if defined(HAVE_LZO1X_H)
48 lzo1x_999_1_compress ( const lzo_bytep src, lzo_uint src_len,
49 lzo_bytep dst, lzo_uintp dst_len,
52 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
53 dict.ptr, dict.len, 0, 1);
57 lzo1x_999_2_compress ( const lzo_bytep src, lzo_uint src_len,
58 lzo_bytep dst, lzo_uintp dst_len,
61 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
62 dict.ptr, dict.len, 0, 2);
66 lzo1x_999_3_compress ( const lzo_bytep src, lzo_uint src_len,
67 lzo_bytep dst, lzo_uintp dst_len,
70 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
71 dict.ptr, dict.len, 0, 3);
75 lzo1x_999_4_compress ( const lzo_bytep src, lzo_uint src_len,
76 lzo_bytep dst, lzo_uintp dst_len,
79 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
80 dict.ptr, dict.len, 0, 4);
84 lzo1x_999_5_compress ( const lzo_bytep src, lzo_uint src_len,
85 lzo_bytep dst, lzo_uintp dst_len,
88 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
89 dict.ptr, dict.len, 0, 5);
93 lzo1x_999_6_compress ( const lzo_bytep src, lzo_uint src_len,
94 lzo_bytep dst, lzo_uintp dst_len,
97 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
98 dict.ptr, dict.len, 0, 6);
102 lzo1x_999_7_compress ( const lzo_bytep src, lzo_uint src_len,
103 lzo_bytep dst, lzo_uintp dst_len,
106 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
107 dict.ptr, dict.len, 0, 7);
111 lzo1x_999_8_compress ( const lzo_bytep src, lzo_uint src_len,
112 lzo_bytep dst, lzo_uintp dst_len,
115 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
116 dict.ptr, dict.len, 0, 8);
120 lzo1x_999_9_compress ( const lzo_bytep src, lzo_uint src_len,
121 lzo_bytep dst, lzo_uintp dst_len,
124 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
125 dict.ptr, dict.len, 0, 9);
131 #if defined(HAVE_LZO1Y_H)
134 lzo1y_999_1_compress ( const lzo_bytep src, lzo_uint src_len,
135 lzo_bytep dst, lzo_uintp dst_len,
138 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
139 dict.ptr, dict.len, 0, 1);
143 lzo1y_999_2_compress ( const lzo_bytep src, lzo_uint src_len,
144 lzo_bytep dst, lzo_uintp dst_len,
147 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
148 dict.ptr, dict.len, 0, 2);
152 lzo1y_999_3_compress ( const lzo_bytep src, lzo_uint src_len,
153 lzo_bytep dst, lzo_uintp dst_len,
156 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
157 dict.ptr, dict.len, 0, 3);
161 lzo1y_999_4_compress ( const lzo_bytep src, lzo_uint src_len,
162 lzo_bytep dst, lzo_uintp dst_len,
165 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
166 dict.ptr, dict.len, 0, 4);
170 lzo1y_999_5_compress ( const lzo_bytep src, lzo_uint src_len,
171 lzo_bytep dst, lzo_uintp dst_len,
174 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
175 dict.ptr, dict.len, 0, 5);
179 lzo1y_999_6_compress ( const lzo_bytep src, lzo_uint src_len,
180 lzo_bytep dst, lzo_uintp dst_len,
183 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
184 dict.ptr, dict.len, 0, 6);
188 lzo1y_999_7_compress ( const lzo_bytep src, lzo_uint src_len,
189 lzo_bytep dst, lzo_uintp dst_len,
192 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
193 dict.ptr, dict.len, 0, 7);
197 lzo1y_999_8_compress ( const lzo_bytep src, lzo_uint src_len,
198 lzo_bytep dst, lzo_uintp dst_len,
201 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
202 dict.ptr, dict.len, 0, 8);
206 lzo1y_999_9_compress ( const lzo_bytep src, lzo_uint src_len,
207 lzo_bytep dst, lzo_uintp dst_len,
210 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
211 dict.ptr, dict.len, 0, 9);
217 /*************************************************************************
218 // other wrappers (pseudo compressors)
219 **************************************************************************/
222 memcpy_x_compress ( const lzo_bytep src, lzo_uint src_len,
223 lzo_bytep dst, lzo_uintp dst_len,
226 lzo_memcpy(dst,src,src_len);
228 if (wrkmem) wrkmem = 0; /* avoid warning */
234 memset_x_compress ( const lzo_bytep src, lzo_uint src_len,
235 lzo_bytep dst, lzo_uintp dst_len,
238 lzo_memset(dst,0,src_len);
240 if (src) src = 0; /* avoid warning */
241 if (wrkmem) wrkmem = 0; /* avoid warning */
247 adler32_x_compress ( const lzo_bytep src, lzo_uint src_len,
248 lzo_bytep dst, lzo_uintp dst_len,
252 adler = lzo_adler32(0, NULL, 0);
253 adler = lzo_adler32(adler, dst, src_len);
255 if (src) src = 0; /* avoid warning */
256 if (wrkmem) wrkmem = 0; /* avoid warning */
262 crc32_x_compress ( const lzo_bytep src, lzo_uint src_len,
263 lzo_bytep dst, lzo_uintp dst_len,
267 crc = lzo_crc32(0, NULL, 0);
268 crc = lzo_crc32(crc, dst, src_len);
270 if (src) src = 0; /* avoid warning */
271 if (wrkmem) wrkmem = 0; /* avoid warning */
276 #if defined(__LZO_PROFESSIONAL__)
277 # include "lzopro/t_wrap.ch"