summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2019-05-29 19:21:14 (GMT)
committerYann Collet <cyan@fb.com>2019-05-29 19:21:14 (GMT)
commit444550defad26bcbe2e62209badbba76e803e521 (patch)
tree25e5f69deb29eaf3d17d3119430c2aac539e3d9a
parentb17f578a919b7e6b078cede2d52be29dd48c8e8c (diff)
downloadlz4-444550defad26bcbe2e62209badbba76e803e521.zip
lz4-444550defad26bcbe2e62209badbba76e803e521.tar.gz
lz4-444550defad26bcbe2e62209badbba76e803e521.tar.bz2
ensure lz4.h can be included with or without LZ4_STATIC_LINKING_ONLY in any order
ensure correct propagation of LZ4_DISTANCE_MAX
-rw-r--r--lib/lz4.c1
-rw-r--r--lib/lz4.h16
-rw-r--r--lib/lz4hc.h3
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 19070c2..a198a03 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -106,6 +106,7 @@
#define LZ4_DISABLE_DEPRECATE_WARNINGS /* due to LZ4_decompress_safe_withPrefix64k */
#endif
+#define LZ4_STATIC_LINKING_ONLY /* LZ4_DISTANCE_MAX */
#include "lz4.h"
/* see also "memory routines" below */
diff --git a/lib/lz4.h b/lib/lz4.h
index ae7f52c..1e24ce9 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -388,6 +388,8 @@ LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecod
*/
LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize);
+#endif /* LZ4_H_2983827168210 */
+
/*^*************************************
* !!!!!! STATIC LINKING ONLY !!!!!!
@@ -413,14 +415,17 @@ LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int sr
* define LZ4_PUBLISH_STATIC_FUNCTIONS when building the LZ4 library.
******************************************************************************/
+#ifdef LZ4_STATIC_LINKING_ONLY
+
+#ifndef LZ4_STATIC_3504398509
+#define LZ4_STATIC_3504398509
+
#ifdef LZ4_PUBLISH_STATIC_FUNCTIONS
#define LZ4LIB_STATIC_API LZ4LIB_API
#else
#define LZ4LIB_STATIC_API
#endif
-#ifdef LZ4_STATIC_LINKING_ONLY
-
/*! LZ4_compress_fast_extState_fastReset() :
* A variant of LZ4_compress_fast_extState().
@@ -503,11 +508,14 @@ LZ4LIB_STATIC_API void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const
#define LZ4_COMPRESS_INPLACE_MARGIN (LZ4_DISTANCE_MAX + 32)
#define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) ( (maxCompressedSize) + LZ4_COMPRESS_INPLACE_MARGIN) /**< maxCompressedSize is generally LZ4_COMPRESSBOUND(inputSize), but can be set to any lower value, with the risk that compression can fail (return code 0(zero)) */
-
+#endif /* LZ4_STATIC_3504398509 */
#endif /* LZ4_STATIC_LINKING_ONLY */
+#ifndef LZ4_H_98237428734687
+#define LZ4_H_98237428734687
+
/*-************************************************************
* PRIVATE DEFINITIONS
**************************************************************
@@ -718,7 +726,7 @@ LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int or
LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
-#endif /* LZ4_H_2983827168210 */
+#endif /* LZ4_H_98237428734687 */
#if defined (__cplusplus)
diff --git a/lib/lz4hc.h b/lib/lz4hc.h
index cdc6d89..44e35bb 100644
--- a/lib/lz4hc.h
+++ b/lib/lz4hc.h
@@ -336,6 +336,9 @@ LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionL
#ifndef LZ4_HC_SLO_098092834
#define LZ4_HC_SLO_098092834
+#define LZ4_STATIC_LINKING_ONLY /* LZ4LIB_STATIC_API */
+#include "lz4.h"
+
#if defined (__cplusplus)
extern "C" {
#endif