summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile13
-rw-r--r--lib/lz4.h6
-rw-r--r--lib/lz4frame.c4
-rw-r--r--lib/lz4frame.h18
-rw-r--r--lib/lz4frame_static.h72
5 files changed, 86 insertions, 27 deletions
diff --git a/lib/Makefile b/lib/Makefile
index c59cc82..2c85ed8 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,6 +1,6 @@
# ################################################################
# LZ4 library - Makefile
-# Copyright (C) Yann Collet 2011-2014
+# Copyright (C) Yann Collet 2011-2015
# All rights reserved.
#
# BSD license
@@ -32,8 +32,7 @@
# ################################################################
# Version numbers
-VERSION=125
-RELEASE=r$(VERSION)
+VERSION ?= 126
LIBVER_MAJOR=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
LIBVER_MINOR=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
LIBVER_PATCH=`sed -n '/define LZ4_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
@@ -41,9 +40,8 @@ LIBVER=$(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
DESTDIR?=
PREFIX ?= /usr
-CC := $(CC)
CFLAGS ?= -O3
-CFLAGS += -I. -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes -DLZ4_VERSION=\"$(RELEASE)\"
+CFLAGS += -I. -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
LIBDIR?= $(PREFIX)/lib
INCLUDEDIR=$(PREFIX)/include
@@ -67,10 +65,10 @@ default: liblz4
all: liblz4
-liblz4: lz4.c lz4hc.c
+liblz4: lz4.c lz4hc.c lz4frame.c xxhash.c
@echo compiling static library
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $^
- @$(AR) rcs liblz4.a lz4.o lz4hc.o
+ @$(AR) rcs liblz4.a lz4.o lz4hc.o lz4frame.o xxhash.o
@echo compiling dynamic library $(LIBVER)
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared $^ -fPIC $(SONAME_FLAGS) -o $@.$(SHARED_EXT_VER)
@echo creating versioned links
@@ -103,6 +101,7 @@ install: liblz4 liblz4.pc
@install -m 644 liblz4.a $(DESTDIR)$(LIBDIR)/liblz4.a
@install -m 644 lz4.h $(DESTDIR)$(INCLUDEDIR)/lz4.h
@install -m 644 lz4hc.h $(DESTDIR)$(INCLUDEDIR)/lz4hc.h
+ @install -m 644 lz4frame.h $(DESTDIR)$(INCLUDEDIR)/lz4frame.h
@echo lz4 static and shared library installed
uninstall:
diff --git a/lib/lz4.h b/lib/lz4.h
index 7392320..7778caa 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -46,9 +46,9 @@ extern "C" {
/**************************************
Version
**************************************/
-#define LZ4_VERSION_MAJOR 1 /* for major interface/format changes */
-#define LZ4_VERSION_MINOR 4 /* for minor interface/format changes */
-#define LZ4_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */
+#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
+#define LZ4_VERSION_MINOR 5 /* for new (non-breaking) interface capabilities */
+#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
int LZ4_versionNumber (void);
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index aa46152..5183f22 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -64,7 +64,7 @@ Memory routines
/**************************************
Includes
**************************************/
-#include "lz4frame.h"
+#include "lz4frame_static.h"
#include "lz4.h"
#include "lz4hc.h"
#include "xxhash.h"
@@ -161,7 +161,7 @@ Error management
static const char* LZ4F_errorStrings[] = { LZ4F_LIST_ERRORS(LZ4F_GENERATE_STRING) };
-int LZ4F_isError(LZ4F_errorCode_t code)
+U32 LZ4F_isError(LZ4F_errorCode_t code)
{
return (code > (LZ4F_errorCode_t)(-ERROR_maxCode));
}
diff --git a/lib/lz4frame.h b/lib/lz4frame.h
index 48fbf80..b2a7f40 100644
--- a/lib/lz4frame.h
+++ b/lib/lz4frame.h
@@ -60,20 +60,8 @@ extern "C" {
* Error management
* ************************************/
typedef size_t LZ4F_errorCode_t;
-#define LZ4F_LIST_ERRORS(ITEM) \
- ITEM(OK_NoError) ITEM(ERROR_GENERIC) \
- ITEM(ERROR_maxBlockSize_invalid) ITEM(ERROR_blockMode_invalid) ITEM(ERROR_contentChecksumFlag_invalid) \
- ITEM(ERROR_compressionLevel_invalid) \
- ITEM(ERROR_allocation_failed) \
- ITEM(ERROR_srcSize_tooLarge) ITEM(ERROR_dstMaxSize_tooSmall) \
- ITEM(ERROR_decompressionFailed) \
- ITEM(ERROR_checksum_invalid) \
- ITEM(ERROR_maxCode)
-
-#define LZ4F_GENERATE_ENUM(ENUM) ENUM,
-typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM) } LZ4F_errorCodes; /* enum is exposed, to detect & handle specific errors; compare function result to -enum value */
-
-int LZ4F_isError(LZ4F_errorCode_t code); /* Basically : code > -ERROR_maxCode */
+
+unsigned LZ4F_isError(LZ4F_errorCode_t code);
const char* LZ4F_getErrorName(LZ4F_errorCode_t code); /* return error code string; useful for debugging */
@@ -108,7 +96,7 @@ size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* prefere
size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuffer, size_t srcSize, const LZ4F_preferences_t* preferencesPtr);
/* LZ4F_compressFrame()
- * Compress an entire srcBuffer into a valid LZ4 frame, as defined by specification v1.4.1, in a single step.
+ * Compress an entire srcBuffer into a valid LZ4 frame, as defined by specification v1.4.1.
* The most important rule is that dstBuffer MUST be large enough (dstMaxSize) to ensure compression completion even in worst case.
* You can get the minimum value of dstMaxSize by using LZ4F_compressFrameBound()
* If this condition is not respected, LZ4F_compressFrame() will fail (result is an errorCode)
diff --git a/lib/lz4frame_static.h b/lib/lz4frame_static.h
new file mode 100644
index 0000000..cde8186
--- /dev/null
+++ b/lib/lz4frame_static.h
@@ -0,0 +1,72 @@
+/*
+ LZ4 auto-framing library
+ Header File for static linking only
+ Copyright (C) 2011-2015, Yann Collet.
+
+ BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ You can contact the author at :
+ - LZ4 source repository : http://code.google.com/p/lz4/
+ - LZ4 source mirror : https://github.com/Cyan4973/lz4
+ - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
+*/
+
+#pragma once
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* lz4frame_static.h should be used solely in the context of static linking.
+ * */
+
+
+/**************************************
+ * Error management
+ * ************************************/
+#define LZ4F_LIST_ERRORS(ITEM) \
+ ITEM(OK_NoError) ITEM(ERROR_GENERIC) \
+ ITEM(ERROR_maxBlockSize_invalid) ITEM(ERROR_blockMode_invalid) ITEM(ERROR_contentChecksumFlag_invalid) \
+ ITEM(ERROR_compressionLevel_invalid) \
+ ITEM(ERROR_allocation_failed) \
+ ITEM(ERROR_srcSize_tooLarge) ITEM(ERROR_dstMaxSize_tooSmall) \
+ ITEM(ERROR_decompressionFailed) \
+ ITEM(ERROR_checksum_invalid) \
+ ITEM(ERROR_maxCode)
+
+#define LZ4F_GENERATE_ENUM(ENUM) ENUM,
+typedef enum { LZ4F_LIST_ERRORS(LZ4F_GENERATE_ENUM) } LZ4F_errorCodes; /* enum is exposed, to handle specific errors; compare function result to -enum value */
+
+
+/**************************************
+ Includes
+**************************************/
+#include "lz4frame.h"
+
+
+#if defined (__cplusplus)
+}
+#endif