File indexing completed on 2025-02-21 10:04:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef __LZOCONF_H_INCLUDED
0030 #define __LZOCONF_H_INCLUDED 1
0031
0032 #define LZO_VERSION 0x20a0
0033 #define LZO_VERSION_STRING "2.10"
0034 #define LZO_VERSION_DATE "Mar 01 2017"
0035
0036
0037 #if defined(LZO_HAVE_CONFIG_H)
0038 # include <config.h>
0039 #endif
0040 #include <limits.h>
0041 #include <stddef.h>
0042
0043
0044
0045
0046
0047
0048 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
0049 # error "invalid CHAR_BIT"
0050 #endif
0051 #if !defined(UCHAR_MAX) || !defined(USHRT_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
0052 # error "check your compiler installation"
0053 #endif
0054 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
0055 # error "your limits.h macros are broken"
0056 #endif
0057
0058
0059 #ifndef __LZODEFS_H_INCLUDED
0060 #include <lzo/lzodefs.h>
0061 #endif
0062
0063
0064 #ifdef __cplusplus
0065 extern "C" {
0066 #endif
0067
0068
0069
0070
0071
0072
0073
0074 #if !defined(__LZO_CHECKER)
0075 # if defined(__BOUNDS_CHECKING_ON)
0076 # define __LZO_CHECKER 1
0077 # elif defined(__CHECKER__)
0078 # define __LZO_CHECKER 1
0079 # elif defined(__INSURE__)
0080 # define __LZO_CHECKER 1
0081 # elif defined(__PURIFY__)
0082 # define __LZO_CHECKER 1
0083 # endif
0084 #endif
0085
0086
0087
0088
0089
0090
0091
0092 #if !defined(LZO_UINT_MAX)
0093 # if (LZO_ABI_LLP64)
0094 # if (LZO_OS_WIN64)
0095 typedef unsigned __int64 lzo_uint;
0096 typedef __int64 lzo_int;
0097 # define LZO_TYPEOF_LZO_INT LZO_TYPEOF___INT64
0098 # else
0099 typedef lzo_ullong_t lzo_uint;
0100 typedef lzo_llong_t lzo_int;
0101 # define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG_LONG
0102 # endif
0103 # define LZO_SIZEOF_LZO_INT 8
0104 # define LZO_UINT_MAX 0xffffffffffffffffull
0105 # define LZO_INT_MAX 9223372036854775807LL
0106 # define LZO_INT_MIN (-1LL - LZO_INT_MAX)
0107 # elif (LZO_ABI_IP32L64)
0108 typedef unsigned int lzo_uint;
0109 typedef int lzo_int;
0110 # define LZO_SIZEOF_LZO_INT LZO_SIZEOF_INT
0111 # define LZO_TYPEOF_LZO_INT LZO_TYPEOF_INT
0112 # define LZO_UINT_MAX UINT_MAX
0113 # define LZO_INT_MAX INT_MAX
0114 # define LZO_INT_MIN INT_MIN
0115 # elif (ULONG_MAX >= LZO_0xffffffffL)
0116 typedef unsigned long lzo_uint;
0117 typedef long lzo_int;
0118 # define LZO_SIZEOF_LZO_INT LZO_SIZEOF_LONG
0119 # define LZO_TYPEOF_LZO_INT LZO_TYPEOF_LONG
0120 # define LZO_UINT_MAX ULONG_MAX
0121 # define LZO_INT_MAX LONG_MAX
0122 # define LZO_INT_MIN LONG_MIN
0123 # else
0124 # error "lzo_uint"
0125 # endif
0126 #endif
0127
0128
0129 #if (LZO_SIZEOF_LZO_INT >= 4)
0130 # define lzo_xint lzo_uint
0131 #else
0132 # define lzo_xint lzo_uint32_t
0133 #endif
0134
0135 typedef int lzo_bool;
0136
0137
0138 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_int) == LZO_SIZEOF_LZO_INT)
0139 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == LZO_SIZEOF_LZO_INT)
0140 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint))
0141 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_xint) >= sizeof(lzo_uint32_t))
0142
0143 #ifndef __LZO_MMODEL
0144 #define __LZO_MMODEL
0145 #endif
0146
0147
0148 #define lzo_bytep unsigned char __LZO_MMODEL *
0149 #define lzo_charp char __LZO_MMODEL *
0150 #define lzo_voidp void __LZO_MMODEL *
0151 #define lzo_shortp short __LZO_MMODEL *
0152 #define lzo_ushortp unsigned short __LZO_MMODEL *
0153 #define lzo_intp lzo_int __LZO_MMODEL *
0154 #define lzo_uintp lzo_uint __LZO_MMODEL *
0155 #define lzo_xintp lzo_xint __LZO_MMODEL *
0156 #define lzo_voidpp lzo_voidp __LZO_MMODEL *
0157 #define lzo_bytepp lzo_bytep __LZO_MMODEL *
0158
0159 #define lzo_int8_tp lzo_int8_t __LZO_MMODEL *
0160 #define lzo_uint8_tp lzo_uint8_t __LZO_MMODEL *
0161 #define lzo_int16_tp lzo_int16_t __LZO_MMODEL *
0162 #define lzo_uint16_tp lzo_uint16_t __LZO_MMODEL *
0163 #define lzo_int32_tp lzo_int32_t __LZO_MMODEL *
0164 #define lzo_uint32_tp lzo_uint32_t __LZO_MMODEL *
0165 #if defined(lzo_int64_t)
0166 #define lzo_int64_tp lzo_int64_t __LZO_MMODEL *
0167 #define lzo_uint64_tp lzo_uint64_t __LZO_MMODEL *
0168 #endif
0169
0170
0171
0172
0173
0174 #if defined(__LZO_MMODEL_HUGE)
0175 #error "__LZO_MMODEL_HUGE memory model is unsupported"
0176 #endif
0177 #if (LZO_MM_PVP)
0178 #error "LZO_MM_PVP memory model is unsupported"
0179 #endif
0180 #if (LZO_SIZEOF_INT < 4)
0181 #error "LZO_SIZEOF_INT < 4 is unsupported"
0182 #endif
0183 #if (__LZO_UINTPTR_T_IS_POINTER)
0184 #error "__LZO_UINTPTR_T_IS_POINTER is unsupported"
0185 #endif
0186 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(int) >= 4)
0187 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) >= 4)
0188
0189
0190
0191 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(size_t))
0192 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(ptrdiff_t))
0193 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint) == sizeof(lzo_uintptr_t))
0194 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_uintptr_t))
0195 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_uintptr_t))
0196 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long *) == sizeof(lzo_uintptr_t))
0197 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(void *) == sizeof(lzo_voidp))
0198 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(char *) == sizeof(lzo_bytep))
0199
0200
0201
0202
0203
0204
0205
0206 #if !defined(__LZO_EXTERN_C)
0207 # ifdef __cplusplus
0208 # define __LZO_EXTERN_C extern "C"
0209 # else
0210 # define __LZO_EXTERN_C extern
0211 # endif
0212 #endif
0213
0214
0215 #if !defined(__LZO_CDECL)
0216 # define __LZO_CDECL __lzo_cdecl
0217 #endif
0218
0219
0220 #if !defined(__LZO_EXPORT1)
0221 # define __LZO_EXPORT1
0222 #endif
0223 #if !defined(__LZO_EXPORT2)
0224 # define __LZO_EXPORT2
0225 #endif
0226
0227
0228 #if !defined(LZO_PUBLIC)
0229 # define LZO_PUBLIC(r) __LZO_EXPORT1 r __LZO_EXPORT2 __LZO_CDECL
0230 #endif
0231 #if !defined(LZO_EXTERN)
0232 # define LZO_EXTERN(r) __LZO_EXTERN_C LZO_PUBLIC(r)
0233 #endif
0234 #if !defined(LZO_PRIVATE)
0235 # define LZO_PRIVATE(r) static r __LZO_CDECL
0236 #endif
0237
0238
0239 typedef int
0240 (__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
0241 lzo_bytep dst, lzo_uintp dst_len,
0242 lzo_voidp wrkmem );
0243
0244 typedef int
0245 (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
0246 lzo_bytep dst, lzo_uintp dst_len,
0247 lzo_voidp wrkmem );
0248
0249 typedef int
0250 (__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
0251 lzo_bytep dst, lzo_uintp dst_len,
0252 lzo_voidp wrkmem );
0253
0254 typedef int
0255 (__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
0256 lzo_bytep dst, lzo_uintp dst_len,
0257 lzo_voidp wrkmem,
0258 const lzo_bytep dict, lzo_uint dict_len );
0259
0260 typedef int
0261 (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
0262 lzo_bytep dst, lzo_uintp dst_len,
0263 lzo_voidp wrkmem,
0264 const lzo_bytep dict, lzo_uint dict_len );
0265
0266
0267
0268
0269
0270 struct lzo_callback_t;
0271 typedef struct lzo_callback_t lzo_callback_t;
0272 #define lzo_callback_p lzo_callback_t __LZO_MMODEL *
0273
0274
0275 typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
0276 (lzo_callback_p self, lzo_uint items, lzo_uint size);
0277 typedef void (__LZO_CDECL *lzo_free_func_t)
0278 (lzo_callback_p self, lzo_voidp ptr);
0279
0280
0281 typedef void (__LZO_CDECL *lzo_progress_func_t)
0282 (lzo_callback_p, lzo_uint, lzo_uint, int);
0283
0284 struct lzo_callback_t
0285 {
0286
0287 lzo_alloc_func_t nalloc;
0288 lzo_free_func_t nfree;
0289
0290
0291 lzo_progress_func_t nprogress;
0292
0293
0294
0295
0296 lzo_voidp user1;
0297 lzo_xint user2;
0298 lzo_xint user3;
0299 };
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310 #define LZO_E_OK 0
0311 #define LZO_E_ERROR (-1)
0312 #define LZO_E_OUT_OF_MEMORY (-2)
0313 #define LZO_E_NOT_COMPRESSIBLE (-3)
0314 #define LZO_E_INPUT_OVERRUN (-4)
0315 #define LZO_E_OUTPUT_OVERRUN (-5)
0316 #define LZO_E_LOOKBEHIND_OVERRUN (-6)
0317 #define LZO_E_EOF_NOT_FOUND (-7)
0318 #define LZO_E_INPUT_NOT_CONSUMED (-8)
0319 #define LZO_E_NOT_YET_IMPLEMENTED (-9)
0320 #define LZO_E_INVALID_ARGUMENT (-10)
0321 #define LZO_E_INVALID_ALIGNMENT (-11)
0322 #define LZO_E_OUTPUT_NOT_CONSUMED (-12)
0323 #define LZO_E_INTERNAL_ERROR (-99)
0324
0325
0326 #ifndef lzo_sizeof_dict_t
0327 # define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
0328 #endif
0329
0330
0331
0332
0333
0334
0335
0336 #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
0337 (int)sizeof(long),(int)sizeof(lzo_uint32_t),(int)sizeof(lzo_uint),\
0338 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
0339 (int)sizeof(lzo_callback_t))
0340 LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
0341
0342
0343 LZO_EXTERN(unsigned) lzo_version(void);
0344 LZO_EXTERN(const char *) lzo_version_string(void);
0345 LZO_EXTERN(const char *) lzo_version_date(void);
0346 LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
0347 LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
0348
0349
0350 LZO_EXTERN(int)
0351 lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
0352 LZO_EXTERN(lzo_voidp)
0353 lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
0354 LZO_EXTERN(lzo_voidp)
0355 lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
0356 LZO_EXTERN(lzo_voidp)
0357 lzo_memset(lzo_voidp buf, int c, lzo_uint len);
0358
0359
0360 LZO_EXTERN(lzo_uint32_t)
0361 lzo_adler32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
0362 LZO_EXTERN(lzo_uint32_t)
0363 lzo_crc32(lzo_uint32_t c, const lzo_bytep buf, lzo_uint len);
0364 LZO_EXTERN(const lzo_uint32_tp)
0365 lzo_get_crc32_table(void);
0366
0367
0368 LZO_EXTERN(int) _lzo_config_check(void);
0369 typedef union {
0370 lzo_voidp a00; lzo_bytep a01; lzo_uint a02; lzo_xint a03; lzo_uintptr_t a04;
0371 void *a05; unsigned char *a06; unsigned long a07; size_t a08; ptrdiff_t a09;
0372 #if defined(lzo_int64_t)
0373 lzo_uint64_t a10;
0374 #endif
0375 } lzo_align_t;
0376
0377
0378 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
0379 #define LZO_PTR_ALIGN_UP(p,size) \
0380 ((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size)))
0381
0382
0383
0384
0385
0386
0387
0388 #define lzo_byte unsigned char
0389
0390 #define lzo_int32 lzo_int32_t
0391 #define lzo_uint32 lzo_uint32_t
0392 #define lzo_int32p lzo_int32_t __LZO_MMODEL *
0393 #define lzo_uint32p lzo_uint32_t __LZO_MMODEL *
0394 #define LZO_INT32_MAX LZO_INT32_C(2147483647)
0395 #define LZO_UINT32_MAX LZO_UINT32_C(4294967295)
0396 #if defined(lzo_int64_t)
0397 #define lzo_int64 lzo_int64_t
0398 #define lzo_uint64 lzo_uint64_t
0399 #define lzo_int64p lzo_int64_t __LZO_MMODEL *
0400 #define lzo_uint64p lzo_uint64_t __LZO_MMODEL *
0401 #define LZO_INT64_MAX LZO_INT64_C(9223372036854775807)
0402 #define LZO_UINT64_MAX LZO_UINT64_C(18446744073709551615)
0403 #endif
0404
0405 typedef union { lzo_bytep a; lzo_uint b; } __lzo_pu_u;
0406 typedef union { lzo_bytep a; lzo_uint32_t b; } __lzo_pu32_u;
0407
0408 #if !defined(LZO_SIZEOF_LZO_UINT)
0409 # define LZO_SIZEOF_LZO_UINT LZO_SIZEOF_LZO_INT
0410 #endif
0411
0412 #if defined(LZO_CFG_COMPAT)
0413
0414 #define __LZOCONF_H 1
0415
0416 #if defined(LZO_ARCH_I086)
0417 # define __LZO_i386 1
0418 #elif defined(LZO_ARCH_I386)
0419 # define __LZO_i386 1
0420 #endif
0421
0422 #if defined(LZO_OS_DOS16)
0423 # define __LZO_DOS 1
0424 # define __LZO_DOS16 1
0425 #elif defined(LZO_OS_DOS32)
0426 # define __LZO_DOS 1
0427 #elif defined(LZO_OS_WIN16)
0428 # define __LZO_WIN 1
0429 # define __LZO_WIN16 1
0430 #elif defined(LZO_OS_WIN32)
0431 # define __LZO_WIN 1
0432 #endif
0433
0434 #define __LZO_CMODEL
0435 #define __LZO_DMODEL
0436 #define __LZO_ENTRY __LZO_CDECL
0437 #define LZO_EXTERN_CDECL LZO_EXTERN
0438 #define LZO_ALIGN LZO_PTR_ALIGN_UP
0439
0440 #define lzo_compress_asm_t lzo_compress_t
0441 #define lzo_decompress_asm_t lzo_decompress_t
0442
0443 #endif
0444
0445
0446 #ifdef __cplusplus
0447 }
0448 #endif
0449
0450 #endif
0451
0452
0453