|
|
|
@ -1,9 +1,13 @@
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
|
|
/** @file lzoconf.h -- configuration for the LZO real-time data compression library
|
|
|
|
|
/* lzoconf.h -- configuration for the LZO real-time data compression library
|
|
|
|
|
|
|
|
|
|
This file is part of the LZO real-time data compression library.
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
|
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
|
|
|
@ -26,34 +30,32 @@
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with the LZO library; see the file COPYING.
|
|
|
|
|
If not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
Markus F.X.J. Oberhumer
|
|
|
|
|
<markus@oberhumer.com> http://www.oberhumer.com/opensource/lzo/
|
|
|
|
|
<markus@oberhumer.com>
|
|
|
|
|
http://www.oberhumer.com/opensource/lzo/
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef LZOCONF_H
|
|
|
|
|
#define LZOCONF_H
|
|
|
|
|
#ifndef __LZOCONF_H_INCLUDED
|
|
|
|
|
#define __LZOCONF_H_INCLUDED
|
|
|
|
|
|
|
|
|
|
#define LZO_VERSION 0x1080
|
|
|
|
|
#define LZO_VERSION_STRING "1.08"
|
|
|
|
|
#define LZO_VERSION_DATE "Jul 12 2002"
|
|
|
|
|
#define LZO_VERSION 0x2030
|
|
|
|
|
#define LZO_VERSION_STRING "2.03"
|
|
|
|
|
#define LZO_VERSION_DATE "Apr 30 2008"
|
|
|
|
|
|
|
|
|
|
/* internal Autoconf configuration file - only used when building LZO */
|
|
|
|
|
#if defined(LZO_HAVE_CONFIG_H)
|
|
|
|
|
# include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* LZO requires a conforming <limits.h>
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
// LZO requires a conforming <limits.h>
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
|
|
|
|
# error "invalid CHAR_BIT"
|
|
|
|
@ -65,111 +67,61 @@ extern "C" {
|
|
|
|
|
# error "your limits.h macros are broken"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* workaround a cpp bug under hpux 10.20 */
|
|
|
|
|
#define LZO_0xffffffffL 4294967295ul
|
|
|
|
|
|
|
|
|
|
#if !defined(LZO_UINT32_C)
|
|
|
|
|
# if (UINT_MAX < LZO_0xffffffffL)
|
|
|
|
|
# define LZO_UINT32_C(c) c ## UL
|
|
|
|
|
# else
|
|
|
|
|
# define LZO_UINT32_C(c) c ## U
|
|
|
|
|
# endif
|
|
|
|
|
/* get OS and architecture defines */
|
|
|
|
|
#ifndef __LZODEFS_H_INCLUDED
|
|
|
|
|
#include "lzodefs.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* architecture defines
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
#if !defined(__LZO_WIN) && !defined(__LZO_DOS) && !defined(__LZO_OS2)
|
|
|
|
|
# if defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
|
|
|
|
|
# define __LZO_WIN
|
|
|
|
|
# elif defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
|
|
|
|
# define __LZO_WIN
|
|
|
|
|
# elif defined(__NT__) || defined(__NT_DLL__) || defined(__WINDOWS_386__)
|
|
|
|
|
# define __LZO_WIN
|
|
|
|
|
# elif defined(__DOS__) || defined(__MSDOS__) || defined(MSDOS)
|
|
|
|
|
# define __LZO_DOS
|
|
|
|
|
# elif defined(__OS2__) || defined(__OS2V2__) || defined(OS2)
|
|
|
|
|
# define __LZO_OS2
|
|
|
|
|
# elif defined(__palmos__)
|
|
|
|
|
# define __LZO_PALMOS
|
|
|
|
|
# elif defined(__TOS__) || defined(__atarist__)
|
|
|
|
|
# define __LZO_TOS
|
|
|
|
|
# endif
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if (UINT_MAX < LZO_0xffffffffL)
|
|
|
|
|
# if defined(__LZO_WIN)
|
|
|
|
|
# define __LZO_WIN16
|
|
|
|
|
# elif defined(__LZO_DOS)
|
|
|
|
|
# define __LZO_DOS16
|
|
|
|
|
# elif defined(__LZO_PALMOS)
|
|
|
|
|
# define __LZO_PALMOS16
|
|
|
|
|
# elif defined(__LZO_TOS)
|
|
|
|
|
# define __LZO_TOS16
|
|
|
|
|
# elif defined(__C166__)
|
|
|
|
|
# else
|
|
|
|
|
/* porting hint: for pure 16-bit architectures try compiling
|
|
|
|
|
* everything with -D__LZO_STRICT_16BIT */
|
|
|
|
|
# error "16-bit target not supported - contact me for porting hints"
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if !defined(__LZO_i386)
|
|
|
|
|
# if defined(__LZO_DOS) || defined(__LZO_WIN16)
|
|
|
|
|
# define __LZO_i386
|
|
|
|
|
# elif defined(__i386__) || defined(__386__) || defined(_M_IX86)
|
|
|
|
|
# define __LZO_i386
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
// some core defines
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
#if defined(__LZO_STRICT_16BIT)
|
|
|
|
|
#if !defined(LZO_UINT32_C)
|
|
|
|
|
# if (UINT_MAX < LZO_0xffffffffL)
|
|
|
|
|
# include <lzo16bit.h>
|
|
|
|
|
# define LZO_UINT32_C(c) c ## UL
|
|
|
|
|
# else
|
|
|
|
|
# define LZO_UINT32_C(c) ((c) + 0U)
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* memory checkers */
|
|
|
|
|
#if !defined(__LZO_CHECKER)
|
|
|
|
|
# if defined(__BOUNDS_CHECKING_ON)
|
|
|
|
|
# define __LZO_CHECKER
|
|
|
|
|
# define __LZO_CHECKER 1
|
|
|
|
|
# elif defined(__CHECKER__)
|
|
|
|
|
# define __LZO_CHECKER
|
|
|
|
|
# define __LZO_CHECKER 1
|
|
|
|
|
# elif defined(__INSURE__)
|
|
|
|
|
# define __LZO_CHECKER
|
|
|
|
|
# define __LZO_CHECKER 1
|
|
|
|
|
# elif defined(__PURIFY__)
|
|
|
|
|
# define __LZO_CHECKER
|
|
|
|
|
# define __LZO_CHECKER 1
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* integral and pointer types
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
// integral and pointer types
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Integral types with 32 bits or more */
|
|
|
|
|
#if !defined(LZO_UINT32_MAX)
|
|
|
|
|
# if (UINT_MAX >= LZO_0xffffffffL)
|
|
|
|
|
typedef unsigned int lzo_uint32;
|
|
|
|
|
typedef int lzo_int32;
|
|
|
|
|
# define LZO_UINT32_MAX UINT_MAX
|
|
|
|
|
# define LZO_INT32_MAX INT_MAX
|
|
|
|
|
# define LZO_INT32_MIN INT_MIN
|
|
|
|
|
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
|
|
|
|
typedef unsigned long lzo_uint32;
|
|
|
|
|
typedef long lzo_int32;
|
|
|
|
|
# define LZO_UINT32_MAX ULONG_MAX
|
|
|
|
|
# define LZO_INT32_MAX LONG_MAX
|
|
|
|
|
# define LZO_INT32_MIN LONG_MIN
|
|
|
|
|
# else
|
|
|
|
|
# error "lzo_uint32"
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* lzo_uint is used like size_t */
|
|
|
|
|
/* lzo_uint should match size_t */
|
|
|
|
|
#if !defined(LZO_UINT_MAX)
|
|
|
|
|
# if (UINT_MAX >= LZO_0xffffffffL)
|
|
|
|
|
# if defined(LZO_ABI_LLP64) /* WIN64 */
|
|
|
|
|
# if defined(LZO_OS_WIN64)
|
|
|
|
|
typedef unsigned __int64 lzo_uint;
|
|
|
|
|
typedef __int64 lzo_int;
|
|
|
|
|
# else
|
|
|
|
|
typedef unsigned long long lzo_uint;
|
|
|
|
|
typedef long long lzo_int;
|
|
|
|
|
# endif
|
|
|
|
|
# define LZO_UINT_MAX 0xffffffffffffffffull
|
|
|
|
|
# define LZO_INT_MAX 9223372036854775807LL
|
|
|
|
|
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
|
|
|
|
# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
|
|
|
|
|
typedef unsigned int lzo_uint;
|
|
|
|
|
typedef int lzo_int;
|
|
|
|
|
# define LZO_UINT_MAX UINT_MAX
|
|
|
|
@ -186,51 +138,45 @@ extern "C" {
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef int lzo_bool;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* memory models
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Memory model for the public code segment. */
|
|
|
|
|
#if !defined(__LZO_CMODEL)
|
|
|
|
|
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
|
|
|
# define __LZO_CMODEL __far
|
|
|
|
|
# elif defined(__LZO_i386) && defined(__WATCOMC__)
|
|
|
|
|
# define __LZO_CMODEL __near
|
|
|
|
|
/* Integral types with 32 bits or more. */
|
|
|
|
|
#if !defined(LZO_UINT32_MAX)
|
|
|
|
|
# if (UINT_MAX >= LZO_0xffffffffL)
|
|
|
|
|
typedef unsigned int lzo_uint32;
|
|
|
|
|
typedef int lzo_int32;
|
|
|
|
|
# define LZO_UINT32_MAX UINT_MAX
|
|
|
|
|
# define LZO_INT32_MAX INT_MAX
|
|
|
|
|
# define LZO_INT32_MIN INT_MIN
|
|
|
|
|
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
|
|
|
|
typedef unsigned long lzo_uint32;
|
|
|
|
|
typedef long lzo_int32;
|
|
|
|
|
# define LZO_UINT32_MAX ULONG_MAX
|
|
|
|
|
# define LZO_INT32_MAX LONG_MAX
|
|
|
|
|
# define LZO_INT32_MIN LONG_MIN
|
|
|
|
|
# else
|
|
|
|
|
# define __LZO_CMODEL
|
|
|
|
|
# error "lzo_uint32"
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Memory model for the public data segment. */
|
|
|
|
|
#if !defined(__LZO_DMODEL)
|
|
|
|
|
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
|
|
|
# define __LZO_DMODEL __far
|
|
|
|
|
# elif defined(__LZO_i386) && defined(__WATCOMC__)
|
|
|
|
|
# define __LZO_DMODEL __near
|
|
|
|
|
# else
|
|
|
|
|
# define __LZO_DMODEL
|
|
|
|
|
# endif
|
|
|
|
|
/* The larger type of lzo_uint and lzo_uint32. */
|
|
|
|
|
#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
|
|
|
|
|
# define lzo_xint lzo_uint
|
|
|
|
|
#else
|
|
|
|
|
# define lzo_xint lzo_uint32
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Memory model that allows to access memory at offsets of lzo_uint. */
|
|
|
|
|
#if !defined(__LZO_MMODEL)
|
|
|
|
|
# if (LZO_UINT_MAX <= UINT_MAX)
|
|
|
|
|
# define __LZO_MMODEL
|
|
|
|
|
# elif defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
|
|
|
# elif defined(LZO_HAVE_MM_HUGE_PTR)
|
|
|
|
|
# define __LZO_MMODEL_HUGE 1
|
|
|
|
|
# define __LZO_MMODEL __huge
|
|
|
|
|
# define LZO_999_UNSUPPORTED
|
|
|
|
|
# elif defined(__LZO_PALMOS16) || defined(__LZO_TOS16)
|
|
|
|
|
# define __LZO_MMODEL
|
|
|
|
|
# else
|
|
|
|
|
# error "__LZO_MMODEL"
|
|
|
|
|
# define __LZO_MMODEL
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* no typedef here because of const-pointer issues */
|
|
|
|
|
#define lzo_byte unsigned char __LZO_MMODEL
|
|
|
|
|
#define lzo_bytep unsigned char __LZO_MMODEL *
|
|
|
|
|
#define lzo_charp char __LZO_MMODEL *
|
|
|
|
|
#define lzo_voidp void __LZO_MMODEL *
|
|
|
|
@ -240,19 +186,20 @@ typedef int lzo_bool;
|
|
|
|
|
#define lzo_int32p lzo_int32 __LZO_MMODEL *
|
|
|
|
|
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
|
|
|
|
#define lzo_intp lzo_int __LZO_MMODEL *
|
|
|
|
|
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
|
|
|
|
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
|
|
|
|
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
|
|
|
|
/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
|
|
|
|
|
#define lzo_byte unsigned char __LZO_MMODEL
|
|
|
|
|
|
|
|
|
|
#ifndef lzo_sizeof_dict_t
|
|
|
|
|
# define lzo_sizeof_dict_t sizeof(lzo_bytep)
|
|
|
|
|
#endif
|
|
|
|
|
typedef int lzo_bool;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* calling conventions and function types
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
// function types
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
/* linkage */
|
|
|
|
|
/* name mangling */
|
|
|
|
|
#if !defined(__LZO_EXTERN_C)
|
|
|
|
|
# ifdef __cplusplus
|
|
|
|
|
# define __LZO_EXTERN_C extern "C"
|
|
|
|
@ -263,120 +210,95 @@ typedef int lzo_bool;
|
|
|
|
|
|
|
|
|
|
/* calling convention */
|
|
|
|
|
#if !defined(__LZO_CDECL)
|
|
|
|
|
# if defined(__LZO_DOS16) || defined(__LZO_WIN16)
|
|
|
|
|
# define __LZO_CDECL __LZO_CMODEL __cdecl
|
|
|
|
|
# elif defined(__LZO_i386) && defined(_MSC_VER)
|
|
|
|
|
# define __LZO_CDECL __LZO_CMODEL __cdecl
|
|
|
|
|
# elif defined(__LZO_i386) && defined(__WATCOMC__)
|
|
|
|
|
# define __LZO_CDECL __LZO_CMODEL __cdecl
|
|
|
|
|
# else
|
|
|
|
|
# define __LZO_CDECL __LZO_CMODEL
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(__LZO_ENTRY)
|
|
|
|
|
# define __LZO_ENTRY __LZO_CDECL
|
|
|
|
|
# define __LZO_CDECL __lzo_cdecl
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* C++ exception specification for extern "C" function types */
|
|
|
|
|
#if !defined(__cplusplus)
|
|
|
|
|
# undef LZO_NOTHROW
|
|
|
|
|
# define LZO_NOTHROW
|
|
|
|
|
#elif !defined(LZO_NOTHROW)
|
|
|
|
|
# define LZO_NOTHROW
|
|
|
|
|
/* DLL export information */
|
|
|
|
|
#if !defined(__LZO_EXPORT1)
|
|
|
|
|
# define __LZO_EXPORT1
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(__LZO_EXPORT2)
|
|
|
|
|
# define __LZO_EXPORT2
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* __cdecl calling convention for public C and assembly functions */
|
|
|
|
|
#if !defined(LZO_PUBLIC)
|
|
|
|
|
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(LZO_EXTERN)
|
|
|
|
|
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(LZO_PRIVATE)
|
|
|
|
|
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* function types */
|
|
|
|
|
typedef int
|
|
|
|
|
(__LZO_ENTRY *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len,
|
|
|
|
|
lzo_byte *dst, lzo_uintp dst_len,
|
|
|
|
|
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
|
|
|
|
lzo_bytep dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem );
|
|
|
|
|
|
|
|
|
|
typedef int
|
|
|
|
|
(__LZO_ENTRY *lzo_decompress_t) ( const lzo_byte *src, lzo_uint src_len,
|
|
|
|
|
lzo_byte *dst, lzo_uintp dst_len,
|
|
|
|
|
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
|
|
|
|
lzo_bytep dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem );
|
|
|
|
|
|
|
|
|
|
typedef int
|
|
|
|
|
(__LZO_ENTRY *lzo_optimize_t) ( lzo_byte *src, lzo_uint src_len,
|
|
|
|
|
lzo_byte *dst, lzo_uintp dst_len,
|
|
|
|
|
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
|
|
|
|
lzo_bytep dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem );
|
|
|
|
|
|
|
|
|
|
typedef int
|
|
|
|
|
(__LZO_ENTRY *lzo_compress_dict_t)(const lzo_byte *src, lzo_uint src_len,
|
|
|
|
|
lzo_byte *dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem,
|
|
|
|
|
const lzo_byte *dict, lzo_uint dict_len );
|
|
|
|
|
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
|
|
|
|
lzo_bytep dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem,
|
|
|
|
|
const lzo_bytep dict, lzo_uint dict_len );
|
|
|
|
|
|
|
|
|
|
typedef int
|
|
|
|
|
(__LZO_ENTRY *lzo_decompress_dict_t)(const lzo_byte *src, lzo_uint src_len,
|
|
|
|
|
lzo_byte *dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem,
|
|
|
|
|
const lzo_byte *dict, lzo_uint dict_len );
|
|
|
|
|
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
|
|
|
|
lzo_bytep dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem,
|
|
|
|
|
const lzo_bytep dict, lzo_uint dict_len );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* assembler versions always use __cdecl */
|
|
|
|
|
typedef int
|
|
|
|
|
(__LZO_CDECL *lzo_compress_asm_t)( const lzo_byte *src, lzo_uint src_len,
|
|
|
|
|
lzo_byte *dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem );
|
|
|
|
|
/* Callback interface. Currently only the progress indicator ("nprogress")
|
|
|
|
|
* is used, but this may change in a future release. */
|
|
|
|
|
|
|
|
|
|
typedef int
|
|
|
|
|
(__LZO_CDECL *lzo_decompress_asm_t)( const lzo_byte *src, lzo_uint src_len,
|
|
|
|
|
lzo_byte *dst, lzo_uintp dst_len,
|
|
|
|
|
lzo_voidp wrkmem );
|
|
|
|
|
struct lzo_callback_t;
|
|
|
|
|
typedef struct lzo_callback_t lzo_callback_t;
|
|
|
|
|
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
|
|
|
|
|
|
|
|
|
/* malloc & free function types */
|
|
|
|
|
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
|
|
|
|
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
|
|
|
|
typedef void (__LZO_CDECL *lzo_free_func_t)
|
|
|
|
|
(lzo_callback_p self, lzo_voidp ptr);
|
|
|
|
|
|
|
|
|
|
/* a progress indicator callback function */
|
|
|
|
|
typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
|
|
|
|
|
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
|
|
|
|
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
|
|
|
|
|
|
|
|
|
struct lzo_callback_t
|
|
|
|
|
{
|
|
|
|
|
/* custom allocators (set to 0 to disable) */
|
|
|
|
|
lzo_alloc_func_t nalloc; /* [not used right now] */
|
|
|
|
|
lzo_free_func_t nfree; /* [not used right now] */
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* export information
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
/* a progress indicator callback function (set to 0 to disable) */
|
|
|
|
|
lzo_progress_func_t nprogress;
|
|
|
|
|
|
|
|
|
|
/* DLL export information */
|
|
|
|
|
#if !defined(__LZO_EXPORT1)
|
|
|
|
|
# define __LZO_EXPORT1
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(__LZO_EXPORT2)
|
|
|
|
|
# define __LZO_EXPORT2
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* exported calling convention for C functions */
|
|
|
|
|
#if !defined(LZO_PUBLIC)
|
|
|
|
|
# define LZO_PUBLIC(_rettype) \
|
|
|
|
|
__LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_ENTRY
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(LZO_EXTERN)
|
|
|
|
|
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(LZO_PRIVATE)
|
|
|
|
|
# define LZO_PRIVATE(_rettype) static _rettype __LZO_ENTRY
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* exported __cdecl calling convention for assembler functions */
|
|
|
|
|
#if !defined(LZO_PUBLIC_CDECL)
|
|
|
|
|
# define LZO_PUBLIC_CDECL(_rettype) \
|
|
|
|
|
__LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(LZO_EXTERN_CDECL)
|
|
|
|
|
# define LZO_EXTERN_CDECL(_rettype) __LZO_EXTERN_C LZO_PUBLIC_CDECL(_rettype)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* exported global variables (LZO currently uses no static variables and
|
|
|
|
|
* is fully thread safe) */
|
|
|
|
|
#if !defined(LZO_PUBLIC_VAR)
|
|
|
|
|
# define LZO_PUBLIC_VAR(_type) \
|
|
|
|
|
__LZO_EXPORT1 _type __LZO_EXPORT2 __LZO_DMODEL
|
|
|
|
|
#endif
|
|
|
|
|
#if !defined(LZO_EXTERN_VAR)
|
|
|
|
|
# define LZO_EXTERN_VAR(_type) extern LZO_PUBLIC_VAR(_type)
|
|
|
|
|
#endif
|
|
|
|
|
/* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
|
|
|
|
|
* callbacks points back to this struct, so you are free to store
|
|
|
|
|
* some extra info in the following variables. */
|
|
|
|
|
lzo_voidp user1;
|
|
|
|
|
lzo_xint user2;
|
|
|
|
|
lzo_xint user3;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
* error codes and prototypes
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
// error codes and prototypes
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Error codes for the compression/decompression functions. Negative
|
|
|
|
|
* values are errors, positive values will be used for special but
|
|
|
|
@ -384,33 +306,38 @@ typedef void (__LZO_ENTRY *lzo_progress_callback_t) (lzo_uint, lzo_uint);
|
|
|
|
|
*/
|
|
|
|
|
#define LZO_E_OK 0
|
|
|
|
|
#define LZO_E_ERROR (-1)
|
|
|
|
|
#define LZO_E_OUT_OF_MEMORY (-2) /* not used right now */
|
|
|
|
|
#define LZO_E_NOT_COMPRESSIBLE (-3) /* not used right now */
|
|
|
|
|
#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
|
|
|
|
|
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
|
|
|
|
#define LZO_E_INPUT_OVERRUN (-4)
|
|
|
|
|
#define LZO_E_OUTPUT_OVERRUN (-5)
|
|
|
|
|
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
|
|
|
|
#define LZO_E_EOF_NOT_FOUND (-7)
|
|
|
|
|
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
|
|
|
|
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef lzo_sizeof_dict_t
|
|
|
|
|
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* lzo_init() should be the first function you call.
|
|
|
|
|
* Check the return code !
|
|
|
|
|
*
|
|
|
|
|
* lzo_init() is a macro to allow checking that the library and the
|
|
|
|
|
* compiler's view of various types are consistent.
|
|
|
|
|
*/
|
|
|
|
|
#define lzo_init() __lzo_init2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
|
|
|
|
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
|
|
|
|
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
|
|
|
|
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
|
|
|
|
(int)sizeof(lzo_compress_t))
|
|
|
|
|
LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int);
|
|
|
|
|
(int)sizeof(lzo_callback_t))
|
|
|
|
|
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
|
|
|
|
|
|
|
|
|
/* version functions (useful for shared libraries) */
|
|
|
|
|
LZO_EXTERN(unsigned) lzo_version();
|
|
|
|
|
LZO_EXTERN(const char *) lzo_version_string();
|
|
|
|
|
LZO_EXTERN(const char *) lzo_version_date();
|
|
|
|
|
LZO_EXTERN(const lzo_charp) _lzo_version_string();
|
|
|
|
|
LZO_EXTERN(const lzo_charp) _lzo_version_date();
|
|
|
|
|
LZO_EXTERN(unsigned) lzo_version(void);
|
|
|
|
|
LZO_EXTERN(const char *) lzo_version_string(void);
|
|
|
|
|
LZO_EXTERN(const char *) lzo_version_date(void);
|
|
|
|
|
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
|
|
|
|
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
|
|
|
|
|
|
|
|
|
/* string functions */
|
|
|
|
|
LZO_EXTERN(int)
|
|
|
|
@ -424,13 +351,14 @@ lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
|
|
|
|
|
|
|
|
|
|
/* checksum functions */
|
|
|
|
|
LZO_EXTERN(lzo_uint32)
|
|
|
|
|
lzo_adler32(lzo_uint32 _adler, const lzo_byte *_buf, lzo_uint _len);
|
|
|
|
|
lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len);
|
|
|
|
|
LZO_EXTERN(lzo_uint32)
|
|
|
|
|
lzo_crc32(lzo_uint32 _c, const lzo_byte *_buf, lzo_uint _len);
|
|
|
|
|
lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len);
|
|
|
|
|
LZO_EXTERN(const lzo_uint32p)
|
|
|
|
|
lzo_get_crc32_table(void);
|
|
|
|
|
|
|
|
|
|
/* misc. */
|
|
|
|
|
LZO_EXTERN(lzo_bool) lzo_assert(int _expr);
|
|
|
|
|
LZO_EXTERN(int) _lzo_config_check();
|
|
|
|
|
LZO_EXTERN(int) _lzo_config_check(void);
|
|
|
|
|
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
|
|
|
|
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
|
|
|
|
typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
|
|
|
|
@ -440,12 +368,50 @@ LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
|
|
|
|
|
#define LZO_PTR_ALIGN_UP(_ptr,_size) \
|
|
|
|
|
((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
|
|
|
|
|
|
|
|
|
|
/* deprecated - only for backward compatibility */
|
|
|
|
|
#define LZO_ALIGN(_ptr,_size) LZO_PTR_ALIGN_UP(_ptr,_size)
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
|
// deprecated macros - only for backward compatibility with LZO v1.xx
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
#if defined(LZO_CFG_COMPAT)
|
|
|
|
|
|
|
|
|
|
#define __LZOCONF_H 1
|
|
|
|
|
|
|
|
|
|
#if defined(LZO_ARCH_I086)
|
|
|
|
|
# define __LZO_i386 1
|
|
|
|
|
#elif defined(LZO_ARCH_I386)
|
|
|
|
|
# define __LZO_i386 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(LZO_OS_DOS16)
|
|
|
|
|
# define __LZO_DOS 1
|
|
|
|
|
# define __LZO_DOS16 1
|
|
|
|
|
#elif defined(LZO_OS_DOS32)
|
|
|
|
|
# define __LZO_DOS 1
|
|
|
|
|
#elif defined(LZO_OS_WIN16)
|
|
|
|
|
# define __LZO_WIN 1
|
|
|
|
|
# define __LZO_WIN16 1
|
|
|
|
|
#elif defined(LZO_OS_WIN32)
|
|
|
|
|
# define __LZO_WIN 1
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define __LZO_CMODEL
|
|
|
|
|
#define __LZO_DMODEL
|
|
|
|
|
#define __LZO_ENTRY __LZO_CDECL
|
|
|
|
|
#define LZO_EXTERN_CDECL LZO_EXTERN
|
|
|
|
|
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
|
|
|
|
|
|
|
|
|
#define lzo_compress_asm_t lzo_compress_t
|
|
|
|
|
#define lzo_decompress_asm_t lzo_decompress_t
|
|
|
|
|
|
|
|
|
|
#endif /* LZO_CFG_COMPAT */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
} /* extern "C" */
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* LZOCONF_H */
|
|
|
|
|
#endif /* already included */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* vim:set ts=4 et: */
|
|
|
|
|