summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2020-08-18 22:34:51 (GMT)
committerYann Collet <cyan@fb.com>2020-08-18 22:34:51 (GMT)
commitf18dbeb8b54917cbc7a2417413c84604ee0b81f5 (patch)
tree6433fec94952456c8283e392ee1e811ecead97f3 /lib
parentab713923a24d52a6c3d0835627b3f0d715955467 (diff)
parentfa5435bca9140c10bd1756d96e1b52a11e88d0ad (diff)
downloadlz4-f18dbeb8b54917cbc7a2417413c84604ee0b81f5.zip
lz4-f18dbeb8b54917cbc7a2417413c84604ee0b81f5.tar.gz
lz4-f18dbeb8b54917cbc7a2417413c84604ee0b81f5.tar.bz2
Merge branch 'dev' into extraInput
Diffstat (limited to 'lib')
-rw-r--r--lib/README.md7
-rw-r--r--lib/lz4frame.c8
-rw-r--r--lib/lz4frame.h6
3 files changed, 12 insertions, 9 deletions
diff --git a/lib/README.md b/lib/README.md
index cba2c34..707d777 100644
--- a/lib/README.md
+++ b/lib/README.md
@@ -35,12 +35,13 @@ So it's necessary to include all `*.c` and `*.h` files present in `/lib`.
Definitions which are not guaranteed to remain stable in future versions,
are protected behind macros, such as `LZ4_STATIC_LINKING_ONLY`.
-As the name implies, these definitions can only be invoked
+As the name strongly implies, these definitions should only be invoked
in the context of static linking ***only***.
Otherwise, dependent application may fail on API or ABI break in the future.
-The associated symbols are also not present in dynamic library by default.
+The associated symbols are also not exposed by the dynamic library by default.
Should they be nonetheless needed, it's possible to force their publication
-by using build macro `LZ4_PUBLISH_STATIC_FUNCTIONS`.
+by using build macros `LZ4_PUBLISH_STATIC_FUNCTIONS`
+and `LZ4F_PUBLISH_STATIC_FUNCTIONS`.
#### Build macros
diff --git a/lib/lz4frame.c b/lib/lz4frame.c
index 5d716ea..e11f1c8 100644
--- a/lib/lz4frame.c
+++ b/lib/lz4frame.c
@@ -1483,14 +1483,16 @@ size_t LZ4F_decompress(LZ4F_dctx* dctx,
} /* if (dctx->dStage == dstage_storeBlockHeader) */
/* decode block header */
- { size_t const nextCBlockSize = LZ4F_readLE32(selectedIn) & 0x7FFFFFFFU;
+ { U32 const blockHeader = LZ4F_readLE32(selectedIn);
+ size_t const nextCBlockSize = blockHeader & 0x7FFFFFFFU;
size_t const crcSize = dctx->frameInfo.blockChecksumFlag * BFSize;
- if (nextCBlockSize==0) { /* frameEnd signal, no more block */
+ if (blockHeader==0) { /* frameEnd signal, no more block */
dctx->dStage = dstage_getSuffix;
break;
}
- if (nextCBlockSize > dctx->maxBlockSize)
+ if (nextCBlockSize > dctx->maxBlockSize) {
return err0r(LZ4F_ERROR_maxBlockSize_invalid);
+ }
if (LZ4F_readLE32(selectedIn) & LZ4F_BLOCKUNCOMPRESSED_FLAG) {
/* next block is uncompressed */
dctx->tmpInTarget = nextCBlockSize;
diff --git a/lib/lz4frame.h b/lib/lz4frame.h
index 77d682b..c669aec 100644
--- a/lib/lz4frame.h
+++ b/lib/lz4frame.h
@@ -381,7 +381,7 @@ LZ4FLIB_API LZ4F_errorCode_t LZ4F_freeDecompressionContext(LZ4F_dctx* dctx);
* note : Frame header size is variable, but is guaranteed to be
* >= LZ4F_HEADER_SIZE_MIN bytes, and <= LZ4F_HEADER_SIZE_MAX bytes.
*/
-size_t LZ4F_headerSize(const void* src, size_t srcSize);
+LZ4FLIB_API size_t LZ4F_headerSize(const void* src, size_t srcSize);
/*! LZ4F_getFrameInfo() :
* This function extracts frame parameters (max blockSize, dictID, etc.).
@@ -498,9 +498,9 @@ extern "C" {
* Use at your own risk.
*/
#ifdef LZ4F_PUBLISH_STATIC_FUNCTIONS
-#define LZ4FLIB_STATIC_API LZ4FLIB_API
+# define LZ4FLIB_STATIC_API LZ4FLIB_API
#else
-#define LZ4FLIB_STATIC_API
+# define LZ4FLIB_STATIC_API
#endif