nfrb 0.0.1.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.document +5 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +27 -0
- data/LICENSE.txt +32 -0
- data/README.rdoc +56 -0
- data/Rakefile +58 -0
- data/ext/rb_nfrb/README.files +14 -0
- data/ext/rb_nfrb/config.h +37 -0
- data/ext/rb_nfrb/dnc/nffile_inline.c +579 -0
- data/ext/rb_nfrb/extconf.rb +3 -0
- data/ext/rb_nfrb/fts_compat.c +1129 -0
- data/ext/rb_nfrb/fts_compat.h +126 -0
- data/ext/rb_nfrb/lzoconf.h +413 -0
- data/ext/rb_nfrb/lzodefs.h +1545 -0
- data/ext/rb_nfrb/minilzo.h +102 -0
- data/ext/rb_nfrb/nf_common.h +117 -0
- data/ext/rb_nfrb/nffile.c +1167 -0
- data/ext/rb_nfrb/nffile.h +1439 -0
- data/ext/rb_nfrb/nfrb.c +368 -0
- data/ext/rb_nfrb/nfx.c +636 -0
- data/ext/rb_nfrb/nfx.h +83 -0
- data/ext/rb_nfrb/util.c +517 -0
- data/ext/rb_nfrb/util.h +84 -0
- data/lib/nfrb.rb +5 -0
- data/lib/nfrb/version.rb +16 -0
- data/test/helper.rb +18 -0
- data/test/test_nfrb.rb +7 -0
- metadata +184 -0
@@ -0,0 +1,126 @@
|
|
1
|
+
/* $Id: fts_compat.h 16 2009-06-19 09:26:19Z haag $ */
|
2
|
+
/* TNFTPD ORIGINAL: libnetbsd/ftpfts.h */
|
3
|
+
|
4
|
+
/* $NetBSD: ftpfts.h,v 1.3 2003/12/15 23:52:02 lukem Exp $ */
|
5
|
+
|
6
|
+
/*
|
7
|
+
* Copyright (c) 1989, 1993
|
8
|
+
* The Regents of the University of California. All rights reserved.
|
9
|
+
*
|
10
|
+
* Redistribution and use in source and binary forms, with or without
|
11
|
+
* modification, are permitted provided that the following conditions
|
12
|
+
* are met:
|
13
|
+
* 1. Redistributions of source code must retain the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer.
|
15
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
16
|
+
* notice, this list of conditions and the following disclaimer in the
|
17
|
+
* documentation and/or other materials provided with the distribution.
|
18
|
+
* 3. Neither the name of the University nor the names of its contributors
|
19
|
+
* may be used to endorse or promote products derived from this software
|
20
|
+
* without specific prior written permission.
|
21
|
+
*
|
22
|
+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
23
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
26
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
27
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
28
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
29
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
30
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
31
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
32
|
+
* SUCH DAMAGE.
|
33
|
+
*
|
34
|
+
* @(#)fts.h 8.3 (Berkeley) 8/14/94
|
35
|
+
*/
|
36
|
+
|
37
|
+
#ifndef _FTS_H_
|
38
|
+
#define _FTS_H_ 1
|
39
|
+
|
40
|
+
typedef struct {
|
41
|
+
struct _ftsent *fts_cur; /* current node */
|
42
|
+
struct _ftsent *fts_child; /* linked list of children */
|
43
|
+
struct _ftsent **fts_array; /* sort array */
|
44
|
+
dev_t fts_dev; /* starting device # */
|
45
|
+
char *fts_path; /* path for this descent */
|
46
|
+
int fts_rfd; /* fd for root */
|
47
|
+
u_int fts_pathlen; /* sizeof(path) */
|
48
|
+
u_int fts_nitems; /* elements in the sort array */
|
49
|
+
int (*fts_compar) /* compare function */
|
50
|
+
(const struct _ftsent **, const struct _ftsent **);
|
51
|
+
|
52
|
+
#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */
|
53
|
+
#define FTS_LOGICAL 0x002 /* logical walk */
|
54
|
+
#define FTS_NOCHDIR 0x004 /* don't change directories */
|
55
|
+
#define FTS_NOSTAT 0x008 /* don't get stat info */
|
56
|
+
#define FTS_PHYSICAL 0x010 /* physical walk */
|
57
|
+
#define FTS_SEEDOT 0x020 /* return dot and dot-dot */
|
58
|
+
#define FTS_XDEV 0x040 /* don't cross devices */
|
59
|
+
#define FTS_WHITEOUT 0x080 /* return whiteout information */
|
60
|
+
#define FTS_OPTIONMASK 0x0ff /* valid user option mask */
|
61
|
+
|
62
|
+
#define FTS_NAMEONLY 0x100 /* (private) child names only */
|
63
|
+
#define FTS_STOP 0x200 /* (private) unrecoverable error */
|
64
|
+
int fts_options; /* fts_open options, global flags */
|
65
|
+
} FTS;
|
66
|
+
|
67
|
+
typedef struct _ftsent {
|
68
|
+
struct _ftsent *fts_cycle; /* cycle node */
|
69
|
+
struct _ftsent *fts_parent; /* parent directory */
|
70
|
+
struct _ftsent *fts_link; /* next file in directory */
|
71
|
+
long fts_number; /* local numeric value */
|
72
|
+
void *fts_pointer; /* local address value */
|
73
|
+
char *fts_accpath; /* access path */
|
74
|
+
char *fts_path; /* root path */
|
75
|
+
int fts_errno; /* errno for this node */
|
76
|
+
int fts_symfd; /* fd for symlink */
|
77
|
+
u_short fts_pathlen; /* strlen(fts_path) */
|
78
|
+
u_short fts_namelen; /* strlen(fts_name) */
|
79
|
+
|
80
|
+
ino_t fts_ino; /* inode */
|
81
|
+
dev_t fts_dev; /* device */
|
82
|
+
nlink_t fts_nlink; /* link count */
|
83
|
+
|
84
|
+
#define FTS_ROOTPARENTLEVEL -1
|
85
|
+
#define FTS_ROOTLEVEL 0
|
86
|
+
short fts_level; /* depth (-1 to N) */
|
87
|
+
|
88
|
+
#define FTS_D 1 /* preorder directory */
|
89
|
+
#define FTS_DC 2 /* directory that causes cycles */
|
90
|
+
#define FTS_DEFAULT 3 /* none of the above */
|
91
|
+
#define FTS_DNR 4 /* unreadable directory */
|
92
|
+
#define FTS_DOT 5 /* dot or dot-dot */
|
93
|
+
#define FTS_DP 6 /* postorder directory */
|
94
|
+
#define FTS_ERR 7 /* error; errno is set */
|
95
|
+
#define FTS_F 8 /* regular file */
|
96
|
+
#define FTS_INIT 9 /* initialized only */
|
97
|
+
#define FTS_NS 10 /* stat(2) failed */
|
98
|
+
#define FTS_NSOK 11 /* no stat(2) requested */
|
99
|
+
#define FTS_SL 12 /* symbolic link */
|
100
|
+
#define FTS_SLNONE 13 /* symbolic link without target */
|
101
|
+
#define FTS_W 14 /* whiteout object */
|
102
|
+
u_short fts_info; /* user flags for FTSENT structure */
|
103
|
+
|
104
|
+
#define FTS_DONTCHDIR 0x01 /* don't chdir .. to the parent */
|
105
|
+
#define FTS_SYMFOLLOW 0x02 /* followed a symlink to get here */
|
106
|
+
#define FTS_ISW 0x04 /* this is a whiteout object */
|
107
|
+
u_short fts_flags; /* private flags for FTSENT structure */
|
108
|
+
|
109
|
+
#define FTS_AGAIN 1 /* read node again */
|
110
|
+
#define FTS_FOLLOW 2 /* follow symbolic link */
|
111
|
+
#define FTS_NOINSTR 3 /* no instructions */
|
112
|
+
#define FTS_SKIP 4 /* discard node */
|
113
|
+
u_short fts_instr; /* fts_set() instructions */
|
114
|
+
|
115
|
+
struct stat *fts_statp; /* stat(2) information */
|
116
|
+
char fts_name[1]; /* file name */
|
117
|
+
} FTSENT;
|
118
|
+
|
119
|
+
FTSENT *fts_children_compat(FTS *, int);
|
120
|
+
int fts_close_compat(FTS *);
|
121
|
+
FTS *fts_open_compat(char * const *, int,
|
122
|
+
int (*)(const FTSENT **, const FTSENT **));
|
123
|
+
FTSENT *fts_read_compat(FTS *);
|
124
|
+
int fts_set_compat(FTS *, FTSENT *, int);
|
125
|
+
|
126
|
+
#endif /* !_FTS_H_ */
|
@@ -0,0 +1,413 @@
|
|
1
|
+
/* lzoconf.h -- configuration for the LZO real-time data compression library
|
2
|
+
|
3
|
+
This file is part of the LZO real-time data compression library.
|
4
|
+
|
5
|
+
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
6
|
+
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
7
|
+
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
8
|
+
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
9
|
+
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
10
|
+
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
11
|
+
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
12
|
+
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
13
|
+
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
14
|
+
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
15
|
+
All Rights Reserved.
|
16
|
+
|
17
|
+
The LZO library is free software; you can redistribute it and/or
|
18
|
+
modify it under the terms of the GNU General Public License,
|
19
|
+
version 2, as published by the Free Software Foundation.
|
20
|
+
|
21
|
+
The LZO library is distributed in the hope that it will be useful,
|
22
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24
|
+
GNU General Public License for more details.
|
25
|
+
|
26
|
+
You should have received a copy of the GNU General Public License
|
27
|
+
along with the LZO library; see the file COPYING.
|
28
|
+
If not, write to the Free Software Foundation, Inc.,
|
29
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
30
|
+
|
31
|
+
Markus F.X.J. Oberhumer
|
32
|
+
<markus@oberhumer.com>
|
33
|
+
http://www.oberhumer.com/opensource/lzo/
|
34
|
+
*/
|
35
|
+
|
36
|
+
|
37
|
+
#ifndef __LZOCONF_H_INCLUDED
|
38
|
+
#define __LZOCONF_H_INCLUDED 1
|
39
|
+
|
40
|
+
#define LZO_VERSION 0x2020
|
41
|
+
#define LZO_VERSION_STRING "2.02"
|
42
|
+
#define LZO_VERSION_DATE "Oct 17 2005"
|
43
|
+
|
44
|
+
/* internal Autoconf configuration file - only used when building LZO */
|
45
|
+
#if defined(LZO_HAVE_CONFIG_H)
|
46
|
+
# include <config.h>
|
47
|
+
#endif
|
48
|
+
#include <limits.h>
|
49
|
+
#include <stddef.h>
|
50
|
+
|
51
|
+
|
52
|
+
/***********************************************************************
|
53
|
+
// LZO requires a conforming <limits.h>
|
54
|
+
************************************************************************/
|
55
|
+
|
56
|
+
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
57
|
+
# error "invalid CHAR_BIT"
|
58
|
+
#endif
|
59
|
+
#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
|
60
|
+
# error "check your compiler installation"
|
61
|
+
#endif
|
62
|
+
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
|
63
|
+
# error "your limits.h macros are broken"
|
64
|
+
#endif
|
65
|
+
|
66
|
+
/* get OS and architecture defines */
|
67
|
+
#ifndef __LZODEFS_H_INCLUDED
|
68
|
+
#include "lzodefs.h"
|
69
|
+
#endif
|
70
|
+
|
71
|
+
|
72
|
+
#ifdef __cplusplus
|
73
|
+
extern "C" {
|
74
|
+
#endif
|
75
|
+
|
76
|
+
|
77
|
+
/***********************************************************************
|
78
|
+
// some core defines
|
79
|
+
************************************************************************/
|
80
|
+
|
81
|
+
#if !defined(LZO_UINT32_C)
|
82
|
+
# if (UINT_MAX < LZO_0xffffffffL)
|
83
|
+
# define LZO_UINT32_C(c) c ## UL
|
84
|
+
# else
|
85
|
+
# define LZO_UINT32_C(c) ((c) + 0U)
|
86
|
+
# endif
|
87
|
+
#endif
|
88
|
+
|
89
|
+
/* memory checkers */
|
90
|
+
#if !defined(__LZO_CHECKER)
|
91
|
+
# if defined(__BOUNDS_CHECKING_ON)
|
92
|
+
# define __LZO_CHECKER 1
|
93
|
+
# elif defined(__CHECKER__)
|
94
|
+
# define __LZO_CHECKER 1
|
95
|
+
# elif defined(__INSURE__)
|
96
|
+
# define __LZO_CHECKER 1
|
97
|
+
# elif defined(__PURIFY__)
|
98
|
+
# define __LZO_CHECKER 1
|
99
|
+
# endif
|
100
|
+
#endif
|
101
|
+
|
102
|
+
|
103
|
+
/***********************************************************************
|
104
|
+
// integral and pointer types
|
105
|
+
************************************************************************/
|
106
|
+
|
107
|
+
/* lzo_uint should match size_t */
|
108
|
+
#if !defined(LZO_UINT_MAX)
|
109
|
+
# if defined(LZO_ABI_LLP64) /* WIN64 */
|
110
|
+
# if defined(LZO_OS_WIN64)
|
111
|
+
typedef unsigned __int64 lzo_uint;
|
112
|
+
typedef __int64 lzo_int;
|
113
|
+
# else
|
114
|
+
typedef unsigned long long lzo_uint;
|
115
|
+
typedef long long lzo_int;
|
116
|
+
# endif
|
117
|
+
# define LZO_UINT_MAX 0xffffffffffffffffull
|
118
|
+
# define LZO_INT_MAX 9223372036854775807LL
|
119
|
+
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
120
|
+
# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
|
121
|
+
typedef unsigned int lzo_uint;
|
122
|
+
typedef int lzo_int;
|
123
|
+
# define LZO_UINT_MAX UINT_MAX
|
124
|
+
# define LZO_INT_MAX INT_MAX
|
125
|
+
# define LZO_INT_MIN INT_MIN
|
126
|
+
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
127
|
+
typedef unsigned long lzo_uint;
|
128
|
+
typedef long lzo_int;
|
129
|
+
# define LZO_UINT_MAX ULONG_MAX
|
130
|
+
# define LZO_INT_MAX LONG_MAX
|
131
|
+
# define LZO_INT_MIN LONG_MIN
|
132
|
+
# else
|
133
|
+
# error "lzo_uint"
|
134
|
+
# endif
|
135
|
+
#endif
|
136
|
+
|
137
|
+
/* Integral types with 32 bits or more. */
|
138
|
+
#if !defined(LZO_UINT32_MAX)
|
139
|
+
# if (UINT_MAX >= LZO_0xffffffffL)
|
140
|
+
typedef unsigned int lzo_uint32;
|
141
|
+
typedef int lzo_int32;
|
142
|
+
# define LZO_UINT32_MAX UINT_MAX
|
143
|
+
# define LZO_INT32_MAX INT_MAX
|
144
|
+
# define LZO_INT32_MIN INT_MIN
|
145
|
+
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
146
|
+
typedef unsigned long lzo_uint32;
|
147
|
+
typedef long lzo_int32;
|
148
|
+
# define LZO_UINT32_MAX ULONG_MAX
|
149
|
+
# define LZO_INT32_MAX LONG_MAX
|
150
|
+
# define LZO_INT32_MIN LONG_MIN
|
151
|
+
# else
|
152
|
+
# error "lzo_uint32"
|
153
|
+
# endif
|
154
|
+
#endif
|
155
|
+
|
156
|
+
/* The larger type of lzo_uint and lzo_uint32. */
|
157
|
+
#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
|
158
|
+
# define lzo_xint lzo_uint
|
159
|
+
#else
|
160
|
+
# define lzo_xint lzo_uint32
|
161
|
+
#endif
|
162
|
+
|
163
|
+
/* Memory model that allows to access memory at offsets of lzo_uint. */
|
164
|
+
#if !defined(__LZO_MMODEL)
|
165
|
+
# if (LZO_UINT_MAX <= UINT_MAX)
|
166
|
+
# define __LZO_MMODEL
|
167
|
+
# elif defined(LZO_HAVE_MM_HUGE_PTR)
|
168
|
+
# define __LZO_MMODEL_HUGE 1
|
169
|
+
# define __LZO_MMODEL __huge
|
170
|
+
# else
|
171
|
+
# define __LZO_MMODEL
|
172
|
+
# endif
|
173
|
+
#endif
|
174
|
+
|
175
|
+
/* no typedef here because of const-pointer issues */
|
176
|
+
#define lzo_bytep unsigned char __LZO_MMODEL *
|
177
|
+
#define lzo_charp char __LZO_MMODEL *
|
178
|
+
#define lzo_voidp void __LZO_MMODEL *
|
179
|
+
#define lzo_shortp short __LZO_MMODEL *
|
180
|
+
#define lzo_ushortp unsigned short __LZO_MMODEL *
|
181
|
+
#define lzo_uint32p lzo_uint32 __LZO_MMODEL *
|
182
|
+
#define lzo_int32p lzo_int32 __LZO_MMODEL *
|
183
|
+
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
184
|
+
#define lzo_intp lzo_int __LZO_MMODEL *
|
185
|
+
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
186
|
+
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
187
|
+
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
188
|
+
/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
|
189
|
+
#define lzo_byte unsigned char __LZO_MMODEL
|
190
|
+
|
191
|
+
typedef int lzo_bool;
|
192
|
+
|
193
|
+
|
194
|
+
/***********************************************************************
|
195
|
+
// function types
|
196
|
+
************************************************************************/
|
197
|
+
|
198
|
+
/* name mangling */
|
199
|
+
#if !defined(__LZO_EXTERN_C)
|
200
|
+
# ifdef __cplusplus
|
201
|
+
# define __LZO_EXTERN_C extern "C"
|
202
|
+
# else
|
203
|
+
# define __LZO_EXTERN_C extern
|
204
|
+
# endif
|
205
|
+
#endif
|
206
|
+
|
207
|
+
/* calling convention */
|
208
|
+
#if !defined(__LZO_CDECL)
|
209
|
+
# define __LZO_CDECL __lzo_cdecl
|
210
|
+
#endif
|
211
|
+
|
212
|
+
/* DLL export information */
|
213
|
+
#if !defined(__LZO_EXPORT1)
|
214
|
+
# define __LZO_EXPORT1
|
215
|
+
#endif
|
216
|
+
#if !defined(__LZO_EXPORT2)
|
217
|
+
# define __LZO_EXPORT2
|
218
|
+
#endif
|
219
|
+
|
220
|
+
/* __cdecl calling convention for public C and assembly functions */
|
221
|
+
#if !defined(LZO_PUBLIC)
|
222
|
+
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
223
|
+
#endif
|
224
|
+
#if !defined(LZO_EXTERN)
|
225
|
+
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
226
|
+
#endif
|
227
|
+
#if !defined(LZO_PRIVATE)
|
228
|
+
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
|
229
|
+
#endif
|
230
|
+
|
231
|
+
/* function types */
|
232
|
+
typedef int
|
233
|
+
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
234
|
+
lzo_bytep dst, lzo_uintp dst_len,
|
235
|
+
lzo_voidp wrkmem );
|
236
|
+
|
237
|
+
typedef int
|
238
|
+
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
239
|
+
lzo_bytep dst, lzo_uintp dst_len,
|
240
|
+
lzo_voidp wrkmem );
|
241
|
+
|
242
|
+
typedef int
|
243
|
+
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
244
|
+
lzo_bytep dst, lzo_uintp dst_len,
|
245
|
+
lzo_voidp wrkmem );
|
246
|
+
|
247
|
+
typedef int
|
248
|
+
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
249
|
+
lzo_bytep dst, lzo_uintp dst_len,
|
250
|
+
lzo_voidp wrkmem,
|
251
|
+
const lzo_bytep dict, lzo_uint dict_len );
|
252
|
+
|
253
|
+
typedef int
|
254
|
+
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
255
|
+
lzo_bytep dst, lzo_uintp dst_len,
|
256
|
+
lzo_voidp wrkmem,
|
257
|
+
const lzo_bytep dict, lzo_uint dict_len );
|
258
|
+
|
259
|
+
|
260
|
+
/* Callback interface. Currently only the progress indicator ("nprogress")
|
261
|
+
* is used, but this may change in a future release. */
|
262
|
+
|
263
|
+
struct lzo_callback_t;
|
264
|
+
typedef struct lzo_callback_t lzo_callback_t;
|
265
|
+
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
266
|
+
|
267
|
+
/* malloc & free function types */
|
268
|
+
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
269
|
+
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
270
|
+
typedef void (__LZO_CDECL *lzo_free_func_t)
|
271
|
+
(lzo_callback_p self, lzo_voidp ptr);
|
272
|
+
|
273
|
+
/* a progress indicator callback function */
|
274
|
+
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
275
|
+
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
276
|
+
|
277
|
+
struct lzo_callback_t
|
278
|
+
{
|
279
|
+
/* custom allocators (set to 0 to disable) */
|
280
|
+
lzo_alloc_func_t nalloc; /* [not used right now] */
|
281
|
+
lzo_free_func_t nfree; /* [not used right now] */
|
282
|
+
|
283
|
+
/* a progress indicator callback function (set to 0 to disable) */
|
284
|
+
lzo_progress_func_t nprogress;
|
285
|
+
|
286
|
+
/* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
|
287
|
+
* callbacks points back to this struct, so you are free to store
|
288
|
+
* some extra info in the following variables. */
|
289
|
+
lzo_voidp user1;
|
290
|
+
lzo_xint user2;
|
291
|
+
lzo_xint user3;
|
292
|
+
};
|
293
|
+
|
294
|
+
|
295
|
+
/***********************************************************************
|
296
|
+
// error codes and prototypes
|
297
|
+
************************************************************************/
|
298
|
+
|
299
|
+
/* Error codes for the compression/decompression functions. Negative
|
300
|
+
* values are errors, positive values will be used for special but
|
301
|
+
* normal events.
|
302
|
+
*/
|
303
|
+
#define LZO_E_OK 0
|
304
|
+
#define LZO_E_ERROR (-1)
|
305
|
+
#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
|
306
|
+
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
307
|
+
#define LZO_E_INPUT_OVERRUN (-4)
|
308
|
+
#define LZO_E_OUTPUT_OVERRUN (-5)
|
309
|
+
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
310
|
+
#define LZO_E_EOF_NOT_FOUND (-7)
|
311
|
+
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
312
|
+
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
313
|
+
|
314
|
+
|
315
|
+
#ifndef lzo_sizeof_dict_t
|
316
|
+
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
317
|
+
#endif
|
318
|
+
|
319
|
+
/* lzo_init() should be the first function you call.
|
320
|
+
* Check the return code !
|
321
|
+
*
|
322
|
+
* lzo_init() is a macro to allow checking that the library and the
|
323
|
+
* compiler's view of various types are consistent.
|
324
|
+
*/
|
325
|
+
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
326
|
+
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
327
|
+
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
328
|
+
(int)sizeof(lzo_callback_t))
|
329
|
+
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
330
|
+
|
331
|
+
/* version functions (useful for shared libraries) */
|
332
|
+
LZO_EXTERN(unsigned) lzo_version(void);
|
333
|
+
LZO_EXTERN(const char *) lzo_version_string(void);
|
334
|
+
LZO_EXTERN(const char *) lzo_version_date(void);
|
335
|
+
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
336
|
+
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
337
|
+
|
338
|
+
/* string functions */
|
339
|
+
LZO_EXTERN(int)
|
340
|
+
lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
|
341
|
+
LZO_EXTERN(lzo_voidp)
|
342
|
+
lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
|
343
|
+
LZO_EXTERN(lzo_voidp)
|
344
|
+
lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
|
345
|
+
LZO_EXTERN(lzo_voidp)
|
346
|
+
lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
|
347
|
+
|
348
|
+
/* checksum functions */
|
349
|
+
LZO_EXTERN(lzo_uint32)
|
350
|
+
lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len);
|
351
|
+
LZO_EXTERN(lzo_uint32)
|
352
|
+
lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len);
|
353
|
+
LZO_EXTERN(const lzo_uint32p)
|
354
|
+
lzo_get_crc32_table(void);
|
355
|
+
|
356
|
+
/* misc. */
|
357
|
+
LZO_EXTERN(int) _lzo_config_check(void);
|
358
|
+
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
359
|
+
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
360
|
+
typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
|
361
|
+
|
362
|
+
/* align a char pointer on a boundary that is a multiple of `size' */
|
363
|
+
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
|
364
|
+
#define LZO_PTR_ALIGN_UP(_ptr,_size) \
|
365
|
+
((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
|
366
|
+
|
367
|
+
|
368
|
+
/***********************************************************************
|
369
|
+
// deprecated macros - only for backward compatibility with LZO v1.xx
|
370
|
+
************************************************************************/
|
371
|
+
|
372
|
+
#if defined(LZO_CFG_COMPAT)
|
373
|
+
|
374
|
+
#define __LZOCONF_H 1
|
375
|
+
|
376
|
+
#if defined(LZO_ARCH_I086)
|
377
|
+
# define __LZO_i386 1
|
378
|
+
#elif defined(LZO_ARCH_I386)
|
379
|
+
# define __LZO_i386 1
|
380
|
+
#endif
|
381
|
+
|
382
|
+
#if defined(LZO_OS_DOS16)
|
383
|
+
# define __LZO_DOS 1
|
384
|
+
# define __LZO_DOS16 1
|
385
|
+
#elif defined(LZO_OS_DOS32)
|
386
|
+
# define __LZO_DOS 1
|
387
|
+
#elif defined(LZO_OS_WIN16)
|
388
|
+
# define __LZO_WIN 1
|
389
|
+
# define __LZO_WIN16 1
|
390
|
+
#elif defined(LZO_OS_WIN32)
|
391
|
+
# define __LZO_WIN 1
|
392
|
+
#endif
|
393
|
+
|
394
|
+
#define __LZO_CMODEL
|
395
|
+
#define __LZO_DMODEL
|
396
|
+
#define __LZO_ENTRY __LZO_CDECL
|
397
|
+
#define LZO_EXTERN_CDECL LZO_EXTERN
|
398
|
+
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
399
|
+
|
400
|
+
#define lzo_compress_asm_t lzo_compress_t
|
401
|
+
#define lzo_decompress_asm_t lzo_decompress_t
|
402
|
+
|
403
|
+
#endif /* LZO_CFG_COMPAT */
|
404
|
+
|
405
|
+
|
406
|
+
#ifdef __cplusplus
|
407
|
+
} /* extern "C" */
|
408
|
+
#endif
|
409
|
+
|
410
|
+
#endif /* already included */
|
411
|
+
|
412
|
+
|
413
|
+
/* vim:set ts=4 et: */
|