summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2022-07-12 19:41:51 (GMT)
committerYann Collet <cyan@fb.com>2022-07-12 20:33:08 (GMT)
commit60f8eb6f4ca44162f26a7a60e8c1346ce4362999 (patch)
tree1caa21e6facb8413fa896538eece0aa2c5711ae9
parentd174f975d218c8d2c4df79da3b80a11c50c59e5a (diff)
downloadlz4-60f8eb6f4ca44162f26a7a60e8c1346ce4362999.zip
lz4-60f8eb6f4ca44162f26a7a60e8c1346ce4362999.tar.gz
lz4-60f8eb6f4ca44162f26a7a60e8c1346ce4362999.tar.bz2
minor : specify min versions for library version identifiers
-rw-r--r--lib/lz4.h42
-rw-r--r--lib/lz4hc.h29
-rw-r--r--tests/abiTest.c1
3 files changed, 27 insertions, 45 deletions
diff --git a/lib/lz4.h b/lib/lz4.h
index 9a896d2..a8c6d1e 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -107,10 +107,10 @@ extern "C" {
#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
#define LZ4_QUOTE(str) #str
#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
-#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
+#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION) /* requires v1.7.3+ */
-LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version */
-LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; useful to check dll version */
+LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version; requires v1.3.0+ */
+LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; useful to check dll version; requires v1.7.5+ */
/*-************************************
@@ -604,6 +604,12 @@ LZ4LIB_STATIC_API void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const
typedef unsigned int LZ4_u32;
#endif
+/*! LZ4_stream_t :
+ * Never ever use below internal definitions directly !
+ * These definitions are not API/ABI safe, and may change in future versions.
+ * If you need static allocation, declare or allocate an LZ4_stream_t object.
+**/
+
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
LZ4_u32 hashTable[LZ4_HASH_SIZE_U32];
@@ -614,23 +620,10 @@ struct LZ4_stream_t_internal {
LZ4_u32 dictSize;
};
-typedef struct {
- const LZ4_byte* externalDict;
- size_t extDictSize;
- const LZ4_byte* prefixEnd;
- size_t prefixSize;
-} LZ4_streamDecode_t_internal;
-
-
-/*! LZ4_stream_t :
- * Never ever use below internal definitions directly !
- * These definitions are not API/ABI safe, and may change in future versions.
- * If you need static allocation, declare or allocate an LZ4_stream_t object.
- */
-#define LZ4_STREAMSIZE ((1UL << LZ4_MEMORY_USAGE) + 32) /* static size, for inter-version compatibility */
+#define LZ4_STREAM_MINSIZE ((1UL << LZ4_MEMORY_USAGE) + 32) /* static size, for inter-version compatibility */
union LZ4_stream_u {
+ char minStateSize[LZ4_STREAM_MINSIZE];
LZ4_stream_t_internal internal_donotuse;
- char minStateSize[LZ4_STREAMSIZE];
}; /* previously typedef'd to LZ4_stream_t */
@@ -655,11 +648,18 @@ LZ4LIB_API LZ4_stream_t* LZ4_initStream (void* buffer, size_t size);
* Never ever use below internal definitions directly !
* These definitions are not API/ABI safe, and may change in future versions.
* If you need static allocation, declare or allocate an LZ4_streamDecode_t object.
- */
-#define LZ4_STREAMDECODESIZE 32
+**/
+typedef struct {
+ const LZ4_byte* externalDict;
+ size_t extDictSize;
+ const LZ4_byte* prefixEnd;
+ size_t prefixSize;
+} LZ4_streamDecode_t_internal;
+
+#define LZ4_STREAMDECODE_MINSIZE 32
union LZ4_streamDecode_u {
+ char minStateSize[LZ4_STREAMDECODE_MINSIZE];
LZ4_streamDecode_t_internal internal_donotuse;
- char minStateSize[LZ4_STREAMDECODESIZE];
} ; /* previously typedef'd to LZ4_streamDecode_t */
diff --git a/lib/lz4hc.h b/lib/lz4hc.h
index bead076..61e228d 100644
--- a/lib/lz4hc.h
+++ b/lib/lz4hc.h
@@ -198,6 +198,9 @@ LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, in
#define LZ4HC_HASH_MASK (LZ4HC_HASHTABLESIZE - 1)
+/* Never ever use these definitions directly !
+ * Declare or allocate an LZ4_streamHC_t instead.
+**/
typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal;
struct LZ4HC_CCtx_internal
{
@@ -216,32 +219,10 @@ struct LZ4HC_CCtx_internal
const LZ4HC_CCtx_internal* dictCtx;
};
-
-/* Never ever use these definitions directly !
- * Declare or allocate an LZ4_streamHC_t instead.
- * Note : OS400 uses 16 byte pointers and so the structure size is larger than other
- * platforms
- * |===========================================================
- * | Offset | Length | Member Name
- * |===========================================================
- * | 0 | 131072 | hashTable[32768]
- * | 131072 | 131072 | chainTable[65536]
- * | 262144 | 16 | end
- * | 262160 | 16 | base
- * | 262176 | 16 | dictBase
- * | 262192 | 4 | dictLimit
- * | 262196 | 4 | lowLimit
- * | 262200 | 4 | nextToUpdate
- * | 262204 | 2 | compressionLevel
- * | 262206 | 1 | favorDecSpeed
- * | 262207 | 1 | dirty
- * | 262208 | 16 | dictCtx
- * ============================================================
- */
-#define LZ4_STREAMHCSIZE 262200 /* static size, for inter-version compatibility */
+#define LZ4_STREAMHC_MINSIZE 262200 /* static size, for inter-version compatibility */
union LZ4_streamHC_u {
+ char minStateSize[LZ4_STREAMHC_MINSIZE];
LZ4HC_CCtx_internal internal_donotuse;
- char minStateSize[LZ4_STREAMHCSIZE];
}; /* previously typedef'd to LZ4_streamHC_t */
/* LZ4_streamHC_t :
diff --git a/tests/abiTest.c b/tests/abiTest.c
index 91e4e79..e46004a 100644
--- a/tests/abiTest.c
+++ b/tests/abiTest.c
@@ -202,6 +202,7 @@ int main(int argCount, const char** argv)
{
const char* const exeName = argv[0];
int argNb = 1;
+ // Note : LZ4_VERSION_STRING requires >= v1.7.3+
MSG("abiTest, built binary based on API %s \n", LZ4_VERSION_STRING);
// Note : LZ4_versionString() requires >= v1.7.5+
MSG("currently linked to dll %s \n", LZ4_versionString());