diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2014-10-21 23:36:32 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2014-10-21 23:36:32 (GMT) |
commit | e468a4eb96ec8e2ea0fc61b5aa20f56a3b214c0e (patch) | |
tree | 453a3c336ee8f702dbb541dc9b0aa5c7359f05f1 /lz4frame.c | |
parent | e450018588560537c2c4b4b2dd3515a9ef3a83f7 (diff) | |
download | lz4-e468a4eb96ec8e2ea0fc61b5aa20f56a3b214c0e.zip lz4-e468a4eb96ec8e2ea0fc61b5aa20f56a3b214c0e.tar.gz lz4-e468a4eb96ec8e2ea0fc61b5aa20f56a3b214c0e.tar.bz2 |
fixed LZ4F_compressFrameBound (dynamic block resize)
Diffstat (limited to 'lz4frame.c')
-rwxr-xr-x[-rw-r--r--] | lz4frame.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lz4frame.c b/lz4frame.c index 93069e0..f7bf242 100644..100755 --- a/lz4frame.c +++ b/lz4frame.c @@ -234,6 +234,20 @@ size_t LZ4F_compressFrameBound(size_t srcSize, const LZ4F_preferences_t* prefere size_t streamSize; if (preferencesPtr!=NULL) prefs = *preferencesPtr; + { + blockSizeID_t proposedBSID = max64KB; + size_t maxBlockSize = 64 KB; + while (prefs.frameInfo.blockSizeID > proposedBSID) + { + if (srcSize <= maxBlockSize) + { + prefs.frameInfo.blockSizeID = proposedBSID; + break; + } + proposedBSID++; + maxBlockSize <<= 2; + } + } prefs.autoFlush = 1; headerSize = 7; /* basic header size (no option) including magic number */ |