Ticket #5733: mythtv-lzo-crash-fix.patch
File mythtv-lzo-crash-fix.patch, 256.0 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/lzoconf.h
diff -uNr mythtv-0.21-orig/libs/libmythtv/lzoconf.h mythtv-0.21/libs/libmythtv/lzoconf.h
old new 2 2 3 3 This file is part of the LZO real-time data compression library. 4 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 5 13 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 6 14 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 7 15 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 8 16 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 9 17 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 18 All Rights Reserved. 10 19 11 20 The LZO library is free software; you can redistribute it and/or 12 21 modify it under the terms of the GNU General Public License as … … 21 30 You should have received a copy of the GNU General Public License 22 31 along with the LZO library; see the file COPYING. 23 32 If not, write to the Free Software Foundation, Inc., 24 5 9 Temple Place - Suite 330, Boston, MA 02111-1307, USA.33 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 34 26 35 Markus F.X.J. Oberhumer 27 <markus .oberhumer@jk.uni-linz.ac.at>28 http://w ildsau.idv.uni-linz.ac.at/mfx/lzo.html36 <markus@oberhumer.com> 37 http://www.oberhumer.com/opensource/lzo/ 29 38 */ 30 39 31 40 32 #ifndef __LZOCONF_H 33 #define __LZOCONF_H 41 #ifndef __LZOCONF_H_INCLUDED 42 #define __LZOCONF_H_INCLUDED 34 43 35 #define LZO_VERSION 0x 107036 #define LZO_VERSION_STRING " 1.07"37 #define LZO_VERSION_DATE " Oct 18 2000"44 #define LZO_VERSION 0x2030 45 #define LZO_VERSION_STRING "2.03" 46 #define LZO_VERSION_DATE "Apr 30 2008" 38 47 39 48 /* internal Autoconf configuration file - only used when building LZO */ 40 49 #if defined(LZO_HAVE_CONFIG_H) 41 50 # include <config.h> 42 51 #endif 43 52 #include <limits.h> 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 53 #include <stddef.h> 48 54 49 55 50 56 /*********************************************************************** … … 61 67 # error "your limits.h macros are broken" 62 68 #endif 63 69 64 /* workaround a cpp bug under hpux 10.20 */ 65 #define LZO_0xffffffffL 4294967295ul 70 /* get OS and architecture defines */ 71 #ifndef __LZODEFS_H_INCLUDED 72 #include "lzodefs.h" 73 #endif 66 74 67 75 68 /*********************************************************************** 69 // architecture defines 70 ************************************************************************/ 71 72 #if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2) 73 # if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) 74 # define __LZO_WIN 75 # elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) 76 # define __LZO_WIN 77 # elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__) 78 # define __LZO_WIN 79 # elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS) 80 # define __LZO_DOS 81 # elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2) 82 # define __LZO_OS2 83 # elif defined(__palmos__) 84 # define __LZO_PALMOS 85 # elif defined(__TOS__) || defined(__atarist__) 86 # define __LZO_TOS 87 # endif 76 #ifdef __cplusplus 77 extern "C" { 88 78 #endif 89 79 90 #if (UINT_MAX < LZO_0xffffffffL)91 # if defined(__LZO_WIN)92 # define __LZO_WIN1693 # elif defined(__LZO_DOS)94 # define __LZO_DOS1695 # elif defined(__LZO_PALMOS)96 # define __LZO_PALMOS1697 # elif defined(__LZO_TOS)98 # define __LZO_TOS1699 # elif defined(__C166__)100 # else101 # error "16-bit target not supported - contact me for porting hints"102 # endif103 #endif104 80 105 #if !defined(__LZO_i386) 106 # if defined(__LZO_DOS) || defined(__LZO_WIN16) 107 # define __LZO_i386 108 # elif defined(__i386__) || defined(__386__) || defined(_M_IX86) 109 # define __LZO_i386 110 # endif 111 #endif 81 /*********************************************************************** 82 // some core defines 83 ************************************************************************/ 112 84 113 #if defined(__LZO_STRICT_16BIT)85 #if !defined(LZO_UINT32_C) 114 86 # if (UINT_MAX < LZO_0xffffffffL) 115 # include <lzo16bit.h> 87 # define LZO_UINT32_C(c) c ## UL 88 # else 89 # define LZO_UINT32_C(c) ((c) + 0U) 116 90 # endif 117 91 #endif 118 92 119 93 /* memory checkers */ 120 94 #if !defined(__LZO_CHECKER) 121 95 # if defined(__BOUNDS_CHECKING_ON) 122 # define __LZO_CHECKER 96 # define __LZO_CHECKER 1 123 97 # elif defined(__CHECKER__) 124 # define __LZO_CHECKER 98 # define __LZO_CHECKER 1 125 99 # elif defined(__INSURE__) 126 # define __LZO_CHECKER 100 # define __LZO_CHECKER 1 127 101 # elif defined(__PURIFY__) 128 # define __LZO_CHECKER 102 # define __LZO_CHECKER 1 129 103 # endif 130 104 #endif 131 105 … … 134 108 // integral and pointer types 135 109 ************************************************************************/ 136 110 137 /* Integral types with 32 bits or more */ 111 /* lzo_uint should match size_t */ 112 #if !defined(LZO_UINT_MAX) 113 # if defined(LZO_ABI_LLP64) /* WIN64 */ 114 # if defined(LZO_OS_WIN64) 115 typedef unsigned __int64 lzo_uint; 116 typedef __int64 lzo_int; 117 # else 118 typedef unsigned long long lzo_uint; 119 typedef long long lzo_int; 120 # endif 121 # define LZO_UINT_MAX 0xffffffffffffffffull 122 # define LZO_INT_MAX 9223372036854775807LL 123 # define LZO_INT_MIN (-1LL - LZO_INT_MAX) 124 # elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */ 125 typedef unsigned int lzo_uint; 126 typedef int lzo_int; 127 # define LZO_UINT_MAX UINT_MAX 128 # define LZO_INT_MAX INT_MAX 129 # define LZO_INT_MIN INT_MIN 130 # elif (ULONG_MAX >= LZO_0xffffffffL) 131 typedef unsigned long lzo_uint; 132 typedef long lzo_int; 133 # define LZO_UINT_MAX ULONG_MAX 134 # define LZO_INT_MAX LONG_MAX 135 # define LZO_INT_MIN LONG_MIN 136 # else 137 # error "lzo_uint" 138 # endif 139 #endif 140 141 /* Integral types with 32 bits or more. */ 138 142 #if !defined(LZO_UINT32_MAX) 139 143 # if (UINT_MAX >= LZO_0xffffffffL) 140 144 typedef unsigned int lzo_uint32; … … 153 157 # endif 154 158 #endif 155 159 156 /* lzo_uint is used like size_t */ 157 #if !defined(LZO_UINT_MAX) 158 # if (UINT_MAX >= LZO_0xffffffffL) 159 typedef unsigned int lzo_uint; 160 typedef int lzo_int; 161 # define LZO_UINT_MAX UINT_MAX 162 # define LZO_INT_MAX INT_MAX 163 # define LZO_INT_MIN INT_MIN 164 # elif (ULONG_MAX >= LZO_0xffffffffL) 165 typedef unsigned long lzo_uint; 166 typedef long lzo_int; 167 # define LZO_UINT_MAX ULONG_MAX 168 # define LZO_INT_MAX LONG_MAX 169 # define LZO_INT_MIN LONG_MIN 170 # else 171 # error "lzo_uint" 172 # endif 160 /* The larger type of lzo_uint and lzo_uint32. */ 161 #if (LZO_UINT_MAX >= LZO_UINT32_MAX) 162 # define lzo_xint lzo_uint 163 #else 164 # define lzo_xint lzo_uint32 173 165 #endif 174 166 175 176 167 /* Memory model that allows to access memory at offsets of lzo_uint. */ 177 168 #if !defined(__LZO_MMODEL) 178 169 # if (LZO_UINT_MAX <= UINT_MAX) 179 170 # define __LZO_MMODEL 180 # elif defined(__LZO_DOS16) || defined(__LZO_WIN16) 171 # elif defined(LZO_HAVE_MM_HUGE_PTR) 172 # define __LZO_MMODEL_HUGE 1 181 173 # define __LZO_MMODEL __huge 182 # define LZO_999_UNSUPPORTED183 # elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16)184 # define __LZO_MMODEL185 174 # else 186 # error "__LZO_MMODEL"175 # define __LZO_MMODEL 187 176 # endif 188 177 #endif 189 178 190 179 /* no typedef here because of const-pointer issues */ 191 #define lzo_byte unsigned char __LZO_MMODEL192 180 #define lzo_bytep unsigned char __LZO_MMODEL * 193 181 #define lzo_charp char __LZO_MMODEL * 194 182 #define lzo_voidp void __LZO_MMODEL * … … 198 186 #define lzo_int32p lzo_int32 __LZO_MMODEL * 199 187 #define lzo_uintp lzo_uint __LZO_MMODEL * 200 188 #define lzo_intp lzo_int __LZO_MMODEL * 189 #define lzo_xintp lzo_xint __LZO_MMODEL * 201 190 #define lzo_voidpp lzo_voidp __LZO_MMODEL * 202 191 #define lzo_bytepp lzo_bytep __LZO_MMODEL * 192 /* deprecated - use `lzo_bytep' instead of `lzo_byte *' */ 193 #define lzo_byte unsigned char __LZO_MMODEL 203 194 204 195 typedef int lzo_bool; 205 196 206 #ifndef lzo_sizeof_dict_t207 # define lzo_sizeof_dict_t sizeof(lzo_bytep)208 #endif209 210 197 211 198 /*********************************************************************** 212 199 // function types 213 200 ************************************************************************/ 214 201 215 /* linkage*/202 /* name mangling */ 216 203 #if !defined(__LZO_EXTERN_C) 217 204 # ifdef __cplusplus 218 205 # define __LZO_EXTERN_C extern "C" … … 221 208 # endif 222 209 #endif 223 210 224 /* calling convention s*/211 /* calling convention */ 225 212 #if !defined(__LZO_CDECL) 226 # if defined(__LZO_DOS16) || defined(__LZO_WIN16) 227 # define __LZO_CDECL __far __cdecl 228 # elif defined(__LZO_i386) && defined(_MSC_VER) 229 # define __LZO_CDECL __cdecl 230 # elif defined(__LZO_i386) && defined(__WATCOMC__) 231 # define __LZO_CDECL __near __cdecl 232 # else 233 # define __LZO_CDECL 234 # endif 235 #endif 236 #if !defined(__LZO_ENTRY) 237 # define __LZO_ENTRY __LZO_CDECL 213 # define __LZO_CDECL __lzo_cdecl 238 214 #endif 239 215 240 216 /* DLL export information */ … … 245 221 # define __LZO_EXPORT2 246 222 #endif 247 223 248 /* calling convention for Cfunctions */224 /* __cdecl calling convention for public C and assembly functions */ 249 225 #if !defined(LZO_PUBLIC) 250 # define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ ENTRY226 # define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL 251 227 #endif 252 228 #if !defined(LZO_EXTERN) 253 229 # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype) 254 230 #endif 255 231 #if !defined(LZO_PRIVATE) 256 # define LZO_PRIVATE(_rettype) static _rettype __LZO_ ENTRY232 # define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL 257 233 #endif 258 234 259 /* cdecl calling convention for assembler functions */ 260 #if !defined(LZO_PUBLIC_CDECL) 261 # define LZO_PUBLIC_CDECL(_rettype) \ 262 __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL 263 #endif 264 #if !defined(LZO_EXTERN_CDECL) 265 # define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype) 266 #endif 267 268 235 /* function types */ 269 236 typedef int 270 (__LZO_ ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len,271 lzo_byte *dst, lzo_uint *dst_len,237 (__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len, 238 lzo_bytep dst, lzo_uintp dst_len, 272 239 lzo_voidp wrkmem ); 273 240 274 241 typedef int 275 (__LZO_ ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len,276 lzo_byte *dst, lzo_uint *dst_len,242 (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len, 243 lzo_bytep dst, lzo_uintp dst_len, 277 244 lzo_voidp wrkmem ); 278 245 279 246 typedef int 280 (__LZO_ ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len,281 lzo_byte *dst, lzo_uint *dst_len,247 (__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len, 248 lzo_bytep dst, lzo_uintp dst_len, 282 249 lzo_voidp wrkmem ); 283 250 284 251 typedef int 285 (__LZO_ ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len,286 lzo_byte *dst, lzo_uint *dst_len,287 lzo_voidp wrkmem,288 const lzo_byte *dict, lzo_uint dict_len );252 (__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len, 253 lzo_bytep dst, lzo_uintp dst_len, 254 lzo_voidp wrkmem, 255 const lzo_bytep dict, lzo_uint dict_len ); 289 256 290 257 typedef int 291 (__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len, 292 lzo_byte *dst, lzo_uint *dst_len, 293 lzo_voidp wrkmem, 294 const lzo_byte *dict, lzo_uint dict_len ); 295 258 (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len, 259 lzo_bytep dst, lzo_uintp dst_len, 260 lzo_voidp wrkmem, 261 const lzo_bytep dict, lzo_uint dict_len ); 262 263 264 /* Callback interface. Currently only the progress indicator ("nprogress") 265 * is used, but this may change in a future release. */ 266 267 struct lzo_callback_t; 268 typedef struct lzo_callback_t lzo_callback_t; 269 #define lzo_callback_p lzo_callback_t __LZO_MMODEL * 270 271 /* malloc & free function types */ 272 typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t) 273 (lzo_callback_p self, lzo_uint items, lzo_uint size); 274 typedef void (__LZO_CDECL *lzo_free_func_t) 275 (lzo_callback_p self, lzo_voidp ptr); 296 276 297 277 /* a progress indicator callback function */ 298 typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint); 278 typedef void (__LZO_CDECL *lzo_progress_func_t) 279 (lzo_callback_p, lzo_uint, lzo_uint, int); 280 281 struct lzo_callback_t 282 { 283 /* custom allocators (set to 0 to disable) */ 284 lzo_alloc_func_t nalloc; /* [not used right now] */ 285 lzo_free_func_t nfree; /* [not used right now] */ 286 287 /* a progress indicator callback function (set to 0 to disable) */ 288 lzo_progress_func_t nprogress; 289 290 /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress 291 * callbacks points back to this struct, so you are free to store 292 * some extra info in the following variables. */ 293 lzo_voidp user1; 294 lzo_xint user2; 295 lzo_xint user3; 296 }; 299 297 300 298 301 299 /*********************************************************************** … … 308 306 */ 309 307 #define LZO_E_OK 0 310 308 #define LZO_E_ERROR (-1) 311 #define LZO_E_OUT_OF_MEMORY (-2) /* not used right now*/312 #define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now*/309 #define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */ 310 #define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */ 313 311 #define LZO_E_INPUT_OVERRUN (-4) 314 312 #define LZO_E_OUTPUT_OVERRUN (-5) 315 313 #define LZO_E_LOOKBEHIND_OVERRUN (-6) 316 314 #define LZO_E_EOF_NOT_FOUND (-7) 317 315 #define LZO_E_INPUT_NOT_CONSUMED (-8) 316 #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */ 318 317 319 318 319 #ifndef lzo_sizeof_dict_t 320 # define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep)) 321 #endif 322 320 323 /* lzo_init() should be the first function you call. 321 324 * Check the return code ! 322 325 * 323 326 * lzo_init() is a macro to allow checking that the library and the 324 327 * compiler's view of various types are consistent. 325 328 */ 326 #define lzo_init() __lzo_init 2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\329 #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\ 327 330 (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\ 328 331 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\ 329 (int)sizeof(lzo_c ompress_t))330 LZO_EXTERN(int) __lzo_init 2(unsigned,int,int,int,int,int,int,int,int,int);332 (int)sizeof(lzo_callback_t)) 333 LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int); 331 334 332 335 /* version functions (useful for shared libraries) */ 333 336 LZO_EXTERN(unsigned) lzo_version(void); … … 348 351 349 352 /* checksum functions */ 350 353 LZO_EXTERN(lzo_uint32) 351 lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len);354 lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len); 352 355 LZO_EXTERN(lzo_uint32) 353 lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len); 354 355 /* memory allocation functions */ 356 LZO_EXTERN(lzo_bytep) lzo_alloc(lzo_uint _nelems, lzo_uint _size); 357 LZO_EXTERN(lzo_bytep) lzo_malloc(lzo_uint _size); 358 LZO_EXTERN(void) lzo_free(lzo_voidp _ptr); 359 360 typedef lzo_bytep (__LZO_ENTRY *lzo_alloc_hook_t) (lzo_uint, lzo_uint); 361 typedef void (__LZO_ENTRY *lzo_free_hook_t) (lzo_voidp); 362 363 extern lzo_alloc_hook_t lzo_alloc_hook; 364 extern lzo_free_hook_t lzo_free_hook; 356 lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len); 357 LZO_EXTERN(const lzo_uint32p) 358 lzo_get_crc32_table(void); 365 359 366 360 /* misc. */ 367 LZO_EXTERN(lzo_bool) lzo_assert(int _expr);368 361 LZO_EXTERN(int) _lzo_config_check(void); 369 362 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u; 370 363 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u; 364 typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t; 371 365 372 366 /* align a char pointer on a boundary that is a multiple of `size' */ 373 367 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size); 374 368 #define LZO_PTR_ALIGN_UP(_ptr,_size) \ 375 369 ((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size))) 376 370 377 /* deprecated - only for backward compatibility */ 378 #define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size) 371 372 /*********************************************************************** 373 // deprecated macros - only for backward compatibility with LZO v1.xx 374 ************************************************************************/ 375 376 #if defined(LZO_CFG_COMPAT) 377 378 #define __LZOCONF_H 1 379 380 #if defined(LZO_ARCH_I086) 381 # define __LZO_i386 1 382 #elif defined(LZO_ARCH_I386) 383 # define __LZO_i386 1 384 #endif 385 386 #if defined(LZO_OS_DOS16) 387 # define __LZO_DOS 1 388 # define __LZO_DOS16 1 389 #elif defined(LZO_OS_DOS32) 390 # define __LZO_DOS 1 391 #elif defined(LZO_OS_WIN16) 392 # define __LZO_WIN 1 393 # define __LZO_WIN16 1 394 #elif defined(LZO_OS_WIN32) 395 # define __LZO_WIN 1 396 #endif 397 398 #define __LZO_CMODEL 399 #define __LZO_DMODEL 400 #define __LZO_ENTRY __LZO_CDECL 401 #define LZO_EXTERN_CDECL LZO_EXTERN 402 #define LZO_ALIGN LZO_PTR_ALIGN_UP 403 404 #define lzo_compress_asm_t lzo_compress_t 405 #define lzo_decompress_asm_t lzo_decompress_t 406 407 #endif /* LZO_CFG_COMPAT */ 379 408 380 409 381 410 #ifdef __cplusplus … … 384 413 385 414 #endif /* already included */ 386 415 416 417 /* vim:set ts=4 et: */ -
libs/libmythtv/lzodefs.h
diff -uNr mythtv-0.21-orig/libs/libmythtv/lzodefs.h mythtv-0.21/libs/libmythtv/lzodefs.h
old new 1 /* lzodefs.h -- architecture, OS and compiler specific defines 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 #ifndef __LZODEFS_H_INCLUDED 42 #define __LZODEFS_H_INCLUDED 1 43 44 #if defined(__CYGWIN32__) && !defined(__CYGWIN__) 45 # define __CYGWIN__ __CYGWIN32__ 46 #endif 47 #if defined(__IBMCPP__) && !defined(__IBMC__) 48 # define __IBMC__ __IBMCPP__ 49 #endif 50 #if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) 51 # define __INTEL_COMPILER __ICL 52 #endif 53 #if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) 54 # define _ALL_SOURCE 1 55 #endif 56 #if defined(__mips__) && defined(__R5900__) 57 # if !defined(__LONG_MAX__) 58 # define __LONG_MAX__ 9223372036854775807L 59 # endif 60 #endif 61 #if defined(__INTEL_COMPILER) && defined(__linux__) 62 # pragma warning(disable: 193) 63 #endif 64 #if defined(__KEIL__) && defined(__C166__) 65 # pragma warning disable = 322 66 #elif 0 && defined(__C251__) 67 # pragma warning disable = 322 68 #endif 69 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) 70 # if (_MSC_VER >= 1300) 71 # pragma warning(disable: 4668) 72 # endif 73 #endif 74 #if 0 && defined(__WATCOMC__) 75 # if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) 76 # pragma warning 203 9 77 # endif 78 #endif 79 #if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) 80 # pragma option -h 81 #endif 82 #if 0 83 #define LZO_0xffffL 0xfffful 84 #define LZO_0xffffffffL 0xfffffffful 85 #else 86 #define LZO_0xffffL 65535ul 87 #define LZO_0xffffffffL 4294967295ul 88 #endif 89 #if (LZO_0xffffL == LZO_0xffffffffL) 90 # error "your preprocessor is broken 1" 91 #endif 92 #if (16ul * 16384ul != 262144ul) 93 # error "your preprocessor is broken 2" 94 #endif 95 #if 0 96 #if (32767 >= 4294967295ul) 97 # error "your preprocessor is broken 3" 98 #endif 99 #if (65535u >= 4294967295ul) 100 # error "your preprocessor is broken 4" 101 #endif 102 #endif 103 #if (UINT_MAX == LZO_0xffffL) 104 #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) 105 # if !defined(MSDOS) 106 # define MSDOS 1 107 # endif 108 # if !defined(_MSDOS) 109 # define _MSDOS 1 110 # endif 111 #elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) 112 # if (__VERSION == 520) && (MB_LEN_MAX == 1) 113 # if !defined(__AZTEC_C__) 114 # define __AZTEC_C__ __VERSION 115 # endif 116 # if !defined(__DOS__) 117 # define __DOS__ 1 118 # endif 119 # endif 120 #endif 121 #endif 122 #if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) 123 # define ptrdiff_t long 124 # define _PTRDIFF_T_DEFINED 125 #endif 126 #if (UINT_MAX == LZO_0xffffL) 127 # undef __LZO_RENAME_A 128 # undef __LZO_RENAME_B 129 # if defined(__AZTEC_C__) && defined(__DOS__) 130 # define __LZO_RENAME_A 1 131 # elif defined(_MSC_VER) && defined(MSDOS) 132 # if (_MSC_VER < 600) 133 # define __LZO_RENAME_A 1 134 # elif (_MSC_VER < 700) 135 # define __LZO_RENAME_B 1 136 # endif 137 # elif defined(__TSC__) && defined(__OS2__) 138 # define __LZO_RENAME_A 1 139 # elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) 140 # define __LZO_RENAME_A 1 141 # elif defined(__PACIFIC__) && defined(DOS) 142 # if !defined(__far) 143 # define __far far 144 # endif 145 # if !defined(__near) 146 # define __near near 147 # endif 148 # endif 149 # if defined(__LZO_RENAME_A) 150 # if !defined(__cdecl) 151 # define __cdecl cdecl 152 # endif 153 # if !defined(__far) 154 # define __far far 155 # endif 156 # if !defined(__huge) 157 # define __huge huge 158 # endif 159 # if !defined(__near) 160 # define __near near 161 # endif 162 # if !defined(__pascal) 163 # define __pascal pascal 164 # endif 165 # if !defined(__huge) 166 # define __huge huge 167 # endif 168 # elif defined(__LZO_RENAME_B) 169 # if !defined(__cdecl) 170 # define __cdecl _cdecl 171 # endif 172 # if !defined(__far) 173 # define __far _far 174 # endif 175 # if !defined(__huge) 176 # define __huge _huge 177 # endif 178 # if !defined(__near) 179 # define __near _near 180 # endif 181 # if !defined(__pascal) 182 # define __pascal _pascal 183 # endif 184 # elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) 185 # if !defined(__cdecl) 186 # define __cdecl cdecl 187 # endif 188 # if !defined(__pascal) 189 # define __pascal pascal 190 # endif 191 # endif 192 # undef __LZO_RENAME_A 193 # undef __LZO_RENAME_B 194 #endif 195 #if (UINT_MAX == LZO_0xffffL) 196 #if defined(__AZTEC_C__) && defined(__DOS__) 197 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 198 #elif defined(_MSC_VER) && defined(MSDOS) 199 # if (_MSC_VER < 600) 200 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 201 # endif 202 # if (_MSC_VER < 700) 203 # define LZO_BROKEN_INTEGRAL_PROMOTION 1 204 # define LZO_BROKEN_SIZEOF 1 205 # endif 206 #elif defined(__PACIFIC__) && defined(DOS) 207 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 208 #elif defined(__TURBOC__) && defined(__MSDOS__) 209 # if (__TURBOC__ < 0x0150) 210 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 211 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 212 # define LZO_BROKEN_INTEGRAL_PROMOTION 1 213 # endif 214 # if (__TURBOC__ < 0x0200) 215 # define LZO_BROKEN_SIZEOF 1 216 # endif 217 # if (__TURBOC__ < 0x0400) && defined(__cplusplus) 218 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 219 # endif 220 #elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) 221 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 222 # define LZO_BROKEN_SIZEOF 1 223 #endif 224 #endif 225 #if defined(__WATCOMC__) && (__WATCOMC__ < 900) 226 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 227 #endif 228 #if defined(_CRAY) && defined(_CRAY1) 229 # define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 230 #endif 231 #define LZO_PP_STRINGIZE(x) #x 232 #define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) 233 #define LZO_PP_CONCAT2(a,b) a ## b 234 #define LZO_PP_CONCAT3(a,b,c) a ## b ## c 235 #define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d 236 #define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e 237 #define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) 238 #define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) 239 #define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) 240 #define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) 241 #if 1 242 #define LZO_CPP_STRINGIZE(x) #x 243 #define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) 244 #define LZO_CPP_CONCAT2(a,b) a ## b 245 #define LZO_CPP_CONCAT3(a,b,c) a ## b ## c 246 #define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d 247 #define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e 248 #define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) 249 #define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) 250 #define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) 251 #define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) 252 #endif 253 #define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) 254 #if 1 && defined(__cplusplus) 255 # if !defined(__STDC_CONSTANT_MACROS) 256 # define __STDC_CONSTANT_MACROS 1 257 # endif 258 # if !defined(__STDC_LIMIT_MACROS) 259 # define __STDC_LIMIT_MACROS 1 260 # endif 261 #endif 262 #if defined(__cplusplus) 263 # define LZO_EXTERN_C extern "C" 264 #else 265 # define LZO_EXTERN_C extern 266 #endif 267 #if !defined(__LZO_OS_OVERRIDE) 268 #if defined(LZO_OS_FREESTANDING) 269 # define LZO_INFO_OS "freestanding" 270 #elif defined(LZO_OS_EMBEDDED) 271 # define LZO_INFO_OS "embedded" 272 #elif 1 && defined(__IAR_SYSTEMS_ICC__) 273 # define LZO_OS_EMBEDDED 1 274 # define LZO_INFO_OS "embedded" 275 #elif defined(__CYGWIN__) && defined(__GNUC__) 276 # define LZO_OS_CYGWIN 1 277 # define LZO_INFO_OS "cygwin" 278 #elif defined(__EMX__) && defined(__GNUC__) 279 # define LZO_OS_EMX 1 280 # define LZO_INFO_OS "emx" 281 #elif defined(__BEOS__) 282 # define LZO_OS_BEOS 1 283 # define LZO_INFO_OS "beos" 284 #elif defined(__Lynx__) 285 # define LZO_OS_LYNXOS 1 286 # define LZO_INFO_OS "lynxos" 287 #elif defined(__OS400__) 288 # define LZO_OS_OS400 1 289 # define LZO_INFO_OS "os400" 290 #elif defined(__QNX__) 291 # define LZO_OS_QNX 1 292 # define LZO_INFO_OS "qnx" 293 #elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) 294 # define LZO_OS_DOS32 1 295 # define LZO_INFO_OS "dos32" 296 #elif defined(__BORLANDC__) && defined(__DPMI16__) 297 # define LZO_OS_DOS16 1 298 # define LZO_INFO_OS "dos16" 299 #elif defined(__ZTC__) && defined(DOS386) 300 # define LZO_OS_DOS32 1 301 # define LZO_INFO_OS "dos32" 302 #elif defined(__OS2__) || defined(__OS2V2__) 303 # if (UINT_MAX == LZO_0xffffL) 304 # define LZO_OS_OS216 1 305 # define LZO_INFO_OS "os216" 306 # elif (UINT_MAX == LZO_0xffffffffL) 307 # define LZO_OS_OS2 1 308 # define LZO_INFO_OS "os2" 309 # else 310 # error "check your limits.h header" 311 # endif 312 #elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) 313 # define LZO_OS_WIN64 1 314 # define LZO_INFO_OS "win64" 315 #elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) 316 # define LZO_OS_WIN32 1 317 # define LZO_INFO_OS "win32" 318 #elif defined(__MWERKS__) && defined(__INTEL__) 319 # define LZO_OS_WIN32 1 320 # define LZO_INFO_OS "win32" 321 #elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) 322 # if (UINT_MAX == LZO_0xffffL) 323 # define LZO_OS_WIN16 1 324 # define LZO_INFO_OS "win16" 325 # elif (UINT_MAX == LZO_0xffffffffL) 326 # define LZO_OS_WIN32 1 327 # define LZO_INFO_OS "win32" 328 # else 329 # error "check your limits.h header" 330 # endif 331 #elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) 332 # if (UINT_MAX == LZO_0xffffL) 333 # define LZO_OS_DOS16 1 334 # define LZO_INFO_OS "dos16" 335 # elif (UINT_MAX == LZO_0xffffffffL) 336 # define LZO_OS_DOS32 1 337 # define LZO_INFO_OS "dos32" 338 # else 339 # error "check your limits.h header" 340 # endif 341 #elif defined(__WATCOMC__) 342 # if defined(__NT__) && (UINT_MAX == LZO_0xffffL) 343 # define LZO_OS_DOS16 1 344 # define LZO_INFO_OS "dos16" 345 # elif defined(__NT__) && (__WATCOMC__ < 1100) 346 # define LZO_OS_WIN32 1 347 # define LZO_INFO_OS "win32" 348 # elif defined(__linux__) || defined(__LINUX__) 349 # define LZO_OS_POSIX 1 350 # define LZO_INFO_OS "posix" 351 # else 352 # error "please specify a target using the -bt compiler option" 353 # endif 354 #elif defined(__palmos__) 355 # define LZO_OS_PALMOS 1 356 # define LZO_INFO_OS "palmos" 357 #elif defined(__TOS__) || defined(__atarist__) 358 # define LZO_OS_TOS 1 359 # define LZO_INFO_OS "tos" 360 #elif defined(macintosh) && !defined(__ppc__) 361 # define LZO_OS_MACCLASSIC 1 362 # define LZO_INFO_OS "macclassic" 363 #elif defined(__VMS) 364 # define LZO_OS_VMS 1 365 # define LZO_INFO_OS "vms" 366 #elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) 367 # define LZO_OS_CONSOLE 1 368 # define LZO_OS_CONSOLE_PS2 1 369 # define LZO_INFO_OS "console" 370 # define LZO_INFO_OS_CONSOLE "ps2" 371 #elif (defined(__mips__) && defined(__psp__)) 372 # define LZO_OS_CONSOLE 1 373 # define LZO_OS_CONSOLE_PSP 1 374 # define LZO_INFO_OS "console" 375 # define LZO_INFO_OS_CONSOLE "psp" 376 #else 377 # define LZO_OS_POSIX 1 378 # define LZO_INFO_OS "posix" 379 #endif 380 #if (LZO_OS_POSIX) 381 # if defined(_AIX) || defined(__AIX__) || defined(__aix__) 382 # define LZO_OS_POSIX_AIX 1 383 # define LZO_INFO_OS_POSIX "aix" 384 # elif defined(__FreeBSD__) 385 # define LZO_OS_POSIX_FREEBSD 1 386 # define LZO_INFO_OS_POSIX "freebsd" 387 # elif defined(__hpux__) || defined(__hpux) 388 # define LZO_OS_POSIX_HPUX 1 389 # define LZO_INFO_OS_POSIX "hpux" 390 # elif defined(__INTERIX) 391 # define LZO_OS_POSIX_INTERIX 1 392 # define LZO_INFO_OS_POSIX "interix" 393 # elif defined(__IRIX__) || defined(__irix__) 394 # define LZO_OS_POSIX_IRIX 1 395 # define LZO_INFO_OS_POSIX "irix" 396 # elif defined(__linux__) || defined(__linux) || defined(__LINUX__) 397 # define LZO_OS_POSIX_LINUX 1 398 # define LZO_INFO_OS_POSIX "linux" 399 # elif defined(__APPLE__) || defined(__MACOS__) 400 # define LZO_OS_POSIX_MACOSX 1 401 # define LZO_INFO_OS_POSIX "macosx" 402 # elif defined(__minix__) || defined(__minix) 403 # define LZO_OS_POSIX_MINIX 1 404 # define LZO_INFO_OS_POSIX "minix" 405 # elif defined(__NetBSD__) 406 # define LZO_OS_POSIX_NETBSD 1 407 # define LZO_INFO_OS_POSIX "netbsd" 408 # elif defined(__OpenBSD__) 409 # define LZO_OS_POSIX_OPENBSD 1 410 # define LZO_INFO_OS_POSIX "openbsd" 411 # elif defined(__osf__) 412 # define LZO_OS_POSIX_OSF 1 413 # define LZO_INFO_OS_POSIX "osf" 414 # elif defined(__solaris__) || defined(__sun) 415 # if defined(__SVR4) || defined(__svr4__) 416 # define LZO_OS_POSIX_SOLARIS 1 417 # define LZO_INFO_OS_POSIX "solaris" 418 # else 419 # define LZO_OS_POSIX_SUNOS 1 420 # define LZO_INFO_OS_POSIX "sunos" 421 # endif 422 # elif defined(__ultrix__) || defined(__ultrix) 423 # define LZO_OS_POSIX_ULTRIX 1 424 # define LZO_INFO_OS_POSIX "ultrix" 425 # elif defined(_UNICOS) 426 # define LZO_OS_POSIX_UNICOS 1 427 # define LZO_INFO_OS_POSIX "unicos" 428 # else 429 # define LZO_OS_POSIX_UNKNOWN 1 430 # define LZO_INFO_OS_POSIX "unknown" 431 # endif 432 #endif 433 #endif 434 #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 435 # if (UINT_MAX != LZO_0xffffL) 436 # error "this should not happen" 437 # endif 438 # if (ULONG_MAX != LZO_0xffffffffL) 439 # error "this should not happen" 440 # endif 441 #endif 442 #if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) 443 # if (UINT_MAX != LZO_0xffffffffL) 444 # error "this should not happen" 445 # endif 446 # if (ULONG_MAX != LZO_0xffffffffL) 447 # error "this should not happen" 448 # endif 449 #endif 450 #if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) 451 # define LZO_CC_CILLY 1 452 # define LZO_INFO_CC "Cilly" 453 # if defined(__CILLY__) 454 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) 455 # else 456 # define LZO_INFO_CCVER "unknown" 457 # endif 458 #elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) 459 # define LZO_CC_SDCC 1 460 # define LZO_INFO_CC "sdcc" 461 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) 462 #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) 463 # define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) 464 # define LZO_INFO_CC "Pathscale C" 465 # define LZO_INFO_CCVER __PATHSCALE__ 466 #elif defined(__INTEL_COMPILER) 467 # define LZO_CC_INTELC 1 468 # define LZO_INFO_CC "Intel C" 469 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) 470 # if defined(_WIN32) || defined(_WIN64) 471 # define LZO_CC_SYNTAX_MSC 1 472 # else 473 # define LZO_CC_SYNTAX_GNUC 1 474 # endif 475 #elif defined(__POCC__) && defined(_WIN32) 476 # define LZO_CC_PELLESC 1 477 # define LZO_INFO_CC "Pelles C" 478 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) 479 #elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) 480 # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) 481 # define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) 482 # else 483 # define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) 484 # endif 485 # define LZO_INFO_CC "llvm-gcc" 486 # define LZO_INFO_CCVER __VERSION__ 487 #elif defined(__GNUC__) && defined(__VERSION__) 488 # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) 489 # define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) 490 # elif defined(__GNUC_MINOR__) 491 # define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) 492 # else 493 # define LZO_CC_GNUC (__GNUC__ * 0x10000L) 494 # endif 495 # define LZO_INFO_CC "gcc" 496 # define LZO_INFO_CCVER __VERSION__ 497 #elif defined(__ACK__) && defined(_ACK) 498 # define LZO_CC_ACK 1 499 # define LZO_INFO_CC "Amsterdam Compiler Kit C" 500 # define LZO_INFO_CCVER "unknown" 501 #elif defined(__AZTEC_C__) 502 # define LZO_CC_AZTECC 1 503 # define LZO_INFO_CC "Aztec C" 504 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) 505 #elif defined(__BORLANDC__) 506 # define LZO_CC_BORLANDC 1 507 # define LZO_INFO_CC "Borland C" 508 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) 509 #elif defined(_CRAYC) && defined(_RELEASE) 510 # define LZO_CC_CRAYC 1 511 # define LZO_INFO_CC "Cray C" 512 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) 513 #elif defined(__DMC__) && defined(__SC__) 514 # define LZO_CC_DMC 1 515 # define LZO_INFO_CC "Digital Mars C" 516 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) 517 #elif defined(__DECC) 518 # define LZO_CC_DECC 1 519 # define LZO_INFO_CC "DEC C" 520 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) 521 #elif defined(__HIGHC__) 522 # define LZO_CC_HIGHC 1 523 # define LZO_INFO_CC "MetaWare High C" 524 # define LZO_INFO_CCVER "unknown" 525 #elif defined(__IAR_SYSTEMS_ICC__) 526 # define LZO_CC_IARC 1 527 # define LZO_INFO_CC "IAR C" 528 # if defined(__VER__) 529 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) 530 # else 531 # define LZO_INFO_CCVER "unknown" 532 # endif 533 #elif defined(__IBMC__) 534 # define LZO_CC_IBMC 1 535 # define LZO_INFO_CC "IBM C" 536 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) 537 #elif defined(__KEIL__) && defined(__C166__) 538 # define LZO_CC_KEILC 1 539 # define LZO_INFO_CC "Keil C" 540 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) 541 #elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) 542 # define LZO_CC_LCCWIN32 1 543 # define LZO_INFO_CC "lcc-win32" 544 # define LZO_INFO_CCVER "unknown" 545 #elif defined(__LCC__) 546 # define LZO_CC_LCC 1 547 # define LZO_INFO_CC "lcc" 548 # if defined(__LCC_VERSION__) 549 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) 550 # else 551 # define LZO_INFO_CCVER "unknown" 552 # endif 553 #elif defined(_MSC_VER) 554 # define LZO_CC_MSC 1 555 # define LZO_INFO_CC "Microsoft C" 556 # if defined(_MSC_FULL_VER) 557 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) 558 # else 559 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) 560 # endif 561 #elif defined(__MWERKS__) 562 # define LZO_CC_MWERKS 1 563 # define LZO_INFO_CC "Metrowerks C" 564 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) 565 #elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) 566 # define LZO_CC_NDPC 1 567 # define LZO_INFO_CC "Microway NDP C" 568 # define LZO_INFO_CCVER "unknown" 569 #elif defined(__PACIFIC__) 570 # define LZO_CC_PACIFICC 1 571 # define LZO_INFO_CC "Pacific C" 572 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) 573 #elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) 574 # define LZO_CC_PGI 1 575 # define LZO_INFO_CC "Portland Group PGI C" 576 # define LZO_INFO_CCVER "unknown" 577 #elif defined(__PUREC__) && defined(__TOS__) 578 # define LZO_CC_PUREC 1 579 # define LZO_INFO_CC "Pure C" 580 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) 581 #elif defined(__SC__) && defined(__ZTC__) 582 # define LZO_CC_SYMANTECC 1 583 # define LZO_INFO_CC "Symantec C" 584 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) 585 #elif defined(__SUNPRO_C) 586 # define LZO_INFO_CC "SunPro C" 587 # if ((__SUNPRO_C)+0 > 0) 588 # define LZO_CC_SUNPROC __SUNPRO_C 589 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) 590 # else 591 # define LZO_CC_SUNPROC 1 592 # define LZO_INFO_CCVER "unknown" 593 # endif 594 #elif defined(__SUNPRO_CC) 595 # define LZO_INFO_CC "SunPro C" 596 # if ((__SUNPRO_CC)+0 > 0) 597 # define LZO_CC_SUNPROC __SUNPRO_CC 598 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) 599 # else 600 # define LZO_CC_SUNPROC 1 601 # define LZO_INFO_CCVER "unknown" 602 # endif 603 #elif defined(__TINYC__) 604 # define LZO_CC_TINYC 1 605 # define LZO_INFO_CC "Tiny C" 606 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) 607 #elif defined(__TSC__) 608 # define LZO_CC_TOPSPEEDC 1 609 # define LZO_INFO_CC "TopSpeed C" 610 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) 611 #elif defined(__WATCOMC__) 612 # define LZO_CC_WATCOMC 1 613 # define LZO_INFO_CC "Watcom C" 614 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) 615 #elif defined(__TURBOC__) 616 # define LZO_CC_TURBOC 1 617 # define LZO_INFO_CC "Turbo C" 618 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) 619 #elif defined(__ZTC__) 620 # define LZO_CC_ZORTECHC 1 621 # define LZO_INFO_CC "Zortech C" 622 # if (__ZTC__ == 0x310) 623 # define LZO_INFO_CCVER "0x310" 624 # else 625 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) 626 # endif 627 #else 628 # define LZO_CC_UNKNOWN 1 629 # define LZO_INFO_CC "unknown" 630 # define LZO_INFO_CCVER "unknown" 631 #endif 632 #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) 633 # error "LZO_CC_MSC: _MSC_FULL_VER is not defined" 634 #endif 635 #if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) 636 # if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) 637 # if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) 638 # define LZO_ARCH_CRAY_MPP 1 639 # elif defined(_CRAY1) 640 # define LZO_ARCH_CRAY_PVP 1 641 # endif 642 # endif 643 #endif 644 #if !defined(__LZO_ARCH_OVERRIDE) 645 #if defined(LZO_ARCH_GENERIC) 646 # define LZO_INFO_ARCH "generic" 647 #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 648 # define LZO_ARCH_I086 1 649 # define LZO_ARCH_IA16 1 650 # define LZO_INFO_ARCH "i086" 651 #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) 652 # define LZO_ARCH_ALPHA 1 653 # define LZO_INFO_ARCH "alpha" 654 #elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) 655 # define LZO_ARCH_ALPHA 1 656 # define LZO_INFO_ARCH "alpha" 657 #elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) 658 # define LZO_ARCH_AMD64 1 659 # define LZO_INFO_ARCH "amd64" 660 #elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) 661 # define LZO_ARCH_ARM 1 662 # define LZO_ARCH_ARM_THUMB 1 663 # define LZO_INFO_ARCH "arm_thumb" 664 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) 665 # define LZO_ARCH_ARM 1 666 # if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) 667 # define LZO_ARCH_ARM_THUMB 1 668 # define LZO_INFO_ARCH "arm_thumb" 669 # elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) 670 # define LZO_INFO_ARCH "arm" 671 # else 672 # define LZO_INFO_ARCH "arm" 673 # endif 674 #elif defined(__arm__) || defined(_M_ARM) 675 # define LZO_ARCH_ARM 1 676 # define LZO_INFO_ARCH "arm" 677 #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) 678 # define LZO_ARCH_AVR 1 679 # define LZO_INFO_ARCH "avr" 680 #elif defined(__bfin__) 681 # define LZO_ARCH_BLACKFIN 1 682 # define LZO_INFO_ARCH "blackfin" 683 #elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) 684 # define LZO_ARCH_C166 1 685 # define LZO_INFO_ARCH "c166" 686 #elif defined(__cris__) 687 # define LZO_ARCH_CRIS 1 688 # define LZO_INFO_ARCH "cris" 689 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) 690 # define LZO_ARCH_EZ80 1 691 # define LZO_INFO_ARCH "ez80" 692 #elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) 693 # define LZO_ARCH_H8300 1 694 # define LZO_INFO_ARCH "h8300" 695 #elif defined(__hppa__) || defined(__hppa) 696 # define LZO_ARCH_HPPA 1 697 # define LZO_INFO_ARCH "hppa" 698 #elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) 699 # define LZO_ARCH_I386 1 700 # define LZO_ARCH_IA32 1 701 # define LZO_INFO_ARCH "i386" 702 #elif (LZO_CC_ZORTECHC && defined(__I86__)) 703 # define LZO_ARCH_I386 1 704 # define LZO_ARCH_IA32 1 705 # define LZO_INFO_ARCH "i386" 706 #elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) 707 # define LZO_ARCH_I386 1 708 # define LZO_ARCH_IA32 1 709 # define LZO_INFO_ARCH "i386" 710 #elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) 711 # define LZO_ARCH_IA64 1 712 # define LZO_INFO_ARCH "ia64" 713 #elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) 714 # define LZO_ARCH_M16C 1 715 # define LZO_INFO_ARCH "m16c" 716 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) 717 # define LZO_ARCH_M16C 1 718 # define LZO_INFO_ARCH "m16c" 719 #elif defined(__m32r__) 720 # define LZO_ARCH_M32R 1 721 # define LZO_INFO_ARCH "m32r" 722 #elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) 723 # define LZO_ARCH_M68K 1 724 # define LZO_INFO_ARCH "m68k" 725 #elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) 726 # define LZO_ARCH_MCS251 1 727 # define LZO_INFO_ARCH "mcs251" 728 #elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) 729 # define LZO_ARCH_MCS51 1 730 # define LZO_INFO_ARCH "mcs51" 731 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) 732 # define LZO_ARCH_MCS51 1 733 # define LZO_INFO_ARCH "mcs51" 734 #elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) 735 # define LZO_ARCH_MIPS 1 736 # define LZO_INFO_ARCH "mips" 737 #elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) 738 # define LZO_ARCH_MSP430 1 739 # define LZO_INFO_ARCH "msp430" 740 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) 741 # define LZO_ARCH_MSP430 1 742 # define LZO_INFO_ARCH "msp430" 743 #elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) 744 # define LZO_ARCH_POWERPC 1 745 # define LZO_INFO_ARCH "powerpc" 746 #elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) 747 # define LZO_ARCH_S390 1 748 # define LZO_INFO_ARCH "s390" 749 #elif defined(__sh__) || defined(_M_SH) 750 # define LZO_ARCH_SH 1 751 # define LZO_INFO_ARCH "sh" 752 #elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) 753 # define LZO_ARCH_SPARC 1 754 # define LZO_INFO_ARCH "sparc" 755 #elif defined(__SPU__) 756 # define LZO_ARCH_SPU 1 757 # define LZO_INFO_ARCH "spu" 758 #elif (UINT_MAX == LZO_0xffffL) && defined(__z80) 759 # define LZO_ARCH_Z80 1 760 # define LZO_INFO_ARCH "z80" 761 #elif (LZO_ARCH_CRAY_PVP) 762 # if defined(_CRAYSV1) 763 # define LZO_ARCH_CRAY_SV1 1 764 # define LZO_INFO_ARCH "cray_sv1" 765 # elif (_ADDR64) 766 # define LZO_ARCH_CRAY_T90 1 767 # define LZO_INFO_ARCH "cray_t90" 768 # elif (_ADDR32) 769 # define LZO_ARCH_CRAY_YMP 1 770 # define LZO_INFO_ARCH "cray_ymp" 771 # else 772 # define LZO_ARCH_CRAY_XMP 1 773 # define LZO_INFO_ARCH "cray_xmp" 774 # endif 775 #else 776 # define LZO_ARCH_UNKNOWN 1 777 # define LZO_INFO_ARCH "unknown" 778 #endif 779 #endif 780 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) 781 # error "FIXME - missing define for CPU architecture" 782 #endif 783 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) 784 # error "FIXME - missing WIN32 define for CPU architecture" 785 #endif 786 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) 787 # error "FIXME - missing WIN64 define for CPU architecture" 788 #endif 789 #if (LZO_OS_OS216 || LZO_OS_WIN16) 790 # define LZO_ARCH_I086PM 1 791 # define LZO_ARCH_IA16PM 1 792 #elif 1 && (LZO_OS_DOS16 && defined(BLX286)) 793 # define LZO_ARCH_I086PM 1 794 # define LZO_ARCH_IA16PM 1 795 #elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) 796 # define LZO_ARCH_I086PM 1 797 # define LZO_ARCH_IA16PM 1 798 #elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) 799 # define LZO_ARCH_I086PM 1 800 # define LZO_ARCH_IA16PM 1 801 #endif 802 #if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) 803 # error "this should not happen" 804 #endif 805 #if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) 806 # error "this should not happen" 807 #endif 808 #if (LZO_ARCH_I086) 809 # if (UINT_MAX != LZO_0xffffL) 810 # error "this should not happen" 811 # endif 812 # if (ULONG_MAX != LZO_0xffffffffL) 813 # error "this should not happen" 814 # endif 815 #endif 816 #if (LZO_ARCH_I386) 817 # if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) 818 # error "this should not happen" 819 # endif 820 # if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) 821 # error "this should not happen" 822 # endif 823 # if (ULONG_MAX != LZO_0xffffffffL) 824 # error "this should not happen" 825 # endif 826 #endif 827 #if !defined(__LZO_MM_OVERRIDE) 828 #if (LZO_ARCH_I086) 829 #if (UINT_MAX != LZO_0xffffL) 830 # error "this should not happen" 831 #endif 832 #if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) 833 # define LZO_MM_TINY 1 834 #elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) 835 # define LZO_MM_HUGE 1 836 #elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) 837 # define LZO_MM_SMALL 1 838 #elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) 839 # define LZO_MM_MEDIUM 1 840 #elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) 841 # define LZO_MM_COMPACT 1 842 #elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) 843 # define LZO_MM_LARGE 1 844 #elif (LZO_CC_AZTECC) 845 # if defined(_LARGE_CODE) && defined(_LARGE_DATA) 846 # define LZO_MM_LARGE 1 847 # elif defined(_LARGE_CODE) 848 # define LZO_MM_MEDIUM 1 849 # elif defined(_LARGE_DATA) 850 # define LZO_MM_COMPACT 1 851 # else 852 # define LZO_MM_SMALL 1 853 # endif 854 #elif (LZO_CC_ZORTECHC && defined(__VCM__)) 855 # define LZO_MM_LARGE 1 856 #else 857 # error "unknown memory model" 858 #endif 859 #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 860 #define LZO_HAVE_MM_HUGE_PTR 1 861 #define LZO_HAVE_MM_HUGE_ARRAY 1 862 #if (LZO_MM_TINY) 863 # undef LZO_HAVE_MM_HUGE_ARRAY 864 #endif 865 #if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) 866 # undef LZO_HAVE_MM_HUGE_PTR 867 # undef LZO_HAVE_MM_HUGE_ARRAY 868 #elif (LZO_CC_DMC || LZO_CC_SYMANTECC) 869 # undef LZO_HAVE_MM_HUGE_ARRAY 870 #elif (LZO_CC_MSC && defined(_QC)) 871 # undef LZO_HAVE_MM_HUGE_ARRAY 872 # if (_MSC_VER < 600) 873 # undef LZO_HAVE_MM_HUGE_PTR 874 # endif 875 #elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) 876 # undef LZO_HAVE_MM_HUGE_ARRAY 877 #endif 878 #if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) 879 # if (LZO_OS_DOS16) 880 # error "this should not happen" 881 # elif (LZO_CC_ZORTECHC) 882 # else 883 # error "this should not happen" 884 # endif 885 #endif 886 #ifdef __cplusplus 887 extern "C" { 888 #endif 889 #if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) 890 extern void __near __cdecl _AHSHIFT(void); 891 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 892 #elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 893 extern void __near __cdecl _AHSHIFT(void); 894 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 895 #elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) 896 extern void __near __cdecl _AHSHIFT(void); 897 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 898 #elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) 899 extern void __near __cdecl _AHSHIFT(void); 900 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 901 #elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) 902 # define LZO_MM_AHSHIFT 12 903 #elif (LZO_CC_WATCOMC) 904 extern unsigned char _HShift; 905 # define LZO_MM_AHSHIFT ((unsigned) _HShift) 906 #else 907 # error "FIXME - implement LZO_MM_AHSHIFT" 908 #endif 909 #ifdef __cplusplus 910 } 911 #endif 912 #endif 913 #elif (LZO_ARCH_C166) 914 #if !defined(__MODEL__) 915 # error "FIXME - C166 __MODEL__" 916 #elif ((__MODEL__) == 0) 917 # define LZO_MM_SMALL 1 918 #elif ((__MODEL__) == 1) 919 # define LZO_MM_SMALL 1 920 #elif ((__MODEL__) == 2) 921 # define LZO_MM_LARGE 1 922 #elif ((__MODEL__) == 3) 923 # define LZO_MM_TINY 1 924 #elif ((__MODEL__) == 4) 925 # define LZO_MM_XTINY 1 926 #elif ((__MODEL__) == 5) 927 # define LZO_MM_XSMALL 1 928 #else 929 # error "FIXME - C166 __MODEL__" 930 #endif 931 #elif (LZO_ARCH_MCS251) 932 #if !defined(__MODEL__) 933 # error "FIXME - MCS251 __MODEL__" 934 #elif ((__MODEL__) == 0) 935 # define LZO_MM_SMALL 1 936 #elif ((__MODEL__) == 2) 937 # define LZO_MM_LARGE 1 938 #elif ((__MODEL__) == 3) 939 # define LZO_MM_TINY 1 940 #elif ((__MODEL__) == 4) 941 # define LZO_MM_XTINY 1 942 #elif ((__MODEL__) == 5) 943 # define LZO_MM_XSMALL 1 944 #else 945 # error "FIXME - MCS251 __MODEL__" 946 #endif 947 #elif (LZO_ARCH_MCS51) 948 #if !defined(__MODEL__) 949 # error "FIXME - MCS51 __MODEL__" 950 #elif ((__MODEL__) == 1) 951 # define LZO_MM_SMALL 1 952 #elif ((__MODEL__) == 2) 953 # define LZO_MM_LARGE 1 954 #elif ((__MODEL__) == 3) 955 # define LZO_MM_TINY 1 956 #elif ((__MODEL__) == 4) 957 # define LZO_MM_XTINY 1 958 #elif ((__MODEL__) == 5) 959 # define LZO_MM_XSMALL 1 960 #else 961 # error "FIXME - MCS51 __MODEL__" 962 #endif 963 #elif (LZO_ARCH_CRAY_PVP) 964 # define LZO_MM_PVP 1 965 #else 966 # define LZO_MM_FLAT 1 967 #endif 968 #if (LZO_MM_COMPACT) 969 # define LZO_INFO_MM "compact" 970 #elif (LZO_MM_FLAT) 971 # define LZO_INFO_MM "flat" 972 #elif (LZO_MM_HUGE) 973 # define LZO_INFO_MM "huge" 974 #elif (LZO_MM_LARGE) 975 # define LZO_INFO_MM "large" 976 #elif (LZO_MM_MEDIUM) 977 # define LZO_INFO_MM "medium" 978 #elif (LZO_MM_PVP) 979 # define LZO_INFO_MM "pvp" 980 #elif (LZO_MM_SMALL) 981 # define LZO_INFO_MM "small" 982 #elif (LZO_MM_TINY) 983 # define LZO_INFO_MM "tiny" 984 #else 985 # error "unknown memory model" 986 #endif 987 #endif 988 #if defined(SIZEOF_SHORT) 989 # define LZO_SIZEOF_SHORT (SIZEOF_SHORT) 990 #endif 991 #if defined(SIZEOF_INT) 992 # define LZO_SIZEOF_INT (SIZEOF_INT) 993 #endif 994 #if defined(SIZEOF_LONG) 995 # define LZO_SIZEOF_LONG (SIZEOF_LONG) 996 #endif 997 #if defined(SIZEOF_LONG_LONG) 998 # define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) 999 #endif 1000 #if defined(SIZEOF___INT16) 1001 # define LZO_SIZEOF___INT16 (SIZEOF___INT16) 1002 #endif 1003 #if defined(SIZEOF___INT32) 1004 # define LZO_SIZEOF___INT32 (SIZEOF___INT32) 1005 #endif 1006 #if defined(SIZEOF___INT64) 1007 # define LZO_SIZEOF___INT64 (SIZEOF___INT64) 1008 #endif 1009 #if defined(SIZEOF_VOID_P) 1010 # define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) 1011 #endif 1012 #if defined(SIZEOF_SIZE_T) 1013 # define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) 1014 #endif 1015 #if defined(SIZEOF_PTRDIFF_T) 1016 # define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) 1017 #endif 1018 #define __LZO_LSR(x,b) (((x)+0ul) >> (b)) 1019 #if !defined(LZO_SIZEOF_SHORT) 1020 # if (LZO_ARCH_CRAY_PVP) 1021 # define LZO_SIZEOF_SHORT 8 1022 # elif (USHRT_MAX == LZO_0xffffL) 1023 # define LZO_SIZEOF_SHORT 2 1024 # elif (__LZO_LSR(USHRT_MAX,7) == 1) 1025 # define LZO_SIZEOF_SHORT 1 1026 # elif (__LZO_LSR(USHRT_MAX,15) == 1) 1027 # define LZO_SIZEOF_SHORT 2 1028 # elif (__LZO_LSR(USHRT_MAX,31) == 1) 1029 # define LZO_SIZEOF_SHORT 4 1030 # elif (__LZO_LSR(USHRT_MAX,63) == 1) 1031 # define LZO_SIZEOF_SHORT 8 1032 # elif (__LZO_LSR(USHRT_MAX,127) == 1) 1033 # define LZO_SIZEOF_SHORT 16 1034 # else 1035 # error "LZO_SIZEOF_SHORT" 1036 # endif 1037 #endif 1038 #if !defined(LZO_SIZEOF_INT) 1039 # if (LZO_ARCH_CRAY_PVP) 1040 # define LZO_SIZEOF_INT 8 1041 # elif (UINT_MAX == LZO_0xffffL) 1042 # define LZO_SIZEOF_INT 2 1043 # elif (UINT_MAX == LZO_0xffffffffL) 1044 # define LZO_SIZEOF_INT 4 1045 # elif (__LZO_LSR(UINT_MAX,7) == 1) 1046 # define LZO_SIZEOF_INT 1 1047 # elif (__LZO_LSR(UINT_MAX,15) == 1) 1048 # define LZO_SIZEOF_INT 2 1049 # elif (__LZO_LSR(UINT_MAX,31) == 1) 1050 # define LZO_SIZEOF_INT 4 1051 # elif (__LZO_LSR(UINT_MAX,63) == 1) 1052 # define LZO_SIZEOF_INT 8 1053 # elif (__LZO_LSR(UINT_MAX,127) == 1) 1054 # define LZO_SIZEOF_INT 16 1055 # else 1056 # error "LZO_SIZEOF_INT" 1057 # endif 1058 #endif 1059 #if !defined(LZO_SIZEOF_LONG) 1060 # if (ULONG_MAX == LZO_0xffffffffL) 1061 # define LZO_SIZEOF_LONG 4 1062 # elif (__LZO_LSR(ULONG_MAX,7) == 1) 1063 # define LZO_SIZEOF_LONG 1 1064 # elif (__LZO_LSR(ULONG_MAX,15) == 1) 1065 # define LZO_SIZEOF_LONG 2 1066 # elif (__LZO_LSR(ULONG_MAX,31) == 1) 1067 # define LZO_SIZEOF_LONG 4 1068 # elif (__LZO_LSR(ULONG_MAX,63) == 1) 1069 # define LZO_SIZEOF_LONG 8 1070 # elif (__LZO_LSR(ULONG_MAX,127) == 1) 1071 # define LZO_SIZEOF_LONG 16 1072 # else 1073 # error "LZO_SIZEOF_LONG" 1074 # endif 1075 #endif 1076 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) 1077 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) 1078 # if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) 1079 # if (LZO_CC_GNUC >= 0x030300ul) 1080 # if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) 1081 # define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG 1082 # elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) 1083 # define LZO_SIZEOF_LONG_LONG 4 1084 # endif 1085 # endif 1086 # endif 1087 #endif 1088 #endif 1089 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) 1090 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) 1091 #if (LZO_ARCH_I086 && LZO_CC_DMC) 1092 #elif (LZO_CC_CILLY) && defined(__GNUC__) 1093 # define LZO_SIZEOF_LONG_LONG 8 1094 #elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1095 # define LZO_SIZEOF_LONG_LONG 8 1096 #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) 1097 # define LZO_SIZEOF_LONG_LONG 8 1098 #elif (LZO_OS_WIN64 || defined(_WIN64)) 1099 # define LZO_SIZEOF___INT64 8 1100 #elif (LZO_ARCH_I386 && (LZO_CC_DMC)) 1101 # define LZO_SIZEOF_LONG_LONG 8 1102 #elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) 1103 # define LZO_SIZEOF_LONG_LONG 8 1104 #elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) 1105 # define LZO_SIZEOF_LONG_LONG 8 1106 #elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) 1107 # define LZO_SIZEOF_LONG_LONG 8 1108 #elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) 1109 # define LZO_SIZEOF___INT64 8 1110 #elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) 1111 # define LZO_SIZEOF___INT64 8 1112 #elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) 1113 # define LZO_SIZEOF___INT64 8 1114 #elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) 1115 # define LZO_SIZEOF___INT64 8 1116 #elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) 1117 # define LZO_SIZEOF___INT64 8 1118 #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) 1119 # define LZO_SIZEOF_LONG_LONG 8 1120 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) 1121 # define LZO_SIZEOF_LONG_LONG 8 1122 #elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) 1123 #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 1124 # define LZO_SIZEOF_LONG_LONG 8 1125 #endif 1126 #endif 1127 #endif 1128 #if defined(__cplusplus) && defined(LZO_CC_GNUC) 1129 # if (LZO_CC_GNUC < 0x020800ul) 1130 # undef LZO_SIZEOF_LONG_LONG 1131 # endif 1132 #endif 1133 #if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) 1134 # undef LZO_SIZEOF_LONG_LONG 1135 #endif 1136 #if !defined(LZO_SIZEOF_VOID_P) 1137 #if (LZO_ARCH_I086) 1138 # define __LZO_WORDSIZE 2 1139 # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) 1140 # define LZO_SIZEOF_VOID_P 2 1141 # elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) 1142 # define LZO_SIZEOF_VOID_P 4 1143 # else 1144 # error "LZO_MM" 1145 # endif 1146 #elif (LZO_ARCH_AVR || LZO_ARCH_Z80) 1147 # define __LZO_WORDSIZE 1 1148 # define LZO_SIZEOF_VOID_P 2 1149 #elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) 1150 # define LZO_SIZEOF_VOID_P 2 1151 #elif (LZO_ARCH_H8300) 1152 # if defined(__NORMAL_MODE__) 1153 # define __LZO_WORDSIZE 4 1154 # define LZO_SIZEOF_VOID_P 2 1155 # elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) 1156 # define __LZO_WORDSIZE 4 1157 # define LZO_SIZEOF_VOID_P 4 1158 # else 1159 # define __LZO_WORDSIZE 2 1160 # define LZO_SIZEOF_VOID_P 2 1161 # endif 1162 # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) 1163 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT 1164 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT 1165 # endif 1166 #elif (LZO_ARCH_M16C) 1167 # define __LZO_WORDSIZE 2 1168 # if defined(__m32c_cpu__) || defined(__m32cm_cpu__) 1169 # define LZO_SIZEOF_VOID_P 4 1170 # else 1171 # define LZO_SIZEOF_VOID_P 2 1172 # endif 1173 #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) 1174 # define __LZO_WORDSIZE 8 1175 # define LZO_SIZEOF_VOID_P 4 1176 #elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) 1177 # define __LZO_WORDSIZE 8 1178 # define LZO_SIZEOF_VOID_P 8 1179 #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) 1180 # define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG 1181 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 1182 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 1183 #elif (LZO_OS_OS400 || defined(__OS400__)) 1184 # define __LZO_WORDSIZE LZO_SIZEOF_LONG 1185 # define LZO_SIZEOF_VOID_P 16 1186 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 1187 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 1188 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) 1189 # define LZO_SIZEOF_VOID_P 8 1190 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 1191 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 1192 #elif (LZO_ARCH_SPU) 1193 # if 0 1194 # define __LZO_WORDSIZE 16 1195 # endif 1196 # define LZO_SIZEOF_VOID_P 4 1197 #else 1198 # define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG 1199 #endif 1200 #endif 1201 #if !defined(LZO_WORDSIZE) 1202 # if defined(__LZO_WORDSIZE) 1203 # define LZO_WORDSIZE __LZO_WORDSIZE 1204 # else 1205 # define LZO_WORDSIZE LZO_SIZEOF_VOID_P 1206 # endif 1207 #endif 1208 #if !defined(LZO_SIZEOF_SIZE_T) 1209 #if (LZO_ARCH_I086 || LZO_ARCH_M16C) 1210 # define LZO_SIZEOF_SIZE_T 2 1211 #else 1212 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P 1213 #endif 1214 #endif 1215 #if !defined(LZO_SIZEOF_PTRDIFF_T) 1216 #if (LZO_ARCH_I086) 1217 # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) 1218 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P 1219 # elif (LZO_MM_COMPACT || LZO_MM_LARGE) 1220 # if (LZO_CC_BORLANDC || LZO_CC_TURBOC) 1221 # define LZO_SIZEOF_PTRDIFF_T 4 1222 # else 1223 # define LZO_SIZEOF_PTRDIFF_T 2 1224 # endif 1225 # else 1226 # error "LZO_MM" 1227 # endif 1228 #else 1229 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T 1230 #endif 1231 #endif 1232 #if defined(LZO_ABI_NEUTRAL_ENDIAN) 1233 # undef LZO_ABI_BIG_ENDIAN 1234 # undef LZO_ABI_LITTLE_ENDIAN 1235 #elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) 1236 #if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) 1237 # define LZO_ABI_BIG_ENDIAN 1 1238 #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) 1239 # define LZO_ABI_LITTLE_ENDIAN 1 1240 #elif (LZO_ARCH_M68K || LZO_ARCH_S390) 1241 # define LZO_ABI_BIG_ENDIAN 1 1242 #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) 1243 # if (__LITTLE_ENDIAN__ == 1) 1244 # define LZO_ABI_LITTLE_ENDIAN 1 1245 # else 1246 # define LZO_ABI_BIG_ENDIAN 1 1247 # endif 1248 #elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) 1249 # define LZO_ABI_BIG_ENDIAN 1 1250 #elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) 1251 # define LZO_ABI_LITTLE_ENDIAN 1 1252 #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) 1253 # define LZO_ABI_BIG_ENDIAN 1 1254 #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) 1255 # define LZO_ABI_LITTLE_ENDIAN 1 1256 #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) 1257 # define LZO_ABI_BIG_ENDIAN 1 1258 #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) 1259 # define LZO_ABI_LITTLE_ENDIAN 1 1260 #endif 1261 #endif 1262 #if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) 1263 # error "this should not happen" 1264 #endif 1265 #if defined(LZO_ABI_BIG_ENDIAN) 1266 # define LZO_INFO_ABI_ENDIAN "be" 1267 #elif defined(LZO_ABI_LITTLE_ENDIAN) 1268 # define LZO_INFO_ABI_ENDIAN "le" 1269 #elif defined(LZO_ABI_NEUTRAL_ENDIAN) 1270 # define LZO_INFO_ABI_ENDIAN "neutral" 1271 #endif 1272 #if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) 1273 # define LZO_ABI_I8LP16 1 1274 # define LZO_INFO_ABI_PM "i8lp16" 1275 #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) 1276 # define LZO_ABI_ILP16 1 1277 # define LZO_INFO_ABI_PM "ilp16" 1278 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) 1279 # define LZO_ABI_ILP32 1 1280 # define LZO_INFO_ABI_PM "ilp32" 1281 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) 1282 # define LZO_ABI_LLP64 1 1283 # define LZO_INFO_ABI_PM "llp64" 1284 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) 1285 # define LZO_ABI_LP64 1 1286 # define LZO_INFO_ABI_PM "lp64" 1287 #elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) 1288 # define LZO_ABI_ILP64 1 1289 # define LZO_INFO_ABI_PM "ilp64" 1290 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) 1291 # define LZO_ABI_IP32L64 1 1292 # define LZO_INFO_ABI_PM "ip32l64" 1293 #endif 1294 #if !defined(__LZO_LIBC_OVERRIDE) 1295 #if defined(LZO_LIBC_NAKED) 1296 # define LZO_INFO_LIBC "naked" 1297 #elif defined(LZO_LIBC_FREESTANDING) 1298 # define LZO_INFO_LIBC "freestanding" 1299 #elif defined(LZO_LIBC_MOSTLY_FREESTANDING) 1300 # define LZO_INFO_LIBC "mfreestanding" 1301 #elif defined(LZO_LIBC_ISOC90) 1302 # define LZO_INFO_LIBC "isoc90" 1303 #elif defined(LZO_LIBC_ISOC99) 1304 # define LZO_INFO_LIBC "isoc99" 1305 #elif defined(__dietlibc__) 1306 # define LZO_LIBC_DIETLIBC 1 1307 # define LZO_INFO_LIBC "dietlibc" 1308 #elif defined(_NEWLIB_VERSION) 1309 # define LZO_LIBC_NEWLIB 1 1310 # define LZO_INFO_LIBC "newlib" 1311 #elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) 1312 # if defined(__UCLIBC_SUBLEVEL__) 1313 # define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) 1314 # else 1315 # define LZO_LIBC_UCLIBC 0x00090bL 1316 # endif 1317 # define LZO_INFO_LIBC "uclibc" 1318 #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) 1319 # define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) 1320 # define LZO_INFO_LIBC "glibc" 1321 #elif (LZO_CC_MWERKS) && defined(__MSL__) 1322 # define LZO_LIBC_MSL __MSL__ 1323 # define LZO_INFO_LIBC "msl" 1324 #elif 1 && defined(__IAR_SYSTEMS_ICC__) 1325 # define LZO_LIBC_ISOC90 1 1326 # define LZO_INFO_LIBC "isoc90" 1327 #else 1328 # define LZO_LIBC_DEFAULT 1 1329 # define LZO_INFO_LIBC "default" 1330 #endif 1331 #endif 1332 #if !defined(__lzo_gnuc_extension__) 1333 #if (LZO_CC_GNUC >= 0x020800ul) 1334 # define __lzo_gnuc_extension__ __extension__ 1335 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1336 # define __lzo_gnuc_extension__ __extension__ 1337 #else 1338 # define __lzo_gnuc_extension__ 1339 #endif 1340 #endif 1341 #if !defined(__lzo_ua_volatile) 1342 # define __lzo_ua_volatile volatile 1343 #endif 1344 #if !defined(__lzo_alignof) 1345 #if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) 1346 # define __lzo_alignof(e) __alignof__(e) 1347 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) 1348 # define __lzo_alignof(e) __alignof__(e) 1349 #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) 1350 # define __lzo_alignof(e) __alignof(e) 1351 #endif 1352 #endif 1353 #if defined(__lzo_alignof) 1354 # define __lzo_HAVE_alignof 1 1355 #endif 1356 #if !defined(__lzo_constructor) 1357 #if (LZO_CC_GNUC >= 0x030400ul) 1358 # define __lzo_constructor __attribute__((__constructor__,__used__)) 1359 #elif (LZO_CC_GNUC >= 0x020700ul) 1360 # define __lzo_constructor __attribute__((__constructor__)) 1361 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1362 # define __lzo_constructor __attribute__((__constructor__)) 1363 #endif 1364 #endif 1365 #if defined(__lzo_constructor) 1366 # define __lzo_HAVE_constructor 1 1367 #endif 1368 #if !defined(__lzo_destructor) 1369 #if (LZO_CC_GNUC >= 0x030400ul) 1370 # define __lzo_destructor __attribute__((__destructor__,__used__)) 1371 #elif (LZO_CC_GNUC >= 0x020700ul) 1372 # define __lzo_destructor __attribute__((__destructor__)) 1373 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1374 # define __lzo_destructor __attribute__((__destructor__)) 1375 #endif 1376 #endif 1377 #if defined(__lzo_destructor) 1378 # define __lzo_HAVE_destructor 1 1379 #endif 1380 #if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) 1381 # error "this should not happen" 1382 #endif 1383 #if !defined(__lzo_inline) 1384 #if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) 1385 #elif defined(__cplusplus) 1386 # define __lzo_inline inline 1387 #elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) 1388 # define __lzo_inline __inline 1389 #elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) 1390 # define __lzo_inline __inline__ 1391 #elif (LZO_CC_DMC) 1392 # define __lzo_inline __inline 1393 #elif (LZO_CC_INTELC) 1394 # define __lzo_inline __inline 1395 #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) 1396 # define __lzo_inline __inline 1397 #elif (LZO_CC_MSC && (_MSC_VER >= 900)) 1398 # define __lzo_inline __inline 1399 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 1400 # define __lzo_inline inline 1401 #endif 1402 #endif 1403 #if defined(__lzo_inline) 1404 # define __lzo_HAVE_inline 1 1405 #else 1406 # define __lzo_inline 1407 #endif 1408 #if !defined(__lzo_forceinline) 1409 #if (LZO_CC_GNUC >= 0x030200ul) 1410 # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1411 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) 1412 # define __lzo_forceinline __forceinline 1413 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) 1414 # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1415 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1416 # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1417 #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) 1418 # define __lzo_forceinline __forceinline 1419 #endif 1420 #endif 1421 #if defined(__lzo_forceinline) 1422 # define __lzo_HAVE_forceinline 1 1423 #else 1424 # define __lzo_forceinline 1425 #endif 1426 #if !defined(__lzo_noinline) 1427 #if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) 1428 # define __lzo_noinline __attribute__((__noinline__,__used__)) 1429 #elif (LZO_CC_GNUC >= 0x030200ul) 1430 # define __lzo_noinline __attribute__((__noinline__)) 1431 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) 1432 # define __lzo_noinline __declspec(noinline) 1433 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) 1434 # define __lzo_noinline __attribute__((__noinline__)) 1435 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1436 # define __lzo_noinline __attribute__((__noinline__)) 1437 #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) 1438 # define __lzo_noinline __declspec(noinline) 1439 #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) 1440 # if defined(__cplusplus) 1441 # else 1442 # define __lzo_noinline __declspec(noinline) 1443 # endif 1444 #endif 1445 #endif 1446 #if defined(__lzo_noinline) 1447 # define __lzo_HAVE_noinline 1 1448 #else 1449 # define __lzo_noinline 1450 #endif 1451 #if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) 1452 # error "this should not happen" 1453 #endif 1454 #if !defined(__lzo_noreturn) 1455 #if (LZO_CC_GNUC >= 0x020700ul) 1456 # define __lzo_noreturn __attribute__((__noreturn__)) 1457 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) 1458 # define __lzo_noreturn __declspec(noreturn) 1459 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) 1460 # define __lzo_noreturn __attribute__((__noreturn__)) 1461 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1462 # define __lzo_noreturn __attribute__((__noreturn__)) 1463 #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) 1464 # define __lzo_noreturn __declspec(noreturn) 1465 #endif 1466 #endif 1467 #if defined(__lzo_noreturn) 1468 # define __lzo_HAVE_noreturn 1 1469 #else 1470 # define __lzo_noreturn 1471 #endif 1472 #if !defined(__lzo_nothrow) 1473 #if (LZO_CC_GNUC >= 0x030300ul) 1474 # define __lzo_nothrow __attribute__((__nothrow__)) 1475 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) 1476 # define __lzo_nothrow __declspec(nothrow) 1477 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) 1478 # define __lzo_nothrow __attribute__((__nothrow__)) 1479 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1480 # define __lzo_nothrow __attribute__((__nothrow__)) 1481 #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) 1482 # define __lzo_nothrow __declspec(nothrow) 1483 #endif 1484 #endif 1485 #if defined(__lzo_nothrow) 1486 # define __lzo_HAVE_nothrow 1 1487 #else 1488 # define __lzo_nothrow 1489 #endif 1490 #if !defined(__lzo_restrict) 1491 #if (LZO_CC_GNUC >= 0x030400ul) 1492 # define __lzo_restrict __restrict__ 1493 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) 1494 # define __lzo_restrict __restrict__ 1495 #elif (LZO_CC_LLVM) 1496 # define __lzo_restrict __restrict__ 1497 #elif (LZO_CC_MSC && (_MSC_VER >= 1400)) 1498 # define __lzo_restrict __restrict 1499 #endif 1500 #endif 1501 #if defined(__lzo_restrict) 1502 # define __lzo_HAVE_restrict 1 1503 #else 1504 # define __lzo_restrict 1505 #endif 1506 #if !defined(__lzo_likely) && !defined(__lzo_unlikely) 1507 #if (LZO_CC_GNUC >= 0x030200ul) 1508 # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1509 # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1510 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) 1511 # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1512 # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1513 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1514 # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1515 # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1516 #endif 1517 #endif 1518 #if defined(__lzo_likely) 1519 # define __lzo_HAVE_likely 1 1520 #else 1521 # define __lzo_likely(e) (e) 1522 #endif 1523 #if defined(__lzo_unlikely) 1524 # define __lzo_HAVE_unlikely 1 1525 #else 1526 # define __lzo_unlikely(e) (e) 1527 #endif 1528 #if !defined(LZO_UNUSED) 1529 # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) 1530 # define LZO_UNUSED(var) ((void) &var) 1531 # elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) 1532 # define LZO_UNUSED(var) if (&var) ; else 1533 # elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1534 # define LZO_UNUSED(var) ((void) var) 1535 # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1536 # define LZO_UNUSED(var) if (&var) ; else 1537 # elif (LZO_CC_KEILC) 1538 # define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} 1539 # elif (LZO_CC_PACIFICC) 1540 # define LZO_UNUSED(var) ((void) sizeof(var)) 1541 # elif (LZO_CC_WATCOMC) && defined(__cplusplus) 1542 # define LZO_UNUSED(var) ((void) var) 1543 # else 1544 # define LZO_UNUSED(var) ((void) &var) 1545 # endif 1546 #endif 1547 #if !defined(LZO_UNUSED_FUNC) 1548 # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) 1549 # define LZO_UNUSED_FUNC(func) ((void) func) 1550 # elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) 1551 # define LZO_UNUSED_FUNC(func) if (func) ; else 1552 # elif (LZO_CC_LLVM) 1553 # define LZO_UNUSED_FUNC(func) ((void) &func) 1554 # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1555 # define LZO_UNUSED_FUNC(func) if (func) ; else 1556 # elif (LZO_CC_MSC) 1557 # define LZO_UNUSED_FUNC(func) ((void) &func) 1558 # elif (LZO_CC_KEILC || LZO_CC_PELLESC) 1559 # define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} 1560 # else 1561 # define LZO_UNUSED_FUNC(func) ((void) func) 1562 # endif 1563 #endif 1564 #if !defined(LZO_UNUSED_LABEL) 1565 # if (LZO_CC_WATCOMC) && defined(__cplusplus) 1566 # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l 1567 # elif (LZO_CC_INTELC || LZO_CC_WATCOMC) 1568 # define LZO_UNUSED_LABEL(l) if (0) goto l 1569 # else 1570 # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l 1571 # endif 1572 #endif 1573 #if !defined(LZO_DEFINE_UNINITIALIZED_VAR) 1574 # if 0 1575 # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var 1576 # elif 0 && (LZO_CC_GNUC) 1577 # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var 1578 # else 1579 # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init 1580 # endif 1581 #endif 1582 #if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) 1583 # if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) 1584 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; 1585 # elif (LZO_CC_DMC || LZO_CC_SYMANTECC) 1586 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; 1587 # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) 1588 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; 1589 # else 1590 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; 1591 # endif 1592 #endif 1593 #if !defined(LZO_COMPILE_TIME_ASSERT) 1594 # if (LZO_CC_AZTECC) 1595 # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} 1596 # elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 1597 # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 1598 # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1599 # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 1600 # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) 1601 # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 1602 # else 1603 # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} 1604 # endif 1605 #endif 1606 #if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) 1607 # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) 1608 # elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 1609 # define __lzo_cdecl __cdecl 1610 # define __lzo_cdecl_atexit 1611 # define __lzo_cdecl_main __cdecl 1612 # if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) 1613 # define __lzo_cdecl_qsort __pascal 1614 # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) 1615 # define __lzo_cdecl_qsort _stdcall 1616 # else 1617 # define __lzo_cdecl_qsort __cdecl 1618 # endif 1619 # elif (LZO_CC_WATCOMC) 1620 # define __lzo_cdecl __cdecl 1621 # else 1622 # define __lzo_cdecl __cdecl 1623 # define __lzo_cdecl_atexit __cdecl 1624 # define __lzo_cdecl_main __cdecl 1625 # define __lzo_cdecl_qsort __cdecl 1626 # endif 1627 # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) 1628 # elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) 1629 # define __lzo_cdecl_sighandler __pascal 1630 # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) 1631 # define __lzo_cdecl_sighandler _stdcall 1632 # elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) 1633 # define __lzo_cdecl_sighandler __clrcall 1634 # elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) 1635 # if defined(_DLL) 1636 # define __lzo_cdecl_sighandler _far _cdecl _loadds 1637 # elif defined(_MT) 1638 # define __lzo_cdecl_sighandler _far _cdecl 1639 # else 1640 # define __lzo_cdecl_sighandler _cdecl 1641 # endif 1642 # else 1643 # define __lzo_cdecl_sighandler __cdecl 1644 # endif 1645 #elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) 1646 # define __lzo_cdecl __cdecl 1647 #elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) 1648 # define __lzo_cdecl cdecl 1649 #endif 1650 #if !defined(__lzo_cdecl) 1651 # define __lzo_cdecl 1652 #endif 1653 #if !defined(__lzo_cdecl_atexit) 1654 # define __lzo_cdecl_atexit 1655 #endif 1656 #if !defined(__lzo_cdecl_main) 1657 # define __lzo_cdecl_main 1658 #endif 1659 #if !defined(__lzo_cdecl_qsort) 1660 # define __lzo_cdecl_qsort 1661 #endif 1662 #if !defined(__lzo_cdecl_sighandler) 1663 # define __lzo_cdecl_sighandler 1664 #endif 1665 #if !defined(__lzo_cdecl_va) 1666 # define __lzo_cdecl_va __lzo_cdecl 1667 #endif 1668 #if !defined(LZO_CFG_NO_WINDOWS_H) 1669 #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) 1670 # if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) 1671 # elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) 1672 # elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) 1673 # else 1674 # define LZO_HAVE_WINDOWS_H 1 1675 # endif 1676 #endif 1677 #endif 1678 #if (LZO_ARCH_ALPHA) 1679 # define LZO_OPT_AVOID_UINT_INDEX 1 1680 # define LZO_OPT_AVOID_SHORT 1 1681 # define LZO_OPT_AVOID_USHORT 1 1682 #elif (LZO_ARCH_AMD64) 1683 # define LZO_OPT_AVOID_INT_INDEX 1 1684 # define LZO_OPT_AVOID_UINT_INDEX 1 1685 # define LZO_OPT_UNALIGNED16 1 1686 # define LZO_OPT_UNALIGNED32 1 1687 # define LZO_OPT_UNALIGNED64 1 1688 #elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) 1689 #elif (LZO_ARCH_ARM) 1690 # define LZO_OPT_AVOID_SHORT 1 1691 # define LZO_OPT_AVOID_USHORT 1 1692 #elif (LZO_ARCH_CRIS) 1693 # define LZO_OPT_UNALIGNED16 1 1694 # define LZO_OPT_UNALIGNED32 1 1695 #elif (LZO_ARCH_I386) 1696 # define LZO_OPT_UNALIGNED16 1 1697 # define LZO_OPT_UNALIGNED32 1 1698 #elif (LZO_ARCH_IA64) 1699 # define LZO_OPT_AVOID_INT_INDEX 1 1700 # define LZO_OPT_AVOID_UINT_INDEX 1 1701 # define LZO_OPT_PREFER_POSTINC 1 1702 #elif (LZO_ARCH_M68K) 1703 # define LZO_OPT_PREFER_POSTINC 1 1704 # define LZO_OPT_PREFER_PREDEC 1 1705 # if defined(__mc68020__) && !defined(__mcoldfire__) 1706 # define LZO_OPT_UNALIGNED16 1 1707 # define LZO_OPT_UNALIGNED32 1 1708 # endif 1709 #elif (LZO_ARCH_MIPS) 1710 # define LZO_OPT_AVOID_UINT_INDEX 1 1711 #elif (LZO_ARCH_POWERPC) 1712 # define LZO_OPT_PREFER_PREINC 1 1713 # define LZO_OPT_PREFER_PREDEC 1 1714 # if defined(LZO_ABI_BIG_ENDIAN) 1715 # define LZO_OPT_UNALIGNED16 1 1716 # define LZO_OPT_UNALIGNED32 1 1717 # endif 1718 #elif (LZO_ARCH_S390) 1719 # define LZO_OPT_UNALIGNED16 1 1720 # define LZO_OPT_UNALIGNED32 1 1721 # if (LZO_SIZEOF_SIZE_T == 8) 1722 # define LZO_OPT_UNALIGNED64 1 1723 # endif 1724 #elif (LZO_ARCH_SH) 1725 # define LZO_OPT_PREFER_POSTINC 1 1726 # define LZO_OPT_PREFER_PREDEC 1 1727 #endif 1728 #if !defined(LZO_CFG_NO_INLINE_ASM) 1729 #if defined(LZO_CC_LLVM) 1730 # define LZO_CFG_NO_INLINE_ASM 1 1731 #endif 1732 #endif 1733 #if !defined(LZO_CFG_NO_UNALIGNED) 1734 #if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) 1735 # define LZO_CFG_NO_UNALIGNED 1 1736 #endif 1737 #endif 1738 #if defined(LZO_CFG_NO_UNALIGNED) 1739 # undef LZO_OPT_UNALIGNED16 1740 # undef LZO_OPT_UNALIGNED32 1741 # undef LZO_OPT_UNALIGNED64 1742 #endif 1743 #if defined(LZO_CFG_NO_INLINE_ASM) 1744 #elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) 1745 # define LZO_ASM_SYNTAX_MSC 1 1746 #elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) 1747 #elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) 1748 # define LZO_ASM_SYNTAX_GNUC 1 1749 #elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) 1750 # define LZO_ASM_SYNTAX_GNUC 1 1751 #endif 1752 #if (LZO_ASM_SYNTAX_GNUC) 1753 #if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) 1754 # define __LZO_ASM_CLOBBER "ax" 1755 #elif (LZO_CC_INTELC) 1756 # define __LZO_ASM_CLOBBER "memory" 1757 #else 1758 # define __LZO_ASM_CLOBBER "cc", "memory" 1759 #endif 1760 #endif 1761 #if defined(__LZO_INFOSTR_MM) 1762 #elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) 1763 # define __LZO_INFOSTR_MM "" 1764 #elif defined(LZO_INFO_MM) 1765 # define __LZO_INFOSTR_MM "." LZO_INFO_MM 1766 #else 1767 # define __LZO_INFOSTR_MM "" 1768 #endif 1769 #if defined(__LZO_INFOSTR_PM) 1770 #elif defined(LZO_INFO_ABI_PM) 1771 # define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM 1772 #else 1773 # define __LZO_INFOSTR_PM "" 1774 #endif 1775 #if defined(__LZO_INFOSTR_ENDIAN) 1776 #elif defined(LZO_INFO_ABI_ENDIAN) 1777 # define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN 1778 #else 1779 # define __LZO_INFOSTR_ENDIAN "" 1780 #endif 1781 #if defined(__LZO_INFOSTR_OSNAME) 1782 #elif defined(LZO_INFO_OS_CONSOLE) 1783 # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE 1784 #elif defined(LZO_INFO_OS_POSIX) 1785 # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX 1786 #else 1787 # define __LZO_INFOSTR_OSNAME LZO_INFO_OS 1788 #endif 1789 #if defined(__LZO_INFOSTR_LIBC) 1790 #elif defined(LZO_INFO_LIBC) 1791 # define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC 1792 #else 1793 # define __LZO_INFOSTR_LIBC "" 1794 #endif 1795 #if defined(__LZO_INFOSTR_CCVER) 1796 #elif defined(LZO_INFO_CCVER) 1797 # define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER 1798 #else 1799 # define __LZO_INFOSTR_CCVER "" 1800 #endif 1801 #define LZO_INFO_STRING \ 1802 LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ 1803 " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER 1804 1805 #endif /* already included */ 1806 1807 /* vim:set ts=4 et: */ -
libs/libmythtv/minilzo.cpp
diff -uNr mythtv-0.21-orig/libs/libmythtv/minilzo.cpp mythtv-0.21/libs/libmythtv/minilzo.cpp
old new 2 2 3 3 This file is part of the LZO real-time data compression library. 4 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 5 13 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 6 14 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 7 15 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 8 16 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 9 17 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 18 All Rights Reserved. 10 19 11 20 The LZO library is free software; you can redistribute it and/or 12 21 modify it under the terms of the GNU General Public License as … … 21 30 You should have received a copy of the GNU General Public License 22 31 along with the LZO library; see the file COPYING. 23 32 If not, write to the Free Software Foundation, Inc., 24 5 9 Temple Place - Suite 330, Boston, MA 02111-1307, USA.33 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 34 26 35 Markus F.X.J. Oberhumer 27 <markus .oberhumer@jk.uni-linz.ac.at>28 http://w ildsau.idv.uni-linz.ac.at/mfx/lzo.html36 <markus@oberhumer.com> 37 http://www.oberhumer.com/opensource/lzo/ 29 38 */ 30 39 31 40 /* 32 41 * NOTE: 33 42 * the full LZO package can be found at 34 * http://w ildsau.idv.uni-linz.ac.at/mfx/lzo.html43 * http://www.oberhumer.com/opensource/lzo/ 35 44 */ 36 45 37 46 #define __LZO_IN_MINILZO 47 #define LZO_BUILD 48 49 #if defined(LZO_CFG_FREESTANDING) 50 # undef MINILZO_HAVE_CONFIG_H 51 # define LZO_LIBC_FREESTANDING 1 52 # define LZO_OS_FREESTANDING 1 53 #endif 38 54 39 55 #ifdef MINILZO_HAVE_CONFIG_H 40 56 # include <config.h> 41 57 #endif 58 #include <limits.h> 59 #include <stddef.h> 60 #if defined(MINILZO_CFG_USE_INTERNAL_LZODEFS) 61 62 #ifndef __LZODEFS_H_INCLUDED 63 #define __LZODEFS_H_INCLUDED 1 64 65 #if defined(__CYGWIN32__) && !defined(__CYGWIN__) 66 # define __CYGWIN__ __CYGWIN32__ 67 #endif 68 #if defined(__IBMCPP__) && !defined(__IBMC__) 69 # define __IBMC__ __IBMCPP__ 70 #endif 71 #if defined(__ICL) && defined(_WIN32) && !defined(__INTEL_COMPILER) 72 # define __INTEL_COMPILER __ICL 73 #endif 74 #if 1 && defined(__INTERIX) && defined(__GNUC__) && !defined(_ALL_SOURCE) 75 # define _ALL_SOURCE 1 76 #endif 77 #if defined(__mips__) && defined(__R5900__) 78 # if !defined(__LONG_MAX__) 79 # define __LONG_MAX__ 9223372036854775807L 80 # endif 81 #endif 82 #if defined(__INTEL_COMPILER) && defined(__linux__) 83 # pragma warning(disable: 193) 84 #endif 85 #if defined(__KEIL__) && defined(__C166__) 86 # pragma warning disable = 322 87 #elif 0 && defined(__C251__) 88 # pragma warning disable = 322 89 #endif 90 #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) 91 # if (_MSC_VER >= 1300) 92 # pragma warning(disable: 4668) 93 # endif 94 #endif 95 #if 0 && defined(__WATCOMC__) 96 # if (__WATCOMC__ >= 1050) && (__WATCOMC__ < 1060) 97 # pragma warning 203 9 98 # endif 99 #endif 100 #if defined(__BORLANDC__) && defined(__MSDOS__) && !defined(__FLAT__) 101 # pragma option -h 102 #endif 103 #if 0 104 #define LZO_0xffffL 0xfffful 105 #define LZO_0xffffffffL 0xfffffffful 106 #else 107 #define LZO_0xffffL 65535ul 108 #define LZO_0xffffffffL 4294967295ul 109 #endif 110 #if (LZO_0xffffL == LZO_0xffffffffL) 111 # error "your preprocessor is broken 1" 112 #endif 113 #if (16ul * 16384ul != 262144ul) 114 # error "your preprocessor is broken 2" 115 #endif 116 #if 0 117 #if (32767 >= 4294967295ul) 118 # error "your preprocessor is broken 3" 119 #endif 120 #if (65535u >= 4294967295ul) 121 # error "your preprocessor is broken 4" 122 #endif 123 #endif 124 #if (UINT_MAX == LZO_0xffffL) 125 #if defined(__ZTC__) && defined(__I86__) && !defined(__OS2__) 126 # if !defined(MSDOS) 127 # define MSDOS 1 128 # endif 129 # if !defined(_MSDOS) 130 # define _MSDOS 1 131 # endif 132 #elif 0 && defined(__VERSION) && defined(MB_LEN_MAX) 133 # if (__VERSION == 520) && (MB_LEN_MAX == 1) 134 # if !defined(__AZTEC_C__) 135 # define __AZTEC_C__ __VERSION 136 # endif 137 # if !defined(__DOS__) 138 # define __DOS__ 1 139 # endif 140 # endif 141 #endif 142 #endif 143 #if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == LZO_0xffffL) 144 # define ptrdiff_t long 145 # define _PTRDIFF_T_DEFINED 146 #endif 147 #if (UINT_MAX == LZO_0xffffL) 148 # undef __LZO_RENAME_A 149 # undef __LZO_RENAME_B 150 # if defined(__AZTEC_C__) && defined(__DOS__) 151 # define __LZO_RENAME_A 1 152 # elif defined(_MSC_VER) && defined(MSDOS) 153 # if (_MSC_VER < 600) 154 # define __LZO_RENAME_A 1 155 # elif (_MSC_VER < 700) 156 # define __LZO_RENAME_B 1 157 # endif 158 # elif defined(__TSC__) && defined(__OS2__) 159 # define __LZO_RENAME_A 1 160 # elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) 161 # define __LZO_RENAME_A 1 162 # elif defined(__PACIFIC__) && defined(DOS) 163 # if !defined(__far) 164 # define __far far 165 # endif 166 # if !defined(__near) 167 # define __near near 168 # endif 169 # endif 170 # if defined(__LZO_RENAME_A) 171 # if !defined(__cdecl) 172 # define __cdecl cdecl 173 # endif 174 # if !defined(__far) 175 # define __far far 176 # endif 177 # if !defined(__huge) 178 # define __huge huge 179 # endif 180 # if !defined(__near) 181 # define __near near 182 # endif 183 # if !defined(__pascal) 184 # define __pascal pascal 185 # endif 186 # if !defined(__huge) 187 # define __huge huge 188 # endif 189 # elif defined(__LZO_RENAME_B) 190 # if !defined(__cdecl) 191 # define __cdecl _cdecl 192 # endif 193 # if !defined(__far) 194 # define __far _far 195 # endif 196 # if !defined(__huge) 197 # define __huge _huge 198 # endif 199 # if !defined(__near) 200 # define __near _near 201 # endif 202 # if !defined(__pascal) 203 # define __pascal _pascal 204 # endif 205 # elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) 206 # if !defined(__cdecl) 207 # define __cdecl cdecl 208 # endif 209 # if !defined(__pascal) 210 # define __pascal pascal 211 # endif 212 # endif 213 # undef __LZO_RENAME_A 214 # undef __LZO_RENAME_B 215 #endif 216 #if (UINT_MAX == LZO_0xffffL) 217 #if defined(__AZTEC_C__) && defined(__DOS__) 218 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 219 #elif defined(_MSC_VER) && defined(MSDOS) 220 # if (_MSC_VER < 600) 221 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 222 # endif 223 # if (_MSC_VER < 700) 224 # define LZO_BROKEN_INTEGRAL_PROMOTION 1 225 # define LZO_BROKEN_SIZEOF 1 226 # endif 227 #elif defined(__PACIFIC__) && defined(DOS) 228 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 229 #elif defined(__TURBOC__) && defined(__MSDOS__) 230 # if (__TURBOC__ < 0x0150) 231 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 232 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 233 # define LZO_BROKEN_INTEGRAL_PROMOTION 1 234 # endif 235 # if (__TURBOC__ < 0x0200) 236 # define LZO_BROKEN_SIZEOF 1 237 # endif 238 # if (__TURBOC__ < 0x0400) && defined(__cplusplus) 239 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 240 # endif 241 #elif (defined(__PUREC__) || defined(__TURBOC__)) && defined(__TOS__) 242 # define LZO_BROKEN_CDECL_ALT_SYNTAX 1 243 # define LZO_BROKEN_SIZEOF 1 244 #endif 245 #endif 246 #if defined(__WATCOMC__) && (__WATCOMC__ < 900) 247 # define LZO_BROKEN_INTEGRAL_CONSTANTS 1 248 #endif 249 #if defined(_CRAY) && defined(_CRAY1) 250 # define LZO_BROKEN_SIGNED_RIGHT_SHIFT 1 251 #endif 252 #define LZO_PP_STRINGIZE(x) #x 253 #define LZO_PP_MACRO_EXPAND(x) LZO_PP_STRINGIZE(x) 254 #define LZO_PP_CONCAT2(a,b) a ## b 255 #define LZO_PP_CONCAT3(a,b,c) a ## b ## c 256 #define LZO_PP_CONCAT4(a,b,c,d) a ## b ## c ## d 257 #define LZO_PP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e 258 #define LZO_PP_ECONCAT2(a,b) LZO_PP_CONCAT2(a,b) 259 #define LZO_PP_ECONCAT3(a,b,c) LZO_PP_CONCAT3(a,b,c) 260 #define LZO_PP_ECONCAT4(a,b,c,d) LZO_PP_CONCAT4(a,b,c,d) 261 #define LZO_PP_ECONCAT5(a,b,c,d,e) LZO_PP_CONCAT5(a,b,c,d,e) 262 #if 1 263 #define LZO_CPP_STRINGIZE(x) #x 264 #define LZO_CPP_MACRO_EXPAND(x) LZO_CPP_STRINGIZE(x) 265 #define LZO_CPP_CONCAT2(a,b) a ## b 266 #define LZO_CPP_CONCAT3(a,b,c) a ## b ## c 267 #define LZO_CPP_CONCAT4(a,b,c,d) a ## b ## c ## d 268 #define LZO_CPP_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e 269 #define LZO_CPP_ECONCAT2(a,b) LZO_CPP_CONCAT2(a,b) 270 #define LZO_CPP_ECONCAT3(a,b,c) LZO_CPP_CONCAT3(a,b,c) 271 #define LZO_CPP_ECONCAT4(a,b,c,d) LZO_CPP_CONCAT4(a,b,c,d) 272 #define LZO_CPP_ECONCAT5(a,b,c,d,e) LZO_CPP_CONCAT5(a,b,c,d,e) 273 #endif 274 #define __LZO_MASK_GEN(o,b) (((((o) << ((b)-1)) - (o)) << 1) + (o)) 275 #if 1 && defined(__cplusplus) 276 # if !defined(__STDC_CONSTANT_MACROS) 277 # define __STDC_CONSTANT_MACROS 1 278 # endif 279 # if !defined(__STDC_LIMIT_MACROS) 280 # define __STDC_LIMIT_MACROS 1 281 # endif 282 #endif 283 #if defined(__cplusplus) 284 # define LZO_EXTERN_C extern "C" 285 #else 286 # define LZO_EXTERN_C extern 287 #endif 288 #if !defined(__LZO_OS_OVERRIDE) 289 #if defined(LZO_OS_FREESTANDING) 290 # define LZO_INFO_OS "freestanding" 291 #elif defined(LZO_OS_EMBEDDED) 292 # define LZO_INFO_OS "embedded" 293 #elif 1 && defined(__IAR_SYSTEMS_ICC__) 294 # define LZO_OS_EMBEDDED 1 295 # define LZO_INFO_OS "embedded" 296 #elif defined(__CYGWIN__) && defined(__GNUC__) 297 # define LZO_OS_CYGWIN 1 298 # define LZO_INFO_OS "cygwin" 299 #elif defined(__EMX__) && defined(__GNUC__) 300 # define LZO_OS_EMX 1 301 # define LZO_INFO_OS "emx" 302 #elif defined(__BEOS__) 303 # define LZO_OS_BEOS 1 304 # define LZO_INFO_OS "beos" 305 #elif defined(__Lynx__) 306 # define LZO_OS_LYNXOS 1 307 # define LZO_INFO_OS "lynxos" 308 #elif defined(__OS400__) 309 # define LZO_OS_OS400 1 310 # define LZO_INFO_OS "os400" 311 #elif defined(__QNX__) 312 # define LZO_OS_QNX 1 313 # define LZO_INFO_OS "qnx" 314 #elif defined(__BORLANDC__) && defined(__DPMI32__) && (__BORLANDC__ >= 0x0460) 315 # define LZO_OS_DOS32 1 316 # define LZO_INFO_OS "dos32" 317 #elif defined(__BORLANDC__) && defined(__DPMI16__) 318 # define LZO_OS_DOS16 1 319 # define LZO_INFO_OS "dos16" 320 #elif defined(__ZTC__) && defined(DOS386) 321 # define LZO_OS_DOS32 1 322 # define LZO_INFO_OS "dos32" 323 #elif defined(__OS2__) || defined(__OS2V2__) 324 # if (UINT_MAX == LZO_0xffffL) 325 # define LZO_OS_OS216 1 326 # define LZO_INFO_OS "os216" 327 # elif (UINT_MAX == LZO_0xffffffffL) 328 # define LZO_OS_OS2 1 329 # define LZO_INFO_OS "os2" 330 # else 331 # error "check your limits.h header" 332 # endif 333 #elif defined(__WIN64__) || defined(_WIN64) || defined(WIN64) 334 # define LZO_OS_WIN64 1 335 # define LZO_INFO_OS "win64" 336 #elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32) || defined(__WINDOWS_386__) 337 # define LZO_OS_WIN32 1 338 # define LZO_INFO_OS "win32" 339 #elif defined(__MWERKS__) && defined(__INTEL__) 340 # define LZO_OS_WIN32 1 341 # define LZO_INFO_OS "win32" 342 #elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows) 343 # if (UINT_MAX == LZO_0xffffL) 344 # define LZO_OS_WIN16 1 345 # define LZO_INFO_OS "win16" 346 # elif (UINT_MAX == LZO_0xffffffffL) 347 # define LZO_OS_WIN32 1 348 # define LZO_INFO_OS "win32" 349 # else 350 # error "check your limits.h header" 351 # endif 352 #elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS)) 353 # if (UINT_MAX == LZO_0xffffL) 354 # define LZO_OS_DOS16 1 355 # define LZO_INFO_OS "dos16" 356 # elif (UINT_MAX == LZO_0xffffffffL) 357 # define LZO_OS_DOS32 1 358 # define LZO_INFO_OS "dos32" 359 # else 360 # error "check your limits.h header" 361 # endif 362 #elif defined(__WATCOMC__) 363 # if defined(__NT__) && (UINT_MAX == LZO_0xffffL) 364 # define LZO_OS_DOS16 1 365 # define LZO_INFO_OS "dos16" 366 # elif defined(__NT__) && (__WATCOMC__ < 1100) 367 # define LZO_OS_WIN32 1 368 # define LZO_INFO_OS "win32" 369 # elif defined(__linux__) || defined(__LINUX__) 370 # define LZO_OS_POSIX 1 371 # define LZO_INFO_OS "posix" 372 # else 373 # error "please specify a target using the -bt compiler option" 374 # endif 375 #elif defined(__palmos__) 376 # define LZO_OS_PALMOS 1 377 # define LZO_INFO_OS "palmos" 378 #elif defined(__TOS__) || defined(__atarist__) 379 # define LZO_OS_TOS 1 380 # define LZO_INFO_OS "tos" 381 #elif defined(macintosh) && !defined(__ppc__) 382 # define LZO_OS_MACCLASSIC 1 383 # define LZO_INFO_OS "macclassic" 384 #elif defined(__VMS) 385 # define LZO_OS_VMS 1 386 # define LZO_INFO_OS "vms" 387 #elif ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) 388 # define LZO_OS_CONSOLE 1 389 # define LZO_OS_CONSOLE_PS2 1 390 # define LZO_INFO_OS "console" 391 # define LZO_INFO_OS_CONSOLE "ps2" 392 #elif (defined(__mips__) && defined(__psp__)) 393 # define LZO_OS_CONSOLE 1 394 # define LZO_OS_CONSOLE_PSP 1 395 # define LZO_INFO_OS "console" 396 # define LZO_INFO_OS_CONSOLE "psp" 397 #else 398 # define LZO_OS_POSIX 1 399 # define LZO_INFO_OS "posix" 400 #endif 401 #if (LZO_OS_POSIX) 402 # if defined(_AIX) || defined(__AIX__) || defined(__aix__) 403 # define LZO_OS_POSIX_AIX 1 404 # define LZO_INFO_OS_POSIX "aix" 405 # elif defined(__FreeBSD__) 406 # define LZO_OS_POSIX_FREEBSD 1 407 # define LZO_INFO_OS_POSIX "freebsd" 408 # elif defined(__hpux__) || defined(__hpux) 409 # define LZO_OS_POSIX_HPUX 1 410 # define LZO_INFO_OS_POSIX "hpux" 411 # elif defined(__INTERIX) 412 # define LZO_OS_POSIX_INTERIX 1 413 # define LZO_INFO_OS_POSIX "interix" 414 # elif defined(__IRIX__) || defined(__irix__) 415 # define LZO_OS_POSIX_IRIX 1 416 # define LZO_INFO_OS_POSIX "irix" 417 # elif defined(__linux__) || defined(__linux) || defined(__LINUX__) 418 # define LZO_OS_POSIX_LINUX 1 419 # define LZO_INFO_OS_POSIX "linux" 420 # elif defined(__APPLE__) || defined(__MACOS__) 421 # define LZO_OS_POSIX_MACOSX 1 422 # define LZO_INFO_OS_POSIX "macosx" 423 # elif defined(__minix__) || defined(__minix) 424 # define LZO_OS_POSIX_MINIX 1 425 # define LZO_INFO_OS_POSIX "minix" 426 # elif defined(__NetBSD__) 427 # define LZO_OS_POSIX_NETBSD 1 428 # define LZO_INFO_OS_POSIX "netbsd" 429 # elif defined(__OpenBSD__) 430 # define LZO_OS_POSIX_OPENBSD 1 431 # define LZO_INFO_OS_POSIX "openbsd" 432 # elif defined(__osf__) 433 # define LZO_OS_POSIX_OSF 1 434 # define LZO_INFO_OS_POSIX "osf" 435 # elif defined(__solaris__) || defined(__sun) 436 # if defined(__SVR4) || defined(__svr4__) 437 # define LZO_OS_POSIX_SOLARIS 1 438 # define LZO_INFO_OS_POSIX "solaris" 439 # else 440 # define LZO_OS_POSIX_SUNOS 1 441 # define LZO_INFO_OS_POSIX "sunos" 442 # endif 443 # elif defined(__ultrix__) || defined(__ultrix) 444 # define LZO_OS_POSIX_ULTRIX 1 445 # define LZO_INFO_OS_POSIX "ultrix" 446 # elif defined(_UNICOS) 447 # define LZO_OS_POSIX_UNICOS 1 448 # define LZO_INFO_OS_POSIX "unicos" 449 # else 450 # define LZO_OS_POSIX_UNKNOWN 1 451 # define LZO_INFO_OS_POSIX "unknown" 452 # endif 453 #endif 454 #endif 455 #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 456 # if (UINT_MAX != LZO_0xffffL) 457 # error "this should not happen" 458 # endif 459 # if (ULONG_MAX != LZO_0xffffffffL) 460 # error "this should not happen" 461 # endif 462 #endif 463 #if (LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_WIN32 || LZO_OS_WIN64) 464 # if (UINT_MAX != LZO_0xffffffffL) 465 # error "this should not happen" 466 # endif 467 # if (ULONG_MAX != LZO_0xffffffffL) 468 # error "this should not happen" 469 # endif 470 #endif 471 #if defined(CIL) && defined(_GNUCC) && defined(__GNUC__) 472 # define LZO_CC_CILLY 1 473 # define LZO_INFO_CC "Cilly" 474 # if defined(__CILLY__) 475 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__CILLY__) 476 # else 477 # define LZO_INFO_CCVER "unknown" 478 # endif 479 #elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__) 480 # define LZO_CC_SDCC 1 481 # define LZO_INFO_CC "sdcc" 482 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(SDCC) 483 #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__) 484 # define LZO_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__) 485 # define LZO_INFO_CC "Pathscale C" 486 # define LZO_INFO_CCVER __PATHSCALE__ 487 #elif defined(__INTEL_COMPILER) 488 # define LZO_CC_INTELC 1 489 # define LZO_INFO_CC "Intel C" 490 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__INTEL_COMPILER) 491 # if defined(_WIN32) || defined(_WIN64) 492 # define LZO_CC_SYNTAX_MSC 1 493 # else 494 # define LZO_CC_SYNTAX_GNUC 1 495 # endif 496 #elif defined(__POCC__) && defined(_WIN32) 497 # define LZO_CC_PELLESC 1 498 # define LZO_INFO_CC "Pelles C" 499 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__POCC__) 500 #elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__) 501 # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) 502 # define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) 503 # else 504 # define LZO_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) 505 # endif 506 # define LZO_INFO_CC "llvm-gcc" 507 # define LZO_INFO_CCVER __VERSION__ 508 #elif defined(__GNUC__) && defined(__VERSION__) 509 # if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) 510 # define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__) 511 # elif defined(__GNUC_MINOR__) 512 # define LZO_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100) 513 # else 514 # define LZO_CC_GNUC (__GNUC__ * 0x10000L) 515 # endif 516 # define LZO_INFO_CC "gcc" 517 # define LZO_INFO_CCVER __VERSION__ 518 #elif defined(__ACK__) && defined(_ACK) 519 # define LZO_CC_ACK 1 520 # define LZO_INFO_CC "Amsterdam Compiler Kit C" 521 # define LZO_INFO_CCVER "unknown" 522 #elif defined(__AZTEC_C__) 523 # define LZO_CC_AZTECC 1 524 # define LZO_INFO_CC "Aztec C" 525 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__AZTEC_C__) 526 #elif defined(__BORLANDC__) 527 # define LZO_CC_BORLANDC 1 528 # define LZO_INFO_CC "Borland C" 529 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__BORLANDC__) 530 #elif defined(_CRAYC) && defined(_RELEASE) 531 # define LZO_CC_CRAYC 1 532 # define LZO_INFO_CC "Cray C" 533 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_RELEASE) 534 #elif defined(__DMC__) && defined(__SC__) 535 # define LZO_CC_DMC 1 536 # define LZO_INFO_CC "Digital Mars C" 537 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DMC__) 538 #elif defined(__DECC) 539 # define LZO_CC_DECC 1 540 # define LZO_INFO_CC "DEC C" 541 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__DECC) 542 #elif defined(__HIGHC__) 543 # define LZO_CC_HIGHC 1 544 # define LZO_INFO_CC "MetaWare High C" 545 # define LZO_INFO_CCVER "unknown" 546 #elif defined(__IAR_SYSTEMS_ICC__) 547 # define LZO_CC_IARC 1 548 # define LZO_INFO_CC "IAR C" 549 # if defined(__VER__) 550 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__VER__) 551 # else 552 # define LZO_INFO_CCVER "unknown" 553 # endif 554 #elif defined(__IBMC__) 555 # define LZO_CC_IBMC 1 556 # define LZO_INFO_CC "IBM C" 557 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__IBMC__) 558 #elif defined(__KEIL__) && defined(__C166__) 559 # define LZO_CC_KEILC 1 560 # define LZO_INFO_CC "Keil C" 561 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__C166__) 562 #elif defined(__LCC__) && defined(_WIN32) && defined(__LCCOPTIMLEVEL) 563 # define LZO_CC_LCCWIN32 1 564 # define LZO_INFO_CC "lcc-win32" 565 # define LZO_INFO_CCVER "unknown" 566 #elif defined(__LCC__) 567 # define LZO_CC_LCC 1 568 # define LZO_INFO_CC "lcc" 569 # if defined(__LCC_VERSION__) 570 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__LCC_VERSION__) 571 # else 572 # define LZO_INFO_CCVER "unknown" 573 # endif 574 #elif defined(_MSC_VER) 575 # define LZO_CC_MSC 1 576 # define LZO_INFO_CC "Microsoft C" 577 # if defined(_MSC_FULL_VER) 578 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) "." LZO_PP_MACRO_EXPAND(_MSC_FULL_VER) 579 # else 580 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(_MSC_VER) 581 # endif 582 #elif defined(__MWERKS__) 583 # define LZO_CC_MWERKS 1 584 # define LZO_INFO_CC "Metrowerks C" 585 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__MWERKS__) 586 #elif (defined(__NDPC__) || defined(__NDPX__)) && defined(__i386) 587 # define LZO_CC_NDPC 1 588 # define LZO_INFO_CC "Microway NDP C" 589 # define LZO_INFO_CCVER "unknown" 590 #elif defined(__PACIFIC__) 591 # define LZO_CC_PACIFICC 1 592 # define LZO_INFO_CC "Pacific C" 593 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PACIFIC__) 594 #elif defined(__PGI) && (defined(__linux__) || defined(__WIN32__)) 595 # define LZO_CC_PGI 1 596 # define LZO_INFO_CC "Portland Group PGI C" 597 # define LZO_INFO_CCVER "unknown" 598 #elif defined(__PUREC__) && defined(__TOS__) 599 # define LZO_CC_PUREC 1 600 # define LZO_INFO_CC "Pure C" 601 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__PUREC__) 602 #elif defined(__SC__) && defined(__ZTC__) 603 # define LZO_CC_SYMANTECC 1 604 # define LZO_INFO_CC "Symantec C" 605 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SC__) 606 #elif defined(__SUNPRO_C) 607 # define LZO_INFO_CC "SunPro C" 608 # if ((__SUNPRO_C)+0 > 0) 609 # define LZO_CC_SUNPROC __SUNPRO_C 610 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_C) 611 # else 612 # define LZO_CC_SUNPROC 1 613 # define LZO_INFO_CCVER "unknown" 614 # endif 615 #elif defined(__SUNPRO_CC) 616 # define LZO_INFO_CC "SunPro C" 617 # if ((__SUNPRO_CC)+0 > 0) 618 # define LZO_CC_SUNPROC __SUNPRO_CC 619 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__SUNPRO_CC) 620 # else 621 # define LZO_CC_SUNPROC 1 622 # define LZO_INFO_CCVER "unknown" 623 # endif 624 #elif defined(__TINYC__) 625 # define LZO_CC_TINYC 1 626 # define LZO_INFO_CC "Tiny C" 627 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TINYC__) 628 #elif defined(__TSC__) 629 # define LZO_CC_TOPSPEEDC 1 630 # define LZO_INFO_CC "TopSpeed C" 631 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TSC__) 632 #elif defined(__WATCOMC__) 633 # define LZO_CC_WATCOMC 1 634 # define LZO_INFO_CC "Watcom C" 635 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__WATCOMC__) 636 #elif defined(__TURBOC__) 637 # define LZO_CC_TURBOC 1 638 # define LZO_INFO_CC "Turbo C" 639 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__TURBOC__) 640 #elif defined(__ZTC__) 641 # define LZO_CC_ZORTECHC 1 642 # define LZO_INFO_CC "Zortech C" 643 # if (__ZTC__ == 0x310) 644 # define LZO_INFO_CCVER "0x310" 645 # else 646 # define LZO_INFO_CCVER LZO_PP_MACRO_EXPAND(__ZTC__) 647 # endif 648 #else 649 # define LZO_CC_UNKNOWN 1 650 # define LZO_INFO_CC "unknown" 651 # define LZO_INFO_CCVER "unknown" 652 #endif 653 #if 0 && (LZO_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER) 654 # error "LZO_CC_MSC: _MSC_FULL_VER is not defined" 655 #endif 656 #if !defined(__LZO_ARCH_OVERRIDE) && !defined(LZO_ARCH_GENERIC) && defined(_CRAY) 657 # if (UINT_MAX > LZO_0xffffffffL) && defined(_CRAY) 658 # if defined(_CRAYMPP) || defined(_CRAYT3D) || defined(_CRAYT3E) 659 # define LZO_ARCH_CRAY_MPP 1 660 # elif defined(_CRAY1) 661 # define LZO_ARCH_CRAY_PVP 1 662 # endif 663 # endif 664 #endif 665 #if !defined(__LZO_ARCH_OVERRIDE) 666 #if defined(LZO_ARCH_GENERIC) 667 # define LZO_INFO_ARCH "generic" 668 #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 669 # define LZO_ARCH_I086 1 670 # define LZO_ARCH_IA16 1 671 # define LZO_INFO_ARCH "i086" 672 #elif defined(__alpha__) || defined(__alpha) || defined(_M_ALPHA) 673 # define LZO_ARCH_ALPHA 1 674 # define LZO_INFO_ARCH "alpha" 675 #elif (LZO_ARCH_CRAY_MPP) && (defined(_CRAYT3D) || defined(_CRAYT3E)) 676 # define LZO_ARCH_ALPHA 1 677 # define LZO_INFO_ARCH "alpha" 678 #elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64) 679 # define LZO_ARCH_AMD64 1 680 # define LZO_INFO_ARCH "amd64" 681 #elif defined(__thumb__) || (defined(_M_ARM) && defined(_M_THUMB)) 682 # define LZO_ARCH_ARM 1 683 # define LZO_ARCH_ARM_THUMB 1 684 # define LZO_INFO_ARCH "arm_thumb" 685 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) 686 # define LZO_ARCH_ARM 1 687 # if defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 1) 688 # define LZO_ARCH_ARM_THUMB 1 689 # define LZO_INFO_ARCH "arm_thumb" 690 # elif defined(__CPU_MODE__) && ((__CPU_MODE__)+0 == 2) 691 # define LZO_INFO_ARCH "arm" 692 # else 693 # define LZO_INFO_ARCH "arm" 694 # endif 695 #elif defined(__arm__) || defined(_M_ARM) 696 # define LZO_ARCH_ARM 1 697 # define LZO_INFO_ARCH "arm" 698 #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__) 699 # define LZO_ARCH_AVR 1 700 # define LZO_INFO_ARCH "avr" 701 #elif defined(__bfin__) 702 # define LZO_ARCH_BLACKFIN 1 703 # define LZO_INFO_ARCH "blackfin" 704 #elif (UINT_MAX == LZO_0xffffL) && defined(__C166__) 705 # define LZO_ARCH_C166 1 706 # define LZO_INFO_ARCH "c166" 707 #elif defined(__cris__) 708 # define LZO_ARCH_CRIS 1 709 # define LZO_INFO_ARCH "cris" 710 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCEZ80__) 711 # define LZO_ARCH_EZ80 1 712 # define LZO_INFO_ARCH "ez80" 713 #elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) 714 # define LZO_ARCH_H8300 1 715 # define LZO_INFO_ARCH "h8300" 716 #elif defined(__hppa__) || defined(__hppa) 717 # define LZO_ARCH_HPPA 1 718 # define LZO_INFO_ARCH "hppa" 719 #elif defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386) 720 # define LZO_ARCH_I386 1 721 # define LZO_ARCH_IA32 1 722 # define LZO_INFO_ARCH "i386" 723 #elif (LZO_CC_ZORTECHC && defined(__I86__)) 724 # define LZO_ARCH_I386 1 725 # define LZO_ARCH_IA32 1 726 # define LZO_INFO_ARCH "i386" 727 #elif (LZO_OS_DOS32 && LZO_CC_HIGHC) && defined(_I386) 728 # define LZO_ARCH_I386 1 729 # define LZO_ARCH_IA32 1 730 # define LZO_INFO_ARCH "i386" 731 #elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64) 732 # define LZO_ARCH_IA64 1 733 # define LZO_INFO_ARCH "ia64" 734 #elif (UINT_MAX == LZO_0xffffL) && defined(__m32c__) 735 # define LZO_ARCH_M16C 1 736 # define LZO_INFO_ARCH "m16c" 737 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCM16C__) 738 # define LZO_ARCH_M16C 1 739 # define LZO_INFO_ARCH "m16c" 740 #elif defined(__m32r__) 741 # define LZO_ARCH_M32R 1 742 # define LZO_INFO_ARCH "m32r" 743 #elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(__mc68020__) || defined(_M_M68K) 744 # define LZO_ARCH_M68K 1 745 # define LZO_INFO_ARCH "m68k" 746 #elif (UINT_MAX == LZO_0xffffL) && defined(__C251__) 747 # define LZO_ARCH_MCS251 1 748 # define LZO_INFO_ARCH "mcs251" 749 #elif (UINT_MAX == LZO_0xffffL) && defined(__C51__) 750 # define LZO_ARCH_MCS51 1 751 # define LZO_INFO_ARCH "mcs51" 752 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC8051__) 753 # define LZO_ARCH_MCS51 1 754 # define LZO_INFO_ARCH "mcs51" 755 #elif defined(__mips__) || defined(__mips) || defined(_MIPS_ARCH) || defined(_M_MRX000) 756 # define LZO_ARCH_MIPS 1 757 # define LZO_INFO_ARCH "mips" 758 #elif (UINT_MAX == LZO_0xffffL) && defined(__MSP430__) 759 # define LZO_ARCH_MSP430 1 760 # define LZO_INFO_ARCH "msp430" 761 #elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICC430__) 762 # define LZO_ARCH_MSP430 1 763 # define LZO_INFO_ARCH "msp430" 764 #elif defined(__powerpc__) || defined(__powerpc) || defined(__ppc__) || defined(__PPC__) || defined(_M_PPC) || defined(_ARCH_PPC) || defined(_ARCH_PWR) 765 # define LZO_ARCH_POWERPC 1 766 # define LZO_INFO_ARCH "powerpc" 767 #elif defined(__s390__) || defined(__s390) || defined(__s390x__) || defined(__s390x) 768 # define LZO_ARCH_S390 1 769 # define LZO_INFO_ARCH "s390" 770 #elif defined(__sh__) || defined(_M_SH) 771 # define LZO_ARCH_SH 1 772 # define LZO_INFO_ARCH "sh" 773 #elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) 774 # define LZO_ARCH_SPARC 1 775 # define LZO_INFO_ARCH "sparc" 776 #elif defined(__SPU__) 777 # define LZO_ARCH_SPU 1 778 # define LZO_INFO_ARCH "spu" 779 #elif (UINT_MAX == LZO_0xffffL) && defined(__z80) 780 # define LZO_ARCH_Z80 1 781 # define LZO_INFO_ARCH "z80" 782 #elif (LZO_ARCH_CRAY_PVP) 783 # if defined(_CRAYSV1) 784 # define LZO_ARCH_CRAY_SV1 1 785 # define LZO_INFO_ARCH "cray_sv1" 786 # elif (_ADDR64) 787 # define LZO_ARCH_CRAY_T90 1 788 # define LZO_INFO_ARCH "cray_t90" 789 # elif (_ADDR32) 790 # define LZO_ARCH_CRAY_YMP 1 791 # define LZO_INFO_ARCH "cray_ymp" 792 # else 793 # define LZO_ARCH_CRAY_XMP 1 794 # define LZO_INFO_ARCH "cray_xmp" 795 # endif 796 #else 797 # define LZO_ARCH_UNKNOWN 1 798 # define LZO_INFO_ARCH "unknown" 799 #endif 800 #endif 801 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_DOS32 || LZO_OS_OS2) 802 # error "FIXME - missing define for CPU architecture" 803 #endif 804 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN32) 805 # error "FIXME - missing WIN32 define for CPU architecture" 806 #endif 807 #if 1 && (LZO_ARCH_UNKNOWN) && (LZO_OS_WIN64) 808 # error "FIXME - missing WIN64 define for CPU architecture" 809 #endif 810 #if (LZO_OS_OS216 || LZO_OS_WIN16) 811 # define LZO_ARCH_I086PM 1 812 # define LZO_ARCH_IA16PM 1 813 #elif 1 && (LZO_OS_DOS16 && defined(BLX286)) 814 # define LZO_ARCH_I086PM 1 815 # define LZO_ARCH_IA16PM 1 816 #elif 1 && (LZO_OS_DOS16 && defined(DOSX286)) 817 # define LZO_ARCH_I086PM 1 818 # define LZO_ARCH_IA16PM 1 819 #elif 1 && (LZO_OS_DOS16 && LZO_CC_BORLANDC && defined(__DPMI16__)) 820 # define LZO_ARCH_I086PM 1 821 # define LZO_ARCH_IA16PM 1 822 #endif 823 #if defined(LZO_ARCH_ARM_THUMB) && !defined(LZO_ARCH_ARM) 824 # error "this should not happen" 825 #endif 826 #if defined(LZO_ARCH_I086PM) && !defined(LZO_ARCH_I086) 827 # error "this should not happen" 828 #endif 829 #if (LZO_ARCH_I086) 830 # if (UINT_MAX != LZO_0xffffL) 831 # error "this should not happen" 832 # endif 833 # if (ULONG_MAX != LZO_0xffffffffL) 834 # error "this should not happen" 835 # endif 836 #endif 837 #if (LZO_ARCH_I386) 838 # if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__) 839 # error "this should not happen" 840 # endif 841 # if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__) 842 # error "this should not happen" 843 # endif 844 # if (ULONG_MAX != LZO_0xffffffffL) 845 # error "this should not happen" 846 # endif 847 #endif 848 #if !defined(__LZO_MM_OVERRIDE) 849 #if (LZO_ARCH_I086) 850 #if (UINT_MAX != LZO_0xffffL) 851 # error "this should not happen" 852 #endif 853 #if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM) 854 # define LZO_MM_TINY 1 855 #elif defined(__HUGE__) || defined(_HUGE_) || defined(M_I86HM) || defined(_M_I86HM) 856 # define LZO_MM_HUGE 1 857 #elif defined(__SMALL__) || defined(M_I86SM) || defined(_M_I86SM) || defined(SMALL_MODEL) 858 # define LZO_MM_SMALL 1 859 #elif defined(__MEDIUM__) || defined(M_I86MM) || defined(_M_I86MM) 860 # define LZO_MM_MEDIUM 1 861 #elif defined(__COMPACT__) || defined(M_I86CM) || defined(_M_I86CM) 862 # define LZO_MM_COMPACT 1 863 #elif defined(__LARGE__) || defined(M_I86LM) || defined(_M_I86LM) || defined(LARGE_MODEL) 864 # define LZO_MM_LARGE 1 865 #elif (LZO_CC_AZTECC) 866 # if defined(_LARGE_CODE) && defined(_LARGE_DATA) 867 # define LZO_MM_LARGE 1 868 # elif defined(_LARGE_CODE) 869 # define LZO_MM_MEDIUM 1 870 # elif defined(_LARGE_DATA) 871 # define LZO_MM_COMPACT 1 872 # else 873 # define LZO_MM_SMALL 1 874 # endif 875 #elif (LZO_CC_ZORTECHC && defined(__VCM__)) 876 # define LZO_MM_LARGE 1 877 #else 878 # error "unknown memory model" 879 #endif 880 #if (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 881 #define LZO_HAVE_MM_HUGE_PTR 1 882 #define LZO_HAVE_MM_HUGE_ARRAY 1 883 #if (LZO_MM_TINY) 884 # undef LZO_HAVE_MM_HUGE_ARRAY 885 #endif 886 #if (LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_ZORTECHC) 887 # undef LZO_HAVE_MM_HUGE_PTR 888 # undef LZO_HAVE_MM_HUGE_ARRAY 889 #elif (LZO_CC_DMC || LZO_CC_SYMANTECC) 890 # undef LZO_HAVE_MM_HUGE_ARRAY 891 #elif (LZO_CC_MSC && defined(_QC)) 892 # undef LZO_HAVE_MM_HUGE_ARRAY 893 # if (_MSC_VER < 600) 894 # undef LZO_HAVE_MM_HUGE_PTR 895 # endif 896 #elif (LZO_CC_TURBOC && (__TURBOC__ < 0x0295)) 897 # undef LZO_HAVE_MM_HUGE_ARRAY 898 #endif 899 #if (LZO_ARCH_I086PM) && !defined(LZO_HAVE_MM_HUGE_PTR) 900 # if (LZO_OS_DOS16) 901 # error "this should not happen" 902 # elif (LZO_CC_ZORTECHC) 903 # else 904 # error "this should not happen" 905 # endif 906 #endif 907 #ifdef __cplusplus 908 extern "C" { 909 #endif 910 #if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0200)) 911 extern void __near __cdecl _AHSHIFT(void); 912 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 913 #elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 914 extern void __near __cdecl _AHSHIFT(void); 915 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 916 #elif (LZO_CC_MSC || LZO_CC_TOPSPEEDC) 917 extern void __near __cdecl _AHSHIFT(void); 918 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 919 #elif (LZO_CC_TURBOC && (__TURBOC__ >= 0x0295)) 920 extern void __near __cdecl _AHSHIFT(void); 921 # define LZO_MM_AHSHIFT ((unsigned) _AHSHIFT) 922 #elif ((LZO_CC_AZTECC || LZO_CC_PACIFICC || LZO_CC_TURBOC) && LZO_OS_DOS16) 923 # define LZO_MM_AHSHIFT 12 924 #elif (LZO_CC_WATCOMC) 925 extern unsigned char _HShift; 926 # define LZO_MM_AHSHIFT ((unsigned) _HShift) 927 #else 928 # error "FIXME - implement LZO_MM_AHSHIFT" 929 #endif 930 #ifdef __cplusplus 931 } 932 #endif 933 #endif 934 #elif (LZO_ARCH_C166) 935 #if !defined(__MODEL__) 936 # error "FIXME - C166 __MODEL__" 937 #elif ((__MODEL__) == 0) 938 # define LZO_MM_SMALL 1 939 #elif ((__MODEL__) == 1) 940 # define LZO_MM_SMALL 1 941 #elif ((__MODEL__) == 2) 942 # define LZO_MM_LARGE 1 943 #elif ((__MODEL__) == 3) 944 # define LZO_MM_TINY 1 945 #elif ((__MODEL__) == 4) 946 # define LZO_MM_XTINY 1 947 #elif ((__MODEL__) == 5) 948 # define LZO_MM_XSMALL 1 949 #else 950 # error "FIXME - C166 __MODEL__" 951 #endif 952 #elif (LZO_ARCH_MCS251) 953 #if !defined(__MODEL__) 954 # error "FIXME - MCS251 __MODEL__" 955 #elif ((__MODEL__) == 0) 956 # define LZO_MM_SMALL 1 957 #elif ((__MODEL__) == 2) 958 # define LZO_MM_LARGE 1 959 #elif ((__MODEL__) == 3) 960 # define LZO_MM_TINY 1 961 #elif ((__MODEL__) == 4) 962 # define LZO_MM_XTINY 1 963 #elif ((__MODEL__) == 5) 964 # define LZO_MM_XSMALL 1 965 #else 966 # error "FIXME - MCS251 __MODEL__" 967 #endif 968 #elif (LZO_ARCH_MCS51) 969 #if !defined(__MODEL__) 970 # error "FIXME - MCS51 __MODEL__" 971 #elif ((__MODEL__) == 1) 972 # define LZO_MM_SMALL 1 973 #elif ((__MODEL__) == 2) 974 # define LZO_MM_LARGE 1 975 #elif ((__MODEL__) == 3) 976 # define LZO_MM_TINY 1 977 #elif ((__MODEL__) == 4) 978 # define LZO_MM_XTINY 1 979 #elif ((__MODEL__) == 5) 980 # define LZO_MM_XSMALL 1 981 #else 982 # error "FIXME - MCS51 __MODEL__" 983 #endif 984 #elif (LZO_ARCH_CRAY_PVP) 985 # define LZO_MM_PVP 1 986 #else 987 # define LZO_MM_FLAT 1 988 #endif 989 #if (LZO_MM_COMPACT) 990 # define LZO_INFO_MM "compact" 991 #elif (LZO_MM_FLAT) 992 # define LZO_INFO_MM "flat" 993 #elif (LZO_MM_HUGE) 994 # define LZO_INFO_MM "huge" 995 #elif (LZO_MM_LARGE) 996 # define LZO_INFO_MM "large" 997 #elif (LZO_MM_MEDIUM) 998 # define LZO_INFO_MM "medium" 999 #elif (LZO_MM_PVP) 1000 # define LZO_INFO_MM "pvp" 1001 #elif (LZO_MM_SMALL) 1002 # define LZO_INFO_MM "small" 1003 #elif (LZO_MM_TINY) 1004 # define LZO_INFO_MM "tiny" 1005 #else 1006 # error "unknown memory model" 1007 #endif 1008 #endif 1009 #if defined(SIZEOF_SHORT) 1010 # define LZO_SIZEOF_SHORT (SIZEOF_SHORT) 1011 #endif 1012 #if defined(SIZEOF_INT) 1013 # define LZO_SIZEOF_INT (SIZEOF_INT) 1014 #endif 1015 #if defined(SIZEOF_LONG) 1016 # define LZO_SIZEOF_LONG (SIZEOF_LONG) 1017 #endif 1018 #if defined(SIZEOF_LONG_LONG) 1019 # define LZO_SIZEOF_LONG_LONG (SIZEOF_LONG_LONG) 1020 #endif 1021 #if defined(SIZEOF___INT16) 1022 # define LZO_SIZEOF___INT16 (SIZEOF___INT16) 1023 #endif 1024 #if defined(SIZEOF___INT32) 1025 # define LZO_SIZEOF___INT32 (SIZEOF___INT32) 1026 #endif 1027 #if defined(SIZEOF___INT64) 1028 # define LZO_SIZEOF___INT64 (SIZEOF___INT64) 1029 #endif 1030 #if defined(SIZEOF_VOID_P) 1031 # define LZO_SIZEOF_VOID_P (SIZEOF_VOID_P) 1032 #endif 1033 #if defined(SIZEOF_SIZE_T) 1034 # define LZO_SIZEOF_SIZE_T (SIZEOF_SIZE_T) 1035 #endif 1036 #if defined(SIZEOF_PTRDIFF_T) 1037 # define LZO_SIZEOF_PTRDIFF_T (SIZEOF_PTRDIFF_T) 1038 #endif 1039 #define __LZO_LSR(x,b) (((x)+0ul) >> (b)) 1040 #if !defined(LZO_SIZEOF_SHORT) 1041 # if (LZO_ARCH_CRAY_PVP) 1042 # define LZO_SIZEOF_SHORT 8 1043 # elif (USHRT_MAX == LZO_0xffffL) 1044 # define LZO_SIZEOF_SHORT 2 1045 # elif (__LZO_LSR(USHRT_MAX,7) == 1) 1046 # define LZO_SIZEOF_SHORT 1 1047 # elif (__LZO_LSR(USHRT_MAX,15) == 1) 1048 # define LZO_SIZEOF_SHORT 2 1049 # elif (__LZO_LSR(USHRT_MAX,31) == 1) 1050 # define LZO_SIZEOF_SHORT 4 1051 # elif (__LZO_LSR(USHRT_MAX,63) == 1) 1052 # define LZO_SIZEOF_SHORT 8 1053 # elif (__LZO_LSR(USHRT_MAX,127) == 1) 1054 # define LZO_SIZEOF_SHORT 16 1055 # else 1056 # error "LZO_SIZEOF_SHORT" 1057 # endif 1058 #endif 1059 #if !defined(LZO_SIZEOF_INT) 1060 # if (LZO_ARCH_CRAY_PVP) 1061 # define LZO_SIZEOF_INT 8 1062 # elif (UINT_MAX == LZO_0xffffL) 1063 # define LZO_SIZEOF_INT 2 1064 # elif (UINT_MAX == LZO_0xffffffffL) 1065 # define LZO_SIZEOF_INT 4 1066 # elif (__LZO_LSR(UINT_MAX,7) == 1) 1067 # define LZO_SIZEOF_INT 1 1068 # elif (__LZO_LSR(UINT_MAX,15) == 1) 1069 # define LZO_SIZEOF_INT 2 1070 # elif (__LZO_LSR(UINT_MAX,31) == 1) 1071 # define LZO_SIZEOF_INT 4 1072 # elif (__LZO_LSR(UINT_MAX,63) == 1) 1073 # define LZO_SIZEOF_INT 8 1074 # elif (__LZO_LSR(UINT_MAX,127) == 1) 1075 # define LZO_SIZEOF_INT 16 1076 # else 1077 # error "LZO_SIZEOF_INT" 1078 # endif 1079 #endif 1080 #if !defined(LZO_SIZEOF_LONG) 1081 # if (ULONG_MAX == LZO_0xffffffffL) 1082 # define LZO_SIZEOF_LONG 4 1083 # elif (__LZO_LSR(ULONG_MAX,7) == 1) 1084 # define LZO_SIZEOF_LONG 1 1085 # elif (__LZO_LSR(ULONG_MAX,15) == 1) 1086 # define LZO_SIZEOF_LONG 2 1087 # elif (__LZO_LSR(ULONG_MAX,31) == 1) 1088 # define LZO_SIZEOF_LONG 4 1089 # elif (__LZO_LSR(ULONG_MAX,63) == 1) 1090 # define LZO_SIZEOF_LONG 8 1091 # elif (__LZO_LSR(ULONG_MAX,127) == 1) 1092 # define LZO_SIZEOF_LONG 16 1093 # else 1094 # error "LZO_SIZEOF_LONG" 1095 # endif 1096 #endif 1097 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) 1098 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) 1099 # if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__) 1100 # if (LZO_CC_GNUC >= 0x030300ul) 1101 # if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0) 1102 # define LZO_SIZEOF_LONG_LONG LZO_SIZEOF_LONG 1103 # elif (__LZO_LSR(__LONG_LONG_MAX__,30) == 1) 1104 # define LZO_SIZEOF_LONG_LONG 4 1105 # endif 1106 # endif 1107 # endif 1108 #endif 1109 #endif 1110 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64) 1111 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8) 1112 #if (LZO_ARCH_I086 && LZO_CC_DMC) 1113 #elif (LZO_CC_CILLY) && defined(__GNUC__) 1114 # define LZO_SIZEOF_LONG_LONG 8 1115 #elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1116 # define LZO_SIZEOF_LONG_LONG 8 1117 #elif ((LZO_OS_WIN32 || LZO_OS_WIN64 || defined(_WIN32)) && LZO_CC_MSC && (_MSC_VER >= 1400)) 1118 # define LZO_SIZEOF_LONG_LONG 8 1119 #elif (LZO_OS_WIN64 || defined(_WIN64)) 1120 # define LZO_SIZEOF___INT64 8 1121 #elif (LZO_ARCH_I386 && (LZO_CC_DMC)) 1122 # define LZO_SIZEOF_LONG_LONG 8 1123 #elif (LZO_ARCH_I386 && (LZO_CC_SYMANTECC && (__SC__ >= 0x700))) 1124 # define LZO_SIZEOF_LONG_LONG 8 1125 #elif (LZO_ARCH_I386 && (LZO_CC_INTELC && defined(__linux__))) 1126 # define LZO_SIZEOF_LONG_LONG 8 1127 #elif (LZO_ARCH_I386 && (LZO_CC_MWERKS || LZO_CC_PELLESC || LZO_CC_PGI || LZO_CC_SUNPROC)) 1128 # define LZO_SIZEOF_LONG_LONG 8 1129 #elif (LZO_ARCH_I386 && (LZO_CC_INTELC || LZO_CC_MSC)) 1130 # define LZO_SIZEOF___INT64 8 1131 #elif ((LZO_OS_WIN32 || defined(_WIN32)) && (LZO_CC_MSC)) 1132 # define LZO_SIZEOF___INT64 8 1133 #elif (LZO_ARCH_I386 && (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0520))) 1134 # define LZO_SIZEOF___INT64 8 1135 #elif (LZO_ARCH_I386 && (LZO_CC_WATCOMC && (__WATCOMC__ >= 1100))) 1136 # define LZO_SIZEOF___INT64 8 1137 #elif (LZO_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) 1138 # define LZO_SIZEOF___INT64 8 1139 #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) 1140 # define LZO_SIZEOF_LONG_LONG 8 1141 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) 1142 # define LZO_SIZEOF_LONG_LONG 8 1143 #elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2) 1144 #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 1145 # define LZO_SIZEOF_LONG_LONG 8 1146 #endif 1147 #endif 1148 #endif 1149 #if defined(__cplusplus) && defined(LZO_CC_GNUC) 1150 # if (LZO_CC_GNUC < 0x020800ul) 1151 # undef LZO_SIZEOF_LONG_LONG 1152 # endif 1153 #endif 1154 #if defined(LZO_CFG_NO_LONG_LONG) || defined(__NO_LONG_LONG) 1155 # undef LZO_SIZEOF_LONG_LONG 1156 #endif 1157 #if !defined(LZO_SIZEOF_VOID_P) 1158 #if (LZO_ARCH_I086) 1159 # define __LZO_WORDSIZE 2 1160 # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM) 1161 # define LZO_SIZEOF_VOID_P 2 1162 # elif (LZO_MM_COMPACT || LZO_MM_LARGE || LZO_MM_HUGE) 1163 # define LZO_SIZEOF_VOID_P 4 1164 # else 1165 # error "LZO_MM" 1166 # endif 1167 #elif (LZO_ARCH_AVR || LZO_ARCH_Z80) 1168 # define __LZO_WORDSIZE 1 1169 # define LZO_SIZEOF_VOID_P 2 1170 #elif (LZO_ARCH_C166 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_MSP430) 1171 # define LZO_SIZEOF_VOID_P 2 1172 #elif (LZO_ARCH_H8300) 1173 # if defined(__NORMAL_MODE__) 1174 # define __LZO_WORDSIZE 4 1175 # define LZO_SIZEOF_VOID_P 2 1176 # elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__) 1177 # define __LZO_WORDSIZE 4 1178 # define LZO_SIZEOF_VOID_P 4 1179 # else 1180 # define __LZO_WORDSIZE 2 1181 # define LZO_SIZEOF_VOID_P 2 1182 # endif 1183 # if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4) 1184 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_INT 1185 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_INT 1186 # endif 1187 #elif (LZO_ARCH_M16C) 1188 # define __LZO_WORDSIZE 2 1189 # if defined(__m32c_cpu__) || defined(__m32cm_cpu__) 1190 # define LZO_SIZEOF_VOID_P 4 1191 # else 1192 # define LZO_SIZEOF_VOID_P 2 1193 # endif 1194 #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__)) 1195 # define __LZO_WORDSIZE 8 1196 # define LZO_SIZEOF_VOID_P 4 1197 #elif defined(__LLP64__) || defined(__LLP64) || defined(_LLP64) || defined(_WIN64) 1198 # define __LZO_WORDSIZE 8 1199 # define LZO_SIZEOF_VOID_P 8 1200 #elif (LZO_OS_OS400 || defined(__OS400__)) && defined(__LLP64_IFC__) 1201 # define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG 1202 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 1203 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 1204 #elif (LZO_OS_OS400 || defined(__OS400__)) 1205 # define __LZO_WORDSIZE LZO_SIZEOF_LONG 1206 # define LZO_SIZEOF_VOID_P 16 1207 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 1208 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 1209 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64) 1210 # define LZO_SIZEOF_VOID_P 8 1211 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_LONG 1212 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_LONG 1213 #elif (LZO_ARCH_SPU) 1214 # if 0 1215 # define __LZO_WORDSIZE 16 1216 # endif 1217 # define LZO_SIZEOF_VOID_P 4 1218 #else 1219 # define LZO_SIZEOF_VOID_P LZO_SIZEOF_LONG 1220 #endif 1221 #endif 1222 #if !defined(LZO_WORDSIZE) 1223 # if defined(__LZO_WORDSIZE) 1224 # define LZO_WORDSIZE __LZO_WORDSIZE 1225 # else 1226 # define LZO_WORDSIZE LZO_SIZEOF_VOID_P 1227 # endif 1228 #endif 1229 #if !defined(LZO_SIZEOF_SIZE_T) 1230 #if (LZO_ARCH_I086 || LZO_ARCH_M16C) 1231 # define LZO_SIZEOF_SIZE_T 2 1232 #else 1233 # define LZO_SIZEOF_SIZE_T LZO_SIZEOF_VOID_P 1234 #endif 1235 #endif 1236 #if !defined(LZO_SIZEOF_PTRDIFF_T) 1237 #if (LZO_ARCH_I086) 1238 # if (LZO_MM_TINY || LZO_MM_SMALL || LZO_MM_MEDIUM || LZO_MM_HUGE) 1239 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_VOID_P 1240 # elif (LZO_MM_COMPACT || LZO_MM_LARGE) 1241 # if (LZO_CC_BORLANDC || LZO_CC_TURBOC) 1242 # define LZO_SIZEOF_PTRDIFF_T 4 1243 # else 1244 # define LZO_SIZEOF_PTRDIFF_T 2 1245 # endif 1246 # else 1247 # error "LZO_MM" 1248 # endif 1249 #else 1250 # define LZO_SIZEOF_PTRDIFF_T LZO_SIZEOF_SIZE_T 1251 #endif 1252 #endif 1253 #if defined(LZO_ABI_NEUTRAL_ENDIAN) 1254 # undef LZO_ABI_BIG_ENDIAN 1255 # undef LZO_ABI_LITTLE_ENDIAN 1256 #elif !defined(LZO_ABI_BIG_ENDIAN) && !defined(LZO_ABI_LITTLE_ENDIAN) 1257 #if (LZO_ARCH_ALPHA) && (LZO_ARCH_CRAY_MPP) 1258 # define LZO_ABI_BIG_ENDIAN 1 1259 #elif (LZO_ARCH_ALPHA || LZO_ARCH_AMD64 || LZO_ARCH_BLACKFIN || LZO_ARCH_CRIS || LZO_ARCH_I086 || LZO_ARCH_I386 || LZO_ARCH_MSP430) 1260 # define LZO_ABI_LITTLE_ENDIAN 1 1261 #elif (LZO_ARCH_M68K || LZO_ARCH_S390) 1262 # define LZO_ABI_BIG_ENDIAN 1 1263 #elif 1 && defined(__IAR_SYSTEMS_ICC__) && defined(__LITTLE_ENDIAN__) 1264 # if (__LITTLE_ENDIAN__ == 1) 1265 # define LZO_ABI_LITTLE_ENDIAN 1 1266 # else 1267 # define LZO_ABI_BIG_ENDIAN 1 1268 # endif 1269 #elif 1 && defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) 1270 # define LZO_ABI_BIG_ENDIAN 1 1271 #elif 1 && defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) 1272 # define LZO_ABI_LITTLE_ENDIAN 1 1273 #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEB__) && !defined(__ARMEL__) 1274 # define LZO_ABI_BIG_ENDIAN 1 1275 #elif 1 && (LZO_ARCH_ARM) && defined(__ARMEL__) && !defined(__ARMEB__) 1276 # define LZO_ABI_LITTLE_ENDIAN 1 1277 #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEB__) && !defined(__MIPSEL__) 1278 # define LZO_ABI_BIG_ENDIAN 1 1279 #elif 1 && (LZO_ARCH_MIPS) && defined(__MIPSEL__) && !defined(__MIPSEB__) 1280 # define LZO_ABI_LITTLE_ENDIAN 1 1281 #endif 1282 #endif 1283 #if defined(LZO_ABI_BIG_ENDIAN) && defined(LZO_ABI_LITTLE_ENDIAN) 1284 # error "this should not happen" 1285 #endif 1286 #if defined(LZO_ABI_BIG_ENDIAN) 1287 # define LZO_INFO_ABI_ENDIAN "be" 1288 #elif defined(LZO_ABI_LITTLE_ENDIAN) 1289 # define LZO_INFO_ABI_ENDIAN "le" 1290 #elif defined(LZO_ABI_NEUTRAL_ENDIAN) 1291 # define LZO_INFO_ABI_ENDIAN "neutral" 1292 #endif 1293 #if (LZO_SIZEOF_INT == 1 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) 1294 # define LZO_ABI_I8LP16 1 1295 # define LZO_INFO_ABI_PM "i8lp16" 1296 #elif (LZO_SIZEOF_INT == 2 && LZO_SIZEOF_LONG == 2 && LZO_SIZEOF_VOID_P == 2) 1297 # define LZO_ABI_ILP16 1 1298 # define LZO_INFO_ABI_PM "ilp16" 1299 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 4) 1300 # define LZO_ABI_ILP32 1 1301 # define LZO_INFO_ABI_PM "ilp32" 1302 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 4 && LZO_SIZEOF_VOID_P == 8 && LZO_SIZEOF_SIZE_T == 8) 1303 # define LZO_ABI_LLP64 1 1304 # define LZO_INFO_ABI_PM "llp64" 1305 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) 1306 # define LZO_ABI_LP64 1 1307 # define LZO_INFO_ABI_PM "lp64" 1308 #elif (LZO_SIZEOF_INT == 8 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 8) 1309 # define LZO_ABI_ILP64 1 1310 # define LZO_INFO_ABI_PM "ilp64" 1311 #elif (LZO_SIZEOF_INT == 4 && LZO_SIZEOF_LONG == 8 && LZO_SIZEOF_VOID_P == 4) 1312 # define LZO_ABI_IP32L64 1 1313 # define LZO_INFO_ABI_PM "ip32l64" 1314 #endif 1315 #if !defined(__LZO_LIBC_OVERRIDE) 1316 #if defined(LZO_LIBC_NAKED) 1317 # define LZO_INFO_LIBC "naked" 1318 #elif defined(LZO_LIBC_FREESTANDING) 1319 # define LZO_INFO_LIBC "freestanding" 1320 #elif defined(LZO_LIBC_MOSTLY_FREESTANDING) 1321 # define LZO_INFO_LIBC "mfreestanding" 1322 #elif defined(LZO_LIBC_ISOC90) 1323 # define LZO_INFO_LIBC "isoc90" 1324 #elif defined(LZO_LIBC_ISOC99) 1325 # define LZO_INFO_LIBC "isoc99" 1326 #elif defined(__dietlibc__) 1327 # define LZO_LIBC_DIETLIBC 1 1328 # define LZO_INFO_LIBC "dietlibc" 1329 #elif defined(_NEWLIB_VERSION) 1330 # define LZO_LIBC_NEWLIB 1 1331 # define LZO_INFO_LIBC "newlib" 1332 #elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__) 1333 # if defined(__UCLIBC_SUBLEVEL__) 1334 # define LZO_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__) 1335 # else 1336 # define LZO_LIBC_UCLIBC 0x00090bL 1337 # endif 1338 # define LZO_INFO_LIBC "uclibc" 1339 #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) 1340 # define LZO_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100) 1341 # define LZO_INFO_LIBC "glibc" 1342 #elif (LZO_CC_MWERKS) && defined(__MSL__) 1343 # define LZO_LIBC_MSL __MSL__ 1344 # define LZO_INFO_LIBC "msl" 1345 #elif 1 && defined(__IAR_SYSTEMS_ICC__) 1346 # define LZO_LIBC_ISOC90 1 1347 # define LZO_INFO_LIBC "isoc90" 1348 #else 1349 # define LZO_LIBC_DEFAULT 1 1350 # define LZO_INFO_LIBC "default" 1351 #endif 1352 #endif 1353 #if !defined(__lzo_gnuc_extension__) 1354 #if (LZO_CC_GNUC >= 0x020800ul) 1355 # define __lzo_gnuc_extension__ __extension__ 1356 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1357 # define __lzo_gnuc_extension__ __extension__ 1358 #else 1359 # define __lzo_gnuc_extension__ 1360 #endif 1361 #endif 1362 #if !defined(__lzo_ua_volatile) 1363 # define __lzo_ua_volatile volatile 1364 #endif 1365 #if !defined(__lzo_alignof) 1366 #if (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) 1367 # define __lzo_alignof(e) __alignof__(e) 1368 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 700)) 1369 # define __lzo_alignof(e) __alignof__(e) 1370 #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) 1371 # define __lzo_alignof(e) __alignof(e) 1372 #endif 1373 #endif 1374 #if defined(__lzo_alignof) 1375 # define __lzo_HAVE_alignof 1 1376 #endif 1377 #if !defined(__lzo_constructor) 1378 #if (LZO_CC_GNUC >= 0x030400ul) 1379 # define __lzo_constructor __attribute__((__constructor__,__used__)) 1380 #elif (LZO_CC_GNUC >= 0x020700ul) 1381 # define __lzo_constructor __attribute__((__constructor__)) 1382 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1383 # define __lzo_constructor __attribute__((__constructor__)) 1384 #endif 1385 #endif 1386 #if defined(__lzo_constructor) 1387 # define __lzo_HAVE_constructor 1 1388 #endif 1389 #if !defined(__lzo_destructor) 1390 #if (LZO_CC_GNUC >= 0x030400ul) 1391 # define __lzo_destructor __attribute__((__destructor__,__used__)) 1392 #elif (LZO_CC_GNUC >= 0x020700ul) 1393 # define __lzo_destructor __attribute__((__destructor__)) 1394 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1395 # define __lzo_destructor __attribute__((__destructor__)) 1396 #endif 1397 #endif 1398 #if defined(__lzo_destructor) 1399 # define __lzo_HAVE_destructor 1 1400 #endif 1401 #if defined(__lzo_HAVE_destructor) && !defined(__lzo_HAVE_constructor) 1402 # error "this should not happen" 1403 #endif 1404 #if !defined(__lzo_inline) 1405 #if (LZO_CC_TURBOC && (__TURBOC__ <= 0x0295)) 1406 #elif defined(__cplusplus) 1407 # define __lzo_inline inline 1408 #elif (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0550)) 1409 # define __lzo_inline __inline 1410 #elif (LZO_CC_CILLY || LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE || LZO_CC_PGI) 1411 # define __lzo_inline __inline__ 1412 #elif (LZO_CC_DMC) 1413 # define __lzo_inline __inline 1414 #elif (LZO_CC_INTELC) 1415 # define __lzo_inline __inline 1416 #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x2405)) 1417 # define __lzo_inline __inline 1418 #elif (LZO_CC_MSC && (_MSC_VER >= 900)) 1419 # define __lzo_inline __inline 1420 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) 1421 # define __lzo_inline inline 1422 #endif 1423 #endif 1424 #if defined(__lzo_inline) 1425 # define __lzo_HAVE_inline 1 1426 #else 1427 # define __lzo_inline 1428 #endif 1429 #if !defined(__lzo_forceinline) 1430 #if (LZO_CC_GNUC >= 0x030200ul) 1431 # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1432 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) 1433 # define __lzo_forceinline __forceinline 1434 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) 1435 # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1436 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1437 # define __lzo_forceinline __inline__ __attribute__((__always_inline__)) 1438 #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) 1439 # define __lzo_forceinline __forceinline 1440 #endif 1441 #endif 1442 #if defined(__lzo_forceinline) 1443 # define __lzo_HAVE_forceinline 1 1444 #else 1445 # define __lzo_forceinline 1446 #endif 1447 #if !defined(__lzo_noinline) 1448 #if 1 && (LZO_ARCH_I386) && (LZO_CC_GNUC >= 0x040000ul) && (LZO_CC_GNUC < 0x040003ul) 1449 # define __lzo_noinline __attribute__((__noinline__,__used__)) 1450 #elif (LZO_CC_GNUC >= 0x030200ul) 1451 # define __lzo_noinline __attribute__((__noinline__)) 1452 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_MSC) 1453 # define __lzo_noinline __declspec(noinline) 1454 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) 1455 # define __lzo_noinline __attribute__((__noinline__)) 1456 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1457 # define __lzo_noinline __attribute__((__noinline__)) 1458 #elif (LZO_CC_MSC && (_MSC_VER >= 1300)) 1459 # define __lzo_noinline __declspec(noinline) 1460 #elif (LZO_CC_MWERKS && (__MWERKS__ >= 0x3200) && (LZO_OS_WIN32 || LZO_OS_WIN64)) 1461 # if defined(__cplusplus) 1462 # else 1463 # define __lzo_noinline __declspec(noinline) 1464 # endif 1465 #endif 1466 #endif 1467 #if defined(__lzo_noinline) 1468 # define __lzo_HAVE_noinline 1 1469 #else 1470 # define __lzo_noinline 1471 #endif 1472 #if (defined(__lzo_HAVE_forceinline) || defined(__lzo_HAVE_noinline)) && !defined(__lzo_HAVE_inline) 1473 # error "this should not happen" 1474 #endif 1475 #if !defined(__lzo_noreturn) 1476 #if (LZO_CC_GNUC >= 0x020700ul) 1477 # define __lzo_noreturn __attribute__((__noreturn__)) 1478 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) 1479 # define __lzo_noreturn __declspec(noreturn) 1480 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) 1481 # define __lzo_noreturn __attribute__((__noreturn__)) 1482 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1483 # define __lzo_noreturn __attribute__((__noreturn__)) 1484 #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) 1485 # define __lzo_noreturn __declspec(noreturn) 1486 #endif 1487 #endif 1488 #if defined(__lzo_noreturn) 1489 # define __lzo_HAVE_noreturn 1 1490 #else 1491 # define __lzo_noreturn 1492 #endif 1493 #if !defined(__lzo_nothrow) 1494 #if (LZO_CC_GNUC >= 0x030300ul) 1495 # define __lzo_nothrow __attribute__((__nothrow__)) 1496 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 450) && LZO_CC_SYNTAX_MSC) && defined(__cplusplus) 1497 # define __lzo_nothrow __declspec(nothrow) 1498 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800) && LZO_CC_SYNTAX_GNUC) 1499 # define __lzo_nothrow __attribute__((__nothrow__)) 1500 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1501 # define __lzo_nothrow __attribute__((__nothrow__)) 1502 #elif (LZO_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus) 1503 # define __lzo_nothrow __declspec(nothrow) 1504 #endif 1505 #endif 1506 #if defined(__lzo_nothrow) 1507 # define __lzo_HAVE_nothrow 1 1508 #else 1509 # define __lzo_nothrow 1510 #endif 1511 #if !defined(__lzo_restrict) 1512 #if (LZO_CC_GNUC >= 0x030400ul) 1513 # define __lzo_restrict __restrict__ 1514 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 600) && LZO_CC_SYNTAX_GNUC) 1515 # define __lzo_restrict __restrict__ 1516 #elif (LZO_CC_LLVM) 1517 # define __lzo_restrict __restrict__ 1518 #elif (LZO_CC_MSC && (_MSC_VER >= 1400)) 1519 # define __lzo_restrict __restrict 1520 #endif 1521 #endif 1522 #if defined(__lzo_restrict) 1523 # define __lzo_HAVE_restrict 1 1524 #else 1525 # define __lzo_restrict 1526 #endif 1527 #if !defined(__lzo_likely) && !defined(__lzo_unlikely) 1528 #if (LZO_CC_GNUC >= 0x030200ul) 1529 # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1530 # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1531 #elif (LZO_CC_INTELC && (__INTEL_COMPILER >= 800)) 1532 # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1533 # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1534 #elif (LZO_CC_LLVM || LZO_CC_PATHSCALE) 1535 # define __lzo_likely(e) (__builtin_expect(!!(e),1)) 1536 # define __lzo_unlikely(e) (__builtin_expect(!!(e),0)) 1537 #endif 1538 #endif 1539 #if defined(__lzo_likely) 1540 # define __lzo_HAVE_likely 1 1541 #else 1542 # define __lzo_likely(e) (e) 1543 #endif 1544 #if defined(__lzo_unlikely) 1545 # define __lzo_HAVE_unlikely 1 1546 #else 1547 # define __lzo_unlikely(e) (e) 1548 #endif 1549 #if !defined(LZO_UNUSED) 1550 # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) 1551 # define LZO_UNUSED(var) ((void) &var) 1552 # elif (LZO_CC_BORLANDC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PELLESC || LZO_CC_TURBOC) 1553 # define LZO_UNUSED(var) if (&var) ; else 1554 # elif (LZO_CC_GNUC || LZO_CC_LLVM || LZO_CC_PATHSCALE) 1555 # define LZO_UNUSED(var) ((void) var) 1556 # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1557 # define LZO_UNUSED(var) if (&var) ; else 1558 # elif (LZO_CC_KEILC) 1559 # define LZO_UNUSED(var) {extern int __lzo_unused[1-2*!(sizeof(var)>0)];} 1560 # elif (LZO_CC_PACIFICC) 1561 # define LZO_UNUSED(var) ((void) sizeof(var)) 1562 # elif (LZO_CC_WATCOMC) && defined(__cplusplus) 1563 # define LZO_UNUSED(var) ((void) var) 1564 # else 1565 # define LZO_UNUSED(var) ((void) &var) 1566 # endif 1567 #endif 1568 #if !defined(LZO_UNUSED_FUNC) 1569 # if (LZO_CC_BORLANDC && (__BORLANDC__ >= 0x0600)) 1570 # define LZO_UNUSED_FUNC(func) ((void) func) 1571 # elif (LZO_CC_BORLANDC || LZO_CC_NDPC || LZO_CC_TURBOC) 1572 # define LZO_UNUSED_FUNC(func) if (func) ; else 1573 # elif (LZO_CC_LLVM) 1574 # define LZO_UNUSED_FUNC(func) ((void) &func) 1575 # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1576 # define LZO_UNUSED_FUNC(func) if (func) ; else 1577 # elif (LZO_CC_MSC) 1578 # define LZO_UNUSED_FUNC(func) ((void) &func) 1579 # elif (LZO_CC_KEILC || LZO_CC_PELLESC) 1580 # define LZO_UNUSED_FUNC(func) {extern int __lzo_unused[1-2*!(sizeof((int)func)>0)];} 1581 # else 1582 # define LZO_UNUSED_FUNC(func) ((void) func) 1583 # endif 1584 #endif 1585 #if !defined(LZO_UNUSED_LABEL) 1586 # if (LZO_CC_WATCOMC) && defined(__cplusplus) 1587 # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l 1588 # elif (LZO_CC_INTELC || LZO_CC_WATCOMC) 1589 # define LZO_UNUSED_LABEL(l) if (0) goto l 1590 # else 1591 # define LZO_UNUSED_LABEL(l) switch(0) case 1:goto l 1592 # endif 1593 #endif 1594 #if !defined(LZO_DEFINE_UNINITIALIZED_VAR) 1595 # if 0 1596 # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var 1597 # elif 0 && (LZO_CC_GNUC) 1598 # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = var 1599 # else 1600 # define LZO_DEFINE_UNINITIALIZED_VAR(type,var,init) type var = init 1601 # endif 1602 #endif 1603 #if !defined(LZO_COMPILE_TIME_ASSERT_HEADER) 1604 # if (LZO_CC_AZTECC || LZO_CC_ZORTECHC) 1605 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; 1606 # elif (LZO_CC_DMC || LZO_CC_SYMANTECC) 1607 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1u-2*!(e)]; 1608 # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) 1609 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-!(e)]; 1610 # else 1611 # define LZO_COMPILE_TIME_ASSERT_HEADER(e) extern int __lzo_cta[1-2*!(e)]; 1612 # endif 1613 #endif 1614 #if !defined(LZO_COMPILE_TIME_ASSERT) 1615 # if (LZO_CC_AZTECC) 1616 # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-!(e)];} 1617 # elif (LZO_CC_DMC || LZO_CC_PACIFICC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 1618 # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 1619 # elif (LZO_CC_MSC && (_MSC_VER < 900)) 1620 # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 1621 # elif (LZO_CC_TURBOC && (__TURBOC__ == 0x0295)) 1622 # define LZO_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break; 1623 # else 1624 # define LZO_COMPILE_TIME_ASSERT(e) {typedef int __lzo_cta_t[1-2*!(e)];} 1625 # endif 1626 #endif 1627 #if (LZO_ARCH_I086 || LZO_ARCH_I386) && (LZO_OS_DOS16 || LZO_OS_DOS32 || LZO_OS_OS2 || LZO_OS_OS216 || LZO_OS_WIN16 || LZO_OS_WIN32 || LZO_OS_WIN64) 1628 # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC) 1629 # elif (LZO_CC_DMC || LZO_CC_SYMANTECC || LZO_CC_ZORTECHC) 1630 # define __lzo_cdecl __cdecl 1631 # define __lzo_cdecl_atexit 1632 # define __lzo_cdecl_main __cdecl 1633 # if (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) 1634 # define __lzo_cdecl_qsort __pascal 1635 # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) 1636 # define __lzo_cdecl_qsort _stdcall 1637 # else 1638 # define __lzo_cdecl_qsort __cdecl 1639 # endif 1640 # elif (LZO_CC_WATCOMC) 1641 # define __lzo_cdecl __cdecl 1642 # else 1643 # define __lzo_cdecl __cdecl 1644 # define __lzo_cdecl_atexit __cdecl 1645 # define __lzo_cdecl_main __cdecl 1646 # define __lzo_cdecl_qsort __cdecl 1647 # endif 1648 # if (LZO_CC_GNUC || LZO_CC_HIGHC || LZO_CC_NDPC || LZO_CC_PACIFICC || LZO_CC_WATCOMC) 1649 # elif (LZO_OS_OS2 && (LZO_CC_DMC || LZO_CC_SYMANTECC)) 1650 # define __lzo_cdecl_sighandler __pascal 1651 # elif (LZO_OS_OS2 && (LZO_CC_ZORTECHC)) 1652 # define __lzo_cdecl_sighandler _stdcall 1653 # elif (LZO_CC_MSC && (_MSC_VER >= 1400)) && defined(_M_CEE_PURE) 1654 # define __lzo_cdecl_sighandler __clrcall 1655 # elif (LZO_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) 1656 # if defined(_DLL) 1657 # define __lzo_cdecl_sighandler _far _cdecl _loadds 1658 # elif defined(_MT) 1659 # define __lzo_cdecl_sighandler _far _cdecl 1660 # else 1661 # define __lzo_cdecl_sighandler _cdecl 1662 # endif 1663 # else 1664 # define __lzo_cdecl_sighandler __cdecl 1665 # endif 1666 #elif (LZO_ARCH_I386) && (LZO_CC_WATCOMC) 1667 # define __lzo_cdecl __cdecl 1668 #elif (LZO_ARCH_M68K && LZO_OS_TOS && (LZO_CC_PUREC || LZO_CC_TURBOC)) 1669 # define __lzo_cdecl cdecl 1670 #endif 1671 #if !defined(__lzo_cdecl) 1672 # define __lzo_cdecl 1673 #endif 1674 #if !defined(__lzo_cdecl_atexit) 1675 # define __lzo_cdecl_atexit 1676 #endif 1677 #if !defined(__lzo_cdecl_main) 1678 # define __lzo_cdecl_main 1679 #endif 1680 #if !defined(__lzo_cdecl_qsort) 1681 # define __lzo_cdecl_qsort 1682 #endif 1683 #if !defined(__lzo_cdecl_sighandler) 1684 # define __lzo_cdecl_sighandler 1685 #endif 1686 #if !defined(__lzo_cdecl_va) 1687 # define __lzo_cdecl_va __lzo_cdecl 1688 #endif 1689 #if !defined(LZO_CFG_NO_WINDOWS_H) 1690 #if (LZO_OS_CYGWIN || (LZO_OS_EMX && defined(__RSXNT__)) || LZO_OS_WIN32 || LZO_OS_WIN64) 1691 # if (LZO_CC_WATCOMC && (__WATCOMC__ < 1000)) 1692 # elif (LZO_OS_WIN32 && LZO_CC_GNUC) && defined(__PW32__) 1693 # elif ((LZO_OS_CYGWIN || defined(__MINGW32__)) && (LZO_CC_GNUC && (LZO_CC_GNUC < 0x025f00ul))) 1694 # else 1695 # define LZO_HAVE_WINDOWS_H 1 1696 # endif 1697 #endif 1698 #endif 1699 #if (LZO_ARCH_ALPHA) 1700 # define LZO_OPT_AVOID_UINT_INDEX 1 1701 # define LZO_OPT_AVOID_SHORT 1 1702 # define LZO_OPT_AVOID_USHORT 1 1703 #elif (LZO_ARCH_AMD64) 1704 # define LZO_OPT_AVOID_INT_INDEX 1 1705 # define LZO_OPT_AVOID_UINT_INDEX 1 1706 # define LZO_OPT_UNALIGNED16 1 1707 # define LZO_OPT_UNALIGNED32 1 1708 # define LZO_OPT_UNALIGNED64 1 1709 #elif (LZO_ARCH_ARM && LZO_ARCH_ARM_THUMB) 1710 #elif (LZO_ARCH_ARM) 1711 # define LZO_OPT_AVOID_SHORT 1 1712 # define LZO_OPT_AVOID_USHORT 1 1713 #elif (LZO_ARCH_CRIS) 1714 # define LZO_OPT_UNALIGNED16 1 1715 # define LZO_OPT_UNALIGNED32 1 1716 #elif (LZO_ARCH_I386) 1717 # define LZO_OPT_UNALIGNED16 1 1718 # define LZO_OPT_UNALIGNED32 1 1719 #elif (LZO_ARCH_IA64) 1720 # define LZO_OPT_AVOID_INT_INDEX 1 1721 # define LZO_OPT_AVOID_UINT_INDEX 1 1722 # define LZO_OPT_PREFER_POSTINC 1 1723 #elif (LZO_ARCH_M68K) 1724 # define LZO_OPT_PREFER_POSTINC 1 1725 # define LZO_OPT_PREFER_PREDEC 1 1726 # if defined(__mc68020__) && !defined(__mcoldfire__) 1727 # define LZO_OPT_UNALIGNED16 1 1728 # define LZO_OPT_UNALIGNED32 1 1729 # endif 1730 #elif (LZO_ARCH_MIPS) 1731 # define LZO_OPT_AVOID_UINT_INDEX 1 1732 #elif (LZO_ARCH_POWERPC) 1733 # define LZO_OPT_PREFER_PREINC 1 1734 # define LZO_OPT_PREFER_PREDEC 1 1735 # if defined(LZO_ABI_BIG_ENDIAN) 1736 # define LZO_OPT_UNALIGNED16 1 1737 # define LZO_OPT_UNALIGNED32 1 1738 # endif 1739 #elif (LZO_ARCH_S390) 1740 # define LZO_OPT_UNALIGNED16 1 1741 # define LZO_OPT_UNALIGNED32 1 1742 # if (LZO_SIZEOF_SIZE_T == 8) 1743 # define LZO_OPT_UNALIGNED64 1 1744 # endif 1745 #elif (LZO_ARCH_SH) 1746 # define LZO_OPT_PREFER_POSTINC 1 1747 # define LZO_OPT_PREFER_PREDEC 1 1748 #endif 1749 #if !defined(LZO_CFG_NO_INLINE_ASM) 1750 #if defined(LZO_CC_LLVM) 1751 # define LZO_CFG_NO_INLINE_ASM 1 1752 #endif 1753 #endif 1754 #if !defined(LZO_CFG_NO_UNALIGNED) 1755 #if defined(LZO_ABI_NEUTRAL_ENDIAN) || defined(LZO_ARCH_GENERIC) 1756 # define LZO_CFG_NO_UNALIGNED 1 1757 #endif 1758 #endif 1759 #if defined(LZO_CFG_NO_UNALIGNED) 1760 # undef LZO_OPT_UNALIGNED16 1761 # undef LZO_OPT_UNALIGNED32 1762 # undef LZO_OPT_UNALIGNED64 1763 #endif 1764 #if defined(LZO_CFG_NO_INLINE_ASM) 1765 #elif (LZO_ARCH_I386 && (LZO_OS_DOS32 || LZO_OS_WIN32) && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) 1766 # define LZO_ASM_SYNTAX_MSC 1 1767 #elif (LZO_OS_WIN64 && (LZO_CC_DMC || LZO_CC_INTELC || LZO_CC_MSC || LZO_CC_PELLESC)) 1768 #elif (LZO_ARCH_I386 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) 1769 # define LZO_ASM_SYNTAX_GNUC 1 1770 #elif (LZO_ARCH_AMD64 && (LZO_CC_GNUC || LZO_CC_INTELC || LZO_CC_PATHSCALE)) 1771 # define LZO_ASM_SYNTAX_GNUC 1 1772 #endif 1773 #if (LZO_ASM_SYNTAX_GNUC) 1774 #if (LZO_ARCH_I386 && LZO_CC_GNUC && (LZO_CC_GNUC < 0x020000ul)) 1775 # define __LZO_ASM_CLOBBER "ax" 1776 #elif (LZO_CC_INTELC) 1777 # define __LZO_ASM_CLOBBER "memory" 1778 #else 1779 # define __LZO_ASM_CLOBBER "cc", "memory" 1780 #endif 1781 #endif 1782 #if defined(__LZO_INFOSTR_MM) 1783 #elif (LZO_MM_FLAT) && (defined(__LZO_INFOSTR_PM) || defined(LZO_INFO_ABI_PM)) 1784 # define __LZO_INFOSTR_MM "" 1785 #elif defined(LZO_INFO_MM) 1786 # define __LZO_INFOSTR_MM "." LZO_INFO_MM 1787 #else 1788 # define __LZO_INFOSTR_MM "" 1789 #endif 1790 #if defined(__LZO_INFOSTR_PM) 1791 #elif defined(LZO_INFO_ABI_PM) 1792 # define __LZO_INFOSTR_PM "." LZO_INFO_ABI_PM 1793 #else 1794 # define __LZO_INFOSTR_PM "" 1795 #endif 1796 #if defined(__LZO_INFOSTR_ENDIAN) 1797 #elif defined(LZO_INFO_ABI_ENDIAN) 1798 # define __LZO_INFOSTR_ENDIAN "." LZO_INFO_ABI_ENDIAN 1799 #else 1800 # define __LZO_INFOSTR_ENDIAN "" 1801 #endif 1802 #if defined(__LZO_INFOSTR_OSNAME) 1803 #elif defined(LZO_INFO_OS_CONSOLE) 1804 # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_CONSOLE 1805 #elif defined(LZO_INFO_OS_POSIX) 1806 # define __LZO_INFOSTR_OSNAME LZO_INFO_OS "." LZO_INFO_OS_POSIX 1807 #else 1808 # define __LZO_INFOSTR_OSNAME LZO_INFO_OS 1809 #endif 1810 #if defined(__LZO_INFOSTR_LIBC) 1811 #elif defined(LZO_INFO_LIBC) 1812 # define __LZO_INFOSTR_LIBC "." LZO_INFO_LIBC 1813 #else 1814 # define __LZO_INFOSTR_LIBC "" 1815 #endif 1816 #if defined(__LZO_INFOSTR_CCVER) 1817 #elif defined(LZO_INFO_CCVER) 1818 # define __LZO_INFOSTR_CCVER " " LZO_INFO_CCVER 1819 #else 1820 # define __LZO_INFOSTR_CCVER "" 1821 #endif 1822 #define LZO_INFO_STRING \ 1823 LZO_INFO_ARCH __LZO_INFOSTR_MM __LZO_INFOSTR_PM __LZO_INFOSTR_ENDIAN \ 1824 " " __LZO_INFOSTR_OSNAME __LZO_INFOSTR_LIBC " " LZO_INFO_CC __LZO_INFOSTR_CCVER 1825 1826 #endif 1827 1828 #endif 42 1829 43 1830 #undef LZO_HAVE_CONFIG_H 44 1831 #include "minilzo.h" 45 1832 46 #if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x 1070)1833 #if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2030) 47 1834 # error "version mismatch in miniLZO source files" 48 1835 #endif 49 1836 … … 51 1838 # define LZO_HAVE_CONFIG_H 52 1839 #endif 53 1840 54 #if !defined(LZO_NO_SYS_TYPES_H)55 # include <sys/types.h>56 #endif57 #include <stdio.h>58 59 1841 #ifndef __LZO_CONF_H 60 1842 #define __LZO_CONF_H 61 1843 62 1844 #if !defined(__LZO_IN_MINILZO) 63 # ifndef __LZOCONF_H 64 # include <lzoconf.h> 65 # endif 1845 #if defined(LZO_CFG_FREESTANDING) 1846 # define LZO_LIBC_FREESTANDING 1 1847 # define LZO_OS_FREESTANDING 1 1848 # define ACC_LIBC_FREESTANDING 1 1849 # define ACC_OS_FREESTANDING 1 1850 #endif 1851 #if defined(LZO_CFG_NO_UNALIGNED) 1852 # define ACC_CFG_NO_UNALIGNED 1 1853 #endif 1854 #if defined(LZO_ARCH_GENERIC) 1855 # define ACC_ARCH_GENERIC 1 1856 #endif 1857 #if defined(LZO_ABI_NEUTRAL_ENDIAN) 1858 # define ACC_ABI_NEUTRAL_ENDIAN 1 1859 #endif 1860 #if defined(LZO_HAVE_CONFIG_H) 1861 # define ACC_CONFIG_NO_HEADER 1 1862 #endif 1863 #if defined(LZO_CFG_EXTRA_CONFIG_HEADER) 1864 # include LZO_CFG_EXTRA_CONFIG_HEADER 1865 #endif 1866 #if defined(__LZOCONF_H) || defined(__LZOCONF_H_INCLUDED) 1867 # error "include this file first" 1868 #endif 1869 #include "lzo/lzoconf.h" 66 1870 #endif 67 1871 68 #if defined(__BOUNDS_CHECKING_ON) 69 # include <unchecked.h> 70 #else 71 # define BOUNDS_CHECKING_OFF_DURING(stmt) stmt 72 # define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) 1872 #if (LZO_VERSION < 0x02000) || !defined(__LZOCONF_H_INCLUDED) 1873 # error "version mismatch" 73 1874 #endif 74 1875 75 #if !defined(LZO_HAVE_CONFIG_H) 76 # include <stddef.h> 77 # include <string.h> 78 # if !defined(NO_STDLIB_H) 79 # include <stdlib.h> 80 # endif 81 # define HAVE_MEMCMP 82 # define HAVE_MEMCPY 83 # define HAVE_MEMMOVE 84 # define HAVE_MEMSET 85 #else 86 # include <sys/types.h> 87 # if defined(STDC_HEADERS) 88 # include <string.h> 89 # include <stdlib.h> 90 # endif 91 # if defined(HAVE_STDDEF_H) 92 # include <stddef.h> 93 # endif 94 # if defined(HAVE_MEMORY_H) 95 # include <memory.h> 96 # endif 1876 #if (LZO_CC_BORLANDC && LZO_ARCH_I086) 1877 # pragma option -h 97 1878 #endif 98 1879 99 #if defined(__LZO_DOS16) || defined(__LZO_WIN16) 100 # define HAVE_MALLOC_H 101 # define HAVE_HALLOC 1880 #if (LZO_CC_MSC && (_MSC_VER >= 1000)) 1881 # pragma warning(disable: 4127 4701) 1882 #endif 1883 #if (LZO_CC_MSC && (_MSC_VER >= 1300)) 1884 # pragma warning(disable: 4820) 1885 # pragma warning(disable: 4514 4710 4711) 102 1886 #endif 103 1887 104 # undef NDEBUG105 # if !defined(LZO_DEBUG)106 # define NDEBUG1888 #if (LZO_CC_SUNPROC) 1889 # pragma error_messages(off,E_END_OF_LOOP_CODE_NOT_REACHED) 1890 # pragma error_messages(off,E_LOOP_NOT_ENTERED_AT_TOP) 107 1891 #endif 108 #if defined(LZO_DEBUG) || !defined(NDEBUG) 109 # if !defined(NO_STDIO_H) 110 # include <stdio.h> 111 # endif 1892 1893 #if defined(__LZO_MMODEL_HUGE) && (!LZO_HAVE_MM_HUGE_PTR) 1894 # error "this should not happen - check defines for __huge" 112 1895 #endif 113 #include <assert.h>114 1896 115 #if !defined(LZO_UNUSED) 116 # define LZO_UNUSED(parm) (parm = parm) 1897 #if defined(__LZO_IN_MINILZO) || defined(LZO_CFG_FREESTANDING) 1898 #elif (LZO_OS_DOS16 || LZO_OS_OS216 || LZO_OS_WIN16) 1899 # define ACC_WANT_ACC_INCD_H 1 1900 # define ACC_WANT_ACC_INCE_H 1 1901 # define ACC_WANT_ACC_INCI_H 1 1902 #elif 1 1903 # include <string.h> 1904 #else 1905 # define ACC_WANT_ACC_INCD_H 1 117 1906 #endif 118 1907 119 #if !defined(__inline__) && !defined(__GNUC__) 120 # if defined(__cplusplus) 121 # define __inline__ inline 1908 #if (LZO_ARCH_I086) 1909 # define ACC_MM_AHSHIFT LZO_MM_AHSHIFT 1910 # define ACC_PTR_FP_OFF(x) (((const unsigned __far*)&(x))[0]) 1911 # define ACC_PTR_FP_SEG(x) (((const unsigned __far*)&(x))[1]) 1912 # define ACC_PTR_MK_FP(s,o) ((void __far*)(((unsigned long)(s)<<16)+(unsigned)(o))) 1913 #endif 1914 1915 #if !defined(lzo_uintptr_t) 1916 # if defined(__LZO_MMODEL_HUGE) 1917 # define lzo_uintptr_t unsigned long 1918 # elif 1 && defined(LZO_OS_OS400) && (LZO_SIZEOF_VOID_P == 16) 1919 # define __LZO_UINTPTR_T_IS_POINTER 1 1920 typedef char* lzo_uintptr_t; 1921 # define lzo_uintptr_t lzo_uintptr_t 1922 # elif (LZO_SIZEOF_SIZE_T == LZO_SIZEOF_VOID_P) 1923 # define lzo_uintptr_t size_t 1924 # elif (LZO_SIZEOF_LONG == LZO_SIZEOF_VOID_P) 1925 # define lzo_uintptr_t unsigned long 1926 # elif (LZO_SIZEOF_INT == LZO_SIZEOF_VOID_P) 1927 # define lzo_uintptr_t unsigned int 1928 # elif (LZO_SIZEOF_LONG_LONG == LZO_SIZEOF_VOID_P) 1929 # define lzo_uintptr_t unsigned long long 122 1930 # else 123 # define __inline__1931 # define lzo_uintptr_t size_t 124 1932 # endif 125 1933 #endif 1934 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) 1935 1936 #if 1 && !defined(LZO_CFG_FREESTANDING) 1937 #if 1 && !defined(HAVE_STRING_H) 1938 #define HAVE_STRING_H 1 1939 #endif 1940 #if 1 && !defined(HAVE_MEMCMP) 1941 #define HAVE_MEMCMP 1 1942 #endif 1943 #if 1 && !defined(HAVE_MEMCPY) 1944 #define HAVE_MEMCPY 1 1945 #endif 1946 #if 1 && !defined(HAVE_MEMMOVE) 1947 #define HAVE_MEMMOVE 1 1948 #endif 1949 #if 1 && !defined(HAVE_MEMSET) 1950 #define HAVE_MEMSET 1 1951 #endif 1952 #endif 1953 1954 #if 1 && defined(HAVE_STRING_H) 1955 #include <string.h> 1956 #endif 126 1957 127 #if defined( NO_MEMCMP)1958 #if defined(LZO_CFG_FREESTANDING) 128 1959 # undef HAVE_MEMCMP 1960 # undef HAVE_MEMCPY 1961 # undef HAVE_MEMMOVE 1962 # undef HAVE_MEMSET 129 1963 #endif 130 1964 131 1965 #if !defined(HAVE_MEMCMP) 132 1966 # undef memcmp 133 # define memcmp lzo_memcmp 1967 # define memcmp(a,b,c) lzo_memcmp(a,b,c) 1968 #elif !defined(__LZO_MMODEL_HUGE) 1969 # define lzo_memcmp(a,b,c) memcmp(a,b,c) 134 1970 #endif 135 1971 #if !defined(HAVE_MEMCPY) 136 1972 # undef memcpy 137 # define memcpy lzo_memcpy 1973 # define memcpy(a,b,c) lzo_memcpy(a,b,c) 1974 #elif !defined(__LZO_MMODEL_HUGE) 1975 # define lzo_memcpy(a,b,c) memcpy(a,b,c) 138 1976 #endif 139 1977 #if !defined(HAVE_MEMMOVE) 140 1978 # undef memmove 141 # define memmove lzo_memmove 1979 # define memmove(a,b,c) lzo_memmove(a,b,c) 1980 #elif !defined(__LZO_MMODEL_HUGE) 1981 # define lzo_memmove(a,b,c) memmove(a,b,c) 142 1982 #endif 143 1983 #if !defined(HAVE_MEMSET) 144 1984 # undef memset 145 # define memset lzo_memset 1985 # define memset(a,b,c) lzo_memset(a,b,c) 1986 #elif !defined(__LZO_MMODEL_HUGE) 1987 # define lzo_memset(a,b,c) memset(a,b,c) 1988 #endif 1989 1990 #undef NDEBUG 1991 #if defined(LZO_CFG_FREESTANDING) 1992 # undef LZO_DEBUG 1993 # define NDEBUG 1 1994 # undef assert 1995 # define assert(e) ((void)0) 1996 #else 1997 # if !defined(LZO_DEBUG) 1998 # define NDEBUG 1 1999 # endif 2000 # include <assert.h> 2001 #endif 2002 2003 #if 0 && defined(__BOUNDS_CHECKING_ON) 2004 # include <unchecked.h> 2005 #else 2006 # define BOUNDS_CHECKING_OFF_DURING(stmt) stmt 2007 # define BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr) 2008 #endif 2009 2010 #if !defined(__lzo_inline) 2011 # define __lzo_inline 2012 #endif 2013 #if !defined(__lzo_forceinline) 2014 # define __lzo_forceinline 2015 #endif 2016 #if !defined(__lzo_noinline) 2017 # define __lzo_noinline 146 2018 #endif 147 2019 148 2020 #if 1 … … 150 2022 #else 151 2023 # define LZO_BYTE(x) ((unsigned char) ((x) & 0xff)) 152 2024 #endif 153 #if 0154 # define LZO_USHORT(x) ((unsigned short) (x))155 #else156 # define LZO_USHORT(x) ((unsigned short) ((x) & 0xffff))157 #endif158 2025 159 2026 #define LZO_MAX(a,b) ((a) >= (b) ? (a) : (b)) 160 2027 #define LZO_MIN(a,b) ((a) <= (b) ? (a) : (b)) … … 174 2041 #define LZO_USIZE(bits) ((lzo_uint) 1 << (bits)) 175 2042 #define LZO_UMASK(bits) (LZO_USIZE(bits) - 1) 176 2043 177 #define LZO_STYPE_MAX(b) (((1l << (8*(b)-2)) - 1l) + (1l << (8*(b)-2))) 178 #define LZO_UTYPE_MAX(b) (((1ul << (8*(b)-1)) - 1ul) + (1ul << (8*(b)-1))) 179 180 #if !defined(SIZEOF_UNSIGNED) 181 # if (UINT_MAX == 0xffff) 182 # define SIZEOF_UNSIGNED 2 183 # elif (UINT_MAX == LZO_0xffffffffL) 184 # define SIZEOF_UNSIGNED 4 185 # elif (UINT_MAX >= LZO_0xffffffffL) 186 # define SIZEOF_UNSIGNED 8 187 # else 188 # error SIZEOF_UNSIGNED 189 # endif 190 #endif 191 192 #if !defined(SIZEOF_UNSIGNED_LONG) 193 # if (ULONG_MAX == LZO_0xffffffffL) 194 # define SIZEOF_UNSIGNED_LONG 4 195 # elif (ULONG_MAX >= LZO_0xffffffffL) 196 # define SIZEOF_UNSIGNED_LONG 8 197 # else 198 # error SIZEOF_UNSIGNED_LONG 199 # endif 200 #endif 2044 #if !defined(DMUL) 2045 #if 0 201 2046 202 #if !defined(SIZEOF_SIZE_T) 203 # define SIZEOF_SIZE_T SIZEOF_UNSIGNED 2047 # define DMUL(a,b) ((lzo_xint) ((lzo_uint32)(a) * (lzo_uint32)(b))) 2048 #else 2049 # define DMUL(a,b) ((lzo_xint) ((a) * (b))) 204 2050 #endif 205 #if !defined(SIZE_T_MAX)206 # define SIZE_T_MAX LZO_UTYPE_MAX(SIZEOF_SIZE_T)207 2051 #endif 208 2052 209 #if 1 && defined(__LZO_i386) && (UINT_MAX == LZO_0xffffffffL) 210 # if !defined(LZO_UNALIGNED_OK_2) && (USHRT_MAX == 0xffff) 2053 #if 1 && !defined(LZO_CFG_NO_UNALIGNED) 2054 #if 1 && (LZO_ARCH_AMD64 || LZO_ARCH_I386) 2055 # if (LZO_SIZEOF_SHORT == 2) 211 2056 # define LZO_UNALIGNED_OK_2 212 2057 # endif 213 # if !defined(LZO_UNALIGNED_OK_4) && (LZO_UINT32_MAX == LZO_0xffffffffL)2058 # if (LZO_SIZEOF_INT == 4) 214 2059 # define LZO_UNALIGNED_OK_4 215 2060 # endif 216 2061 #endif 217 218 #if defined(LZO_UNALIGNED_OK_2) || defined(LZO_UNALIGNED_OK_4)219 # if !defined(LZO_UNALIGNED_OK)220 # define LZO_UNALIGNED_OK221 # endif222 #endif223 224 #if defined(__LZO_NO_UNALIGNED)225 # undef LZO_UNALIGNED_OK226 # undef LZO_UNALIGNED_OK_2227 # undef LZO_UNALIGNED_OK_4228 #endif229 230 #if defined(LZO_UNALIGNED_OK_2) && (USHRT_MAX != 0xffff)231 # error "LZO_UNALIGNED_OK_2 must not be defined on this system"232 #endif233 #if defined(LZO_UNALIGNED_OK_4) && (LZO_UINT32_MAX != LZO_0xffffffffL)234 # error "LZO_UNALIGNED_OK_4 must not be defined on this system"235 #endif236 237 #if defined(__LZO_NO_ALIGNED)238 # undef LZO_ALIGNED_OK_4239 2062 #endif 240 2063 241 #if defined(LZO_ALIGNED_OK_4) && (LZO_UINT32_MAX != LZO_0xffffffffL) 242 # error "LZO_ALIGNED_OK_4 must not be defined on this system" 243 #endif 244 245 #define LZO_LITTLE_ENDIAN 1234 246 #define LZO_BIG_ENDIAN 4321 247 #define LZO_PDP_ENDIAN 3412 248 249 #if !defined(LZO_BYTE_ORDER) 250 # if defined(MFX_BYTE_ORDER) 251 # define LZO_BYTE_ORDER MFX_BYTE_ORDER 252 # elif defined(__LZO_i386) 253 # define LZO_BYTE_ORDER LZO_LITTLE_ENDIAN 254 # elif defined(BYTE_ORDER) 255 # define LZO_BYTE_ORDER BYTE_ORDER 256 # elif defined(__BYTE_ORDER) 257 # define LZO_BYTE_ORDER __BYTE_ORDER 258 # endif 2064 #if defined(LZO_UNALIGNED_OK_2) 2065 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(short) == 2) 259 2066 #endif 260 261 #if defined(LZO_BYTE_ORDER) 262 # if (LZO_BYTE_ORDER != LZO_LITTLE_ENDIAN) && \ 263 (LZO_BYTE_ORDER != LZO_BIG_ENDIAN) 264 # error "invalid LZO_BYTE_ORDER" 265 # endif 2067 #if defined(LZO_UNALIGNED_OK_4) 2068 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) 2069 #elif defined(LZO_ALIGNED_OK_4) 2070 LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(lzo_uint32) == 4) 266 2071 #endif 267 2072 268 #if defined(LZO_UNALIGNED_OK) && !defined(LZO_BYTE_ORDER) 269 # error "LZO_BYTE_ORDER is not defined" 270 #endif 2073 #define MEMCPY8_DS(dest,src,len) \ 2074 lzo_memcpy(dest,src,len); dest += len; src += len 271 2075 272 #define LZO_OPTIMIZE_GNUC_i386_IS_BUGGY 2076 #define BZERO8_PTR(s,l,n) \ 2077 lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) 273 2078 274 #if defined(NDEBUG) && !defined(LZO_DEBUG) && !defined(__LZO_CHECKER) 275 # if defined(__GNUC__) && defined(__i386__) 276 # if !defined(LZO_OPTIMIZE_GNUC_i386_IS_BUGGY) 277 # define LZO_OPTIMIZE_GNUC_i386 278 # endif 279 # endif 280 #endif 2079 #define MEMCPY_DS(dest,src,len) \ 2080 do *dest++ = *src++; while (--len > 0) 281 2081 282 2082 __LZO_EXTERN_C int __lzo_init_done; 283 __LZO_EXTERN_C const lzo_byte __lzo_copyright[]; 284 LZO_EXTERN(const lzo_byte *) lzo_copyright(void); 285 __LZO_EXTERN_C const lzo_uint32 _lzo_crc32_table[256]; 286 287 #define _LZO_STRINGIZE(x) #x 288 #define _LZO_MEXPAND(x) _LZO_STRINGIZE(x) 289 290 #define _LZO_CONCAT2(a,b) a ## b 291 #define _LZO_CONCAT3(a,b,c) a ## b ## c 292 #define _LZO_CONCAT4(a,b,c,d) a ## b ## c ## d 293 #define _LZO_CONCAT5(a,b,c,d,e) a ## b ## c ## d ## e 294 295 #define _LZO_ECONCAT2(a,b) _LZO_CONCAT2(a,b) 296 #define _LZO_ECONCAT3(a,b,c) _LZO_CONCAT3(a,b,c) 297 #define _LZO_ECONCAT4(a,b,c,d) _LZO_CONCAT4(a,b,c,d) 298 #define _LZO_ECONCAT5(a,b,c,d,e) _LZO_CONCAT5(a,b,c,d,e) 299 300 #if 0 301 302 #define __LZO_IS_COMPRESS_QUERY(i,il,o,ol,w) ((lzo_voidp)(o) == (w)) 303 #define __LZO_QUERY_COMPRESS(i,il,o,ol,w,n,s) \ 304 (*ol = (n)*(s), LZO_E_OK) 305 306 #define __LZO_IS_DECOMPRESS_QUERY(i,il,o,ol,w) ((lzo_voidp)(o) == (w)) 307 #define __LZO_QUERY_DECOMPRESS(i,il,o,ol,w,n,s) \ 308 (*ol = (n)*(s), LZO_E_OK) 309 310 #define __LZO_IS_OPTIMIZE_QUERY(i,il,o,ol,w) ((lzo_voidp)(o) == (w)) 311 #define __LZO_QUERY_OPTIMIZE(i,il,o,ol,w,n,s) \ 312 (*ol = (n)*(s), LZO_E_OK) 313 314 #endif 2083 __LZO_EXTERN_C const char __lzo_copyright[]; 2084 LZO_EXTERN(const lzo_bytep) lzo_copyright(void); 315 2085 316 2086 #ifndef __LZO_PTR_H 317 2087 #define __LZO_PTR_H … … 320 2090 extern "C" { 321 2091 #endif 322 2092 323 #if defined(__LZO_DOS16) || defined(__LZO_WIN16) 324 # include <dos.h> 325 # if 1 && defined(__WATCOMC__) 326 # include <i86.h> 327 __LZO_EXTERN_C unsigned char _HShift; 328 # define __LZO_HShift _HShift 329 # elif 1 && defined(_MSC_VER) 330 __LZO_EXTERN_C unsigned short __near _AHSHIFT; 331 # define __LZO_HShift ((unsigned) &_AHSHIFT) 332 # elif defined(__LZO_WIN16) 333 # define __LZO_HShift 3 2093 #if !defined(lzo_uintptr_t) 2094 # if defined(__LZO_MMODEL_HUGE) 2095 # define lzo_uintptr_t unsigned long 334 2096 # else 335 # define __LZO_HShift 12 336 # endif 337 # if !defined(_FP_SEG) && defined(FP_SEG) 338 # define _FP_SEG FP_SEG 339 # endif 340 # if !defined(_FP_OFF) && defined(FP_OFF) 341 # define _FP_OFF FP_OFF 342 # endif 343 #endif 344 345 #if (UINT_MAX >= LZO_0xffffffffL) 346 typedef ptrdiff_t lzo_ptrdiff_t; 347 #else 348 typedef long lzo_ptrdiff_t; 349 #endif 350 351 #if !defined(__LZO_HAVE_PTR_T) 352 # if defined(lzo_ptr_t) 353 # define __LZO_HAVE_PTR_T 354 # endif 355 #endif 356 #if !defined(__LZO_HAVE_PTR_T) 357 # if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED_LONG) 358 # if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED_LONG) 359 typedef unsigned long lzo_ptr_t; 360 typedef long lzo_sptr_t; 361 # define __LZO_HAVE_PTR_T 2097 # define lzo_uintptr_t acc_uintptr_t 2098 # ifdef __ACC_INTPTR_T_IS_POINTER 2099 # define __LZO_UINTPTR_T_IS_POINTER 1 362 2100 # endif 363 2101 # endif 364 2102 #endif 365 #if !defined(__LZO_HAVE_PTR_T)366 # if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED)367 # if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED)368 typedef unsigned int lzo_ptr_t;369 typedef int lzo_sptr_t;370 # define __LZO_HAVE_PTR_T371 # endif372 # endif373 #endif374 #if !defined(__LZO_HAVE_PTR_T)375 # if defined(SIZEOF_CHAR_P) && defined(SIZEOF_UNSIGNED_SHORT)376 # if (SIZEOF_CHAR_P == SIZEOF_UNSIGNED_SHORT)377 typedef unsigned short lzo_ptr_t;378 typedef short lzo_sptr_t;379 # define __LZO_HAVE_PTR_T380 # endif381 # endif382 #endif383 #if !defined(__LZO_HAVE_PTR_T)384 # if defined(LZO_HAVE_CONFIG_H) || defined(SIZEOF_CHAR_P)385 # error "no suitable type for lzo_ptr_t"386 # else387 typedef unsigned long lzo_ptr_t;388 typedef long lzo_sptr_t;389 # define __LZO_HAVE_PTR_T390 # endif391 #endif392 2103 393 #if defined(__LZO_DOS16) || defined(__LZO_WIN16)2104 #if (LZO_ARCH_I086) 394 2105 #define PTR(a) ((lzo_bytep) (a)) 395 #define PTR_ALIGNED_4(a) ((_FP_OFF(a) & 3) == 0) 396 #define PTR_ALIGNED2_4(a,b) (((_FP_OFF(a) | _FP_OFF(b)) & 3) == 0) 2106 #define PTR_ALIGNED_4(a) ((ACC_PTR_FP_OFF(a) & 3) == 0) 2107 #define PTR_ALIGNED2_4(a,b) (((ACC_PTR_FP_OFF(a) | ACC_PTR_FP_OFF(b)) & 3) == 0) 2108 #elif (LZO_MM_PVP) 2109 #define PTR(a) ((lzo_bytep) (a)) 2110 #define PTR_ALIGNED_8(a) ((((lzo_uintptr_t)(a)) >> 61) == 0) 2111 #define PTR_ALIGNED2_8(a,b) ((((lzo_uintptr_t)(a)|(lzo_uintptr_t)(b)) >> 61) == 0) 397 2112 #else 398 #define PTR(a) ((lzo_ ptr_t) (a))2113 #define PTR(a) ((lzo_uintptr_t) (a)) 399 2114 #define PTR_LINEAR(a) PTR(a) 400 2115 #define PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0) 401 2116 #define PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0) … … 405 2120 406 2121 #define PTR_LT(a,b) (PTR(a) < PTR(b)) 407 2122 #define PTR_GE(a,b) (PTR(a) >= PTR(b)) 408 #define PTR_DIFF(a,b) ((lzo_ptrdiff_t) (PTR(a) - PTR(b))) 2123 #define PTR_DIFF(a,b) (PTR(a) - PTR(b)) 2124 #define pd(a,b) ((lzo_uint) ((a)-(b))) 409 2125 410 LZO_EXTERN(lzo_ ptr_t)2126 LZO_EXTERN(lzo_uintptr_t) 411 2127 __lzo_ptr_linear(const lzo_voidp ptr); 412 2128 413 2129 typedef union … … 425 2141 lzo_int32 a_lzo_int32; 426 2142 lzo_uint32 a_lzo_uint32; 427 2143 ptrdiff_t a_ptrdiff_t; 428 lzo_ ptrdiff_t a_lzo_ptrdiff_t;429 lzo_ ptr_t a_lzo_ptr_t;430 char * a_charp;2144 lzo_uintptr_t a_lzo_uintptr_t; 2145 lzo_voidp a_lzo_voidp; 2146 void * a_void_p; 431 2147 lzo_bytep a_lzo_bytep; 432 2148 lzo_bytepp a_lzo_bytepp; 433 } 434 lzo_align_t; 435 436 #ifdef __cplusplus 437 } 438 #endif 439 440 #endif 441 442 #define LZO_DETERMINISTIC 443 444 #define LZO_DICT_USE_PTR 445 #if defined(__LZO_DOS16) || defined(__LZO_WIN16) || defined(__LZO_STRICT_16BIT) 446 # undef LZO_DICT_USE_PTR 447 #endif 448 449 #if defined(LZO_DICT_USE_PTR) 450 # define lzo_dict_t const lzo_bytep 451 # define lzo_dict_p lzo_dict_t __LZO_MMODEL * 452 #else 453 # define lzo_dict_t lzo_uint 454 # define lzo_dict_p lzo_dict_t __LZO_MMODEL * 455 #endif 456 457 #if !defined(lzo_moff_t) 458 #define lzo_moff_t lzo_uint 459 #endif 460 461 #endif 462 463 LZO_PUBLIC(lzo_ptr_t) 464 __lzo_ptr_linear(const lzo_voidp ptr) 465 { 466 lzo_ptr_t p; 467 468 #if defined(__LZO_DOS16) || defined(__LZO_WIN16) 469 p = (((lzo_ptr_t)(_FP_SEG(ptr))) << (16 - __LZO_HShift)) + (_FP_OFF(ptr)); 470 #else 471 p = PTR_LINEAR(ptr); 472 #endif 473 474 return p; 475 } 476 477 LZO_PUBLIC(unsigned) 478 __lzo_align_gap(const lzo_voidp ptr, lzo_uint size) 479 { 480 lzo_ptr_t p, s, n; 481 482 assert(size > 0); 483 484 p = __lzo_ptr_linear(ptr); 485 s = (lzo_ptr_t) (size - 1); 486 #if 0 487 assert((size & (size - 1)) == 0); 488 n = ((p + s) & ~s) - p; 489 #else 490 n = (((p + s) / size) * size) - p; 491 #endif 492 493 assert((long)n >= 0); 494 assert(n <= s); 495 496 return (unsigned)n; 497 } 498 499 #ifndef __LZO_UTIL_H 500 #define __LZO_UTIL_H 501 502 #ifndef __LZO_CONF_H 503 #endif 504 505 #ifdef __cplusplus 506 extern "C" { 507 #endif 508 509 #if 1 && defined(HAVE_MEMCPY) 510 #if !defined(__LZO_DOS16) && !defined(__LZO_WIN16) 511 512 #define MEMCPY8_DS(dest,src,len) \ 513 memcpy(dest,src,len); \ 514 dest += len; \ 515 src += len 516 517 #endif 518 #endif 519 520 #if 0 && !defined(MEMCPY8_DS) 521 522 #define MEMCPY8_DS(dest,src,len) \ 523 { do { \ 524 *dest++ = *src++; \ 525 *dest++ = *src++; \ 526 *dest++ = *src++; \ 527 *dest++ = *src++; \ 528 *dest++ = *src++; \ 529 *dest++ = *src++; \ 530 *dest++ = *src++; \ 531 *dest++ = *src++; \ 532 len -= 8; \ 533 } while (len > 0); } 2149 lzo_uintp a_lzo_uintp; 2150 lzo_uint * a_lzo_uint_p; 2151 lzo_uint32p a_lzo_uint32p; 2152 lzo_uint32 * a_lzo_uint32_p; 2153 unsigned char * a_uchar_p; 2154 char * a_char_p; 2155 } 2156 lzo_full_align_t; 534 2157 2158 #ifdef __cplusplus 2159 } 535 2160 #endif 536 2161 537 #if !defined(MEMCPY8_DS)538 539 #define MEMCPY8_DS(dest,src,len) \540 { register lzo_uint __l = (len) / 8; \541 do { \542 *dest++ = *src++; \543 *dest++ = *src++; \544 *dest++ = *src++; \545 *dest++ = *src++; \546 *dest++ = *src++; \547 *dest++ = *src++; \548 *dest++ = *src++; \549 *dest++ = *src++; \550 } while (--__l > 0); }551 552 2162 #endif 553 2163 554 #define MEMCPY_DS(dest,src,len) \ 555 do *dest++ = *src++; \ 556 while (--len > 0) 557 558 #define MEMMOVE_DS(dest,src,len) \ 559 do *dest++ = *src++; \ 560 while (--len > 0) 561 562 #if 0 && defined(LZO_OPTIMIZE_GNUC_i386) 563 564 #define BZERO8_PTR(s,l,n) \ 565 __asm__ __volatile__( \ 566 "movl %0,%%eax \n" \ 567 "movl %1,%%edi \n" \ 568 "movl %2,%%ecx \n" \ 569 "cld \n" \ 570 "rep \n" \ 571 "stosl %%eax,(%%edi) \n" \ 572 : \ 573 :"g" (0),"g" (s),"g" (n) \ 574 :"eax","edi","ecx", "memory", "cc" \ 575 ) 576 577 #elif (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMSET) 2164 #define LZO_DETERMINISTIC 578 2165 579 #if 1 580 #define BZERO8_PTR(s,l,n) memset((s),0,(lzo_uint)(l)*(n)) 581 #else 582 #define BZERO8_PTR(s,l,n) memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) 2166 #define LZO_DICT_USE_PTR 2167 #if 0 && (LZO_ARCH_I086) 2168 # undef LZO_DICT_USE_PTR 583 2169 #endif 584 2170 2171 #if defined(LZO_DICT_USE_PTR) 2172 # define lzo_dict_t const lzo_bytep 2173 # define lzo_dict_p lzo_dict_t __LZO_MMODEL * 585 2174 #else 586 587 # define BZERO8_PTR(s,l,n) \588 lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n)) 2175 # define lzo_dict_t lzo_uint 2176 # define lzo_dict_p lzo_dict_t __LZO_MMODEL * 2177 #endif 589 2178 590 2179 #endif 591 2180 592 #if 0 593 #if defined(__GNUC__) && defined(__i386__) 2181 #if !defined(MINILZO_CFG_SKIP_LZO_PTR) 594 2182 595 unsigned char lzo_rotr8(unsigned char value, int shift); 596 extern __inline__ unsigned char lzo_rotr8(unsigned char value, int shift)2183 LZO_PUBLIC(lzo_uintptr_t) 2184 __lzo_ptr_linear(const lzo_voidp ptr) 597 2185 { 598 unsigned char result;2186 lzo_uintptr_t p; 599 2187 600 __asm__ __volatile__ ("movb %b1, %b0; rorb %b2, %b0" 601 : "=a"(result) : "g"(value), "c"(shift)); 602 return result; 603 } 604 605 unsigned short lzo_rotr16(unsigned short value, int shift); 606 extern __inline__ unsigned short lzo_rotr16(unsigned short value, int shift) 607 { 608 unsigned short result; 2188 #if (LZO_ARCH_I086) 2189 p = (((lzo_uintptr_t)(ACC_PTR_FP_SEG(ptr))) << (16 - ACC_MM_AHSHIFT)) + (ACC_PTR_FP_OFF(ptr)); 2190 #elif (LZO_MM_PVP) 2191 p = (lzo_uintptr_t) (ptr); 2192 p = (p << 3) | (p >> 61); 2193 #else 2194 p = (lzo_uintptr_t) PTR_LINEAR(ptr); 2195 #endif 609 2196 610 __asm__ __volatile__ ("movw %b1, %b0; rorw %b2, %b0" 611 : "=a"(result) : "g"(value), "c"(shift)); 612 return result; 2197 return p; 613 2198 } 614 2199 615 #endif 2200 LZO_PUBLIC(unsigned) 2201 __lzo_align_gap(const lzo_voidp ptr, lzo_uint size) 2202 { 2203 #if defined(__LZO_UINTPTR_T_IS_POINTER) 2204 size_t n = (size_t) ptr; 2205 n = (((n + size - 1) / size) * size) - n; 2206 #else 2207 lzo_uintptr_t p, n; 2208 p = __lzo_ptr_linear(ptr); 2209 n = (((p + size - 1) / size) * size) - p; 616 2210 #endif 617 2211 618 #ifdef __cplusplus 2212 assert(size > 0); 2213 assert((long)n >= 0); 2214 assert(n <= size); 2215 return (unsigned)n; 619 2216 } 620 #endif621 2217 622 2218 #endif 623 2219 624 LZO_PUBLIC(lzo_bool) 625 lzo_assert(int expr) 626 { 627 return (expr) ? 1 : 0; 628 } 629 630 /* If you use the LZO library in a product, you *must* keep this 631 * copyright string in the executable of your product. 2220 /* If you use the LZO library in a product, I would appreciate that you 2221 * keep this copyright string in the executable of your product. 632 2222 */ 633 2223 634 const lzo_byte__lzo_copyright[] =2224 const char __lzo_copyright[] = 635 2225 #if !defined(__LZO_IN_MINLZO) 636 2226 LZO_VERSION_STRING; 637 2227 #else 638 "\n\n\n" 639 "LZO real-time data compression library.\n" 640 "Copyright (C) 1996, 1997, 1998, 1999, 2000 Markus Franz Xaver Johannes Oberhumer\n" 641 "<markus.oberhumer@jk.uni-linz.ac.at>\n" 642 "http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html\n" 643 "\n" 644 "LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE "\n" 645 "LZO build date: " __DATE__ " " __TIME__ "\n\n" 646 "LZO special compilation options:\n" 647 #ifdef __cplusplus 648 " __cplusplus\n" 649 #endif 650 #if defined(__PIC__) 651 " __PIC__\n" 652 #elif defined(__pic__) 653 " __pic__\n" 654 #endif 655 #if (UINT_MAX < LZO_0xffffffffL) 656 " 16BIT\n" 657 #endif 658 #if defined(__LZO_STRICT_16BIT) 659 " __LZO_STRICT_16BIT\n" 660 #endif 661 #if (UINT_MAX > LZO_0xffffffffL) 662 " UINT_MAX=" _LZO_MEXPAND(UINT_MAX) "\n" 663 #endif 664 #if (ULONG_MAX > LZO_0xffffffffL) 665 " ULONG_MAX=" _LZO_MEXPAND(ULONG_MAX) "\n" 666 #endif 667 #if defined(LZO_BYTE_ORDER) 668 " LZO_BYTE_ORDER=" _LZO_MEXPAND(LZO_BYTE_ORDER) "\n" 669 #endif 670 #if defined(LZO_UNALIGNED_OK_2) 671 " LZO_UNALIGNED_OK_2\n" 672 #endif 673 #if defined(LZO_UNALIGNED_OK_4) 674 " LZO_UNALIGNED_OK_4\n" 675 #endif 676 #if defined(LZO_ALIGNED_OK_4) 677 " LZO_ALIGNED_OK_4\n" 678 #endif 679 #if defined(LZO_DICT_USE_PTR) 680 " LZO_DICT_USE_PTR\n" 681 #endif 682 #if defined(__LZO_QUERY_COMPRESS) 683 " __LZO_QUERY_COMPRESS\n" 684 #endif 685 #if defined(__LZO_QUERY_DECOMPRESS) 686 " __LZO_QUERY_DECOMPRESS\n" 687 #endif 688 #if defined(__LZO_IN_MINILZO) 689 " __LZO_IN_MINILZO\n" 690 #endif 691 "\n\n" 692 "$Id: LZO " LZO_VERSION_STRING " built " __DATE__ " " __TIME__ 693 #if defined(__GNUC__) && defined(__VERSION__) 694 " by gcc " __VERSION__ 695 #elif defined(__BORLANDC__) 696 " by Borland C " _LZO_MEXPAND(__BORLANDC__) 697 #elif defined(_MSC_VER) 698 " by Microsoft C " _LZO_MEXPAND(_MSC_VER) 699 #elif defined(__PUREC__) 700 " by Pure C " _LZO_MEXPAND(__PUREC__) 701 #elif defined(__SC__) 702 " by Symantec C " _LZO_MEXPAND(__SC__) 703 #elif defined(__TURBOC__) 704 " by Turbo C " _LZO_MEXPAND(__TURBOC__) 705 #elif defined(__WATCOMC__) 706 " by Watcom C " _LZO_MEXPAND(__WATCOMC__) 707 #endif 708 " $\n" 709 "$Copyright: LZO (C) 1996, 1997, 1998, 1999, 2000 Markus Franz Xaver Johannes Oberhumer $\n"; 2228 "\r\n\n" 2229 "LZO data compression library.\n" 2230 "$Copyright: LZO (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Markus Franz Xaver Johannes Oberhumer\n" 2231 "<markus@oberhumer.com>\n" 2232 "http://www.oberhumer.com $\n\n" 2233 "$Id: LZO version: v" LZO_VERSION_STRING ", " LZO_VERSION_DATE " $\n" 2234 "$Built: " __DATE__ " " __TIME__ " $\n" 2235 "$Info: " LZO_INFO_STRING " $\n"; 710 2236 #endif 711 2237 712 LZO_PUBLIC(const lzo_byte *)2238 LZO_PUBLIC(const lzo_bytep) 713 2239 lzo_copyright(void) 714 2240 { 715 return __lzo_copyright; 2241 #if (LZO_OS_DOS16 && LZO_CC_TURBOC) 2242 return (lzo_voidp) __lzo_copyright; 2243 #else 2244 return (const lzo_bytep) __lzo_copyright; 2245 #endif 716 2246 } 717 2247 718 2248 LZO_PUBLIC(unsigned) … … 748 2278 #define LZO_BASE 65521u 749 2279 #define LZO_NMAX 5552 750 2280 751 #define LZO_DO1(buf,i) {s1 += buf[i]; s2 += s1;}2281 #define LZO_DO1(buf,i) s1 += buf[i]; s2 += s1 752 2282 #define LZO_DO2(buf,i) LZO_DO1(buf,i); LZO_DO1(buf,i+1); 753 2283 #define LZO_DO4(buf,i) LZO_DO2(buf,i); LZO_DO2(buf,i+2); 754 2284 #define LZO_DO8(buf,i) LZO_DO4(buf,i); LZO_DO4(buf,i+4); 755 2285 #define LZO_DO16(buf,i) LZO_DO8(buf,i); LZO_DO8(buf,i+8); 756 2286 757 2287 LZO_PUBLIC(lzo_uint32) 758 lzo_adler32(lzo_uint32 adler, const lzo_byte *buf, lzo_uint len)2288 lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len) 759 2289 { 760 2290 lzo_uint32 s1 = adler & 0xffff; 761 2291 lzo_uint32 s2 = (adler >> 16) & 0xffff; 762 intk;2292 unsigned k; 763 2293 764 2294 if (buf == NULL) 765 2295 return 1; 766 2296 767 2297 while (len > 0) 768 2298 { 769 k = len < LZO_NMAX ? (int) len : LZO_NMAX;770 771 772 773 774 775 776 777 778 779 780 781 782 783 2299 k = len < LZO_NMAX ? (unsigned) len : LZO_NMAX; 2300 len -= k; 2301 if (k >= 16) do 2302 { 2303 LZO_DO16(buf,0); 2304 buf += 16; 2305 k -= 16; 2306 } while (k >= 16); 2307 if (k != 0) do 2308 { 2309 s1 += *buf++; 2310 s2 += s1; 2311 } while (--k > 0); 2312 s1 %= LZO_BASE; 2313 s2 %= LZO_BASE; 784 2314 } 785 2315 return (s2 << 16) | s1; 786 2316 } 787 2317 788 LZO_PUBLIC(int) 789 lzo_memcmp(const lzo_voidp s1, const lzo_voidp s2, lzo_uint len) 2318 #undef LZO_DO1 2319 #undef LZO_DO2 2320 #undef LZO_DO4 2321 #undef LZO_DO8 2322 #undef LZO_DO16 2323 2324 #if !defined(MINILZO_CFG_SKIP_LZO_STRING) 2325 #undef lzo_memcmp 2326 #undef lzo_memcpy 2327 #undef lzo_memmove 2328 #undef lzo_memset 2329 #if !defined(__LZO_MMODEL_HUGE) 2330 # undef LZO_HAVE_MM_HUGE_PTR 2331 #endif 2332 #define lzo_hsize_t lzo_uint 2333 #define lzo_hvoid_p lzo_voidp 2334 #define lzo_hbyte_p lzo_bytep 2335 #define LZOLIB_PUBLIC(r,f) LZO_PUBLIC(r) f 2336 #define lzo_hmemcmp lzo_memcmp 2337 #define lzo_hmemcpy lzo_memcpy 2338 #define lzo_hmemmove lzo_memmove 2339 #define lzo_hmemset lzo_memset 2340 #define __LZOLIB_HMEMCPY_CH_INCLUDED 1 2341 #if !defined(LZOLIB_PUBLIC) 2342 # define LZOLIB_PUBLIC(r,f) r __LZOLIB_FUNCNAME(f) 2343 #endif 2344 LZOLIB_PUBLIC(int, lzo_hmemcmp) (const lzo_hvoid_p s1, const lzo_hvoid_p s2, lzo_hsize_t len) 790 2345 { 791 #if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCMP) 792 return memcmp(s1,s2,len); 793 #else 794 const lzo_byte *p1 = (const lzo_byte *) s1; 795 const lzo_byte *p2 = (const lzo_byte *) s2; 796 int d; 797 798 if (len > 0) do 2346 #if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCMP) 2347 const lzo_hbyte_p p1 = (const lzo_hbyte_p) s1; 2348 const lzo_hbyte_p p2 = (const lzo_hbyte_p) s2; 2349 if __lzo_likely(len > 0) do 799 2350 { 800 d = *p1 - *p2; 801 if (d != 0) 802 return d; 803 p1++; 804 p2++; 805 } 806 while (--len > 0); 2351 int d = *p1 - *p2; 2352 if (d != 0) 2353 return d; 2354 p1++; p2++; 2355 } while __lzo_likely(--len > 0); 807 2356 return 0; 2357 #else 2358 return memcmp(s1, s2, len); 808 2359 #endif 809 2360 } 810 811 LZO_PUBLIC(lzo_voidp) 812 lzo_memcpy(lzo_voidp dest, const lzo_voidp src, lzo_uint len) 2361 LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemcpy) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) 813 2362 { 814 #if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMCPY) 815 return memcpy(dest,src,len); 816 #else 817 lzo_byte *p1 = (lzo_byte *) dest; 818 const lzo_byte *p2 = (const lzo_byte *) src; 819 820 if (len <= 0 || p1 == p2) 821 return dest; 2363 #if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMCPY) 2364 lzo_hbyte_p p1 = (lzo_hbyte_p) dest; 2365 const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; 2366 if (!(len > 0) || p1 == p2) 2367 return dest; 822 2368 do 823 824 while (--len > 0);2369 *p1++ = *p2++; 2370 while __lzo_likely(--len > 0); 825 2371 return dest; 2372 #else 2373 return memcpy(dest, src, len); 826 2374 #endif 827 2375 } 828 829 LZO_PUBLIC(lzo_voidp) 830 lzo_memmove(lzo_voidp dest, const lzo_voidp src, lzo_uint len) 2376 LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemmove) (lzo_hvoid_p dest, const lzo_hvoid_p src, lzo_hsize_t len) 831 2377 { 832 #if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMMOVE) 833 return memmove(dest,src,len); 834 #else 835 lzo_byte *p1 = (lzo_byte *) dest; 836 const lzo_byte *p2 = (const lzo_byte *) src; 837 838 if (len <= 0 || p1 == p2) 839 return dest; 840 2378 #if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMMOVE) 2379 lzo_hbyte_p p1 = (lzo_hbyte_p) dest; 2380 const lzo_hbyte_p p2 = (const lzo_hbyte_p) src; 2381 if (!(len > 0) || p1 == p2) 2382 return dest; 841 2383 if (p1 < p2) 842 2384 { 843 844 845 while(--len > 0);2385 do 2386 *p1++ = *p2++; 2387 while __lzo_likely(--len > 0); 846 2388 } 847 2389 else 848 2390 { 849 850 851 852 853 while(--len > 0);2391 p1 += len; 2392 p2 += len; 2393 do 2394 *--p1 = *--p2; 2395 while __lzo_likely(--len > 0); 854 2396 } 855 2397 return dest; 856 #endif857 }858 859 LZO_PUBLIC(lzo_voidp)860 lzo_memset(lzo_voidp s, int c, lzo_uint len)861 {862 #if (LZO_UINT_MAX <= SIZE_T_MAX) && defined(HAVE_MEMSET)863 return memset(s,c,len);864 2398 #else 865 lzo_byte *p = (lzo_byte *) s; 866 867 if (len > 0) do 868 *p++ = LZO_BYTE(c); 869 while (--len > 0); 870 return s; 2399 return memmove(dest, src, len); 871 2400 #endif 872 2401 } 873 874 #include <stdio.h> 875 876 #if 0 877 # define IS_SIGNED(type) (((type) (1ul << (8 * sizeof(type) - 1))) < 0) 878 # define IS_UNSIGNED(type) (((type) (1ul << (8 * sizeof(type) - 1))) > 0) 879 #else 880 # define IS_SIGNED(type) (((type) (-1)) < ((type) 0)) 881 # define IS_UNSIGNED(type) (((type) (-1)) > ((type) 0)) 882 #endif 883 884 static lzo_bool schedule_insns_bug(void); 885 static lzo_bool strength_reduce_bug(int *); 886 887 #if 0 || defined(LZO_DEBUG) 888 static lzo_bool __lzo_assert_fail(const char *s, unsigned line) 2402 LZOLIB_PUBLIC(lzo_hvoid_p, lzo_hmemset) (lzo_hvoid_p s, int c, lzo_hsize_t len) 889 2403 { 890 #if defined(__palmos__) 891 printf("LZO assertion failed in line %u: '%s'\n",line,s); 2404 #if (LZO_HAVE_MM_HUGE_PTR) || !defined(HAVE_MEMSET) 2405 lzo_hbyte_p p = (lzo_hbyte_p) s; 2406 if __lzo_likely(len > 0) do 2407 *p++ = (unsigned char) c; 2408 while __lzo_likely(--len > 0); 2409 return s; 892 2410 #else 893 fprintf(stderr,"LZO assertion failed in line %u: '%s'\n",line,s);2411 return memset(s, c, len); 894 2412 #endif 895 return 0;896 2413 } 897 # define __lzo_assert(x) ((x) ? 1 : __lzo_assert_fail(#x,__LINE__)) 898 #else 899 # define __lzo_assert(x) ((x) ? 1 : 0) 900 #endif 901 902 static lzo_bool basic_integral_check(void) 903 { 904 lzo_bool r = 1; 905 lzo_bool sanity; 906 907 r &= __lzo_assert(CHAR_BIT == 8); 908 r &= __lzo_assert(sizeof(char) == 1); 909 r &= __lzo_assert(sizeof(short) >= 2); 910 r &= __lzo_assert(sizeof(long) >= 4); 911 r &= __lzo_assert(sizeof(int) >= sizeof(short)); 912 r &= __lzo_assert(sizeof(long) >= sizeof(int)); 913 914 r &= __lzo_assert(sizeof(lzo_uint32) >= 4); 915 r &= __lzo_assert(sizeof(lzo_uint32) >= sizeof(unsigned)); 916 #if defined(__LZO_STRICT_16BIT) 917 r &= __lzo_assert(sizeof(lzo_uint) == 2); 918 #else 919 r &= __lzo_assert(sizeof(lzo_uint) >= 4); 920 r &= __lzo_assert(sizeof(lzo_uint) >= sizeof(unsigned)); 921 #endif 922 923 #if defined(SIZEOF_UNSIGNED) 924 r &= __lzo_assert(SIZEOF_UNSIGNED == sizeof(unsigned)); 925 #endif 926 #if defined(SIZEOF_UNSIGNED_LONG) 927 r &= __lzo_assert(SIZEOF_UNSIGNED_LONG == sizeof(unsigned long)); 928 #endif 929 #if defined(SIZEOF_UNSIGNED_SHORT) 930 r &= __lzo_assert(SIZEOF_UNSIGNED_SHORT == sizeof(unsigned short)); 931 #endif 932 #if !defined(__LZO_IN_MINILZO) 933 #if defined(SIZEOF_SIZE_T) 934 r &= __lzo_assert(SIZEOF_SIZE_T == sizeof(size_t)); 935 #endif 2414 #undef LZOLIB_PUBLIC 936 2415 #endif 937 2416 938 sanity = IS_UNSIGNED(unsigned short) && IS_UNSIGNED(unsigned) &&939 IS_UNSIGNED(unsigned long) &&940 IS_SIGNED(short) && IS_SIGNED(int) && IS_SIGNED(long);941 if (sanity)942 {943 r &= __lzo_assert(IS_UNSIGNED(lzo_uint32));944 r &= __lzo_assert(IS_UNSIGNED(lzo_uint));945 r &= __lzo_assert(IS_SIGNED(lzo_int32));946 r &= __lzo_assert(IS_SIGNED(lzo_int));947 948 r &= __lzo_assert(INT_MAX == LZO_STYPE_MAX(sizeof(int)));949 r &= __lzo_assert(UINT_MAX == LZO_UTYPE_MAX(sizeof(unsigned)));950 r &= __lzo_assert(LONG_MAX == LZO_STYPE_MAX(sizeof(long)));951 r &= __lzo_assert(ULONG_MAX == LZO_UTYPE_MAX(sizeof(unsigned long)));952 r &= __lzo_assert(SHRT_MAX == LZO_STYPE_MAX(sizeof(short)));953 r &= __lzo_assert(USHRT_MAX == LZO_UTYPE_MAX(sizeof(unsigned short)));954 r &= __lzo_assert(LZO_UINT32_MAX == LZO_UTYPE_MAX(sizeof(lzo_uint32)));955 r &= __lzo_assert(LZO_UINT_MAX == LZO_UTYPE_MAX(sizeof(lzo_uint)));956 2417 #if !defined(__LZO_IN_MINILZO) 957 r &= __lzo_assert(SIZE_T_MAX == LZO_UTYPE_MAX(sizeof(size_t)));958 #endif959 }960 961 #if 0962 r &= __lzo_assert(LZO_BYTE(257) == 1);963 r &= __lzo_assert(LZO_USHORT(65537L) == 1);964 #endif965 966 return r;967 }968 2418 969 static lzo_bool basic_ptr_check(void) 970 { 971 lzo_bool r = 1; 972 lzo_bool sanity; 973 974 r &= __lzo_assert(sizeof(char *) >= sizeof(int)); 975 r &= __lzo_assert(sizeof(lzo_byte *) >= sizeof(char *)); 976 977 r &= __lzo_assert(sizeof(lzo_voidp) == sizeof(lzo_byte *)); 978 r &= __lzo_assert(sizeof(lzo_voidp) == sizeof(lzo_voidpp)); 979 r &= __lzo_assert(sizeof(lzo_voidp) == sizeof(lzo_bytepp)); 980 r &= __lzo_assert(sizeof(lzo_voidp) >= sizeof(lzo_uint)); 2419 #define ACC_WANT_ACC_CHK_CH 1 2420 #undef ACCCHK_ASSERT 981 2421 982 r &= __lzo_assert(sizeof(lzo_ptr_t) == sizeof(lzo_voidp));983 r &= __lzo_assert(sizeof(lzo_ptr_t) >= sizeof(lzo_uint));2422 ACCCHK_ASSERT_IS_SIGNED_T(lzo_int) 2423 ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint) 984 2424 985 r &= __lzo_assert(sizeof(lzo_ptrdiff_t) >= 4); 986 r &= __lzo_assert(sizeof(lzo_ptrdiff_t) >= sizeof(ptrdiff_t)); 2425 ACCCHK_ASSERT_IS_SIGNED_T(lzo_int32) 2426 ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32) 2427 ACCCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0) 2428 ACCCHK_ASSERT(sizeof(lzo_uint32) >= 4) 987 2429 988 #if defined(SIZEOF_CHAR_P)989 r &= __lzo_assert(SIZEOF_CHAR_P == sizeof(char *));2430 #if !defined(__LZO_UINTPTR_T_IS_POINTER) 2431 ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t) 990 2432 #endif 991 #if defined(SIZEOF_PTRDIFF_T) 992 r &= __lzo_assert(SIZEOF_PTRDIFF_T == sizeof(ptrdiff_t)); 993 #endif 994 995 sanity = IS_UNSIGNED(unsigned short) && IS_UNSIGNED(unsigned) && 996 IS_UNSIGNED(unsigned long) && 997 IS_SIGNED(short) && IS_SIGNED(int) && IS_SIGNED(long); 998 if (sanity) 999 { 1000 r &= __lzo_assert(IS_UNSIGNED(lzo_ptr_t)); 1001 r &= __lzo_assert(IS_UNSIGNED(lzo_moff_t)); 1002 r &= __lzo_assert(IS_SIGNED(lzo_ptrdiff_t)); 1003 r &= __lzo_assert(IS_SIGNED(lzo_sptr_t)); 1004 } 1005 1006 return r; 1007 } 1008 1009 static lzo_bool ptr_check(void) 1010 { 1011 lzo_bool r = 1; 1012 int i; 1013 char _wrkmem[10 * sizeof(lzo_byte *) + sizeof(lzo_align_t)]; 1014 lzo_byte *wrkmem; 1015 lzo_bytepp dict; 1016 unsigned char x[4 * sizeof(lzo_align_t)]; 1017 long d; 1018 lzo_align_t a; 1019 1020 for (i = 0; i < (int) sizeof(x); i++) 1021 x[i] = LZO_BYTE(i); 1022 1023 wrkmem = LZO_PTR_ALIGN_UP((lzo_byte *)_wrkmem,sizeof(lzo_align_t)); 1024 dict = (lzo_bytepp) wrkmem; 1025 1026 d = (long) ((const lzo_bytep) dict - (const lzo_bytep) _wrkmem); 1027 r &= __lzo_assert(d >= 0); 1028 r &= __lzo_assert(d < (long) sizeof(lzo_align_t)); 1029 1030 memset(&a,0xff,sizeof(a)); 1031 r &= __lzo_assert(a.a_ushort == USHRT_MAX); 1032 r &= __lzo_assert(a.a_uint == UINT_MAX); 1033 r &= __lzo_assert(a.a_ulong == ULONG_MAX); 1034 r &= __lzo_assert(a.a_lzo_uint == LZO_UINT_MAX); 1035 1036 if (r == 1) 1037 { 1038 for (i = 0; i < 8; i++) 1039 r &= __lzo_assert((const lzo_voidp) (&dict[i]) == (const lzo_voidp) (&wrkmem[i * sizeof(lzo_byte *)])); 1040 } 1041 1042 memset(&a,0,sizeof(a)); 1043 r &= __lzo_assert(a.a_charp == NULL); 1044 r &= __lzo_assert(a.a_lzo_bytep == NULL); 1045 //r &= __lzo_assert(0 == NULL); 1046 if (r == 1) 1047 { 1048 for (i = 0; i < 10; i++) 1049 dict[i] = wrkmem; 1050 BZERO8_PTR(dict+1,sizeof(dict[0]),8); 1051 r &= __lzo_assert(dict[0] == wrkmem); 1052 for (i = 1; i < 9; i++) 1053 r &= __lzo_assert(dict[i] == NULL); 1054 r &= __lzo_assert(dict[9] == wrkmem); 1055 } 2433 ACCCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp)) 1056 2434 1057 if (r == 1) 1058 { 1059 unsigned k = 1; 1060 const unsigned n = (unsigned) sizeof(lzo_uint32); 1061 lzo_byte *p0; 1062 lzo_byte *p1; 1063 1064 k += __lzo_align_gap(&x[k],n); 1065 p0 = (lzo_bytep) &x[k]; 1066 #if defined(PTR_LINEAR) 1067 r &= __lzo_assert((PTR_LINEAR(p0) & (n-1)) == 0); 1068 #else 1069 r &= __lzo_assert(n == 4); 1070 r &= __lzo_assert(PTR_ALIGNED_4(p0)); 1071 #endif 1072 1073 r &= __lzo_assert(k >= 1); 1074 p1 = (lzo_bytep) &x[1]; 1075 r &= __lzo_assert(PTR_GE(p0,p1)); 1076 1077 r &= __lzo_assert(k < 1+n); 1078 p1 = (lzo_bytep) &x[1+n]; 1079 r &= __lzo_assert(PTR_LT(p0,p1)); 1080 1081 if (r == 1) 1082 { 1083 lzo_uint32 v0 = * (lzo_uint32 *) &x[k]; 1084 lzo_uint32 v1 = * (lzo_uint32 *) &x[k+n]; 1085 1086 r &= __lzo_assert(v0 > 0); 1087 r &= __lzo_assert(v1 > 0); 1088 } 1089 } 2435 ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_xint) 2436 ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint32)) 2437 ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint)) 2438 ACCCHK_ASSERT(sizeof(lzo_xint) == sizeof(lzo_uint32) || sizeof(lzo_xint) == sizeof(lzo_uint)) 1090 2439 1091 return r; 1092 } 2440 #endif 2441 #undef ACCCHK_ASSERT 1093 2442 1094 2443 LZO_PUBLIC(int) 1095 2444 _lzo_config_check(void) 1096 2445 { 1097 2446 lzo_bool r = 1; 1098 int i; 1099 union { 1100 lzo_uint32 a; 1101 unsigned short b; 1102 lzo_uint32 aa[4]; 1103 unsigned char x[4*sizeof(lzo_align_t)]; 1104 } u; 1105 1106 #if 0 1107 r &= __lzo_assert((const void *)&u == (const void *)&u.a); 1108 r &= __lzo_assert((const void *)&u == (const void *)&u.b); 1109 r &= __lzo_assert((const void *)&u == (const void *)&u.x[0]); 1110 r &= __lzo_assert((const void *)&u == (const void *)&u.aa[0]); 1111 #endif 1112 1113 r &= basic_integral_check(); 1114 r &= basic_ptr_check(); 1115 if (r != 1) 1116 return LZO_E_ERROR; 1117 1118 u.a = 0; u.b = 0; 1119 for (i = 0; i < (int) sizeof(u.x); i++) 1120 u.x[i] = LZO_BYTE(i); 1121 1122 #if 0 1123 r &= __lzo_assert( (int) (unsigned char) ((char) -1) == 255); 1124 #endif 2447 union { unsigned char c[2*sizeof(lzo_xint)]; lzo_xint l[2]; } u; 2448 lzo_uintptr_t p; 1125 2449 1126 #if defined(LZO_BYTE_ORDER) 1127 if (r == 1) 1128 { 1129 # if (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) 1130 lzo_uint32 a = (lzo_uint32) (u.a & LZO_0xffffffffL); 1131 unsigned short b = (unsigned short) (u.b & 0xffff); 1132 r &= __lzo_assert(a == 0x03020100L); 1133 r &= __lzo_assert(b == 0x0100); 1134 # elif (LZO_BYTE_ORDER == LZO_BIG_ENDIAN) 1135 lzo_uint32 a = u.a >> (8 * sizeof(u.a) - 32); 1136 unsigned short b = u.b >> (8 * sizeof(u.b) - 16); 1137 r &= __lzo_assert(a == 0x00010203L); 1138 r &= __lzo_assert(b == 0x0001); 1139 # else 1140 # error invalid LZO_BYTE_ORDER 1141 # endif 1142 } 2450 #if !defined(LZO_CFG_NO_CONFIG_CHECK) 2451 #if defined(LZO_ABI_BIG_ENDIAN) 2452 u.l[0] = u.l[1] = 0; u.c[sizeof(lzo_xint) - 1] = 128; 2453 r &= (u.l[0] == 128); 2454 #endif 2455 #if defined(LZO_ABI_LITTLE_ENDIAN) 2456 u.l[0] = u.l[1] = 0; u.c[0] = 128; 2457 r &= (u.l[0] == 128); 1143 2458 #endif 1144 1145 2459 #if defined(LZO_UNALIGNED_OK_2) 1146 r &= __lzo_assert(sizeof(short) == 2); 1147 if (r == 1) 1148 { 1149 unsigned short b[4]; 1150 1151 for (i = 0; i < 4; i++) 1152 b[i] = * (const unsigned short *) &u.x[i]; 1153 1154 # if (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) 1155 r &= __lzo_assert(b[0] == 0x0100); 1156 r &= __lzo_assert(b[1] == 0x0201); 1157 r &= __lzo_assert(b[2] == 0x0302); 1158 r &= __lzo_assert(b[3] == 0x0403); 1159 # elif (LZO_BYTE_ORDER == LZO_BIG_ENDIAN) 1160 r &= __lzo_assert(b[0] == 0x0001); 1161 r &= __lzo_assert(b[1] == 0x0102); 1162 r &= __lzo_assert(b[2] == 0x0203); 1163 r &= __lzo_assert(b[3] == 0x0304); 1164 # endif 1165 } 2460 p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; 2461 u.l[0] = u.l[1] = 0; 2462 r &= ((* (const lzo_ushortp) (p+1)) == 0); 1166 2463 #endif 1167 1168 2464 #if defined(LZO_UNALIGNED_OK_4) 1169 r &= __lzo_assert(sizeof(lzo_uint32) == 4); 1170 if (r == 1) 1171 { 1172 lzo_uint32 a[4]; 1173 1174 for (i = 0; i < 4; i++) 1175 a[i] = * (const lzo_uint32 *) &u.x[i]; 1176 1177 # if (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN) 1178 r &= __lzo_assert(a[0] == 0x03020100L); 1179 r &= __lzo_assert(a[1] == 0x04030201L); 1180 r &= __lzo_assert(a[2] == 0x05040302L); 1181 r &= __lzo_assert(a[3] == 0x06050403L); 1182 # elif (LZO_BYTE_ORDER == LZO_BIG_ENDIAN) 1183 r &= __lzo_assert(a[0] == 0x00010203L); 1184 r &= __lzo_assert(a[1] == 0x01020304L); 1185 r &= __lzo_assert(a[2] == 0x02030405L); 1186 r &= __lzo_assert(a[3] == 0x03040506L); 1187 # endif 1188 } 1189 #endif 1190 1191 #if defined(LZO_ALIGNED_OK_4) 1192 r &= __lzo_assert(sizeof(lzo_uint32) == 4); 2465 p = (lzo_uintptr_t) (const lzo_voidp) &u.c[0]; 2466 u.l[0] = u.l[1] = 0; 2467 r &= ((* (const lzo_uint32p) (p+1)) == 0); 1193 2468 #endif 1194 1195 r &= __lzo_assert(lzo_sizeof_dict_t == sizeof(lzo_dict_t));1196 1197 #if defined(__LZO_IN_MINLZO)1198 if (r == 1)1199 {1200 lzo_uint32 adler;1201 adler = lzo_adler32(0, NULL, 0);1202 adler = lzo_adler32(adler, lzo_copyright(), 200);1203 r &= __lzo_assert(adler == 0x7ea34377L);1204 }1205 2469 #endif 1206 2470 1207 if (r == 1) 1208 { 1209 r &= __lzo_assert(!schedule_insns_bug()); 1210 } 1211 1212 if (r == 1) 1213 { 1214 static int x[3]; 1215 static unsigned xn = 3; 1216 register unsigned j; 1217 1218 for (j = 0; j < xn; j++) 1219 x[j] = (int)j - 3; 1220 r &= __lzo_assert(!strength_reduce_bug(x)); 1221 } 1222 1223 if (r == 1) 1224 { 1225 r &= ptr_check(); 1226 } 1227 2471 LZO_UNUSED(u); LZO_UNUSED(p); 1228 2472 return r == 1 ? LZO_E_OK : LZO_E_ERROR; 1229 2473 } 1230 2474 1231 static lzo_bool schedule_insns_bug(void)1232 {1233 #if defined(__LZO_CHECKER)1234 return 0;1235 #else1236 const int clone[] = {1, 2, 0};1237 const int *q;1238 q = clone;1239 return (*q) ? 0 : 1;1240 #endif1241 }1242 1243 static lzo_bool strength_reduce_bug(int *x)1244 {1245 return x[0] != -3 || x[1] != -2 || x[2] != -1;1246 }1247 1248 2475 int __lzo_init_done = 0; 1249 2476 1250 2477 LZO_PUBLIC(int) 1251 __lzo_init 2(unsigned v, int s1, int s2, int s3, int s4, int s5,1252 2478 __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5, 2479 int s6, int s7, int s8, int s9) 1253 2480 { 1254 2481 int r; 1255 2482 2483 #if defined(__LZO_IN_MINILZO) 2484 #elif (LZO_CC_MSC && ((_MSC_VER) < 700)) 2485 #else 2486 #define ACC_WANT_ACC_CHK_CH 1 2487 #undef ACCCHK_ASSERT 2488 #define ACCCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr) 2489 #endif 2490 #undef ACCCHK_ASSERT 2491 1256 2492 __lzo_init_done = 1; 1257 2493 1258 2494 if (v == 0) 1259 2495 return LZO_E_ERROR; 1260 2496 1261 2497 r = (s1 == -1 || s1 == (int) sizeof(short)) && 1262 1263 1264 1265 1266 1267 1268 1269 (s9 == -1 || s9 == (int) sizeof(lzo_compress_t));2498 (s2 == -1 || s2 == (int) sizeof(int)) && 2499 (s3 == -1 || s3 == (int) sizeof(long)) && 2500 (s4 == -1 || s4 == (int) sizeof(lzo_uint32)) && 2501 (s5 == -1 || s5 == (int) sizeof(lzo_uint)) && 2502 (s6 == -1 || s6 == (int) lzo_sizeof_dict_t) && 2503 (s7 == -1 || s7 == (int) sizeof(char *)) && 2504 (s8 == -1 || s8 == (int) sizeof(lzo_voidp)) && 2505 (s9 == -1 || s9 == (int) sizeof(lzo_callback_t)); 1270 2506 if (!r) 1271 2507 return LZO_E_ERROR; 1272 2508 1273 2509 r = _lzo_config_check(); 1274 2510 if (r != LZO_E_OK) 1275 2511 return r; 1276 2512 1277 2513 return r; 1278 2514 } 1279 2515 1280 2516 #if !defined(__LZO_IN_MINILZO) 1281 2517 1282 LZO_EXTERN(int) 1283 __lzo_init(unsigned v,int s1,int s2,int s3,int s4,int s5,int s6,int s7); 2518 #if (LZO_OS_WIN16 && LZO_CC_WATCOMC) && defined(__SW_BD) 1284 2519 1285 LZO_PUBLIC(int) 1286 __lzo_init(unsigned v,int s1,int s2,int s3,int s4,int s5,int s6,int s7) 2520 #if 0 2521 BOOL FAR PASCAL LibMain ( HANDLE hInstance, WORD wDataSegment, 2522 WORD wHeapSize, LPSTR lpszCmdLine ) 2523 #else 2524 int __far __pascal LibMain ( int a, short b, short c, long d ) 2525 #endif 1287 2526 { 1288 if (v == 0 || v > 0x1010) 1289 return LZO_E_ERROR; 1290 return __lzo_init2(v,s1,s2,s3,s4,s5,-1,-1,s6,s7); 2527 LZO_UNUSED(a); LZO_UNUSED(b); LZO_UNUSED(c); LZO_UNUSED(d); 2528 return 1; 1291 2529 } 1292 2530 1293 2531 #endif 1294 2532 2533 #endif 2534 1295 2535 #define do_compress _lzo1x_1_do_compress 1296 2536 2537 #if !defined(MINILZO_CFG_SKIP_LZO1X_1_COMPRESS) 2538 1297 2539 #define LZO_NEED_DICT_H 1298 2540 #define D_BITS 14 1299 #define D_INDEX1(d,p) d = DM( (0x21*DX3(p,5,5,6)) >> 5)2541 #define D_INDEX1(d,p) d = DM(DMUL(0x21,DX3(p,5,5,6)) >> 5) 1300 2542 #define D_INDEX2(d,p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f) 1301 2543 1302 2544 #ifndef __LZO_CONFIG1X_H … … 1307 2549 #endif 1308 2550 1309 2551 #if !defined(__LZO_IN_MINILZO) 1310 #include <lzo1x.h>2552 #include "lzo/lzo1x.h" 1311 2553 #endif 1312 2554 1313 2555 #define LZO_EOF_CODE … … 1360 2602 # define D_BITS DBITS 1361 2603 #endif 1362 2604 #if !defined(D_BITS) 1363 # error D_BITS is not defined2605 # error "D_BITS is not defined" 1364 2606 #endif 1365 2607 #if (D_BITS < 16) 1366 2608 # define D_SIZE LZO_SIZE(D_BITS) … … 1389 2631 #endif 1390 2632 1391 2633 #if (D_BITS != DL_BITS + DD_BITS) 1392 # error D_BITS does not match2634 # error "D_BITS does not match" 1393 2635 #endif 1394 2636 #if (D_BITS < 8 || D_BITS > 18) 1395 # error invalid D_BITS2637 # error "invalid D_BITS" 1396 2638 #endif 1397 2639 #if (DL_BITS < 8 || DL_BITS > 20) 1398 # error invalid DL_BITS2640 # error "invalid DL_BITS" 1399 2641 #endif 1400 2642 #if (DD_BITS < 0 || DD_BITS > 6) 1401 # error invalid DD_BITS2643 # error "invalid DD_BITS" 1402 2644 #endif 1403 2645 1404 2646 #if !defined(DL_MIN_LEN) … … 1414 2656 #define LZO_HASH_LZO_INCREMENTAL_B 4 1415 2657 1416 2658 #if !defined(LZO_HASH) 1417 # error choose a hashing strategy2659 # error "choose a hashing strategy" 1418 2660 #endif 1419 2661 2662 #undef DM 2663 #undef DX 2664 1420 2665 #if (DL_MIN_LEN == 3) 1421 2666 # define _DV2_A(p,shift1,shift2) \ 1422 (((( (lzo_uint32)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2])2667 (((( (lzo_xint)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2]) 1423 2668 # define _DV2_B(p,shift1,shift2) \ 1424 (((( (lzo_uint32)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0])2669 (((( (lzo_xint)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0]) 1425 2670 # define _DV3_B(p,shift1,shift2,shift3) \ 1426 2671 ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0]) 1427 2672 #elif (DL_MIN_LEN == 2) 1428 2673 # define _DV2_A(p,shift1,shift2) \ 1429 (( (lzo_uint32)(p[0]) << shift1) ^ p[1])2674 (( (lzo_xint)(p[0]) << shift1) ^ p[1]) 1430 2675 # define _DV2_B(p,shift1,shift2) \ 1431 (( (lzo_uint32)(p[1]) << shift1) ^ p[2])2676 (( (lzo_xint)(p[1]) << shift1) ^ p[2]) 1432 2677 #else 1433 # error invalid DL_MIN_LEN2678 # error "invalid DL_MIN_LEN" 1434 2679 #endif 1435 2680 #define _DV_A(p,shift) _DV2_A(p,shift,shift) 1436 2681 #define _DV_B(p,shift) _DV2_B(p,shift,shift) 1437 2682 #define DA2(p,s1,s2) \ 1438 (((((lzo_uint32)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0])2683 (((((lzo_xint)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0]) 1439 2684 #define DS2(p,s1,s2) \ 1440 (((((lzo_uint32)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0])2685 (((((lzo_xint)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0]) 1441 2686 #define DX2(p,s1,s2) \ 1442 (((((lzo_uint32)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0])2687 (((((lzo_xint)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0]) 1443 2688 #define DA3(p,s1,s2,s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0]) 1444 2689 #define DS3(p,s1,s2,s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0]) 1445 2690 #define DX3(p,s1,s2,s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0]) … … 1460 2705 # define __LZO_HASH_INCREMENTAL 1461 2706 # define DVAL_FIRST(dv,p) dv = _DV_A((p),5) 1462 2707 # define DVAL_NEXT(dv,p) \ 1463 dv ^= (lzo_uint32)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2])1464 # define _DINDEX(dv,p) (( 0x9f5f * (dv)) >> 5)2708 dv ^= (lzo_xint)(p[-1]) << (2*5); dv = (((dv) << 5) ^ p[2]) 2709 # define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) 1465 2710 # define DVAL_LOOKAHEAD DL_MIN_LEN 1466 2711 1467 2712 #elif (LZO_HASH == LZO_HASH_LZO_INCREMENTAL_B) 1468 2713 # define __LZO_HASH_INCREMENTAL 1469 2714 # define DVAL_FIRST(dv,p) dv = _DV_B((p),5) 1470 2715 # define DVAL_NEXT(dv,p) \ 1471 dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_uint32)(p[2]) << (2*5)))1472 # define _DINDEX(dv,p) (( 0x9f5f * (dv)) >> 5)2716 dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_xint)(p[2]) << (2*5))) 2717 # define _DINDEX(dv,p) ((DMUL(0x9f5f,dv)) >> 5) 1473 2718 # define DVAL_LOOKAHEAD DL_MIN_LEN 1474 2719 1475 2720 #else 1476 # error choose a hashing strategy2721 # error "choose a hashing strategy" 1477 2722 #endif 1478 2723 1479 2724 #ifndef DINDEX … … 1494 2739 1495 2740 #if !defined(DVAL_ASSERT) 1496 2741 #if defined(__LZO_HASH_INCREMENTAL) && !defined(NDEBUG) 1497 static void DVAL_ASSERT(lzo_ uint32 dv, const lzo_byte *p)2742 static void DVAL_ASSERT(lzo_xint dv, const lzo_bytep p) 1498 2743 { 1499 lzo_ uint32df;2744 lzo_xint df; 1500 2745 DVAL_FIRST(df,(p)); 1501 2746 assert(DINDEX(dv,p) == DINDEX(df,p)); 1502 2747 } … … 1522 2767 #else 1523 2768 1524 2769 # define UPDATE_D(dict,drun,dv,p,in) \ 1525 2770 dict[ DINDEX(dv,p) + drun++ ] = DENTRY(p,in); drun &= DD_MASK 1526 2771 # define UPDATE_I(dict,drun,index,p,in) \ 1527 2772 dict[ (index) + drun++ ] = DENTRY(p,in); drun &= DD_MASK 1528 2773 # define UPDATE_P(ptr,drun,p,in) \ 1529 2774 (ptr) [ drun++ ] = DENTRY(p,in); drun &= DD_MASK 1530 2775 1531 2776 #endif 1532 2777 1533 2778 #if defined(LZO_DICT_USE_PTR) 1534 2779 1535 2780 #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ 1536 (m_pos == NULL || (m_off = (lzo_moff_t) (ip -m_pos)) > max_offset)2781 (m_pos == NULL || (m_off = pd(ip, m_pos)) > max_offset) 1537 2782 1538 2783 #define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ 1539 (BOUNDS_CHECKING_OFF_IN_EXPR( \ 1540 (PTR_LT(m_pos,in) || \ 1541 (m_off = (lzo_moff_t) PTR_DIFF(ip,m_pos)) <= 0 || \ 1542 m_off > max_offset) )) 2784 (BOUNDS_CHECKING_OFF_IN_EXPR(( \ 2785 m_pos = ip - (lzo_uint) PTR_DIFF(ip,m_pos), \ 2786 PTR_LT(m_pos,in) || \ 2787 (m_off = (lzo_uint) PTR_DIFF(ip,m_pos)) <= 0 || \ 2788 m_off > max_offset ))) 1543 2789 1544 2790 #else 1545 2791 1546 2792 #define LZO_CHECK_MPOS_DET(m_pos,m_off,in,ip,max_offset) \ 1547 1548 ((m_off = (lzo_moff_t) ((ip)-(in)) - m_off) > max_offset) || \1549 2793 (m_off == 0 || \ 2794 ((m_off = pd(ip, in) - m_off) > max_offset) || \ 2795 (m_pos = (ip) - (m_off), 0) ) 1550 2796 1551 2797 #define LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,max_offset) \ 1552 ((lzo_moff_t) ((ip)-(in)) <= m_off || \1553 ((m_off = (lzo_moff_t) ((ip)-(in)) - m_off) > max_offset) || \1554 2798 (pd(ip, in) <= m_off || \ 2799 ((m_off = pd(ip, in) - m_off) > max_offset) || \ 2800 (m_pos = (ip) - (m_off), 0) ) 1555 2801 1556 2802 #endif 1557 2803 … … 1573 2819 1574 2820 #define DO_COMPRESS lzo1x_1_compress 1575 2821 1576 static 1577 lzo_uint do_compress ( const lzo_byte *in , lzo_uint in_len, 1578 lzo_byte *out, lzo_uint *out_len, 1579 lzo_voidp wrkmem ) 1580 { 1581 #if 0 && defined(__GNUC__) && defined(__i386__) 1582 register const lzo_byte *ip __asm__("%esi"); 1583 #else 1584 register const lzo_byte *ip = NULL; 1585 #endif 1586 lzo_byte *op = NULL; 1587 const lzo_byte * const in_end = in + in_len; 1588 const lzo_byte * const ip_end = in + in_len - M2_MAX_LEN - 5; 1589 const lzo_byte *ii = NULL; 2822 static __lzo_noinline lzo_uint 2823 do_compress ( const lzo_bytep in , lzo_uint in_len, 2824 lzo_bytep out, lzo_uintp out_len, 2825 lzo_voidp wrkmem ) 2826 { 2827 register const lzo_bytep ip; 2828 lzo_bytep op; 2829 const lzo_bytep const in_end = in + in_len; 2830 const lzo_bytep const ip_end = in + in_len - M2_MAX_LEN - 5; 2831 const lzo_bytep ii; 1590 2832 lzo_dict_p const dict = (lzo_dict_p) wrkmem; 1591 2833 1592 2834 op = out; … … 1596 2838 ip += 4; 1597 2839 for (;;) 1598 2840 { 1599 #if 0 && defined(__GNUC__) && defined(__i386__) 1600 register const lzo_byte *m_pos __asm__("%edi"); 1601 #else 1602 register const lzo_byte *m_pos = NULL; 1603 #endif 1604 lzo_moff_t m_off = 0; 1605 lzo_uint m_len = 0; 1606 lzo_uint dindex = 0; 1607 1608 DINDEX1(dindex,ip); 1609 GINDEX(m_pos,m_off,dict,dindex,in); 1610 if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) 1611 goto literal; 2841 register const lzo_bytep m_pos; 2842 lzo_uint m_off; 2843 lzo_uint m_len; 2844 lzo_uint dindex; 2845 2846 DINDEX1(dindex,ip); 2847 GINDEX(m_pos,m_off,dict,dindex,in); 2848 if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) 2849 goto literal; 1612 2850 #if 1 1613 1614 1615 1616 #endif 1617 1618 1619 1620 1621 1622 2851 if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) 2852 goto try_match; 2853 DINDEX2(dindex,ip); 2854 #endif 2855 GINDEX(m_pos,m_off,dict,dindex,in); 2856 if (LZO_CHECK_MPOS_NON_DET(m_pos,m_off,in,ip,M4_MAX_OFFSET)) 2857 goto literal; 2858 if (m_off <= M2_MAX_OFFSET || m_pos[3] == ip[3]) 2859 goto try_match; 2860 goto literal; 1623 2861 1624 2862 try_match: 1625 2863 #if 1 && defined(LZO_UNALIGNED_OK_2) 1626 2864 if (* (const lzo_ushortp) m_pos != * (const lzo_ushortp) ip) 1627 2865 #else 1628 2866 if (m_pos[0] != ip[0] || m_pos[1] != ip[1]) 1629 2867 #endif 1630 1631 1632 1633 1634 if(m_pos[2] == ip[2])1635 2868 { 2869 } 2870 else 2871 { 2872 if __lzo_likely(m_pos[2] == ip[2]) 2873 { 1636 2874 #if 0 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 #endif 1649 1650 1651 1652 2875 if (m_off <= M2_MAX_OFFSET) 2876 goto match; 2877 if (lit <= 3) 2878 goto match; 2879 if (lit == 3) 2880 { 2881 assert(op - 2 > out); op[-2] |= LZO_BYTE(3); 2882 *op++ = *ii++; *op++ = *ii++; *op++ = *ii++; 2883 goto code_match; 2884 } 2885 if (m_pos[3] == ip[3]) 2886 #endif 2887 goto match; 2888 } 2889 else 2890 { 1653 2891 #if 0 1654 2892 #if 0 1655 2893 if (m_off <= M1_MAX_OFFSET && lit > 0 && lit <= 3) 1656 2894 #else 1657 2895 if (m_off <= M1_MAX_OFFSET && lit == 3) 1658 2896 #endif 1659 1660 2897 { 2898 register lzo_uint t; 1661 2899 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 2900 t = lit; 2901 assert(op - 2 > out); op[-2] |= LZO_BYTE(t); 2902 do *op++ = *ii++; while (--t > 0); 2903 assert(ii == ip); 2904 m_off -= 1; 2905 *op++ = LZO_BYTE(M1_MARKER | ((m_off & 3) << 2)); 2906 *op++ = LZO_BYTE(m_off >> 2); 2907 ip += 2; 2908 goto match_done; 2909 } 1672 2910 #endif 1673 1674 2911 } 2912 } 1675 2913 1676 2914 literal: 1677 1678 1679 if(ip >= ip_end)1680 1681 2915 UPDATE_I(dict,0,dindex,ip,in); 2916 ++ip; 2917 if __lzo_unlikely(ip >= ip_end) 2918 break; 2919 continue; 1682 2920 1683 2921 match: 1684 1685 if (ip - ii> 0)1686 1687 register lzo_uint t = ip - ii;1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 2922 UPDATE_I(dict,0,dindex,ip,in); 2923 if (pd(ip,ii) > 0) 2924 { 2925 register lzo_uint t = pd(ip,ii); 2926 2927 if (t <= 3) 2928 { 2929 assert(op - 2 > out); 2930 op[-2] |= LZO_BYTE(t); 2931 } 2932 else if (t <= 18) 2933 *op++ = LZO_BYTE(t - 3); 2934 else 2935 { 2936 register lzo_uint tt = t - 18; 2937 2938 *op++ = 0; 2939 while (tt > 255) 2940 { 2941 tt -= 255; 2942 *op++ = 0; 2943 } 2944 assert(tt > 0); 2945 *op++ = LZO_BYTE(tt); 2946 } 2947 do *op++ = *ii++; while (--t > 0); 2948 } 2949 2950 assert(ii == ip); 2951 ip += 3; 2952 if (m_pos[3] != *ip++ || m_pos[4] != *ip++ || m_pos[5] != *ip++ || 2953 m_pos[6] != *ip++ || m_pos[7] != *ip++ || m_pos[8] != *ip++ 1716 2954 #ifdef LZO1Y 1717 1718 2955 || m_pos[ 9] != *ip++ || m_pos[10] != *ip++ || m_pos[11] != *ip++ 2956 || m_pos[12] != *ip++ || m_pos[13] != *ip++ || m_pos[14] != *ip++ 1719 2957 #endif 1720 1721 1722 1723 m_len = ip - ii;1724 1725 1726 1727 1728 2958 ) 2959 { 2960 --ip; 2961 m_len = pd(ip, ii); 2962 assert(m_len >= 3); assert(m_len <= M2_MAX_LEN); 2963 2964 if (m_off <= M2_MAX_OFFSET) 2965 { 2966 m_off -= 1; 1729 2967 #if defined(LZO1X) 1730 1731 2968 *op++ = LZO_BYTE(((m_len - 1) << 5) | ((m_off & 7) << 2)); 2969 *op++ = LZO_BYTE(m_off >> 3); 1732 2970 #elif defined(LZO1Y) 1733 1734 2971 *op++ = LZO_BYTE(((m_len + 1) << 4) | ((m_off & 3) << 2)); 2972 *op++ = LZO_BYTE(m_off >> 2); 1735 2973 #endif 1736 1737 1738 1739 1740 1741 1742 1743 2974 } 2975 else if (m_off <= M3_MAX_OFFSET) 2976 { 2977 m_off -= 1; 2978 *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); 2979 goto m3_m4_offset; 2980 } 2981 else 1744 2982 #if defined(LZO1X) 1745 1746 1747 1748 1749 1750 1751 2983 { 2984 m_off -= 0x4000; 2985 assert(m_off > 0); assert(m_off <= 0x7fff); 2986 *op++ = LZO_BYTE(M4_MARKER | 2987 ((m_off & 0x4000) >> 11) | (m_len - 2)); 2988 goto m3_m4_offset; 2989 } 1752 2990 #elif defined(LZO1Y) 1753 2991 goto m4_match; 1754 2992 #endif 1755 1756 1757 1758 1759 const lzo_byte *end = in_end;1760 const lzo_byte *m = m_pos + M2_MAX_LEN + 1;1761 1762 1763 m_len = (ip -ii);1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 2993 } 2994 else 2995 { 2996 { 2997 const lzo_bytep end = in_end; 2998 const lzo_bytep m = m_pos + M2_MAX_LEN + 1; 2999 while (ip < end && *m == *ip) 3000 m++, ip++; 3001 m_len = pd(ip, ii); 3002 } 3003 assert(m_len > M2_MAX_LEN); 3004 3005 if (m_off <= M3_MAX_OFFSET) 3006 { 3007 m_off -= 1; 3008 if (m_len <= 33) 3009 *op++ = LZO_BYTE(M3_MARKER | (m_len - 2)); 3010 else 3011 { 3012 m_len -= 33; 3013 *op++ = M3_MARKER | 0; 3014 goto m3_m4_len; 3015 } 3016 } 3017 else 3018 { 1781 3019 #if defined(LZO1Y) 1782 3020 m4_match: 1783 3021 #endif 1784 1785 1786 1787 1788 1789 1790 1791 1792 3022 m_off -= 0x4000; 3023 assert(m_off > 0); assert(m_off <= 0x7fff); 3024 if (m_len <= M4_MAX_LEN) 3025 *op++ = LZO_BYTE(M4_MARKER | 3026 ((m_off & 0x4000) >> 11) | (m_len - 2)); 3027 else 3028 { 3029 m_len -= M4_MAX_LEN; 3030 *op++ = LZO_BYTE(M4_MARKER | ((m_off & 0x4000) >> 11)); 1793 3031 m3_m4_len: 1794 1795 1796 1797 1798 1799 1800 1801 1802 3032 while (m_len > 255) 3033 { 3034 m_len -= 255; 3035 *op++ = 0; 3036 } 3037 assert(m_len > 0); 3038 *op++ = LZO_BYTE(m_len); 3039 } 3040 } 1803 3041 1804 3042 m3_m4_offset: 1805 1806 1807 3043 *op++ = LZO_BYTE((m_off & 63) << 2); 3044 *op++ = LZO_BYTE(m_off >> 6); 3045 } 1808 3046 1809 3047 #if 0 1810 3048 match_done: 1811 3049 #endif 1812 1813 if(ip >= ip_end)1814 3050 ii = ip; 3051 if __lzo_unlikely(ip >= ip_end) 3052 break; 1815 3053 } 1816 3054 1817 *out_len = op - out;1818 return (lzo_uint) (in_end -ii);3055 *out_len = pd(op, out); 3056 return pd(in_end,ii); 1819 3057 } 1820 3058 1821 3059 LZO_PUBLIC(int) 1822 DO_COMPRESS ( const lzo_byte *in , lzo_uint in_len,1823 lzo_byte *out, lzo_uint *out_len,1824 3060 DO_COMPRESS ( const lzo_bytep in , lzo_uint in_len, 3061 lzo_bytep out, lzo_uintp out_len, 3062 lzo_voidp wrkmem ) 1825 3063 { 1826 lzo_byte *op = out;3064 lzo_bytep op = out; 1827 3065 lzo_uint t; 1828 3066 1829 #if defined(__LZO_QUERY_COMPRESS) 1830 if (__LZO_IS_COMPRESS_QUERY(in,in_len,out,out_len,wrkmem)) 1831 return __LZO_QUERY_COMPRESS(in,in_len,out,out_len,wrkmem,D_SIZE,lzo_sizeof(lzo_dict_t)); 1832 #endif 1833 1834 if (in_len <= M2_MAX_LEN + 5) 1835 t = in_len; 3067 if __lzo_unlikely(in_len <= M2_MAX_LEN + 5) 3068 t = in_len; 1836 3069 else 1837 3070 { 1838 1839 3071 t = do_compress(in,in_len,op,out_len,wrkmem); 3072 op += *out_len; 1840 3073 } 1841 3074 1842 3075 if (t > 0) 1843 3076 { 1844 const lzo_byte *ii = in + in_len - t;3077 const lzo_bytep ii = in + in_len - t; 1845 3078 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 3079 if (op == out && t <= 238) 3080 *op++ = LZO_BYTE(17 + t); 3081 else if (t <= 3) 3082 op[-2] |= LZO_BYTE(t); 3083 else if (t <= 18) 3084 *op++ = LZO_BYTE(t - 3); 3085 else 3086 { 3087 lzo_uint tt = t - 18; 3088 3089 *op++ = 0; 3090 while (tt > 255) 3091 { 3092 tt -= 255; 3093 *op++ = 0; 3094 } 3095 assert(tt > 0); 3096 *op++ = LZO_BYTE(tt); 3097 } 3098 do *op++ = *ii++; while (--t > 0); 1866 3099 } 1867 3100 1868 3101 *op++ = M4_MARKER | 1; 1869 3102 *op++ = 0; 1870 3103 *op++ = 0; 1871 3104 1872 *out_len = op - out;3105 *out_len = pd(op, out); 1873 3106 return LZO_E_OK; 1874 3107 } 1875 3108 3109 #endif 3110 1876 3111 #undef do_compress 1877 3112 #undef DO_COMPRESS 1878 3113 #undef LZO_HASH 1879 3114 1880 #undef LZO_TEST_DECOMPRESS_OVERRUN 1881 #undef LZO_TEST_DECOMPRESS_OVERRUN_INPUT 1882 #undef LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT 1883 #undef LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND 3115 #undef LZO_TEST_OVERRUN 1884 3116 #undef DO_DECOMPRESS 1885 3117 #define DO_DECOMPRESS lzo1x_decompress 1886 3118 1887 #if defined(LZO_TEST_DECOMPRESS_OVERRUN) 1888 # if !defined(LZO_TEST_DECOMPRESS_OVERRUN_INPUT) 1889 # define LZO_TEST_DECOMPRESS_OVERRUN_INPUT 2 3119 #if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS) 3120 3121 #if defined(LZO_TEST_OVERRUN) 3122 # if !defined(LZO_TEST_OVERRUN_INPUT) 3123 # define LZO_TEST_OVERRUN_INPUT 2 1890 3124 # endif 1891 # if !defined(LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT)1892 # define LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT 23125 # if !defined(LZO_TEST_OVERRUN_OUTPUT) 3126 # define LZO_TEST_OVERRUN_OUTPUT 2 1893 3127 # endif 1894 # if !defined(LZO_TEST_ DECOMPRESS_OVERRUN_LOOKBEHIND)1895 # define LZO_TEST_ DECOMPRESS_OVERRUN_LOOKBEHIND3128 # if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) 3129 # define LZO_TEST_OVERRUN_LOOKBEHIND 1896 3130 # endif 1897 3131 #endif 1898 3132 1899 3133 #undef TEST_IP 1900 3134 #undef TEST_OP 1901 #undef TEST_LOOKBEHIND 3135 #undef TEST_LB 3136 #undef TEST_LBO 1902 3137 #undef NEED_IP 1903 3138 #undef NEED_OP 1904 3139 #undef HAVE_TEST_IP … … 1908 3143 #undef HAVE_ANY_IP 1909 3144 #undef HAVE_ANY_OP 1910 3145 1911 #if defined(LZO_TEST_ DECOMPRESS_OVERRUN_INPUT)1912 # if (LZO_TEST_ DECOMPRESS_OVERRUN_INPUT >= 1)3146 #if defined(LZO_TEST_OVERRUN_INPUT) 3147 # if (LZO_TEST_OVERRUN_INPUT >= 1) 1913 3148 # define TEST_IP (ip < ip_end) 1914 3149 # endif 1915 # if (LZO_TEST_ DECOMPRESS_OVERRUN_INPUT >= 2)3150 # if (LZO_TEST_OVERRUN_INPUT >= 2) 1916 3151 # define NEED_IP(x) \ 1917 3152 if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun 1918 3153 # endif 1919 3154 #endif 1920 3155 1921 #if defined(LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT)1922 # if (LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT >= 1)3156 #if defined(LZO_TEST_OVERRUN_OUTPUT) 3157 # if (LZO_TEST_OVERRUN_OUTPUT >= 1) 1923 3158 # define TEST_OP (op <= op_end) 1924 3159 # endif 1925 # if (LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT >= 2)3160 # if (LZO_TEST_OVERRUN_OUTPUT >= 2) 1926 3161 # undef TEST_OP 1927 3162 # define NEED_OP(x) \ 1928 3163 if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun 1929 3164 # endif 1930 3165 #endif 1931 3166 1932 #if defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) 1933 # define TEST_LOOKBEHIND(m_pos,out) if (m_pos < out) goto lookbehind_overrun 3167 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND) 3168 # define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun 3169 # define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun 1934 3170 #else 1935 # define TEST_LOOKBEHIND(m_pos,op) ((void) 0) 3171 # define TEST_LB(m_pos) ((void) 0) 3172 # define TEST_LBO(m_pos,o) ((void) 0) 1936 3173 #endif 1937 3174 1938 3175 #if !defined(LZO_EOF_CODE) && !defined(TEST_IP) … … 1968 3205 # define HAVE_ANY_OP 1969 3206 #endif 1970 3207 3208 #undef __COPY4 3209 #define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) 3210 3211 #undef COPY4 3212 #if defined(LZO_UNALIGNED_OK_4) 3213 # define COPY4(dst,src) __COPY4(dst,src) 3214 #elif defined(LZO_ALIGNED_OK_4) 3215 # define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) 3216 #endif 3217 1971 3218 #if defined(DO_DECOMPRESS) 1972 3219 LZO_PUBLIC(int) 1973 DO_DECOMPRESS ( const lzo_byte *in , lzo_uint in_len,1974 lzo_byte *out, lzo_uint *out_len,1975 3220 DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, 3221 lzo_bytep out, lzo_uintp out_len, 3222 lzo_voidp wrkmem ) 1976 3223 #endif 1977 3224 { 1978 register lzo_byte *op;1979 register const lzo_byte *ip;3225 register lzo_bytep op; 3226 register const lzo_bytep ip; 1980 3227 register lzo_uint t; 1981 3228 #if defined(COPY_DICT) 1982 3229 lzo_uint m_off; 1983 const lzo_byte *dict_end;3230 const lzo_bytep dict_end; 1984 3231 #else 1985 register const lzo_byte *m_pos;3232 register const lzo_bytep m_pos; 1986 3233 #endif 1987 3234 1988 const lzo_byte *const ip_end = in + in_len;3235 const lzo_bytep const ip_end = in + in_len; 1989 3236 #if defined(HAVE_ANY_OP) 1990 lzo_byte *const op_end = out + *out_len;3237 lzo_bytep const op_end = out + *out_len; 1991 3238 #endif 1992 3239 #if defined(LZO1Z) 1993 3240 lzo_uint last_m_off = 0; … … 1995 3242 1996 3243 LZO_UNUSED(wrkmem); 1997 3244 1998 #if defined(__LZO_QUERY_DECOMPRESS)1999 if (__LZO_IS_DECOMPRESS_QUERY(in,in_len,out,out_len,wrkmem))2000 return __LZO_QUERY_DECOMPRESS(in,in_len,out,out_len,wrkmem,0,0);2001 #endif2002 2003 3245 #if defined(COPY_DICT) 2004 3246 if (dict) 2005 3247 { 2006 2007 2008 2009 2010 2011 3248 if (dict_len > M4_MAX_OFFSET) 3249 { 3250 dict += dict_len - M4_MAX_OFFSET; 3251 dict_len = M4_MAX_OFFSET; 3252 } 3253 dict_end = dict + dict_len; 2012 3254 } 2013 3255 else 2014 3256 { 2015 2016 3257 dict_len = 0; 3258 dict_end = NULL; 2017 3259 } 2018 3260 #endif 2019 3261 … … 2024 3266 2025 3267 if (*ip > 17) 2026 3268 { 2027 2028 2029 2030 2031 2032 3269 t = *ip++ - 17; 3270 if (t < 4) 3271 goto match_next; 3272 assert(t > 0); NEED_OP(t); NEED_IP(t+1); 3273 do *op++ = *ip++; while (--t > 0); 3274 goto first_literal_run; 2033 3275 } 2034 3276 2035 3277 while (TEST_IP && TEST_OP) 2036 3278 { 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 3279 t = *ip++; 3280 if (t >= 16) 3281 goto match; 3282 if (t == 0) 3283 { 3284 NEED_IP(1); 3285 while (*ip == 0) 3286 { 3287 t += 255; 3288 ip++; 3289 NEED_IP(1); 3290 } 3291 t += 15 + *ip++; 3292 } 3293 assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); 2052 3294 #if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) 2053 3295 #if !defined(LZO_UNALIGNED_OK_4) 2054 2055 3296 if (PTR_ALIGNED2_4(op,ip)) 3297 { 2056 3298 #endif 2057 * (lzo_uint32p) op = * (const lzo_uint32p) ip;2058 2059 2060 2061 2062 2063 2064 * (lzo_uint32p) op = * (const lzo_uint32p) ip;2065 2066 2067 2068 2069 2070 2071 3299 COPY4(op,ip); 3300 op += 4; ip += 4; 3301 if (--t > 0) 3302 { 3303 if (t >= 4) 3304 { 3305 do { 3306 COPY4(op,ip); 3307 op += 4; ip += 4; t -= 4; 3308 } while (t >= 4); 3309 if (t > 0) do *op++ = *ip++; while (--t > 0); 3310 } 3311 else 3312 do *op++ = *ip++; while (--t > 0); 3313 } 2072 3314 #if !defined(LZO_UNALIGNED_OK_4) 2073 2074 3315 } 3316 else 2075 3317 #endif 2076 3318 #endif 2077 3319 #if !defined(LZO_UNALIGNED_OK_4) 2078 2079 2080 2081 3320 { 3321 *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; 3322 do *op++ = *ip++; while (--t > 0); 3323 } 2082 3324 #endif 2083 3325 2084 3326 first_literal_run: 2085 3327 2086 2087 2088 3328 t = *ip++; 3329 if (t >= 16) 3330 goto match; 2089 3331 #if defined(COPY_DICT) 2090 3332 #if defined(LZO1Z) 2091 2092 3333 m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); 3334 last_m_off = m_off; 2093 3335 #else 2094 3336 m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); 2095 3337 #endif 2096 2097 3338 NEED_OP(3); 3339 t = 3; COPY_DICT(t,m_off) 2098 3340 #else 2099 3341 #if defined(LZO1Z) 2100 2101 2102 3342 t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); 3343 m_pos = op - t; 3344 last_m_off = t; 2103 3345 #else 2104 2105 2106 3346 m_pos = op - (1 + M2_MAX_OFFSET); 3347 m_pos -= t >> 2; 3348 m_pos -= *ip++ << 2; 2107 3349 #endif 2108 TEST_LOOKBEHIND(m_pos,out); NEED_OP(3);2109 3350 TEST_LB(m_pos); NEED_OP(3); 3351 *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; 2110 3352 #endif 2111 3353 goto match_done; 2112 3354 2113 while (TEST_IP && TEST_OP) 2114 { 3355 do { 2115 3356 match: 2116 2117 3357 if (t >= 64) 3358 { 2118 3359 #if defined(COPY_DICT) 2119 3360 #if defined(LZO1X) 2120 2121 3361 m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); 3362 t = (t >> 5) - 1; 2122 3363 #elif defined(LZO1Y) 2123 2124 3364 m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); 3365 t = (t >> 4) - 3; 2125 3366 #elif defined(LZO1Z) 2126 2127 2128 2129 2130 2131 2132 2133 2134 3367 m_off = t & 0x1f; 3368 if (m_off >= 0x1c) 3369 m_off = last_m_off; 3370 else 3371 { 3372 m_off = 1 + (m_off << 6) + (*ip++ >> 2); 3373 last_m_off = m_off; 3374 } 3375 t = (t >> 5) - 1; 2135 3376 #endif 2136 3377 #else 2137 3378 #if defined(LZO1X) 2138 2139 2140 2141 3379 m_pos = op - 1; 3380 m_pos -= (t >> 2) & 7; 3381 m_pos -= *ip++ << 3; 3382 t = (t >> 5) - 1; 2142 3383 #elif defined(LZO1Y) 2143 2144 2145 2146 3384 m_pos = op - 1; 3385 m_pos -= (t >> 2) & 3; 3386 m_pos -= *ip++ << 2; 3387 t = (t >> 4) - 3; 2147 3388 #elif defined(LZO1Z) 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 #endif 2165 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1);2166 2167 #endif 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 3389 { 3390 lzo_uint off = t & 0x1f; 3391 m_pos = op; 3392 if (off >= 0x1c) 3393 { 3394 assert(last_m_off > 0); 3395 m_pos -= last_m_off; 3396 } 3397 else 3398 { 3399 off = 1 + (off << 6) + (*ip++ >> 2); 3400 m_pos -= off; 3401 last_m_off = off; 3402 } 3403 } 3404 t = (t >> 5) - 1; 3405 #endif 3406 TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); 3407 goto copy_match; 3408 #endif 3409 } 3410 else if (t >= 32) 3411 { 3412 t &= 31; 3413 if (t == 0) 3414 { 3415 NEED_IP(1); 3416 while (*ip == 0) 3417 { 3418 t += 255; 3419 ip++; 3420 NEED_IP(1); 3421 } 3422 t += 31 + *ip++; 3423 } 2183 3424 #if defined(COPY_DICT) 2184 3425 #if defined(LZO1Z) 2185 2186 3426 m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); 3427 last_m_off = m_off; 2187 3428 #else 2188 3429 m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); 2189 3430 #endif 2190 3431 #else 2191 3432 #if defined(LZO1Z) 2192 2193 2194 2195 2196 2197 #elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN)2198 2199 2200 #else 2201 2202 2203 #endif 2204 #endif 2205 2206 2207 2208 3433 { 3434 lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); 3435 m_pos = op - off; 3436 last_m_off = off; 3437 } 3438 #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) 3439 m_pos = op - 1; 3440 m_pos -= (* (const lzo_ushortp) ip) >> 2; 3441 #else 3442 m_pos = op - 1; 3443 m_pos -= (ip[0] >> 2) + (ip[1] << 6); 3444 #endif 3445 #endif 3446 ip += 2; 3447 } 3448 else if (t >= 16) 3449 { 2209 3450 #if defined(COPY_DICT) 2210 3451 m_off = (t & 8) << 11; 2211 3452 #else 2212 2213 3453 m_pos = op; 3454 m_pos -= (t & 8) << 11; 2214 3455 #endif 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 3456 t &= 7; 3457 if (t == 0) 3458 { 3459 NEED_IP(1); 3460 while (*ip == 0) 3461 { 3462 t += 255; 3463 ip++; 3464 NEED_IP(1); 3465 } 3466 t += 7 + *ip++; 3467 } 2227 3468 #if defined(COPY_DICT) 2228 3469 #if defined(LZO1Z) 2229 3470 m_off += (ip[0] << 6) + (ip[1] >> 2); 2230 3471 #else 2231 3472 m_off += (ip[0] >> 2) + (ip[1] << 6); 2232 3473 #endif 2233 2234 2235 2236 3474 ip += 2; 3475 if (m_off == 0) 3476 goto eof_found; 3477 m_off += 0x4000; 2237 3478 #if defined(LZO1Z) 2238 3479 last_m_off = m_off; 2239 3480 #endif 2240 3481 #else 2241 3482 #if defined(LZO1Z) 2242 2243 #elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN)2244 2245 #else 2246 2247 #endif 2248 2249 2250 2251 3483 m_pos -= (ip[0] << 6) + (ip[1] >> 2); 3484 #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) 3485 m_pos -= (* (const lzo_ushortp) ip) >> 2; 3486 #else 3487 m_pos -= (ip[0] >> 2) + (ip[1] << 6); 3488 #endif 3489 ip += 2; 3490 if (m_pos == op) 3491 goto eof_found; 3492 m_pos -= 0x4000; 2252 3493 #if defined(LZO1Z) 2253 last_m_off = op - m_pos;3494 last_m_off = pd((const lzo_bytep)op, m_pos); 2254 3495 #endif 2255 3496 #endif 2256 2257 2258 3497 } 3498 else 3499 { 2259 3500 #if defined(COPY_DICT) 2260 3501 #if defined(LZO1Z) 2261 2262 3502 m_off = 1 + (t << 6) + (*ip++ >> 2); 3503 last_m_off = m_off; 2263 3504 #else 2264 3505 m_off = 1 + (t >> 2) + (*ip++ << 2); 2265 3506 #endif 2266 2267 3507 NEED_OP(2); 3508 t = 2; COPY_DICT(t,m_off) 2268 3509 #else 2269 3510 #if defined(LZO1Z) 2270 2271 2272 2273 #else 2274 2275 2276 3511 t = 1 + (t << 6) + (*ip++ >> 2); 3512 m_pos = op - t; 3513 last_m_off = t; 3514 #else 3515 m_pos = op - 1; 3516 m_pos -= t >> 2; 3517 m_pos -= *ip++ << 2; 2277 3518 #endif 2278 TEST_LOOKBEHIND(m_pos,out); NEED_OP(2);2279 3519 TEST_LB(m_pos); NEED_OP(2); 3520 *op++ = *m_pos++; *op++ = *m_pos; 2280 3521 #endif 2281 2282 3522 goto match_done; 3523 } 2283 3524 2284 3525 #if defined(COPY_DICT) 2285 3526 2286 2287 3527 NEED_OP(t+3-1); 3528 t += 3-1; COPY_DICT(t,m_off) 2288 3529 2289 3530 #else 2290 3531 2291 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1);3532 TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); 2292 3533 #if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) 2293 3534 #if !defined(LZO_UNALIGNED_OK_4) 2294 2295 2296 2297 #else 2298 2299 2300 #endif 2301 * (lzo_uint32p) op = * (const lzo_uint32p) m_pos;2302 2303 2304 * (lzo_uint32p) op = * (const lzo_uint32p) m_pos;2305 2306 2307 2308 2309 3535 if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) 3536 { 3537 assert((op - m_pos) >= 4); 3538 #else 3539 if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) 3540 { 3541 #endif 3542 COPY4(op,m_pos); 3543 op += 4; m_pos += 4; t -= 4 - (3 - 1); 3544 do { 3545 COPY4(op,m_pos); 3546 op += 4; m_pos += 4; t -= 4; 3547 } while (t >= 4); 3548 if (t > 0) do *op++ = *m_pos++; while (--t > 0); 3549 } 3550 else 2310 3551 #endif 2311 3552 { 2312 3553 copy_match: 2313 2314 2315 3554 *op++ = *m_pos++; *op++ = *m_pos++; 3555 do *op++ = *m_pos++; while (--t > 0); 3556 } 2316 3557 2317 3558 #endif 2318 3559 2319 3560 match_done: 2320 3561 #if defined(LZO1Z) 2321 3562 t = ip[-1] & 3; 2322 3563 #else 2323 3564 t = ip[-2] & 3; 2324 3565 #endif 2325 2326 3566 if (t == 0) 3567 break; 2327 3568 2328 3569 match_next: 2329 assert(t > 0); NEED_OP(t); NEED_IP(t+1); 2330 do *op++ = *ip++; while (--t > 0); 2331 t = *ip++; 2332 } 3570 assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); 3571 #if 0 3572 do *op++ = *ip++; while (--t > 0); 3573 #else 3574 *op++ = *ip++; 3575 if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } 3576 #endif 3577 t = *ip++; 3578 } while (TEST_IP && TEST_OP); 2333 3579 } 2334 3580 2335 3581 #if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) 2336 *out_len = op - out;3582 *out_len = pd(op, out); 2337 3583 return LZO_E_EOF_NOT_FOUND; 2338 3584 #endif 2339 3585 2340 3586 eof_found: 2341 3587 assert(t == 1); 2342 *out_len = op - out;3588 *out_len = pd(op, out); 2343 3589 return (ip == ip_end ? LZO_E_OK : 2344 3590 (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); 2345 3591 2346 3592 #if defined(HAVE_NEED_IP) 2347 3593 input_overrun: 2348 *out_len = op - out;3594 *out_len = pd(op, out); 2349 3595 return LZO_E_INPUT_OVERRUN; 2350 3596 #endif 2351 3597 2352 3598 #if defined(HAVE_NEED_OP) 2353 3599 output_overrun: 2354 *out_len = op - out;3600 *out_len = pd(op, out); 2355 3601 return LZO_E_OUTPUT_OVERRUN; 2356 3602 #endif 2357 3603 2358 #if defined(LZO_TEST_ DECOMPRESS_OVERRUN_LOOKBEHIND)3604 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND) 2359 3605 lookbehind_overrun: 2360 *out_len = op - out;3606 *out_len = pd(op, out); 2361 3607 return LZO_E_LOOKBEHIND_OVERRUN; 2362 3608 #endif 2363 3609 } 2364 3610 2365 #define LZO_TEST_DECOMPRESS_OVERRUN 3611 #endif 3612 3613 #define LZO_TEST_OVERRUN 2366 3614 #undef DO_DECOMPRESS 2367 3615 #define DO_DECOMPRESS lzo1x_decompress_safe 2368 3616 2369 #if defined(LZO_TEST_DECOMPRESS_OVERRUN) 2370 # if !defined(LZO_TEST_DECOMPRESS_OVERRUN_INPUT) 2371 # define LZO_TEST_DECOMPRESS_OVERRUN_INPUT 2 3617 #if !defined(MINILZO_CFG_SKIP_LZO1X_DECOMPRESS_SAFE) 3618 3619 #if defined(LZO_TEST_OVERRUN) 3620 # if !defined(LZO_TEST_OVERRUN_INPUT) 3621 # define LZO_TEST_OVERRUN_INPUT 2 2372 3622 # endif 2373 # if !defined(LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT)2374 # define LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT 23623 # if !defined(LZO_TEST_OVERRUN_OUTPUT) 3624 # define LZO_TEST_OVERRUN_OUTPUT 2 2375 3625 # endif 2376 # if !defined(LZO_TEST_ DECOMPRESS_OVERRUN_LOOKBEHIND)2377 # define LZO_TEST_ DECOMPRESS_OVERRUN_LOOKBEHIND3626 # if !defined(LZO_TEST_OVERRUN_LOOKBEHIND) 3627 # define LZO_TEST_OVERRUN_LOOKBEHIND 2378 3628 # endif 2379 3629 #endif 2380 3630 2381 3631 #undef TEST_IP 2382 3632 #undef TEST_OP 2383 #undef TEST_LOOKBEHIND 3633 #undef TEST_LB 3634 #undef TEST_LBO 2384 3635 #undef NEED_IP 2385 3636 #undef NEED_OP 2386 3637 #undef HAVE_TEST_IP … … 2390 3641 #undef HAVE_ANY_IP 2391 3642 #undef HAVE_ANY_OP 2392 3643 2393 #if defined(LZO_TEST_ DECOMPRESS_OVERRUN_INPUT)2394 # if (LZO_TEST_ DECOMPRESS_OVERRUN_INPUT >= 1)3644 #if defined(LZO_TEST_OVERRUN_INPUT) 3645 # if (LZO_TEST_OVERRUN_INPUT >= 1) 2395 3646 # define TEST_IP (ip < ip_end) 2396 3647 # endif 2397 # if (LZO_TEST_ DECOMPRESS_OVERRUN_INPUT >= 2)3648 # if (LZO_TEST_OVERRUN_INPUT >= 2) 2398 3649 # define NEED_IP(x) \ 2399 3650 if ((lzo_uint)(ip_end - ip) < (lzo_uint)(x)) goto input_overrun 2400 3651 # endif 2401 3652 #endif 2402 3653 2403 #if defined(LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT)2404 # if (LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT >= 1)3654 #if defined(LZO_TEST_OVERRUN_OUTPUT) 3655 # if (LZO_TEST_OVERRUN_OUTPUT >= 1) 2405 3656 # define TEST_OP (op <= op_end) 2406 3657 # endif 2407 # if (LZO_TEST_ DECOMPRESS_OVERRUN_OUTPUT >= 2)3658 # if (LZO_TEST_OVERRUN_OUTPUT >= 2) 2408 3659 # undef TEST_OP 2409 3660 # define NEED_OP(x) \ 2410 3661 if ((lzo_uint)(op_end - op) < (lzo_uint)(x)) goto output_overrun 2411 3662 # endif 2412 3663 #endif 2413 3664 2414 #if defined(LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND) 2415 # define TEST_LOOKBEHIND(m_pos,out) if (m_pos < out) goto lookbehind_overrun 3665 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND) 3666 # define TEST_LB(m_pos) if (m_pos < out || m_pos >= op) goto lookbehind_overrun 3667 # define TEST_LBO(m_pos,o) if (m_pos < out || m_pos >= op - (o)) goto lookbehind_overrun 2416 3668 #else 2417 # define TEST_LOOKBEHIND(m_pos,op) ((void) 0) 3669 # define TEST_LB(m_pos) ((void) 0) 3670 # define TEST_LBO(m_pos,o) ((void) 0) 2418 3671 #endif 2419 3672 2420 3673 #if !defined(LZO_EOF_CODE) && !defined(TEST_IP) … … 2450 3703 # define HAVE_ANY_OP 2451 3704 #endif 2452 3705 3706 #undef __COPY4 3707 #define __COPY4(dst,src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src) 3708 3709 #undef COPY4 3710 #if defined(LZO_UNALIGNED_OK_4) 3711 # define COPY4(dst,src) __COPY4(dst,src) 3712 #elif defined(LZO_ALIGNED_OK_4) 3713 # define COPY4(dst,src) __COPY4((lzo_uintptr_t)(dst),(lzo_uintptr_t)(src)) 3714 #endif 3715 2453 3716 #if defined(DO_DECOMPRESS) 2454 3717 LZO_PUBLIC(int) 2455 DO_DECOMPRESS ( const lzo_byte *in , lzo_uint in_len,2456 lzo_byte *out, lzo_uint *out_len,2457 3718 DO_DECOMPRESS ( const lzo_bytep in , lzo_uint in_len, 3719 lzo_bytep out, lzo_uintp out_len, 3720 lzo_voidp wrkmem ) 2458 3721 #endif 2459 3722 { 2460 register lzo_byte *op;2461 register const lzo_byte *ip;3723 register lzo_bytep op; 3724 register const lzo_bytep ip; 2462 3725 register lzo_uint t; 2463 3726 #if defined(COPY_DICT) 2464 3727 lzo_uint m_off; 2465 const lzo_byte *dict_end;3728 const lzo_bytep dict_end; 2466 3729 #else 2467 register const lzo_byte *m_pos;3730 register const lzo_bytep m_pos; 2468 3731 #endif 2469 3732 2470 const lzo_byte *const ip_end = in + in_len;3733 const lzo_bytep const ip_end = in + in_len; 2471 3734 #if defined(HAVE_ANY_OP) 2472 lzo_byte *const op_end = out + *out_len;3735 lzo_bytep const op_end = out + *out_len; 2473 3736 #endif 2474 3737 #if defined(LZO1Z) 2475 3738 lzo_uint last_m_off = 0; … … 2477 3740 2478 3741 LZO_UNUSED(wrkmem); 2479 3742 2480 #if defined(__LZO_QUERY_DECOMPRESS)2481 if (__LZO_IS_DECOMPRESS_QUERY(in,in_len,out,out_len,wrkmem))2482 return __LZO_QUERY_DECOMPRESS(in,in_len,out,out_len,wrkmem,0,0);2483 #endif2484 2485 3743 #if defined(COPY_DICT) 2486 3744 if (dict) 2487 3745 { 2488 2489 2490 2491 2492 2493 3746 if (dict_len > M4_MAX_OFFSET) 3747 { 3748 dict += dict_len - M4_MAX_OFFSET; 3749 dict_len = M4_MAX_OFFSET; 3750 } 3751 dict_end = dict + dict_len; 2494 3752 } 2495 3753 else 2496 3754 { 2497 2498 3755 dict_len = 0; 3756 dict_end = NULL; 2499 3757 } 2500 3758 #endif 2501 3759 … … 2506 3764 2507 3765 if (*ip > 17) 2508 3766 { 2509 2510 2511 2512 2513 2514 3767 t = *ip++ - 17; 3768 if (t < 4) 3769 goto match_next; 3770 assert(t > 0); NEED_OP(t); NEED_IP(t+1); 3771 do *op++ = *ip++; while (--t > 0); 3772 goto first_literal_run; 2515 3773 } 2516 3774 2517 3775 while (TEST_IP && TEST_OP) 2518 3776 { 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 3777 t = *ip++; 3778 if (t >= 16) 3779 goto match; 3780 if (t == 0) 3781 { 3782 NEED_IP(1); 3783 while (*ip == 0) 3784 { 3785 t += 255; 3786 ip++; 3787 NEED_IP(1); 3788 } 3789 t += 15 + *ip++; 3790 } 3791 assert(t > 0); NEED_OP(t+3); NEED_IP(t+4); 2534 3792 #if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) 2535 3793 #if !defined(LZO_UNALIGNED_OK_4) 2536 2537 3794 if (PTR_ALIGNED2_4(op,ip)) 3795 { 2538 3796 #endif 2539 * (lzo_uint32p) op = * (const lzo_uint32p) ip;2540 2541 2542 2543 2544 2545 2546 * (lzo_uint32p) op = * (const lzo_uint32p) ip;2547 2548 2549 2550 2551 2552 2553 3797 COPY4(op,ip); 3798 op += 4; ip += 4; 3799 if (--t > 0) 3800 { 3801 if (t >= 4) 3802 { 3803 do { 3804 COPY4(op,ip); 3805 op += 4; ip += 4; t -= 4; 3806 } while (t >= 4); 3807 if (t > 0) do *op++ = *ip++; while (--t > 0); 3808 } 3809 else 3810 do *op++ = *ip++; while (--t > 0); 3811 } 2554 3812 #if !defined(LZO_UNALIGNED_OK_4) 2555 2556 3813 } 3814 else 2557 3815 #endif 2558 3816 #endif 2559 3817 #if !defined(LZO_UNALIGNED_OK_4) 2560 2561 2562 2563 3818 { 3819 *op++ = *ip++; *op++ = *ip++; *op++ = *ip++; 3820 do *op++ = *ip++; while (--t > 0); 3821 } 2564 3822 #endif 2565 3823 2566 3824 first_literal_run: 2567 3825 2568 2569 2570 3826 t = *ip++; 3827 if (t >= 16) 3828 goto match; 2571 3829 #if defined(COPY_DICT) 2572 3830 #if defined(LZO1Z) 2573 2574 3831 m_off = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); 3832 last_m_off = m_off; 2575 3833 #else 2576 3834 m_off = (1 + M2_MAX_OFFSET) + (t >> 2) + (*ip++ << 2); 2577 3835 #endif 2578 2579 3836 NEED_OP(3); 3837 t = 3; COPY_DICT(t,m_off) 2580 3838 #else 2581 3839 #if defined(LZO1Z) 2582 2583 2584 3840 t = (1 + M2_MAX_OFFSET) + (t << 6) + (*ip++ >> 2); 3841 m_pos = op - t; 3842 last_m_off = t; 2585 3843 #else 2586 2587 2588 3844 m_pos = op - (1 + M2_MAX_OFFSET); 3845 m_pos -= t >> 2; 3846 m_pos -= *ip++ << 2; 2589 3847 #endif 2590 TEST_LOOKBEHIND(m_pos,out); NEED_OP(3);2591 3848 TEST_LB(m_pos); NEED_OP(3); 3849 *op++ = *m_pos++; *op++ = *m_pos++; *op++ = *m_pos; 2592 3850 #endif 2593 3851 goto match_done; 2594 3852 2595 while (TEST_IP && TEST_OP) 2596 { 3853 do { 2597 3854 match: 2598 2599 3855 if (t >= 64) 3856 { 2600 3857 #if defined(COPY_DICT) 2601 3858 #if defined(LZO1X) 2602 2603 3859 m_off = 1 + ((t >> 2) & 7) + (*ip++ << 3); 3860 t = (t >> 5) - 1; 2604 3861 #elif defined(LZO1Y) 2605 2606 3862 m_off = 1 + ((t >> 2) & 3) + (*ip++ << 2); 3863 t = (t >> 4) - 3; 2607 3864 #elif defined(LZO1Z) 2608 2609 2610 2611 2612 2613 2614 2615 2616 3865 m_off = t & 0x1f; 3866 if (m_off >= 0x1c) 3867 m_off = last_m_off; 3868 else 3869 { 3870 m_off = 1 + (m_off << 6) + (*ip++ >> 2); 3871 last_m_off = m_off; 3872 } 3873 t = (t >> 5) - 1; 2617 3874 #endif 2618 3875 #else 2619 3876 #if defined(LZO1X) 2620 2621 2622 2623 3877 m_pos = op - 1; 3878 m_pos -= (t >> 2) & 7; 3879 m_pos -= *ip++ << 3; 3880 t = (t >> 5) - 1; 2624 3881 #elif defined(LZO1Y) 2625 2626 2627 2628 3882 m_pos = op - 1; 3883 m_pos -= (t >> 2) & 3; 3884 m_pos -= *ip++ << 2; 3885 t = (t >> 4) - 3; 2629 3886 #elif defined(LZO1Z) 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 #endif 2647 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1);2648 2649 #endif 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 3887 { 3888 lzo_uint off = t & 0x1f; 3889 m_pos = op; 3890 if (off >= 0x1c) 3891 { 3892 assert(last_m_off > 0); 3893 m_pos -= last_m_off; 3894 } 3895 else 3896 { 3897 off = 1 + (off << 6) + (*ip++ >> 2); 3898 m_pos -= off; 3899 last_m_off = off; 3900 } 3901 } 3902 t = (t >> 5) - 1; 3903 #endif 3904 TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); 3905 goto copy_match; 3906 #endif 3907 } 3908 else if (t >= 32) 3909 { 3910 t &= 31; 3911 if (t == 0) 3912 { 3913 NEED_IP(1); 3914 while (*ip == 0) 3915 { 3916 t += 255; 3917 ip++; 3918 NEED_IP(1); 3919 } 3920 t += 31 + *ip++; 3921 } 2665 3922 #if defined(COPY_DICT) 2666 3923 #if defined(LZO1Z) 2667 2668 3924 m_off = 1 + (ip[0] << 6) + (ip[1] >> 2); 3925 last_m_off = m_off; 2669 3926 #else 2670 3927 m_off = 1 + (ip[0] >> 2) + (ip[1] << 6); 2671 3928 #endif 2672 3929 #else 2673 3930 #if defined(LZO1Z) 2674 2675 2676 2677 2678 2679 #elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN)2680 2681 2682 #else 2683 2684 2685 #endif 2686 #endif 2687 2688 2689 2690 3931 { 3932 lzo_uint off = 1 + (ip[0] << 6) + (ip[1] >> 2); 3933 m_pos = op - off; 3934 last_m_off = off; 3935 } 3936 #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) 3937 m_pos = op - 1; 3938 m_pos -= (* (const lzo_ushortp) ip) >> 2; 3939 #else 3940 m_pos = op - 1; 3941 m_pos -= (ip[0] >> 2) + (ip[1] << 6); 3942 #endif 3943 #endif 3944 ip += 2; 3945 } 3946 else if (t >= 16) 3947 { 2691 3948 #if defined(COPY_DICT) 2692 3949 m_off = (t & 8) << 11; 2693 3950 #else 2694 2695 3951 m_pos = op; 3952 m_pos -= (t & 8) << 11; 2696 3953 #endif 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 3954 t &= 7; 3955 if (t == 0) 3956 { 3957 NEED_IP(1); 3958 while (*ip == 0) 3959 { 3960 t += 255; 3961 ip++; 3962 NEED_IP(1); 3963 } 3964 t += 7 + *ip++; 3965 } 2709 3966 #if defined(COPY_DICT) 2710 3967 #if defined(LZO1Z) 2711 3968 m_off += (ip[0] << 6) + (ip[1] >> 2); 2712 3969 #else 2713 3970 m_off += (ip[0] >> 2) + (ip[1] << 6); 2714 3971 #endif 2715 2716 2717 2718 3972 ip += 2; 3973 if (m_off == 0) 3974 goto eof_found; 3975 m_off += 0x4000; 2719 3976 #if defined(LZO1Z) 2720 3977 last_m_off = m_off; 2721 3978 #endif 2722 3979 #else 2723 3980 #if defined(LZO1Z) 2724 2725 #elif defined(LZO_UNALIGNED_OK_2) && (LZO_BYTE_ORDER == LZO_LITTLE_ENDIAN)2726 2727 #else 2728 2729 #endif 2730 2731 2732 2733 3981 m_pos -= (ip[0] << 6) + (ip[1] >> 2); 3982 #elif defined(LZO_UNALIGNED_OK_2) && defined(LZO_ABI_LITTLE_ENDIAN) 3983 m_pos -= (* (const lzo_ushortp) ip) >> 2; 3984 #else 3985 m_pos -= (ip[0] >> 2) + (ip[1] << 6); 3986 #endif 3987 ip += 2; 3988 if (m_pos == op) 3989 goto eof_found; 3990 m_pos -= 0x4000; 2734 3991 #if defined(LZO1Z) 2735 last_m_off = op - m_pos;3992 last_m_off = pd((const lzo_bytep)op, m_pos); 2736 3993 #endif 2737 3994 #endif 2738 2739 2740 3995 } 3996 else 3997 { 2741 3998 #if defined(COPY_DICT) 2742 3999 #if defined(LZO1Z) 2743 2744 4000 m_off = 1 + (t << 6) + (*ip++ >> 2); 4001 last_m_off = m_off; 2745 4002 #else 2746 4003 m_off = 1 + (t >> 2) + (*ip++ << 2); 2747 4004 #endif 2748 2749 4005 NEED_OP(2); 4006 t = 2; COPY_DICT(t,m_off) 2750 4007 #else 2751 4008 #if defined(LZO1Z) 2752 2753 2754 2755 #else 2756 2757 2758 4009 t = 1 + (t << 6) + (*ip++ >> 2); 4010 m_pos = op - t; 4011 last_m_off = t; 4012 #else 4013 m_pos = op - 1; 4014 m_pos -= t >> 2; 4015 m_pos -= *ip++ << 2; 2759 4016 #endif 2760 TEST_LOOKBEHIND(m_pos,out); NEED_OP(2);2761 4017 TEST_LB(m_pos); NEED_OP(2); 4018 *op++ = *m_pos++; *op++ = *m_pos; 2762 4019 #endif 2763 2764 4020 goto match_done; 4021 } 2765 4022 2766 4023 #if defined(COPY_DICT) 2767 4024 2768 2769 4025 NEED_OP(t+3-1); 4026 t += 3-1; COPY_DICT(t,m_off) 2770 4027 2771 4028 #else 2772 4029 2773 TEST_LOOKBEHIND(m_pos,out); assert(t > 0); NEED_OP(t+3-1);4030 TEST_LB(m_pos); assert(t > 0); NEED_OP(t+3-1); 2774 4031 #if defined(LZO_UNALIGNED_OK_4) || defined(LZO_ALIGNED_OK_4) 2775 4032 #if !defined(LZO_UNALIGNED_OK_4) 2776 2777 2778 2779 #else 2780 2781 2782 #endif 2783 * (lzo_uint32p) op = * (const lzo_uint32p) m_pos;2784 2785 2786 * (lzo_uint32p) op = * (const lzo_uint32p) m_pos;2787 2788 2789 2790 2791 4033 if (t >= 2 * 4 - (3 - 1) && PTR_ALIGNED2_4(op,m_pos)) 4034 { 4035 assert((op - m_pos) >= 4); 4036 #else 4037 if (t >= 2 * 4 - (3 - 1) && (op - m_pos) >= 4) 4038 { 4039 #endif 4040 COPY4(op,m_pos); 4041 op += 4; m_pos += 4; t -= 4 - (3 - 1); 4042 do { 4043 COPY4(op,m_pos); 4044 op += 4; m_pos += 4; t -= 4; 4045 } while (t >= 4); 4046 if (t > 0) do *op++ = *m_pos++; while (--t > 0); 4047 } 4048 else 2792 4049 #endif 2793 4050 { 2794 4051 copy_match: 2795 2796 2797 4052 *op++ = *m_pos++; *op++ = *m_pos++; 4053 do *op++ = *m_pos++; while (--t > 0); 4054 } 2798 4055 2799 4056 #endif 2800 4057 2801 4058 match_done: 2802 4059 #if defined(LZO1Z) 2803 4060 t = ip[-1] & 3; 2804 4061 #else 2805 4062 t = ip[-2] & 3; 2806 4063 #endif 2807 2808 4064 if (t == 0) 4065 break; 2809 4066 2810 4067 match_next: 2811 assert(t > 0); NEED_OP(t); NEED_IP(t+1); 2812 do *op++ = *ip++; while (--t > 0); 2813 t = *ip++; 2814 } 4068 assert(t > 0); assert(t < 4); NEED_OP(t); NEED_IP(t+1); 4069 #if 0 4070 do *op++ = *ip++; while (--t > 0); 4071 #else 4072 *op++ = *ip++; 4073 if (t > 1) { *op++ = *ip++; if (t > 2) { *op++ = *ip++; } } 4074 #endif 4075 t = *ip++; 4076 } while (TEST_IP && TEST_OP); 2815 4077 } 2816 4078 2817 4079 #if defined(HAVE_TEST_IP) || defined(HAVE_TEST_OP) 2818 *out_len = op - out;4080 *out_len = pd(op, out); 2819 4081 return LZO_E_EOF_NOT_FOUND; 2820 4082 #endif 2821 4083 2822 4084 eof_found: 2823 4085 assert(t == 1); 2824 *out_len = op - out;4086 *out_len = pd(op, out); 2825 4087 return (ip == ip_end ? LZO_E_OK : 2826 4088 (ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN)); 2827 4089 2828 4090 #if defined(HAVE_NEED_IP) 2829 4091 input_overrun: 2830 *out_len = op - out;4092 *out_len = pd(op, out); 2831 4093 return LZO_E_INPUT_OVERRUN; 2832 4094 #endif 2833 4095 2834 4096 #if defined(HAVE_NEED_OP) 2835 4097 output_overrun: 2836 *out_len = op - out;4098 *out_len = pd(op, out); 2837 4099 return LZO_E_OUTPUT_OVERRUN; 2838 4100 #endif 2839 4101 2840 #if defined(LZO_TEST_ DECOMPRESS_OVERRUN_LOOKBEHIND)4102 #if defined(LZO_TEST_OVERRUN_LOOKBEHIND) 2841 4103 lookbehind_overrun: 2842 *out_len = op - out;4104 *out_len = pd(op, out); 2843 4105 return LZO_E_LOOKBEHIND_OVERRUN; 2844 4106 #endif 2845 4107 } 2846 4108 4109 #endif 4110 2847 4111 /***** End of minilzo.c *****/ 2848 4112 -
libs/libmythtv/minilzo.h
diff -uNr mythtv-0.21-orig/libs/libmythtv/minilzo.h mythtv-0.21/libs/libmythtv/minilzo.h
old new 2 2 3 3 This file is part of the LZO real-time data compression library. 4 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 5 13 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer 6 14 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer 7 15 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer 8 16 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer 9 17 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer 18 All Rights Reserved. 10 19 11 20 The LZO library is free software; you can redistribute it and/or 12 21 modify it under the terms of the GNU General Public License as … … 21 30 You should have received a copy of the GNU General Public License 22 31 along with the LZO library; see the file COPYING. 23 32 If not, write to the Free Software Foundation, Inc., 24 5 9 Temple Place - Suite 330, Boston, MA 02111-1307, USA.33 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 34 26 35 Markus F.X.J. Oberhumer 27 <markus .oberhumer@jk.uni-linz.ac.at>28 http://w ildsau.idv.uni-linz.ac.at/mfx/lzo.html36 <markus@oberhumer.com> 37 http://www.oberhumer.com/opensource/lzo/ 29 38 */ 30 39 31 40 /* 32 41 * NOTE: 33 42 * the full LZO package can be found at 34 * http://w ildsau.idv.uni-linz.ac.at/mfx/lzo.html43 * http://www.oberhumer.com/opensource/lzo/ 35 44 */ 36 45 37 46 38 47 #ifndef __MINILZO_H 39 48 #define __MINILZO_H 40 49 41 #define MINILZO_VERSION 0x 107050 #define MINILZO_VERSION 0x2030 42 51 43 52 #ifdef __LZOCONF_H 44 53 # error "you cannot use both LZO and miniLZO" … … 72 81 73 82 /* compression */ 74 83 LZO_EXTERN(int) 75 lzo1x_1_compress ( const lzo_byte *src, lzo_uint src_len,76 lzo_byte *dst, lzo_uint *dst_len,84 lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len, 85 lzo_bytep dst, lzo_uintp dst_len, 77 86 lzo_voidp wrkmem ); 78 87 79 88 /* decompression */ 80 89 LZO_EXTERN(int) 81 lzo1x_decompress ( const lzo_byte *src, lzo_uint src_len,82 lzo_byte *dst, lzo_uint *dst_len,90 lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len, 91 lzo_bytep dst, lzo_uintp dst_len, 83 92 lzo_voidp wrkmem /* NOT USED */ ); 84 93 85 94 /* safe decompression with overrun testing */ 86 95 LZO_EXTERN(int) 87 lzo1x_decompress_safe ( const lzo_byte *src, lzo_uint src_len,88 lzo_byte *dst, lzo_uint *dst_len,96 lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len, 97 lzo_bytep dst, lzo_uintp dst_len, 89 98 lzo_voidp wrkmem /* NOT USED */ ); 90 99 91 100 -
libs/libmythtv/nuppeldecoder.cpp
diff -uNr mythtv-0.21-orig/libs/libmythtv/nuppeldecoder.cpp mythtv-0.21/libs/libmythtv/nuppeldecoder.cpp
old new 770 770 unsigned char *lstrm, VideoFrame *frame) 771 771 { 772 772 int r; 773 unsignedint out_len;773 lzo_uint out_len; 774 774 int compoff = 0; 775 775 776 776 unsigned char *outbuf = frame->buf;