summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpcg <pcg>2003-12-23 04:52:00 +0000
committerpcg <pcg>2003-12-23 04:52:00 +0000
commitd5607e01318876986723cab8e02cb479c7636e5d (patch)
tree3ad20b59dc62ff1ef5511538c5f899b14c5e6231
parent3d0092ba13033a7f502240c12b748cebe6ed84cf (diff)
*** empty log message ***
-rw-r--r--Changes6
-rw-r--r--LICENSE2
-rw-r--r--Makefile.in2
-rw-r--r--configure.in2
-rw-r--r--lzf.c8
-rw-r--r--lzf.h3
-rw-r--r--lzfP.h4
-rw-r--r--lzf_c.c16
-rw-r--r--lzf_d.c21
9 files changed, 43 insertions, 21 deletions
diff --git a/Changes b/Changes
index 08d087a..b2e9891 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
-1.1
+1.1 Tue Dec 23 05:48:32 CET 2003
- removed #warn directive, it's not worth the hassle.
+ - add LZF_STACK_ARG and AVOID_ERRNO configurations
+ for embedded systems.
+ - make it compile cleanly as c++.
+ - some small documentation and code fixes.
1.0 Sun Nov 17 12:37:37 CET 2002
- slightly better compression ratio, almost unmeasurably
diff --git a/LICENSE b/LICENSE
index 2458e88..b6e74be 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2000-2002 Marc Alexander Lehmann <pcg@goof.com>
+Copyright (c) 2000-2003 Marc Alexander Lehmann <pcg@goof.com>
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
diff --git a/Makefile.in b/Makefile.in
index 2b9e0a2..ef5b2d3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-VERSION = 1.0
+VERSION = 1.1
prefix = @prefix@
exec_prefix = @exec_prefix@
diff --git a/configure.in b/configure.in
index 33b5921..b18a9fb 100644
--- a/configure.in
+++ b/configure.in
@@ -14,7 +14,7 @@ AC_CHECK_SIZEOF(long, 4)
AC_C_CONST
if test "$GCC" = yes; then
- CFLAGS="$CFLAGS -O2 -funroll-all-loops"
+ CFLAGS="$CFLAGS -O3 -funroll-all-loops"
else
AC_MSG_RESULT(no gcc)
fi
diff --git a/lzf.c b/lzf.c
index cc979e8..b382b6d 100644
--- a/lzf.c
+++ b/lzf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002 Marc Alexander Lehmann <pcg@goof.com>
+ * Copyright (c) 2000-2003 Marc Alexander Lehmann <pcg@goof.com>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -37,13 +37,15 @@
#include "lzf.h"
+typedef unsigned char u8;
+
static void
usage (int ec)
{
fprintf (stderr, "\n"
- "lzf, a very leightweight compression/decompression filter\n"
+ "lzf, a very lightweight compression/decompression filter\n"
"written by Marc Lehmann <pcg@goof.com> You can find more info at\n"
- "http://liblzv.plan9.de/\n"
+ "http://liblzf.plan9.de/\n"
"\n"
"USAGE: lzf -c [-b blocksize] | -d\n"
" -c compress\n"
diff --git a/lzf.h b/lzf.h
index 8e3165e..1af6656 100644
--- a/lzf.h
+++ b/lzf.h
@@ -56,6 +56,9 @@
*
* The buffers must not be overlapping.
*
+ * If the option LZF_STATE_ART is enabled, an extra argument must be
+ * supplied which is not reflected in this header file. Refer to lzf_c.c.
+ *
*/
unsigned int
lzf_compress (const void *const in_data, unsigned int in_len,
diff --git a/lzfP.h b/lzfP.h
index 03d5921..c007d83 100644
--- a/lzfP.h
+++ b/lzfP.h
@@ -82,7 +82,8 @@
/*
* avoid assigning values to errno variable? for some embedding purposes
- * (linux kernel for example), this is not
+ * (linux kernel for example), this is neccessary. NOTE: this breaks
+ * the documentation in lzf.h.
*/
#ifndef AVOID_ERRNO
# define AVOID_ERRNO 0
@@ -91,6 +92,7 @@
/*
* Wether to pass the LZF_STATE variable as argument, or allocate it
* on the stack. For small-stack environments, define this to zero.
+ * NOTE: this breaks the prototype in lzf.h.
*/
#ifndef LZF_STATE_ARG
# define LZF_STATE_ARG 1
diff --git a/lzf_c.c b/lzf_c.c
index 7cd7041..0c94baa 100644
--- a/lzf_c.c
+++ b/lzf_c.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002 Marc Alexander Lehmann <pcg@goof.com>
+ * Copyright (c) 2000-2003 Marc Alexander Lehmann <pcg@goof.com>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -68,12 +68,18 @@
unsigned int
lzf_compress (const void *const in_data, unsigned int in_len,
- void *out_data, unsigned int out_len)
+ void *out_data, unsigned int out_len
+#if !LZF_STATE_ARG
+ , LZF_STATE *htab
+#endif
+ )
{
- const u8 *htab[HSIZE];
+#if LZF_STATE_ARG
+ LZF_STATE htab;
+#endif
const u8 **hslot;
- const u8 *ip = in_data;
- u8 *op = out_data;
+ const u8 *ip = (const u8 *)in_data;
+ u8 *op = (u8 *)out_data;
const u8 *in_end = ip + in_len;
u8 *out_end = op + out_len;
const u8 *ref;
diff --git a/lzf_d.c b/lzf_d.c
index d1eb2cf..351b967 100644
--- a/lzf_d.c
+++ b/lzf_d.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2002 Marc Alexander Lehmann <pcg@goof.com>
+ * Copyright (c) 2000-2003 Marc Alexander Lehmann <pcg@goof.com>
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
@@ -26,16 +26,21 @@
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <errno.h>
-
#include "lzfP.h"
+#if AVOID_ERRNO
+# define SET_ERRNO(n)
+#else
+# include <errno.h>
+# define SET_ERRNO(n) errno = (n)
+#endif
+
unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len)
{
- u8 const *ip = in_data;
- u8 *op = out_data;
+ u8 const *ip = (const u8 *)in_data;
+ u8 *op = (u8 *)out_data;
u8 const *const in_end = ip + in_len;
u8 *const out_end = op + out_len;
@@ -49,7 +54,7 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
if (op + ctrl > out_end)
{
- errno = E2BIG;
+ SET_ERRNO (E2BIG);
return 0;
}
@@ -76,13 +81,13 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
if (op + len + 2 > out_end)
{
- errno = E2BIG;
+ SET_ERRNO (E2BIG);
return 0;
}
if (ref < (u8 *)out_data)
{
- errno = EINVAL;
+ SET_ERRNO (EINVAL);
return 0;
}