summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-04-24 12:26:53 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-04-24 12:26:53 (GMT)
commitef55dfb000a9150cb9baee80e00f22c2dcddaada (patch)
tree5cbca548e156c4f5dc5edc2ad65e2ec9837cce55
parent87a1c70ae43fe7569ec93c73fedc7e706faf00ae (diff)
downloadlz4-ef55dfb000a9150cb9baee80e00f22c2dcddaada.zip
lz4-ef55dfb000a9150cb9baee80e00f22c2dcddaada.tar.gz
lz4-ef55dfb000a9150cb9baee80e00f22c2dcddaada.tar.bz2
Modified lz4frame context typedef, to enforce stricter alignment condition
-rw-r--r--lib/lz4frame.c7
-rw-r--r--lib/lz4frame.h4
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 8f82f6c..c6b9634 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -283,6 +283,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_cctx_internal_t cctxI;
+ LZ4F_compressionContext_t cctx = (LZ4F_compressionContext_t)(&cctxI);
LZ4_stream_t lz4ctx;
LZ4F_preferences_t prefs;
LZ4F_compressOptions_t options;
@@ -321,15 +322,15 @@ size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuf
if (dstMaxSize < LZ4F_compressFrameBound(srcSize, &prefs))
return (size_t)-LZ4F_ERROR_dstMaxSize_tooSmall;
- errorCode = LZ4F_compressBegin(&cctxI, dstBuffer, dstMaxSize, &prefs); /* write header */
+ errorCode = LZ4F_compressBegin(cctx, dstBuffer, dstMaxSize, &prefs); /* write header */
if (LZ4F_isError(errorCode)) return errorCode;
dstPtr += errorCode; /* header size */
- errorCode = LZ4F_compressUpdate(&cctxI, dstPtr, dstEnd-dstPtr, srcBuffer, srcSize, &options);
+ errorCode = LZ4F_compressUpdate(cctx, dstPtr, dstEnd-dstPtr, srcBuffer, srcSize, &options);
if (LZ4F_isError(errorCode)) return errorCode;
dstPtr += errorCode;
- errorCode = LZ4F_compressEnd(&cctxI, dstPtr, dstEnd-dstPtr, &options); /* flush last block, and generate suffix */
+ errorCode = LZ4F_compressEnd(cctx, dstPtr, dstEnd-dstPtr, &options); /* flush last block, and generate suffix */
if (LZ4F_isError(errorCode)) return errorCode;
dstPtr += errorCode;
diff --git a/lib/lz4frame.h b/lib/lz4frame.h
index b5ba2fb..4698c4b 100644
--- a/lib/lz4frame.h
+++ b/lib/lz4frame.h
@@ -146,7 +146,7 @@ size_t LZ4F_compressFrame(void* dstBuffer, size_t dstMaxSize, const void* srcBuf
/**********************************
* Advanced compression functions
* ********************************/
-typedef void* LZ4F_compressionContext_t;
+typedef size_t* LZ4F_compressionContext_t;
typedef struct {
unsigned stableSrc; /* 1 == src content will remain available on future calls to LZ4F_compress(); avoid saving src content within tmp buffer as future dictionary */
@@ -226,7 +226,7 @@ size_t LZ4F_compressEnd(LZ4F_compressionContext_t cctx, void* dstBuffer, size_t
* Decompression functions
* *********************************/
-typedef void* LZ4F_decompressionContext_t;
+typedef size_t* LZ4F_decompressionContext_t;
typedef struct {
unsigned stableDst; /* guarantee that decompressed data will still be there on next function calls (avoid storage into tmp buffers) */