Skip to content

Commit

Permalink
Updated lz4: 1.9.4 -> 1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekazakov committed Dec 16, 2024
1 parent 4be9306 commit 7a760ec
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 218 deletions.
2 changes: 1 addition & 1 deletion 3rd_Party/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Verify the Xcode version with `xcode-select -p`.
| libarchive | 3.7.4 | 2024.04.26 | https://github.com/libarchive/libarchive.git
| libcxx | 18.x | 2024.03.05 | https://github.com/llvm/llvm-project.git
| libssh2 | 1.11.1 | 2024.10.16 | https://github.com/libssh2/libssh2.git
| lz4 | 1.9.4 | 2022.08.15 | https://github.com/lz4/lz4.git
| lz4 | 1.10.0 | 2024.07.22 | https://github.com/lz4/lz4.git
| lzma(xz) | 5.6.3 | 2024.10.01 | https://github.com/tukaani-project/xz.git
| lzo | 2.10 | 2017.03.01 | http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
| nlohmann | 3.11.3 | 2023.11.28 | https://github.com/nlohmann/json.git
Expand Down
2 changes: 1 addition & 1 deletion 3rd_Party/lz4/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TMP_DIR=${CUR_DIR}/lz4.tmp
mkdir ${TMP_DIR}
cd ${TMP_DIR}

git clone -b v1.9.4 --single-branch https://github.com/lz4/lz4.git
git clone -b v1.10.0 --single-branch https://github.com/lz4/lz4.git

cd lz4/build/cmake
mkdir builddir
Expand Down
180 changes: 111 additions & 69 deletions 3rd_Party/lz4/include/lz4.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions 3rd_Party/lz4/include/lz4file.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extern "C" {
#ifndef LZ4FILE_H
#define LZ4FILE_H

#include <stdio.h>
#include <stdio.h> /* FILE* */
#include "lz4frame_static.h"

typedef struct LZ4_readFile_s LZ4_readFile_t;
Expand Down Expand Up @@ -78,7 +78,7 @@ LZ4FLIB_STATIC_API LZ4F_errorCode_t LZ4F_writeOpen(LZ4_writeFile_t** lz4fWrite,
* `buf` write data buffer.
* `size` write data buffer size.
*/
LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, void* buf, size_t size);
LZ4FLIB_STATIC_API size_t LZ4F_write(LZ4_writeFile_t* lz4fWrite, const void* buf, size_t size);

/*! LZ4F_writeClose() :
* Close lz4file handle.
Expand Down
265 changes: 162 additions & 103 deletions 3rd_Party/lz4/include/lz4frame.h

Large diffs are not rendered by default.

85 changes: 43 additions & 42 deletions 3rd_Party/lz4/include/lz4hc.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern "C" {


/* --- Useful constants --- */
#define LZ4HC_CLEVEL_MIN 3
#define LZ4HC_CLEVEL_MIN 2
#define LZ4HC_CLEVEL_DEFAULT 9
#define LZ4HC_CLEVEL_OPT_MIN 10
#define LZ4HC_CLEVEL_MAX 12
Expand Down Expand Up @@ -126,6 +126,8 @@ LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr);
After reset, a first "fictional block" can be designated as initial dictionary,
using LZ4_loadDictHC() (Optional).
Note: In order for LZ4_loadDictHC() to create the correct data structure,
it is essential to set the compression level _before_ loading the dictionary.
Invoke LZ4_compress_HC_continue() to compress each successive block.
The number of blocks is unlimited.
Expand All @@ -135,12 +137,12 @@ LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr);
It's allowed to update compression level anytime between blocks,
using LZ4_setCompressionLevel() (experimental).
'dst' buffer should be sized to handle worst case scenarios
@dst buffer should be sized to handle worst case scenarios
(see LZ4_compressBound(), it ensures compression success).
In case of failure, the API does not guarantee recovery,
so the state _must_ be reset.
To ensure compression success
whenever `dst` buffer size cannot be made >= LZ4_compressBound(),
whenever @dst buffer size cannot be made >= LZ4_compressBound(),
consider using LZ4_compress_HC_continue_destSize().
Whenever previous input blocks can't be preserved unmodified in-place during compression of next blocks,
Expand Down Expand Up @@ -176,6 +178,34 @@ LZ4LIB_API int LZ4_compress_HC_continue_destSize(LZ4_streamHC_t* LZ4_streamHCPtr
LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, int maxDictSize);


/*! LZ4_attach_HC_dictionary() : stable since v1.10.0
* This API allows for the efficient re-use of a static dictionary many times.
*
* Rather than re-loading the dictionary buffer into a working context before
* each compression, or copying a pre-loaded dictionary's LZ4_streamHC_t into a
* working LZ4_streamHC_t, this function introduces a no-copy setup mechanism,
* in which the working stream references the dictionary stream in-place.
*
* Several assumptions are made about the state of the dictionary stream.
* Currently, only streams which have been prepared by LZ4_loadDictHC() should
* be expected to work.
*
* Alternatively, the provided dictionary stream pointer may be NULL, in which
* case any existing dictionary stream is unset.
*
* A dictionary should only be attached to a stream without any history (i.e.,
* a stream that has just been reset).
*
* The dictionary will remain attached to the working stream only for the
* current stream session. Calls to LZ4_resetStreamHC(_fast) will remove the
* dictionary context association from the working stream. The dictionary
* stream (and source buffer) must remain in-place / accessible / unchanged
* through the lifetime of the stream session.
*/
LZ4LIB_API void
LZ4_attach_HC_dictionary(LZ4_streamHC_t* working_stream,
const LZ4_streamHC_t* dictionary_stream);


/*^**********************************************
* !!!!!! STATIC LINKING ONLY !!!!!!
Expand Down Expand Up @@ -204,18 +234,18 @@ LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, in
typedef struct LZ4HC_CCtx_internal LZ4HC_CCtx_internal;
struct LZ4HC_CCtx_internal
{
LZ4_u32 hashTable[LZ4HC_HASHTABLESIZE];
LZ4_u16 chainTable[LZ4HC_MAXD];
const LZ4_byte* end; /* next block here to continue on current prefix */
LZ4_u32 hashTable[LZ4HC_HASHTABLESIZE];
LZ4_u16 chainTable[LZ4HC_MAXD];
const LZ4_byte* end; /* next block here to continue on current prefix */
const LZ4_byte* prefixStart; /* Indexes relative to this position */
const LZ4_byte* dictStart; /* alternate reference for extDict */
LZ4_u32 dictLimit; /* below that point, need extDict */
LZ4_u32 lowLimit; /* below that point, no more dict */
LZ4_u32 nextToUpdate; /* index from which to continue dictionary update */
short compressionLevel;
LZ4_i8 favorDecSpeed; /* favor decompression speed if this flag set,
otherwise, favor compression ratio */
LZ4_i8 dirty; /* stream has to be fully reset if this flag is set */
LZ4_u32 dictLimit; /* below that point, need extDict */
LZ4_u32 lowLimit; /* below that point, no more history */
LZ4_u32 nextToUpdate; /* index from which to continue dictionary update */
short compressionLevel;
LZ4_i8 favorDecSpeed; /* favor decompression speed if this flag set,
otherwise, favor compression ratio */
LZ4_i8 dirty; /* stream has to be fully reset if this flag is set */
const LZ4HC_CCtx_internal* dictCtx;
};

Expand Down Expand Up @@ -376,35 +406,6 @@ LZ4LIB_STATIC_API int LZ4_compress_HC_extStateHC_fastReset (
int srcSize, int dstCapacity,
int compressionLevel);

/*! LZ4_attach_HC_dictionary() :
* This is an experimental API that allows for the efficient use of a
* static dictionary many times.
*
* Rather than re-loading the dictionary buffer into a working context before
* each compression, or copying a pre-loaded dictionary's LZ4_streamHC_t into a
* working LZ4_streamHC_t, this function introduces a no-copy setup mechanism,
* in which the working stream references the dictionary stream in-place.
*
* Several assumptions are made about the state of the dictionary stream.
* Currently, only streams which have been prepared by LZ4_loadDictHC() should
* be expected to work.
*
* Alternatively, the provided dictionary stream pointer may be NULL, in which
* case any existing dictionary stream is unset.
*
* A dictionary should only be attached to a stream without any history (i.e.,
* a stream that has just been reset).
*
* The dictionary will remain attached to the working stream only for the
* current stream session. Calls to LZ4_resetStreamHC(_fast) will remove the
* dictionary context association from the working stream. The dictionary
* stream (and source buffer) must remain in-place / accessible / unchanged
* through the lifetime of the stream session.
*/
LZ4LIB_STATIC_API void LZ4_attach_HC_dictionary(
LZ4_streamHC_t *working_stream,
const LZ4_streamHC_t *dictionary_stream);

#if defined (__cplusplus)
}
#endif
Expand Down
Binary file modified 3rd_Party/lz4/lib/liblz4.a
Binary file not shown.

0 comments on commit 7a760ec

Please sign in to comment.