Tizen 2.0 Alpha
[toolchains/lzo.git] / lzotest / wrap.h
1 /* wrap.h -- wrapper functions
2
3    This file is part of the LZO real-time data compression library.
4
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
18    All Rights Reserved.
19
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.
24
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.
29
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.
34
35    Markus F.X.J. Oberhumer
36    <markus@oberhumer.com>
37    http://www.oberhumer.com/opensource/lzo/
38  */
39
40
41 /*************************************************************************
42 // compression levels of LZO1X-999 and LZO1Y-999
43 **************************************************************************/
44
45 #if defined(HAVE_LZO1X_H)
46
47 LZO_PRIVATE(int)
48 lzo1x_999_1_compress    ( const lzo_bytep src, lzo_uint  src_len,
49                                 lzo_bytep dst, lzo_uintp dst_len,
50                                 lzo_voidp wrkmem )
51 {
52     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
53                                     dict.ptr, dict.len, 0, 1);
54 }
55
56 LZO_PRIVATE(int)
57 lzo1x_999_2_compress    ( const lzo_bytep src, lzo_uint  src_len,
58                                 lzo_bytep dst, lzo_uintp dst_len,
59                                 lzo_voidp wrkmem )
60 {
61     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
62                                     dict.ptr, dict.len, 0, 2);
63 }
64
65 LZO_PRIVATE(int)
66 lzo1x_999_3_compress    ( const lzo_bytep src, lzo_uint  src_len,
67                                 lzo_bytep dst, lzo_uintp dst_len,
68                                 lzo_voidp wrkmem )
69 {
70     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
71                                     dict.ptr, dict.len, 0, 3);
72 }
73
74 LZO_PRIVATE(int)
75 lzo1x_999_4_compress    ( const lzo_bytep src, lzo_uint  src_len,
76                                 lzo_bytep dst, lzo_uintp dst_len,
77                                 lzo_voidp wrkmem )
78 {
79     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
80                                     dict.ptr, dict.len, 0, 4);
81 }
82
83 LZO_PRIVATE(int)
84 lzo1x_999_5_compress    ( const lzo_bytep src, lzo_uint  src_len,
85                                 lzo_bytep dst, lzo_uintp dst_len,
86                                 lzo_voidp wrkmem )
87 {
88     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
89                                     dict.ptr, dict.len, 0, 5);
90 }
91
92 LZO_PRIVATE(int)
93 lzo1x_999_6_compress    ( const lzo_bytep src, lzo_uint  src_len,
94                                 lzo_bytep dst, lzo_uintp dst_len,
95                                 lzo_voidp wrkmem )
96 {
97     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
98                                     dict.ptr, dict.len, 0, 6);
99 }
100
101 LZO_PRIVATE(int)
102 lzo1x_999_7_compress    ( const lzo_bytep src, lzo_uint  src_len,
103                                 lzo_bytep dst, lzo_uintp dst_len,
104                                 lzo_voidp wrkmem )
105 {
106     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
107                                     dict.ptr, dict.len, 0, 7);
108 }
109
110 LZO_PRIVATE(int)
111 lzo1x_999_8_compress    ( const lzo_bytep src, lzo_uint  src_len,
112                                 lzo_bytep dst, lzo_uintp dst_len,
113                                 lzo_voidp wrkmem )
114 {
115     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
116                                     dict.ptr, dict.len, 0, 8);
117 }
118
119 LZO_PRIVATE(int)
120 lzo1x_999_9_compress    ( const lzo_bytep src, lzo_uint  src_len,
121                                 lzo_bytep dst, lzo_uintp dst_len,
122                                 lzo_voidp wrkmem )
123 {
124     return lzo1x_999_compress_level(src, src_len, dst, dst_len, wrkmem,
125                                     dict.ptr, dict.len, 0, 9);
126 }
127
128 #endif
129
130
131 #if defined(HAVE_LZO1Y_H)
132
133 LZO_PRIVATE(int)
134 lzo1y_999_1_compress    ( const lzo_bytep src, lzo_uint  src_len,
135                                 lzo_bytep dst, lzo_uintp dst_len,
136                                 lzo_voidp wrkmem )
137 {
138     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
139                                     dict.ptr, dict.len, 0, 1);
140 }
141
142 LZO_PRIVATE(int)
143 lzo1y_999_2_compress    ( const lzo_bytep src, lzo_uint  src_len,
144                                 lzo_bytep dst, lzo_uintp dst_len,
145                                 lzo_voidp wrkmem )
146 {
147     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
148                                     dict.ptr, dict.len, 0, 2);
149 }
150
151 LZO_PRIVATE(int)
152 lzo1y_999_3_compress    ( const lzo_bytep src, lzo_uint  src_len,
153                                 lzo_bytep dst, lzo_uintp dst_len,
154                                 lzo_voidp wrkmem )
155 {
156     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
157                                     dict.ptr, dict.len, 0, 3);
158 }
159
160 LZO_PRIVATE(int)
161 lzo1y_999_4_compress    ( const lzo_bytep src, lzo_uint  src_len,
162                                 lzo_bytep dst, lzo_uintp dst_len,
163                                 lzo_voidp wrkmem )
164 {
165     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
166                                     dict.ptr, dict.len, 0, 4);
167 }
168
169 LZO_PRIVATE(int)
170 lzo1y_999_5_compress    ( const lzo_bytep src, lzo_uint  src_len,
171                                 lzo_bytep dst, lzo_uintp dst_len,
172                                 lzo_voidp wrkmem )
173 {
174     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
175                                     dict.ptr, dict.len, 0, 5);
176 }
177
178 LZO_PRIVATE(int)
179 lzo1y_999_6_compress    ( const lzo_bytep src, lzo_uint  src_len,
180                                 lzo_bytep dst, lzo_uintp dst_len,
181                                 lzo_voidp wrkmem )
182 {
183     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
184                                     dict.ptr, dict.len, 0, 6);
185 }
186
187 LZO_PRIVATE(int)
188 lzo1y_999_7_compress    ( const lzo_bytep src, lzo_uint  src_len,
189                                 lzo_bytep dst, lzo_uintp dst_len,
190                                 lzo_voidp wrkmem )
191 {
192     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
193                                     dict.ptr, dict.len, 0, 7);
194 }
195
196 LZO_PRIVATE(int)
197 lzo1y_999_8_compress    ( const lzo_bytep src, lzo_uint  src_len,
198                                 lzo_bytep dst, lzo_uintp dst_len,
199                                 lzo_voidp wrkmem )
200 {
201     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
202                                     dict.ptr, dict.len, 0, 8);
203 }
204
205 LZO_PRIVATE(int)
206 lzo1y_999_9_compress    ( const lzo_bytep src, lzo_uint  src_len,
207                                 lzo_bytep dst, lzo_uintp dst_len,
208                                 lzo_voidp wrkmem )
209 {
210     return lzo1y_999_compress_level(src, src_len, dst, dst_len, wrkmem,
211                                     dict.ptr, dict.len, 0, 9);
212 }
213
214 #endif
215
216
217 /*************************************************************************
218 // other wrappers (pseudo compressors)
219 **************************************************************************/
220
221 LZO_PRIVATE(int)
222 memcpy_x_compress       ( const lzo_bytep src, lzo_uint  src_len,
223                                 lzo_bytep dst, lzo_uintp dst_len,
224                                 lzo_voidp wrkmem )
225 {
226     lzo_memcpy(dst,src,src_len);
227     *dst_len = src_len;
228     if (wrkmem) wrkmem = 0; /* avoid warning */
229     return 0;
230 }
231
232
233 LZO_PRIVATE(int)
234 memset_x_compress       ( const lzo_bytep src, lzo_uint  src_len,
235                                 lzo_bytep dst, lzo_uintp dst_len,
236                                 lzo_voidp wrkmem )
237 {
238     lzo_memset(dst,0,src_len);
239     *dst_len = src_len;
240     if (src) src = 0;       /* avoid warning */
241     if (wrkmem) wrkmem = 0; /* avoid warning */
242     return 0;
243 }
244
245
246 LZO_PRIVATE(int)
247 adler32_x_compress      ( const lzo_bytep src, lzo_uint  src_len,
248                                 lzo_bytep dst, lzo_uintp dst_len,
249                                 lzo_voidp wrkmem )
250 {
251     lzo_uint32 adler;
252     adler = lzo_adler32(0, NULL, 0);
253     adler = lzo_adler32(adler, dst, src_len);
254     *dst_len = src_len;
255     if (src) src = 0;       /* avoid warning */
256     if (wrkmem) wrkmem = 0; /* avoid warning */
257     return 0;
258 }
259
260
261 LZO_PRIVATE(int)
262 crc32_x_compress        ( const lzo_bytep src, lzo_uint  src_len,
263                                 lzo_bytep dst, lzo_uintp dst_len,
264                                 lzo_voidp wrkmem )
265 {
266     lzo_uint32 crc;
267     crc = lzo_crc32(0, NULL, 0);
268     crc = lzo_crc32(crc, dst, src_len);
269     *dst_len = src_len;
270     if (src) src = 0;       /* avoid warning */
271     if (wrkmem) wrkmem = 0; /* avoid warning */
272     return 0;
273 }
274
275
276 #if defined(__LZO_PROFESSIONAL__)
277 #  include "lzopro/t_wrap.ch"
278 #endif
279
280
281 /*
282 vi:ts=4:et
283 */
284