lzo: update to 2.09
[tomato.git] / release / src / router / lzo / lzotest / wrap.h
blobd2a9c13aaf6d8beec6c2acbd54fe89441dab7ad3
1 /* wrap.h -- wrapper functions
3 This file is part of the LZO real-time data compression library.
5 Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
6 All Rights Reserved.
8 The LZO library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of
11 the License, or (at your option) any later version.
13 The LZO library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with the LZO library; see the file COPYING.
20 If not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 Markus F.X.J. Oberhumer
24 <markus@oberhumer.com>
25 http://www.oberhumer.com/opensource/lzo/
29 /*************************************************************************
30 // compression levels of LZO1X-999 and LZO1Y-999
31 **************************************************************************/
33 #if defined(HAVE_LZO1X_H)
35 LZO_PRIVATE(int)
36 lzo1x_999_1_compress ( const lzo_bytep src, lzo_uint src_len,
37 lzo_bytep dst, lzo_uintp dst_len,
38 lzo_voidp wrkmem )
40 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
41 dict.ptr, dict.len, 0, 1);
44 LZO_PRIVATE(int)
45 lzo1x_999_2_compress ( const lzo_bytep src, lzo_uint src_len,
46 lzo_bytep dst, lzo_uintp dst_len,
47 lzo_voidp wrkmem )
49 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
50 dict.ptr, dict.len, 0, 2);
53 LZO_PRIVATE(int)
54 lzo1x_999_3_compress ( const lzo_bytep src, lzo_uint src_len,
55 lzo_bytep dst, lzo_uintp dst_len,
56 lzo_voidp wrkmem )
58 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
59 dict.ptr, dict.len, 0, 3);
62 LZO_PRIVATE(int)
63 lzo1x_999_4_compress ( const lzo_bytep src, lzo_uint src_len,
64 lzo_bytep dst, lzo_uintp dst_len,
65 lzo_voidp wrkmem )
67 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
68 dict.ptr, dict.len, 0, 4);
71 LZO_PRIVATE(int)
72 lzo1x_999_5_compress ( const lzo_bytep src, lzo_uint src_len,
73 lzo_bytep dst, lzo_uintp dst_len,
74 lzo_voidp wrkmem )
76 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
77 dict.ptr, dict.len, 0, 5);
80 LZO_PRIVATE(int)
81 lzo1x_999_6_compress ( const lzo_bytep src, lzo_uint src_len,
82 lzo_bytep dst, lzo_uintp dst_len,
83 lzo_voidp wrkmem )
85 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
86 dict.ptr, dict.len, 0, 6);
89 LZO_PRIVATE(int)
90 lzo1x_999_7_compress ( const lzo_bytep src, lzo_uint src_len,
91 lzo_bytep dst, lzo_uintp dst_len,
92 lzo_voidp wrkmem )
94 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
95 dict.ptr, dict.len, 0, 7);
98 LZO_PRIVATE(int)
99 lzo1x_999_8_compress ( const lzo_bytep src, lzo_uint src_len,
100 lzo_bytep dst, lzo_uintp dst_len,
101 lzo_voidp wrkmem )
103 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
104 dict.ptr, dict.len, 0, 8);
107 LZO_PRIVATE(int)
108 lzo1x_999_9_compress ( const lzo_bytep src, lzo_uint src_len,
109 lzo_bytep dst, lzo_uintp dst_len,
110 lzo_voidp wrkmem )
112 return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
113 dict.ptr, dict.len, 0, 9);
116 #endif
119 #if defined(HAVE_LZO1Y_H)
121 LZO_PRIVATE(int)
122 lzo1y_999_1_compress ( const lzo_bytep src, lzo_uint src_len,
123 lzo_bytep dst, lzo_uintp dst_len,
124 lzo_voidp wrkmem )
126 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
127 dict.ptr, dict.len, 0, 1);
130 LZO_PRIVATE(int)
131 lzo1y_999_2_compress ( const lzo_bytep src, lzo_uint src_len,
132 lzo_bytep dst, lzo_uintp dst_len,
133 lzo_voidp wrkmem )
135 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
136 dict.ptr, dict.len, 0, 2);
139 LZO_PRIVATE(int)
140 lzo1y_999_3_compress ( const lzo_bytep src, lzo_uint src_len,
141 lzo_bytep dst, lzo_uintp dst_len,
142 lzo_voidp wrkmem )
144 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
145 dict.ptr, dict.len, 0, 3);
148 LZO_PRIVATE(int)
149 lzo1y_999_4_compress ( const lzo_bytep src, lzo_uint src_len,
150 lzo_bytep dst, lzo_uintp dst_len,
151 lzo_voidp wrkmem )
153 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
154 dict.ptr, dict.len, 0, 4);
157 LZO_PRIVATE(int)
158 lzo1y_999_5_compress ( const lzo_bytep src, lzo_uint src_len,
159 lzo_bytep dst, lzo_uintp dst_len,
160 lzo_voidp wrkmem )
162 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
163 dict.ptr, dict.len, 0, 5);
166 LZO_PRIVATE(int)
167 lzo1y_999_6_compress ( const lzo_bytep src, lzo_uint src_len,
168 lzo_bytep dst, lzo_uintp dst_len,
169 lzo_voidp wrkmem )
171 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
172 dict.ptr, dict.len, 0, 6);
175 LZO_PRIVATE(int)
176 lzo1y_999_7_compress ( const lzo_bytep src, lzo_uint src_len,
177 lzo_bytep dst, lzo_uintp dst_len,
178 lzo_voidp wrkmem )
180 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
181 dict.ptr, dict.len, 0, 7);
184 LZO_PRIVATE(int)
185 lzo1y_999_8_compress ( const lzo_bytep src, lzo_uint src_len,
186 lzo_bytep dst, lzo_uintp dst_len,
187 lzo_voidp wrkmem )
189 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
190 dict.ptr, dict.len, 0, 8);
193 LZO_PRIVATE(int)
194 lzo1y_999_9_compress ( const lzo_bytep src, lzo_uint src_len,
195 lzo_bytep dst, lzo_uintp dst_len,
196 lzo_voidp wrkmem )
198 return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
199 dict.ptr, dict.len, 0, 9);
202 #endif
205 /*************************************************************************
206 // other wrappers (pseudo compressors)
207 **************************************************************************/
209 LZO_PRIVATE(int)
210 memcpy_x_compress ( const lzo_bytep src, lzo_uint src_len,
211 lzo_bytep dst, lzo_uintp dst_len,
212 lzo_voidp wrkmem )
214 lzo_memcpy(dst, src, src_len);
215 *dst_len = src_len;
216 LZO_UNUSED(wrkmem);
217 return 0;
221 LZO_PRIVATE(int)
222 memset_x_compress ( const lzo_bytep src, lzo_uint src_len,
223 lzo_bytep dst, lzo_uintp dst_len,
224 lzo_voidp wrkmem )
226 lzo_memset(dst, 0, src_len);
227 *dst_len = src_len;
228 LZO_UNUSED(src); LZO_UNUSED(wrkmem);
229 return 0;
233 LZO_PRIVATE(int)
234 adler32_x_compress ( const lzo_bytep src, lzo_uint src_len,
235 lzo_bytep dst, lzo_uintp dst_len,
236 lzo_voidp wrkmem )
238 lzo_uint32_t adler;
239 adler = lzo_adler32(0, NULL, 0);
240 adler = lzo_adler32(adler, dst, src_len);
241 *dst_len = src_len;
242 LZO_UNUSED(src); LZO_UNUSED(wrkmem);
243 return 0;
247 LZO_PRIVATE(int)
248 crc32_x_compress ( const lzo_bytep src, lzo_uint src_len,
249 lzo_bytep dst, lzo_uintp dst_len,
250 lzo_voidp wrkmem )
252 lzo_uint32_t crc;
253 crc = lzo_crc32(0, NULL, 0);
254 crc = lzo_crc32(crc, dst, src_len);
255 *dst_len = src_len;
256 LZO_UNUSED(src); LZO_UNUSED(wrkmem);
257 return 0;
261 /* vim:set ts=4 sw=4 et: */