]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Move MiniLZO to separate directory.
authorSimon Josefsson <simon@josefsson.org>
Tue, 12 Jul 2005 10:27:37 +0000 (10:27 +0000)
committerSimon Josefsson <simon@josefsson.org>
Tue, 12 Jul 2005 10:27:37 +0000 (10:27 +0000)
Update from MiniLZO 2.00 to 2.01.

12 files changed:
configure.in
lib/gnutls_compress_int.c
libextra/Makefile.am
libextra/gnutls_extra.c
libextra/minilzo/.cvsignore [new file with mode: 0644]
libextra/minilzo/Makefile.am [new file with mode: 0644]
libextra/minilzo/README.LZO [new file with mode: 0644]
libextra/minilzo/lzoconf.h [moved from libextra/lzoconf.h with 95% similarity]
libextra/minilzo/lzodefs.h [moved from libextra/lzodefs.h with 96% similarity]
libextra/minilzo/minilzo.c [moved from libextra/minilzo.c with 98% similarity]
libextra/minilzo/minilzo.h [moved from libextra/minilzo.h with 98% similarity]
libextra/minilzo/testmini.c [new file with mode: 0644]

index a3958f9b32709380d1017ecbb3affa9c3cb3335b..67e55a445e73ed11ddf2fb7881914922153a6f45 100644 (file)
@@ -513,6 +513,7 @@ AC_CONFIG_FILES([Makefile \
        includes/Makefile includes/gnutls/gnutls.h \
        lib/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
        libextra/Makefile libextra/openpgp/Makefile libextra/opencdk/Makefile \
+       libextra/minilzo/Makefile \
        src/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
        src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
        lib/libgnutls-config libextra/libgnutls-extra-config \
index 76942446ef23aa0eb303e87b7ad6464814027d00..0925048800df78dfe34db3df548b1d79a22b5634 100644 (file)
 
 #ifdef USE_LZO
 # ifdef USE_MINILZO
-#  include "../libextra/minilzo.h"     /* get the prototypes only.
-                                        * Since LZO is a GPLed library, the gnutls_global_init_extra() has
-                                        * to be called, before LZO compression can be used.
-                                        */
+/* Get the prototypes only.  Since LZO is a GPLed library, the
+ * gnutls_global_init_extra() has to be called, before LZO compression
+ * can be used.
+ */
+#  include "../libextra/minilzo/minilzo.h"
 # else
 #  include <lzo1x.h>
 # endif
index df80f89493e23f7d1badc6100d28425d1481559c..df9b2c03bdb8045edd7237f5234ff246caed83bd 100644 (file)
@@ -93,21 +93,20 @@ libgnutls_extra_la_LDFLAGS += $(LIBOPENCDK_LIBS)
 endif
 endif
 
-# LZO
-
-LZO_OBJECTS = 
-if ENABLE_INCLUDED_LZO
-LZO_OBJECTS += lzodefs.h lzoconf.h minilzo.h minilzo.c
-endif
-
 libgnutls_extra_la_LDFLAGS += -export-symbols-regex '^gnutls.*' \
        -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
        $(LZO_LIBS)
 
-libgnutls_extra_la_SOURCES = $(COBJECTS) $(LZO_OBJECTS) gnutls_extra.h
+libgnutls_extra_la_SOURCES = $(COBJECTS) gnutls_extra.h
 
 libgnutls_extra_la_LIBADD += ../lib/libgnutls.la ../gl/libgnu.la
 
+# LZO
+
+if ENABLE_INCLUDED_LZO
+SUBDIRS += minilzo
+libgnutls_extra_la_LIBADD += minilzo/libminilzo.la
+endif
 
 gnutls-extra-api.texi: $(COBJECTS)
        @echo "" > gnutls-extra-api.texi
index 20c2706fee87c8c2e045da36eb297ae48dd1e963..42752b5039cb0b711c5d23f4d1074ca45104f52c 100644 (file)
@@ -30,7 +30,7 @@
 #include <gnutls_algorithms.h>
 #ifdef USE_LZO
 # ifdef USE_MINILZO
-#  include "minilzo.h"
+#  include "minilzo/minilzo.h"
 # else
 #  include <lzo1x.h>
 # endif
diff --git a/libextra/minilzo/.cvsignore b/libextra/minilzo/.cvsignore
new file mode 100644 (file)
index 0000000..ff0e08d
--- /dev/null
@@ -0,0 +1,7 @@
+.deps
+.libs
+Makefile
+Makefile.in
+libminilzo.la
+minilzo.lo
+testmini
diff --git a/libextra/minilzo/Makefile.am b/libextra/minilzo/Makefile.am
new file mode 100644 (file)
index 0000000..edde7fc
--- /dev/null
@@ -0,0 +1,32 @@
+## Process this file with automake to produce Makefile.in
+# Copyright (C) 2005 Free Software Foundation
+#
+# Author: Simon Josefsson
+#
+# This file is part of GNUTLS-EXTRA.
+#
+# GNUTLS-EXTRA 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.
+#
+# GNUTLS-EXTRA 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 GNUTLS-EXTRA; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+LDADD = libminilzo.la
+
+noinst_LTLIBRARIES = libminilzo.la
+
+libminilzo_la_SOURCES = lzoconf.h lzodefs.h minilzo.c minilzo.h
+
+EXTRA_DIST = README.LZO
+
+TESTS = testmini
+check_PROGRAMS = testmini
diff --git a/libextra/minilzo/README.LZO b/libextra/minilzo/README.LZO
new file mode 100644 (file)
index 0000000..85d39e3
--- /dev/null
@@ -0,0 +1,123 @@
+
+ ============================================================================
+ miniLZO -- mini subset of the LZO real-time data compression library
+ ============================================================================
+
+ Author  : Markus Franz Xaver Johannes Oberhumer
+           <markus@oberhumer.com>
+           http://www.oberhumer.com/opensource/lzo/
+ Version : 2.01
+ Date    : 27 Jun 2005
+
+ I've created miniLZO for projects where it is inconvenient to
+ include (or require) the full LZO source code just because you
+ want to add a little bit of data compression to your application.
+
+ miniLZO implements the LZO1X-1 compressor and both the standard and
+ safe LZO1X decompressor. Apart from fast compression it also useful
+ for situations where you want to use pre-compressed data files (which
+ must have been compressed with LZO1X-999).
+
+ miniLZO consists of one C source file and three header files:
+    minilzo.c
+    minilzo.h, lzoconf.h, lzodefs.h
+
+ To use miniLZO just copy these files into your source directory, add
+ minilzo.c to your Makefile and #include minilzo.h from your program.
+ Note: you also must distribute this file (`README.LZO') with your project.
+
+ minilzo.o compiles to about 6 kB (using gcc or Visual C on a i386), and
+ the sources are about 30 kB when packed with zip - so there's no more
+ excuse that your application doesn't support data compression :-)
+
+ For more information, documentation, example programs and other support
+ files (like Makefiles and build scripts) please download the full LZO
+ package from
+    http://www.oberhumer.com/opensource/lzo/
+
+ Have fun,
+  Markus
+
+
+ P.S. minilzo.c is generated automatically from the LZO sources and
+      therefore functionality is completely identical
+
+
+ Appendix A: building miniLZO
+ ----------------------------
+ miniLZO is written such a way that it should compile and run
+ out-of-the-box on most machines.
+
+ If you are running on a very unusual architecture and lzo_init() fails then
+ you should first recompile with `-DLZO_DEBUG' to see what causes the failure.
+ The most probable case is something like `sizeof(char *) != sizeof(long)'.
+ After identifying the problem you can compile by adding some defines
+ like `-DSIZEOF_CHAR_P=8' to your Makefile.
+
+ The best solution is (of course) using Autoconf - if your project uses
+ Autoconf anyway just add `-DMINILZO_HAVE_CONFIG_H' to your compiler
+ flags when compiling minilzo.c. See the LZO distribution for an example
+ how to set up configure.in.
+
+
+ Appendix B: list of public functions available in miniLZO
+ ---------------------------------------------------------
+ Library initialization
+    lzo_init()
+
+ Compression
+    lzo1x_1_compress()
+
+ Decompression
+    lzo1x_decompress()
+    lzo1x_decompress_safe()
+
+ Checksum functions
+    lzo_adler32()
+
+ Version functions
+    lzo_version()
+    lzo_version_string()
+    lzo_version_date()
+
+ Portable (but slow) string functions
+    lzo_memcmp()
+    lzo_memcpy()
+    lzo_memmove()
+    lzo_memset()
+
+
+ Appendix C: suggested macros for `configure.in' when using Autoconf
+ -------------------------------------------------------------------
+ Checks for typedefs and structures
+    AC_CHECK_TYPE(ptrdiff_t,long)
+    AC_TYPE_SIZE_T
+    AC_CHECK_SIZEOF(short)
+    AC_CHECK_SIZEOF(int)
+    AC_CHECK_SIZEOF(long)
+    AC_CHECK_SIZEOF(long long)
+    AC_CHECK_SIZEOF(__int64)
+    AC_CHECK_SIZEOF(void *)
+    AC_CHECK_SIZEOF(size_t)
+    AC_CHECK_SIZEOF(ptrdiff_t)
+
+ Checks for compiler characteristics
+    AC_C_CONST
+
+ Checks for library functions
+    AC_CHECK_FUNCS(memcmp memcpy memmove memset)
+
+
+ Appendix D: Copyright
+ ---------------------
+ LZO and miniLZO are Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2005 Markus Franz Xaver Johannes Oberhumer
+
+ LZO and miniLZO are distributed under the terms of the GNU General
+ Public License (GPL).  See the file COPYING.
+
+ Special licenses for commercial and other applications which
+ are not willing to accept the GNU General Public License
+ are available by contacting the author.
+
+
similarity index 95%
rename from libextra/lzoconf.h
rename to libextra/minilzo/lzoconf.h
index 6b69d9371c74bf5ef7378bda75736943761f5cbf..38bab068cda9fffcac938858eaf52fe9aef6b701 100644 (file)
@@ -38,9 +38,9 @@
 #ifndef __LZOCONF_H_INCLUDED
 #define __LZOCONF_H_INCLUDED
 
-#define LZO_VERSION             0x2000
-#define LZO_VERSION_STRING      "2.00"
-#define LZO_VERSION_DATE        "May 30 2005"
+#define LZO_VERSION             0x2010
+#define LZO_VERSION_STRING      "2.01"
+#define LZO_VERSION_DATE        "Jun 27 2005"
 
 /* internal Autoconf configuration file - only used when building LZO */
 #if defined(LZO_HAVE_CONFIG_H)
@@ -247,15 +247,15 @@ typedef int
 
 typedef int
 (__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 );
+                                         lzo_bytep dst, lzo_uintp dst_len,
+                                         lzo_voidp wrkmem,
+                                   const lzo_bytep dict, lzo_uint dict_len );
 
 typedef int
 (__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 );
+                                           lzo_bytep dst, lzo_uintp dst_len,
+                                           lzo_voidp wrkmem,
+                                     const lzo_bytep dict, lzo_uint dict_len );
 
 
 /* Callback interface. Currently only the progress indicator ("nprogress")
similarity index 96%
rename from libextra/lzodefs.h
rename to libextra/minilzo/lzodefs.h
index 202e897ec00d4f9d3f9f587bfc1caa5ac20e393f..ec9ea4976054bf2d5ad74506ddd0177228a7e8ee 100644 (file)
 #  else
 #    define LZO_INFO_CCVER      "unknown"
 #  endif
+#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__)
+#  define LZO_CC_SDCC           1
+#  define LZO_INFO_CC           "sdcc"
+#  define LZO_INFO_CCVER        LZO_CPP_MACRO_EXPAND(SDCC)
 #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__)
 #  define LZO_CC_PATHSCALE      (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__)
 #  define LZO_INFO_CC           "Pathscale C"
 #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__)
 #  define LZO_ARCH_AVR              1
 #  define LZO_INFO_ARCH             "avr"
+#elif defined(__bfin__)
+#  define LZO_ARCH_BLACKFIN         1
+#  define LZO_INFO_ARCH             "blackfin"
 #elif (UINT_MAX == LZO_0xffffL) && defined(__C166__)
 #  define LZO_ARCH_C166             1
 #  define LZO_INFO_ARCH             "c166"
+#elif defined(__cris__)
+#  define LZO_ARCH_CRIS             1
+#  define LZO_INFO_ARCH             "cris"
+#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
+#  define LZO_ARCH_H8300            1
+#  define LZO_INFO_ARCH             "h8300"
 #elif defined(__hppa__) || defined(__hppa)
 #  define LZO_ARCH_HPPA             1
 #  define LZO_INFO_ARCH             "hppa"
 #elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
 #  define LZO_ARCH_IA64             1
 #  define LZO_INFO_ARCH             "ia64"
+#elif defined(__m32r__)
+#  define LZO_ARCH_M32R             1
+#  define LZO_INFO_ARCH             "m32r"
 #elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(_M_M68K)
 #  define LZO_ARCH_M68K             1
 #  define LZO_INFO_ARCH             "m68k"
 #elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8)
 #  define LZO_ARCH_SPARC            1
 #  define LZO_INFO_ARCH             "sparc"
+#elif (UINT_MAX == LZO_0xffffL) && defined(__z80)
+#  define LZO_ARCH_Z80              1
+#  define LZO_INFO_ARCH             "z80"
 #else
 #  define LZO_ARCH_UNKNOWN          1
 #  define LZO_INFO_ARCH             "unknown"
 #  endif
 #endif
 #if (LZO_ARCH_I386)
-#  if (UINT_MAX != LZO_0xffffffffL)
+#  if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__)
+#    error "this should not happen"
+#  endif
+#  if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__)
 #    error "this should not happen"
 #  endif
 #  if (ULONG_MAX != LZO_0xffffffffL)
@@ -917,6 +939,17 @@ extern "C" {
 #endif
 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
+#  if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__)
+#    if (LZO_CC_GNUC >= 0x030300ul)
+#      if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0)
+#        define LZO_SIZEOF_LONG_LONG      LZO_SIZEOF_LONG
+#      endif
+#    endif
+#  endif
+#endif
+#endif
+#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
+#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
 #if (LZO_ARCH_I086 && LZO_CC_DMC)
 #elif (LZO_CC_CILLY) && defined(__GNUC__)
 #  define LZO_SIZEOF_LONG_LONG      8
@@ -948,6 +981,7 @@ extern "C" {
 #  define LZO_SIZEOF_LONG_LONG      8
 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64)
 #  define LZO_SIZEOF_LONG_LONG      8
+#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2)
 #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
 #  define LZO_SIZEOF_LONG_LONG      8
 #endif
@@ -967,8 +1001,20 @@ extern "C" {
 #  else
 #    error "LZO_MM"
 #  endif
-#elif (LZO_ARCH_AVR || LZO_ARCH_C166 || LZO_ARCH_I086 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251)
+#elif (LZO_ARCH_AVR || LZO_ARCH_C166 || LZO_ARCH_I086 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_Z80)
 #  define LZO_SIZEOF_VOID_P         2
+#elif (LZO_ARCH_H8300)
+#  if defined(__NORMAL_MODE__)
+#    define LZO_SIZEOF_VOID_P       2
+#  elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
+#    define LZO_SIZEOF_VOID_P       4
+#  else
+#    define LZO_SIZEOF_VOID_P       2
+#  endif
+#  if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4)
+#    define LZO_SIZEOF_SIZE_T       LZO_SIZEOF_INT
+#    define LZO_SIZEOF_PTRDIFF_T    LZO_SIZEOF_INT
+#  endif
 #elif (LZO_OS_CONSOLE_PS2)
 #  define LZO_SIZEOF_VOID_P         4
 #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__))
similarity index 98%
rename from libextra/minilzo.c
rename to libextra/minilzo/minilzo.c
index d98e32434226af4af75832e1569ac23699171ff3..c30e25d90d1c2137275f53ecccdb5e809e0fbc65 100644 (file)
 #  else
 #    define LZO_INFO_CCVER      "unknown"
 #  endif
+#elif 0 && defined(SDCC) && defined(__VERSION__) && !defined(__GNUC__)
+#  define LZO_CC_SDCC           1
+#  define LZO_INFO_CC           "sdcc"
+#  define LZO_INFO_CCVER        LZO_CPP_MACRO_EXPAND(SDCC)
 #elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__)
 #  define LZO_CC_PATHSCALE      (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__)
 #  define LZO_INFO_CC           "Pathscale C"
 #elif (UINT_MAX <= LZO_0xffffL) && defined(__AVR__)
 #  define LZO_ARCH_AVR              1
 #  define LZO_INFO_ARCH             "avr"
+#elif defined(__bfin__)
+#  define LZO_ARCH_BLACKFIN         1
+#  define LZO_INFO_ARCH             "blackfin"
 #elif (UINT_MAX == LZO_0xffffL) && defined(__C166__)
 #  define LZO_ARCH_C166             1
 #  define LZO_INFO_ARCH             "c166"
+#elif defined(__cris__)
+#  define LZO_ARCH_CRIS             1
+#  define LZO_INFO_ARCH             "cris"
+#elif defined(__H8300__) || defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
+#  define LZO_ARCH_H8300            1
+#  define LZO_INFO_ARCH             "h8300"
 #elif defined(__hppa__) || defined(__hppa)
 #  define LZO_ARCH_HPPA             1
 #  define LZO_INFO_ARCH             "hppa"
 #elif defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
 #  define LZO_ARCH_IA64             1
 #  define LZO_INFO_ARCH             "ia64"
+#elif defined(__m32r__)
+#  define LZO_ARCH_M32R             1
+#  define LZO_INFO_ARCH             "m32r"
 #elif (LZO_OS_TOS) || defined(__m68k__) || defined(__m68000__) || defined(__mc68000__) || defined(_M_M68K)
 #  define LZO_ARCH_M68K             1
 #  define LZO_INFO_ARCH             "m68k"
 #elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8)
 #  define LZO_ARCH_SPARC            1
 #  define LZO_INFO_ARCH             "sparc"
+#elif (UINT_MAX == LZO_0xffffL) && defined(__z80)
+#  define LZO_ARCH_Z80              1
+#  define LZO_INFO_ARCH             "z80"
 #else
 #  define LZO_ARCH_UNKNOWN          1
 #  define LZO_INFO_ARCH             "unknown"
 #  endif
 #endif
 #if (LZO_ARCH_I386)
-#  if (UINT_MAX != LZO_0xffffffffL)
+#  if (UINT_MAX != LZO_0xffffL) && defined(__i386_int16__)
+#    error "this should not happen"
+#  endif
+#  if (UINT_MAX != LZO_0xffffffffL) && !defined(__i386_int16__)
 #    error "this should not happen"
 #  endif
 #  if (ULONG_MAX != LZO_0xffffffffL)
@@ -938,6 +960,17 @@ extern "C" {
 #endif
 #if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
 #if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
+#  if defined(__LONG_MAX__) && defined(__LONG_LONG_MAX__)
+#    if (LZO_CC_GNUC >= 0x030300ul)
+#      if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0)
+#        define LZO_SIZEOF_LONG_LONG      LZO_SIZEOF_LONG
+#      endif
+#    endif
+#  endif
+#endif
+#endif
+#if !defined(LZO_SIZEOF_LONG_LONG) && !defined(LZO_SIZEOF___INT64)
+#if (LZO_SIZEOF_LONG > 0 && LZO_SIZEOF_LONG < 8)
 #if (LZO_ARCH_I086 && LZO_CC_DMC)
 #elif (LZO_CC_CILLY) && defined(__GNUC__)
 #  define LZO_SIZEOF_LONG_LONG      8
@@ -969,6 +1002,7 @@ extern "C" {
 #  define LZO_SIZEOF_LONG_LONG      8
 #elif (defined(__vms) || defined(__VMS)) && (__INITIAL_POINTER_SIZE+0 == 64)
 #  define LZO_SIZEOF_LONG_LONG      8
+#elif (LZO_CC_SDCC) && (LZO_SIZEOF_INT == 2)
 #elif 1 && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
 #  define LZO_SIZEOF_LONG_LONG      8
 #endif
@@ -988,8 +1022,20 @@ extern "C" {
 #  else
 #    error "LZO_MM"
 #  endif
-#elif (LZO_ARCH_AVR || LZO_ARCH_C166 || LZO_ARCH_I086 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251)
+#elif (LZO_ARCH_AVR || LZO_ARCH_C166 || LZO_ARCH_I086 || LZO_ARCH_MCS51 || LZO_ARCH_MCS251 || LZO_ARCH_Z80)
 #  define LZO_SIZEOF_VOID_P         2
+#elif (LZO_ARCH_H8300)
+#  if defined(__NORMAL_MODE__)
+#    define LZO_SIZEOF_VOID_P       2
+#  elif defined(__H8300H__) || defined(__H8300S__) || defined(__H8300SX__)
+#    define LZO_SIZEOF_VOID_P       4
+#  else
+#    define LZO_SIZEOF_VOID_P       2
+#  endif
+#  if (LZO_CC_GNUC && (LZO_CC_GNUC < 0x040000ul)) && (LZO_SIZEOF_INT == 4)
+#    define LZO_SIZEOF_SIZE_T       LZO_SIZEOF_INT
+#    define LZO_SIZEOF_PTRDIFF_T    LZO_SIZEOF_INT
+#  endif
 #elif (LZO_OS_CONSOLE_PS2)
 #  define LZO_SIZEOF_VOID_P         4
 #elif (LZO_SIZEOF_LONG == 8) && ((defined(__mips__) && defined(__R5900__)) || defined(__MIPS_PSX2__))
@@ -1457,7 +1503,7 @@ extern "C" {
 #undef LZO_HAVE_CONFIG_H
 #include "minilzo.h"
 
-#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2000)
+#if !defined(MINILZO_VERSION) || (MINILZO_VERSION != 0x2010)
 #  error "version mismatch in miniLZO source files"
 #endif
 
@@ -1880,7 +1926,7 @@ _lzo_version_date(void)
 #define LZO_BASE 65521u
 #define LZO_NMAX 5552
 
-#define LZO_DO1(buf,i)  {s1 += buf[i]; s2 += s1;}
+#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);
@@ -1917,6 +1963,12 @@ lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len)
     return (s2 << 16) | s1;
 }
 
+#undef LZO_DO1
+#undef LZO_DO2
+#undef LZO_DO4
+#undef LZO_DO8
+#undef LZO_DO16
+
 #undef lzo_memcmp
 #undef lzo_memcpy
 #undef lzo_memmove
@@ -1932,7 +1984,6 @@ lzo_adler32(lzo_uint32 adler, const lzo_bytep buf, lzo_uint len)
 #define lzo_hmemcpy             lzo_memcpy
 #define lzo_hmemmove            lzo_memmove
 #define lzo_hmemset             lzo_memset
-#define LZO_WANT_ACCLIB_HMEMCPY 1
 #define __LZOLIB_HMEMCPY_CH_INCLUDED 1
 #if !defined(LZOLIB_PUBLIC)
 #  define LZOLIB_PUBLIC(r,f)    r __LZOLIB_FUNCNAME(f)
similarity index 98%
rename from libextra/minilzo.h
rename to libextra/minilzo/minilzo.h
index c4ee40d643b421bfd340c292d4632cb0e687f5b5..b74e8838147b389b461d03a52f9836cca81211ae 100644 (file)
@@ -44,7 +44,7 @@
 #ifndef __MINILZO_H
 #define __MINILZO_H
 
-#define MINILZO_VERSION         0x2000
+#define MINILZO_VERSION         0x2010
 
 #ifdef __LZOCONF_H
 #  error "you cannot use both LZO and miniLZO"
diff --git a/libextra/minilzo/testmini.c b/libextra/minilzo/testmini.c
new file mode 100644 (file)
index 0000000..ed1eafa
--- /dev/null
@@ -0,0 +1,153 @@
+/* testmini.c -- very simple test program for the miniLZO library
+
+   This file is part of the LZO real-time data compression library.
+
+   Copyright (C) 1996-2005 Markus Franz Xaver Johannes Oberhumer
+
+   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>
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+/*************************************************************************
+// This program shows the basic usage of the LZO library.
+// We will compress a block of data and decompress again.
+//
+// For more information, documentation, example programs and other support
+// files (like Makefiles and build scripts) please download the full LZO
+// package from
+//    http://www.oberhumer.com/opensource/lzo/
+**************************************************************************/
+
+/* First let's include "minizo.h". */
+
+#include "minilzo.h"
+
+
+/* We want to compress the data block at `in' with length `IN_LEN' to
+ * the block at `out'. Because the input block may be incompressible,
+ * we must provide a little more output space in case that compression
+ * is not possible.
+ */
+
+#if defined(__LZO_STRICT_16BIT)
+#define IN_LEN      (8*1024u)
+#elif defined(LZO_ARCH_I086) && !defined(LZO_HAVE_MM_HUGE_ARRAY)
+#define IN_LEN      (60*1024u)
+#else
+#define IN_LEN      (128*1024ul)
+#endif
+#define OUT_LEN     (IN_LEN + IN_LEN / 16 + 64 + 3)
+
+static unsigned char __LZO_MMODEL in  [ IN_LEN ];
+static unsigned char __LZO_MMODEL out [ OUT_LEN ];
+
+
+/* Work-memory needed for compression. Allocate memory in units
+ * of `lzo_align_t' (instead of `char') to make sure it is properly aligned.
+ */
+
+#define HEAP_ALLOC(var,size) \
+    lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]
+
+static HEAP_ALLOC(wrkmem,LZO1X_1_MEM_COMPRESS);
+
+
+/*************************************************************************
+//
+**************************************************************************/
+
+int main(int argc, char *argv[])
+{
+    int r;
+    lzo_uint in_len;
+    lzo_uint out_len;
+    lzo_uint new_len;
+
+    if (argc < 0 && argv == NULL)   /* avoid warning about unused args */
+        return 0;
+
+    printf("\nLZO real-time data compression library (v%s, %s).\n",
+            lzo_version_string(), lzo_version_date());
+    printf("Copyright (C) 1996-2005 Markus Franz Xaver Johannes Oberhumer\nAll Rights Reserved.\n\n");
+
+
+/*
+ * Step 1: initialize the LZO library
+ */
+    if (lzo_init() != LZO_E_OK)
+    {
+        printf("internal error - lzo_init() failed !!!\n");
+        printf("(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable `-DLZO_DEBUG' for diagnostics)\n");
+        return 3;
+    }
+
+/*
+ * Step 2: prepare the input block that will get compressed.
+ *         We just fill it with zeros in this example program,
+ *         but you would use your real-world data here.
+ */
+    in_len = IN_LEN;
+    lzo_memset(in,0,in_len);
+
+/*
+ * Step 3: compress from `in' to `out' with LZO1X-1
+ */
+    r = lzo1x_1_compress(in,in_len,out,&out_len,wrkmem);
+    if (r == LZO_E_OK)
+        printf("compressed %lu bytes into %lu bytes\n",
+            (unsigned long) in_len, (unsigned long) out_len);
+    else
+    {
+        /* this should NEVER happen */
+        printf("internal error - compression failed: %d\n", r);
+        return 2;
+    }
+    /* check for an incompressible block */
+    if (out_len >= in_len)
+    {
+        printf("This block contains incompressible data.\n");
+        return 0;
+    }
+
+/*
+ * Step 4: decompress again, now going from `out' to `in'
+ */
+    r = lzo1x_decompress(out,out_len,in,&new_len,NULL);
+    if (r == LZO_E_OK && new_len == in_len)
+        printf("decompressed %lu bytes back into %lu bytes\n",
+            (unsigned long) out_len, (unsigned long) in_len);
+    else
+    {
+        /* this should NEVER happen */
+        printf("internal error - decompression failed: %d\n", r);
+        return 1;
+    }
+
+    printf("\nminiLZO simple compression test passed.\n");
+    return 0;
+}
+
+/*
+vi:ts=4
+*/
+