summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2018-03-14 19:51:59 (GMT)
committerW. Felix Handte <w@felixhandte.com>2018-03-14 19:53:10 (GMT)
commit66b6fbfe6fa9d7e8d4686e6525883ff4aef31e02 (patch)
tree45fbd09e540471c548b9b3f2222df711d43f0d57
parentc852f20c39e877b877da49dea52dd4e36a5d6cb9 (diff)
downloadlz4-66b6fbfe6fa9d7e8d4686e6525883ff4aef31e02.zip
lz4-66b6fbfe6fa9d7e8d4686e6525883ff4aef31e02.tar.gz
lz4-66b6fbfe6fa9d7e8d4686e6525883ff4aef31e02.tar.bz2
Restore the Other Old Streaming Functions in a Degraded Fashion
-rw-r--r--lib/lz4.c19
-rw-r--r--lib/lz4.h11
2 files changed, 28 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 48cdad1..37782f5 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1707,6 +1707,25 @@ int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize,
int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; }
+int LZ4_resetStreamState(void* state, char* inputBuffer)
+{
+ (void)inputBuffer;
+ LZ4_resetStream((LZ4_stream_t*)state);
+ return 0;
+}
+
+void* LZ4_create (char* inputBuffer)
+{
+ (void)inputBuffer;
+ return LZ4_createStream();
+}
+
+char* LZ4_slideInputBuffer (void* state)
+{
+ // avoid const char * -> char * conversion warning
+ return (char *)(uptrval)((LZ4_stream_t*)state)->internal_donotuse.dictionary;
+}
+
/* Obsolete streaming decompression functions */
int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int compressedSize, int maxOutputSize)
diff --git a/lib/lz4.h b/lib/lz4.h
index e4a257b..6cb6589 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -477,8 +477,15 @@ LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_co
LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize);
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
-/* Obsolete streaming functions; use new streaming interface whenever possible */
-LZ4_DEPRECATED("use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);
+/* Broken, obsolete streaming functions; do not use!
+ *
+ * These functions depended on data that is no longer tracked in the state. They
+ * are therefore broken--they don't retain any history across compressions.
+ */
+LZ4_DEPRECATED("Broken!!! Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer);
+LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);
+LZ4_DEPRECATED("Broken!!! Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer);
+LZ4_DEPRECATED("Broken!!! Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state);
/* Obsolete streaming decoding functions */
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);