# minilzo.cpp File Reference

-- mini subset of the LZO real-time data compression library More...

`#include "minilzo.h"`
`#include <sys/types.h>`
`#include <stdio.h>`
`#include <stddef.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <assert.h>`

Go to the source code of this file.

## Data Structures

union | lzo_full_align_t

## Defines

#define | LZO_DISABLE_CHECKS
#define | LZO1X
#define | __LZO_IN_MINILZO
#define | LZO_BUILD
#define | BOUNDS_CHECKING_OFF_DURING(stmt) stmt
#define | BOUNDS_CHECKING_OFF_IN_EXPR(expr) (expr)
#define | HAVE_MEMCMP
#define | HAVE_MEMCPY
#define | HAVE_MEMMOVE
#define | HAVE_MEMSET
#define | NDEBUG
#define | LZO_COMPILE_TIME_ASSERT(expr) { typedef int __lzo_compile_time_assert_fail[1 - 2 * !(expr)]; }
#define | LZO_UNUSED(var) ((void)&var)
#define | __inline__
#define | LZO_BYTE(x) ((unsigned char) ((x) & 0xff))
#define | LZO_MAX(a, b) ((a) >= (b) ? (a) : (b))
#define | LZO_MIN(a, b) ((a) <= (b) ? (a) : (b))
#define | LZO_MAX3(a, b, c) ((a) >= (b) ? LZO_MAX(a,c) : LZO_MAX(b,c))
#define | LZO_MIN3(a, b, c) ((a) <= (b) ? LZO_MIN(a,c) : LZO_MIN(b,c))
#define | lzo_sizeof(type) ((lzo_uint) (sizeof(type)))
#define | LZO_HIGH(array) ((lzo_uint) (sizeof(array)/sizeof(*(array))))
#define | LZO_SIZE(bits) (1u << (bits))
#define | LZO_MASK(bits) (LZO_SIZE(bits) - 1)
#define | LZO_LSIZE(bits) (1ul << (bits))
#define | LZO_LMASK(bits) (LZO_LSIZE(bits) - 1)
#define | LZO_USIZE(bits) ((lzo_uint) 1 << (bits))
#define | LZO_UMASK(bits) (LZO_USIZE(bits) - 1)
#define | LZO_STYPE_MAX(b) (((1l << (8*(b)-2)) - 1l) + (1l << (8*(b)-2)))
#define | LZO_UTYPE_MAX(b) (((1ul << (8*(b)-1)) - 1ul) + (1ul << (8*(b)-1)))
#define | SIZEOF_UNSIGNED 8
#define | SIZEOF_UNSIGNED_LONG 8
#define | SIZEOF_SIZE_T SIZEOF_UNSIGNED
#define | SIZE_T_MAX LZO_UTYPE_MAX(SIZEOF_SIZE_T)
#define | LZO_LITTLE_ENDIAN 1234
#define | LZO_BIG_ENDIAN 4321
#define | LZO_PDP_ENDIAN 3412
#define | LZO_OPTIMIZE_GNUC_i386_IS_BUGGY
#define | _LZO_STRINGIZE(x) #x
#define | _LZO_MEXPAND(x) _LZO_STRINGIZE(x)
#define | _LZO_CONCAT2(a, b) a ## b
#define | _LZO_CONCAT3(a, b, c) a ## b ## c
#define | _LZO_CONCAT4(a, b, c, d) a ## b ## c ## d
#define | _LZO_CONCAT5(a, b, c, d, e) a ## b ## c ## d ## e
#define | _LZO_ECONCAT2(a, b) _LZO_CONCAT2(a,b)
#define | _LZO_ECONCAT3(a, b, c) _LZO_CONCAT3(a,b,c)
#define | _LZO_ECONCAT4(a, b, c, d) _LZO_CONCAT4(a,b,c,d)
#define | _LZO_ECONCAT5(a, b, c, d, e) _LZO_CONCAT5(a,b,c,d,e)
#define | __LZO_HAVE_PTR_T
#define | PTR(a) ((lzo_ptr_t) (a))
#define | PTR_LINEAR(a) PTR(a)
#define | PTR_ALIGNED_4(a) ((PTR_LINEAR(a) & 3) == 0)
#define | PTR_ALIGNED_8(a) ((PTR_LINEAR(a) & 7) == 0)
#define | PTR_ALIGNED2_4(a, b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 3) == 0)
#define | PTR_ALIGNED2_8(a, b) (((PTR_LINEAR(a) | PTR_LINEAR(b)) & 7) == 0)
#define | PTR_LT(a, b) (PTR(a) < PTR(b))
#define | PTR_GE(a, b) (PTR(a) >= PTR(b))
#define | PTR_DIFF(a, b) ((lzo_ptrdiff_t) (PTR(a) - PTR(b)))
#define | pd(a, b) ((lzo_uint) ((a)-(b)))
#define | LZO_DETERMINISTIC
#define | LZO_DICT_USE_PTR
#define | lzo_dict_t const lzo_bytep
#define | lzo_dict_p lzo_dict_t __LZO_MMODEL *
#define | lzo_moff_t lzo_uint
#define | MEMCPY8_DS(dest, src, len)
#define | MEMCPY_DS(dest, src, len)
#define | MEMMOVE_DS(dest, src, len)
#define | BZERO8_PTR(s, l, n) lzo_memset((lzo_voidp)(s),0,(lzo_uint)(l)*(n))
#define | LZO_BASE 65521u
#define | LZO_NMAX 5552
#define | LZO_DO1(buf, i) {s1 += buf[i]; s2 += s1;}
#define | LZO_DO2(buf, i) LZO_DO1(buf,i); LZO_DO1(buf,i+1);
#define | LZO_DO4(buf, i) LZO_DO2(buf,i); LZO_DO2(buf,i+2);
#define | LZO_DO8(buf, i) LZO_DO4(buf,i); LZO_DO4(buf,i+4);
#define | LZO_DO16(buf, i) LZO_DO8(buf,i); LZO_DO8(buf,i+8);
#define | IS_SIGNED(type) (((type) (-1)) < ((type) 0))
#define | IS_UNSIGNED(type) (((type) (-1)) > ((type) 0))
#define | IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0)
#define | __lzo_assert(x) ((x) ? 1 : 0)
#define | COMPILE_TIME_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr)
#define | do_compress _lzo1x_1_do_compress
#define | LZO_NEED_DICT_H
#define | D_BITS 12
#define | D_INDEX1(d, p) d = DM((0x21*DX3(p,5,5,6)) >> 5)
#define | D_INDEX2(d, p) d = (d & (D_MASK & 0x7ff)) ^ (D_HIGH | 0x1f)
#define | LZO_EOF_CODE
#define | M1_MAX_OFFSET 0x0400
#define | M2_MAX_OFFSET 0x0800
#define | M3_MAX_OFFSET 0x4000
#define | M4_MAX_OFFSET 0xbfff
#define | MX_MAX_OFFSET (M1_MAX_OFFSET + M2_MAX_OFFSET)
#define | M1_MIN_LEN 2
#define | M1_MAX_LEN 2
#define | M2_MIN_LEN 3
#define | M2_MAX_LEN 8
#define | M3_MIN_LEN 3
#define | M3_MAX_LEN 33
#define | M4_MIN_LEN 3
#define | M4_MAX_LEN 9
#define | M1_MARKER 0
#define | M2_MARKER 64
#define | M3_MARKER 32
#define | M4_MARKER 16
#define | MIN_LOOKAHEAD (M2_MAX_LEN + 1)
#define | LZO_HASH LZO_HASH_LZO_INCREMENTAL_B
#define | DL_MIN_LEN M2_MIN_LEN
#define | D_SIZE LZO_SIZE(D_BITS)
#define | D_MASK LZO_MASK(D_BITS)
#define | D_HIGH ((D_MASK >> 1) + 1)
#define | DD_BITS 0
#define | DD_SIZE LZO_SIZE(DD_BITS)
#define | DD_MASK LZO_MASK(DD_BITS)
#define | DL_BITS (D_BITS - DD_BITS)
#define | DL_SIZE LZO_SIZE(DL_BITS)
#define | DL_MASK LZO_MASK(DL_BITS)
#define | DL_SHIFT ((DL_BITS + (DL_MIN_LEN - 1)) / DL_MIN_LEN)
#define | LZO_HASH_GZIP 1
#define | LZO_HASH_GZIP_INCREMENTAL 2
#define | LZO_HASH_LZO_INCREMENTAL_A 3
#define | LZO_HASH_LZO_INCREMENTAL_B 4
#define | _DV2_A(p, shift1, shift2) (((( (lzo_uint32)((p)[0]) << shift1) ^ (p)[1]) << shift2) ^ (p)[2])
#define | _DV2_B(p, shift1, shift2) (((( (lzo_uint32)((p)[2]) << shift1) ^ (p)[1]) << shift2) ^ (p)[0])
#define | _DV3_B(p, shift1, shift2, shift3) ((_DV2_B((p)+1,shift1,shift2) << (shift3)) ^ (p)[0])
#define | _DV_A(p, shift) _DV2_A(p,shift,shift)
#define | _DV_B(p, shift) _DV2_B(p,shift,shift)
#define | DA2(p, s1, s2) (((((lzo_uint32)((p)[2]) << (s2)) + (p)[1]) << (s1)) + (p)[0])
#define | DS2(p, s1, s2) (((((lzo_uint32)((p)[2]) << (s2)) - (p)[1]) << (s1)) - (p)[0])
#define | DX2(p, s1, s2) (((((lzo_uint32)((p)[2]) << (s2)) ^ (p)[1]) << (s1)) ^ (p)[0])
#define | DA3(p, s1, s2, s3) ((DA2((p)+1,s2,s3) << (s1)) + (p)[0])
#define | DS3(p, s1, s2, s3) ((DS2((p)+1,s2,s3) << (s1)) - (p)[0])
#define | DX3(p, s1, s2, s3) ((DX2((p)+1,s2,s3) << (s1)) ^ (p)[0])
#define | DMS(v, s) ((lzo_uint) (((v) & (D_MASK >> (s))) << (s)))
#define | DM(v) DMS(v,0)
#define | __LZO_HASH_INCREMENTAL
#define | DVAL_FIRST(dv, p) dv = _DV_B((p),5)
#define | DVAL_NEXT(dv, p) dv ^= p[-1]; dv = (((dv) >> 5) ^ ((lzo_uint32)(p[2]) << (2*5)))
#define | _DINDEX(dv, p) ((0x9f5f * (dv)) >> 5)
#define | DVAL_LOOKAHEAD DL_MIN_LEN
#define | DINDEX(dv, p) ((lzo_uint)((_DINDEX(dv,p)) & DL_MASK) << DD_BITS)
#define | DINDEX1 D_INDEX1
#define | DINDEX2 D_INDEX2
#define | DVAL_ASSERT(dv, p) ((void) 0)
#define | DENTRY(p, in) (p)
#define | GINDEX(m_pos, m_off, dict, dindex, in) m_pos = dict[dindex]
#define | UPDATE_D(dict, drun, dv, p, in) dict[ DINDEX(dv,p) ] = DENTRY(p,in)
#define | UPDATE_I(dict, drun, index, p, in) dict[index] = DENTRY(p,in)
#define | UPDATE_P(ptr, drun, p, in) (ptr)[0] = DENTRY(p,in)
#define | LZO_CHECK_MPOS_DET(m_pos, m_off, in, ip, max_offset) (m_pos == NULL || (m_off = (lzo_moff_t) (ip - m_pos)) > max_offset)
#define | LZO_CHECK_MPOS_NON_DET(m_pos, m_off, in, ip, max_offset)
#define | LZO_CHECK_MPOS LZO_CHECK_MPOS_NON_DET
#define | DO_COMPRESS lzo1x_1_compress
#define | DO_DECOMPRESS lzo1x_decompress
#define | TEST_LOOKBEHIND(m_pos, op) ((void) 0)
#define | TEST_IP 1
#define | TEST_OP 1
#define | NEED_IP(x) ((void) 0)
#define | NEED_OP(x) ((void) 0)
#define | __COPY4(dst, src) * (lzo_uint32p)(dst) = * (const lzo_uint32p)(src)
#define | LZO_TEST_DECOMPRESS_OVERRUN
#define | DO_DECOMPRESS lzo1x_decompress_safe
#define | LZO_TEST_DECOMPRESS_OVERRUN_INPUT 2
#define | LZO_TEST_DECOMPRESS_OVERRUN_OUTPUT 2
#define | LZO_TEST_DECOMPRESS_OVERRUN_LOOKBEHIND

## Typedefs

typedef ptrdiff_t | lzo_ptrdiff_t
typedef unsigned long | lzo_ptr_t
typedef long | lzo_sptr_t

## Functions

| LZO_EXTERN (const lzo_byte *) lzo_copyright()
| __lzo_ptr_linear (const lzo_voidp ptr)
| lzo_adler32 (lzo_uint32 adler, const lzo_byte *buf, lzo_uint len)
static lzo_uint | do_compress (const lzo_byte *in, lzo_uint in_len, lzo_byte *out, lzo_uintp out_len, lzo_voidp wrkmem)
| DO_COMPRESS (const lzo_byte *in, lzo_uint in_len, lzo_byte *out, lzo_uintp out_len, lzo_voidp wrkmem)
| DO_DECOMPRESS (const lzo_byte *in, lzo_uint in_len, lzo_byte *out, lzo_uintp out_len, lzo_voidp wrkmem)

## Variables

__LZO_EXTERN_C int | __lzo_init_done
__LZO_EXTERN_C const lzo_byte | __lzo_copyright []
__LZO_EXTERN_C const lzo_uint32 | _lzo_crc32_table [256]

## Detailed Description

-- mini subset of the LZO real-time data compression library

This file is part of the LZO real-time data compression library.

Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer All Rights Reserved.

The LZO library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The LZO library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

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.

Markus F.X.J. Oberhumer <markus@oberhumer.com> http://www.oberhumer.com/opensource/lzo/

NOTE: the full LZO package can be found at http://www.oberhumer.com/opensource/lzo/

Definition in file minilzo.cpp.

## Define Documentation

#define LZO_CHECK_MPOS_NON_DET | ( | m_pos,
|  | m_off,
|  | in,
|  | ip,
|  | max_offset |  | ) |

Value:

    (BOUNDS_CHECKING_OFF_IN_EXPR( \
        (PTR_LT(m_pos,in) || \
         (m_off = (lzo_moff_t) PTR_DIFF(ip,m_pos)) <= 0 || \
          m_off > max_offset) ))

Definition at line 973 of file minilzo.cpp.

#define MEMCPY8_DS | ( | dest,
|  | src,
|  | len |  | ) |

Value:

    memcpy(dest,src,len); \
      dest += len; \
      src += len

Definition at line 466 of file minilzo.cpp.

#define MEMCPY_DS | ( | dest,
|  | src,
|  | len |  | ) |

Value:

    do *dest++ = *src++; \
      while (--len > 0)

Definition at line 508 of file minilzo.cpp.

#define MEMMOVE_DS | ( | dest,
|  | src,
|  | len |  | ) |

Value:

    do *dest++ = *src++; \
      while (--len > 0)

Definition at line 512 of file minilzo.cpp.

## Variable Documentation

const lzo_byte __lzo_copyright

Initial value:

      LZO_VERSION_STRING

Definition at line 271 of file minilzo.cpp.