Merge pull request #684 from lz4/cxxlz4f
lz4frame: initializers compatibility with C++
This commit is contained in:
commit
40e82df003
2
Makefile
2
Makefile
@ -182,7 +182,7 @@ gpptest gpptest32: clean
|
||||
CC=$(CC) $(MAKE) -C $(TESTDIR) all CFLAGS="$(CFLAGS)"
|
||||
|
||||
cxx17build : CC = "$(CXX) -Wno-deprecated"
|
||||
cxx17build : CFLAGS = -std=c++17 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
|
||||
cxx17build : CFLAGS = -std=c++17 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror -pedantic
|
||||
cxx17build : clean
|
||||
$(CXX) -v
|
||||
CC=$(CC) $(MAKE) -C $(LZ4DIR) all CFLAGS="$(CFLAGS)"
|
||||
|
@ -325,8 +325,7 @@ static size_t LZ4F_compressBound_internal(size_t srcSize,
|
||||
const LZ4F_preferences_t* preferencesPtr,
|
||||
size_t alreadyBuffered)
|
||||
{
|
||||
LZ4F_preferences_t prefsNull;
|
||||
MEM_INIT(&prefsNull, 0, sizeof(prefsNull));
|
||||
LZ4F_preferences_t prefsNull = LZ4F_INIT_PREFERENCES;
|
||||
prefsNull.frameInfo.contentChecksumFlag = LZ4F_contentChecksumEnabled; /* worst case */
|
||||
{ const LZ4F_preferences_t* const prefsPtr = (preferencesPtr==NULL) ? &prefsNull : preferencesPtr;
|
||||
U32 const flush = prefsPtr->autoFlush | (srcSize==0);
|
||||
@ -1065,7 +1064,10 @@ struct LZ4F_dctx_s {
|
||||
LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx** LZ4F_decompressionContextPtr, unsigned versionNumber)
|
||||
{
|
||||
LZ4F_dctx* const dctx = (LZ4F_dctx*)ALLOC_AND_ZERO(sizeof(LZ4F_dctx));
|
||||
if (dctx==NULL) return err0r(LZ4F_ERROR_GENERIC);
|
||||
if (dctx == NULL) { /* failed allocation */
|
||||
*LZ4F_decompressionContextPtr = NULL;
|
||||
return err0r(LZ4F_ERROR_allocation_failed);
|
||||
}
|
||||
|
||||
dctx->version = versionNumber;
|
||||
*LZ4F_decompressionContextPtr = dctx;
|
||||
|
@ -176,7 +176,7 @@ typedef struct {
|
||||
LZ4F_blockChecksum_t blockChecksumFlag; /* 1: each block followed by a checksum of block's compressed data; 0: disabled (default) */
|
||||
} LZ4F_frameInfo_t;
|
||||
|
||||
#define LZ4F_INIT_FRAMEINFO { 0, 0, 0, 0, 0, 0, 0 } /* v1.8.3+ */
|
||||
#define LZ4F_INIT_FRAMEINFO { LZ4F_default, LZ4F_blockLinked, LZ4F_noContentChecksum, LZ4F_frame, 0ULL, 0U, LZ4F_noBlockChecksum } /* v1.8.3+ */
|
||||
|
||||
/*! LZ4F_preferences_t :
|
||||
* makes it possible to supply advanced compression instructions to streaming interface.
|
||||
@ -191,7 +191,7 @@ typedef struct {
|
||||
unsigned reserved[3]; /* must be zero for forward compatibility */
|
||||
} LZ4F_preferences_t;
|
||||
|
||||
#define LZ4F_INIT_PREFERENCES { LZ4F_INIT_FRAMEINFO, 0, 0, 0, { 0, 0, 0 } } /* v1.8.3+ */
|
||||
#define LZ4F_INIT_PREFERENCES { LZ4F_INIT_FRAMEINFO, 0, 0u, 0u, { 0u, 0u, 0u } } /* v1.8.3+ */
|
||||
|
||||
|
||||
/*-*********************************
|
||||
|
Loading…
Reference in New Issue
Block a user