From 0eddd72025cd43a7fc3364733165e96489dd0a6b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 7 May 2021 11:13:56 +0200 Subject: [PATCH] fix cppcheck warnings --- common/lz4/lz4.c | 178 +++++++++++++++++++++++------------------------ common/lz4/lz4.h | 2 +- 2 files changed, 90 insertions(+), 90 deletions(-) diff --git a/common/lz4/lz4.c b/common/lz4/lz4.c index 0b7df1fb0..41c92193d 100644 --- a/common/lz4/lz4.c +++ b/common/lz4/lz4.c @@ -658,9 +658,9 @@ int LZ4_sizeofState(void) { return LZ4_STREAMSIZE; } extern "C" { #endif -int LZ4_compress_forceExtDict(LZ4_stream_t *LZ4_dict, const char *source, char *dest, int srcSize); +int LZ4_compress_forceExtDict(LZ4_stream_t *LZ4_dict, const char *src, char *dest, int srcSize); -int LZ4_decompress_safe_forceExtDict(const char *source, char *dest, +int LZ4_decompress_safe_forceExtDict(const char *src, char *dest, int compressedSize, int maxOutputSize, const void *dictStart, size_t dictSize); @@ -821,7 +821,7 @@ LZ4_prepareTable(LZ4_stream_t_internal *const cctx, */ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( LZ4_stream_t_internal *const cctx, - const char *const source, + const char *const src, char *const dest, const int inputSize, int *inputConsumed, /* only written when outputDirective == fillOutput */ @@ -832,10 +832,10 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( const dictIssue_directive dictIssue, const int acceleration) { int result; - const BYTE *ip = (const BYTE *) source; + const BYTE *ip = (const BYTE *) src; U32 const startIndex = cctx->currentOffset; - const BYTE *base = (const BYTE *) source - startIndex; + const BYTE *base = (const BYTE *) src - startIndex; const BYTE *lowLimit; const LZ4_stream_t_internal *dictCtx = (const LZ4_stream_t_internal *) cctx->dictCtx; @@ -848,7 +848,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( int const maybe_extMem = (dictDirective == usingExtDict) || (dictDirective == usingDictCtx); U32 const prefixIdxLimit = startIndex - dictSize; /* used when dictDirective == dictSmall */ const BYTE *const dictEnd = dictionary ? dictionary + dictSize : dictionary; - const BYTE *anchor = (const BYTE *) source; + const BYTE *anchor = (const BYTE *) src; const BYTE *const iend = ip + inputSize; const BYTE *const mflimitPlusOne = iend - MFLIMIT + 1; const BYTE *const matchlimit = iend - LASTLITERALS; @@ -874,7 +874,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( if (tableType == byPtr) assert(dictDirective == noDict); /* only supported use case with byPtr */ assert(acceleration >= 1); - lowLimit = (const BYTE *)source - (dictDirective == withPrefix64k ? dictSize : 0); + lowLimit = (const BYTE *)src - (dictDirective == withPrefix64k ? dictSize : 0); /* Update context state */ if (dictDirective == usingDictCtx) { @@ -950,7 +950,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( lowLimit = dictionary; } else { match = base + matchIndex; - lowLimit = (const BYTE *)source; + lowLimit = (const BYTE *)src; } } else if (dictDirective == usingExtDict) { if (matchIndex < startIndex) { @@ -960,7 +960,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( lowLimit = dictionary; } else { match = base + matchIndex; - lowLimit = (const BYTE *)source; + lowLimit = (const BYTE *)src; } } else { /* single continuous memory segment */ match = base + matchIndex; @@ -1013,7 +1013,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( LZ4_wildCopy8(op, anchor, op + litLength); op += litLength; DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i", - (int)(anchor - (const BYTE *)source), litLength, (int)(ip - (const BYTE *)source)); + (int)(anchor - (const BYTE *)src), litLength, (int)(ip - (const BYTE *)src)); } _next_match: @@ -1034,7 +1034,7 @@ _next_match: /* Encode Offset */ if (maybe_extMem) { /* static test */ - DEBUGLOG(6, " with offset=%u (ext if > %i)", offset, (int)(ip - (const BYTE *)source)); + DEBUGLOG(6, " with offset=%u (ext if > %i)", offset, (int)(ip - (const BYTE *)src)); assert(offset <= LZ4_DISTANCE_MAX && offset > 0); LZ4_writeLE16(op, (U16)offset); op += 2; @@ -1057,7 +1057,7 @@ _next_match: matchCode = LZ4_count(ip + MINMATCH, match + MINMATCH, limit); ip += (size_t)matchCode + MINMATCH; if (ip == limit) { - unsigned const more = LZ4_count(limit, (const BYTE *)source, matchlimit); + unsigned const more = LZ4_count(limit, (const BYTE *)src, matchlimit); matchCode += more; ip += more; } @@ -1143,7 +1143,7 @@ _next_match: matchIndex += dictDelta; } else { match = base + matchIndex; - lowLimit = (const BYTE *)source; /* required for match length counter */ + lowLimit = (const BYTE *)src; /* required for match length counter */ } } else if (dictDirective == usingExtDict) { if (matchIndex < startIndex) { @@ -1151,7 +1151,7 @@ _next_match: lowLimit = dictionary; /* required for match length counter */ } else { match = base + matchIndex; - lowLimit = (const BYTE *)source; /* required for match length counter */ + lowLimit = (const BYTE *)src; /* required for match length counter */ } } else { /* single memory segment */ match = base + matchIndex; @@ -1165,7 +1165,7 @@ _next_match: *token = 0; if (maybe_extMem) offset = current - matchIndex; DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i", - (int)(anchor - (const BYTE *)source), 0, (int)(ip - (const BYTE *)source)); + (int)(anchor - (const BYTE *)src), 0, (int)(ip - (const BYTE *)src)); goto _next_match; } } @@ -1206,7 +1206,7 @@ _last_literals: } if (outputDirective == fillOutput) { - *inputConsumed = (int)(((const char *)ip) - source); + *inputConsumed = (int)(((const char *)ip) - src); } result = (int)(((char *)op) - dest); assert(result > 0); @@ -1255,24 +1255,24 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( } -int LZ4_compress_fast_extState(void *state, const char *source, char *dest, int inputSize, int maxOutputSize, int acceleration) { +int LZ4_compress_fast_extState(void *state, const char *src, char *dest, int inputSize, int maxOutputSize, int acceleration) { LZ4_stream_t_internal *const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse; assert(ctx != NULL); if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT; if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX; if (maxOutputSize >= LZ4_compressBound(inputSize)) { if (inputSize < LZ4_64Klimit) { - return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration); + return LZ4_compress_generic(ctx, src, dest, inputSize, NULL, 0, notLimited, byU16, noDict, noDictIssue, acceleration); } else { - const tableType_t tableType = ((sizeof(void *) == 4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32; - return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration); + const tableType_t tableType = ((sizeof(void *) == 4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32; + return LZ4_compress_generic(ctx, src, dest, inputSize, NULL, 0, notLimited, tableType, noDict, noDictIssue, acceleration); } } else { if (inputSize < LZ4_64Klimit) { - return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration); + return LZ4_compress_generic(ctx, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration); } else { - const tableType_t tableType = ((sizeof(void *) == 4) && ((uptrval)source > LZ4_DISTANCE_MAX)) ? byPtr : byU32; - return LZ4_compress_generic(ctx, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration); + const tableType_t tableType = ((sizeof(void *) == 4) && ((uptrval)src > LZ4_DISTANCE_MAX)) ? byPtr : byU32; + return LZ4_compress_generic(ctx, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, noDict, noDictIssue, acceleration); } } } @@ -1323,7 +1323,7 @@ int LZ4_compress_fast_extState_fastReset(void *state, const char *src, char *dst } -int LZ4_compress_fast(const char *source, char *dest, int inputSize, int maxOutputSize, int acceleration) { +int LZ4_compress_fast(const char *src, char *dest, int inputSize, int maxOutputSize, int acceleration) { int result; #if (LZ4_HEAPMODE) LZ4_stream_t *ctxPtr = ALLOC(sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ @@ -1332,7 +1332,7 @@ int LZ4_compress_fast(const char *source, char *dest, int inputSize, int maxOutp LZ4_stream_t ctx; LZ4_stream_t *const ctxPtr = &ctx; #endif - result = LZ4_compress_fast_extState(ctxPtr, source, dest, inputSize, maxOutputSize, acceleration); + result = LZ4_compress_fast_extState(ctxPtr, src, dest, inputSize, maxOutputSize, acceleration); #if (LZ4_HEAPMODE) FREEMEM(ctxPtr); @@ -1530,7 +1530,7 @@ static void LZ4_renormDictT(LZ4_stream_t_internal *LZ4_dict, int nextSize) { int LZ4_compress_fast_continue(LZ4_stream_t *LZ4_stream, - const char *source, char *dest, + const char *src, char *dest, int inputSize, int maxOutputSize, int acceleration) { const tableType_t tableType = byU32; @@ -1545,18 +1545,18 @@ int LZ4_compress_fast_continue(LZ4_stream_t *LZ4_stream, /* invalidate tiny dictionaries */ if ((streamPtr->dictSize - 1 < 4 - 1) /* intentional underflow */ - && (dictEnd != (const BYTE *)source)) { + && (dictEnd != (const BYTE *)src)) { DEBUGLOG(5, "LZ4_compress_fast_continue: dictSize(%u) at addr:%p is too small", streamPtr->dictSize, streamPtr->dictionary); streamPtr->dictSize = 0; - streamPtr->dictionary = (const BYTE *)source; - dictEnd = (const BYTE *)source; + streamPtr->dictionary = (const BYTE *)src; + dictEnd = (const BYTE *)src; } /* Check overlapping input/dictionary space */ { - const BYTE *sourceEnd = (const BYTE *) source + inputSize; - if ((sourceEnd > streamPtr->dictionary) && (sourceEnd < dictEnd)) { - streamPtr->dictSize = (U32)(dictEnd - sourceEnd); + const BYTE *srcEnd = (const BYTE *) src + inputSize; + if ((srcEnd > streamPtr->dictionary) && (srcEnd < dictEnd)) { + streamPtr->dictSize = (U32)(dictEnd - srcEnd); if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB; if (streamPtr->dictSize < 4) streamPtr->dictSize = 0; streamPtr->dictionary = dictEnd - streamPtr->dictSize; @@ -1564,11 +1564,11 @@ int LZ4_compress_fast_continue(LZ4_stream_t *LZ4_stream, } /* prefix mode : source data follows dictionary */ - if (dictEnd == (const BYTE *)source) { + if (dictEnd == (const BYTE *)src) { if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) - return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, dictSmall, acceleration); + return LZ4_compress_generic(streamPtr, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, dictSmall, acceleration); else - return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, noDictIssue, acceleration); + return LZ4_compress_generic(streamPtr, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, noDictIssue, acceleration); } /* external dictionary mode */ @@ -1587,18 +1587,18 @@ int LZ4_compress_fast_continue(LZ4_stream_t *LZ4_stream, * so that the compression loop is only looking into one table. */ LZ4_memcpy(streamPtr, streamPtr->dictCtx, sizeof(*streamPtr)); - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration); + result = LZ4_compress_generic(streamPtr, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration); } else { - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingDictCtx, noDictIssue, acceleration); + result = LZ4_compress_generic(streamPtr, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingDictCtx, noDictIssue, acceleration); } } else { if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) { - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, dictSmall, acceleration); + result = LZ4_compress_generic(streamPtr, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, dictSmall, acceleration); } else { - result = LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration); + result = LZ4_compress_generic(streamPtr, src, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, usingExtDict, noDictIssue, acceleration); } } - streamPtr->dictionary = (const BYTE *)source; + streamPtr->dictionary = (const BYTE *)src; streamPtr->dictSize = (U32)inputSize; return result; } @@ -1606,19 +1606,19 @@ int LZ4_compress_fast_continue(LZ4_stream_t *LZ4_stream, /* Hidden debug function, to force-test external dictionary mode */ -int LZ4_compress_forceExtDict(LZ4_stream_t *LZ4_dict, const char *source, char *dest, int srcSize) { +int LZ4_compress_forceExtDict(LZ4_stream_t *LZ4_dict, const char *src, char *dest, int srcSize) { LZ4_stream_t_internal *streamPtr = &LZ4_dict->internal_donotuse; int result; LZ4_renormDictT(streamPtr, srcSize); if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) { - result = LZ4_compress_generic(streamPtr, source, dest, srcSize, NULL, 0, notLimited, byU32, usingExtDict, dictSmall, 1); + result = LZ4_compress_generic(streamPtr, src, dest, srcSize, NULL, 0, notLimited, byU32, usingExtDict, dictSmall, 1); } else { - result = LZ4_compress_generic(streamPtr, source, dest, srcSize, NULL, 0, notLimited, byU32, usingExtDict, noDictIssue, 1); + result = LZ4_compress_generic(streamPtr, src, dest, srcSize, NULL, 0, notLimited, byU32, usingExtDict, noDictIssue, 1); } - streamPtr->dictionary = (const BYTE *)source; + streamPtr->dictionary = (const BYTE *)src; streamPtr->dictSize = (U32)srcSize; return result; @@ -2145,8 +2145,8 @@ _output_error: /*===== Instantiate the API decoding functions. =====*/ LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe(const char *source, char *dest, int compressedSize, int maxDecompressedSize) { - return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, +int LZ4_decompress_safe(const char *src, char *dest, int compressedSize, int maxDecompressedSize) { + return LZ4_decompress_generic(src, dest, compressedSize, maxDecompressedSize, endOnInputSize, decode_full_block, noDict, (BYTE *)dest, NULL, 0); } @@ -2160,8 +2160,8 @@ int LZ4_decompress_safe_partial(const char *src, char *dst, int compressedSize, } LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_fast(const char *source, char *dest, int originalSize) { - return LZ4_decompress_generic(source, dest, 0, originalSize, +int LZ4_decompress_fast(const char *src, char *dest, int originalSize) { + return LZ4_decompress_generic(src, dest, 0, originalSize, endOnOutputSize, decode_full_block, withPrefix64k, (BYTE *)dest - 64 KB, NULL, 0); } @@ -2169,40 +2169,40 @@ int LZ4_decompress_fast(const char *source, char *dest, int originalSize) { /*===== Instantiate a few more decoding cases, used more than once. =====*/ LZ4_FORCE_O2_GCC_PPC64LE /* Exported, an obsolete API function. */ -int LZ4_decompress_safe_withPrefix64k(const char *source, char *dest, int compressedSize, int maxOutputSize) { - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, +int LZ4_decompress_safe_withPrefix64k(const char *src, char *dest, int compressedSize, int maxOutputSize) { + return LZ4_decompress_generic(src, dest, compressedSize, maxOutputSize, endOnInputSize, decode_full_block, withPrefix64k, (BYTE *)dest - 64 KB, NULL, 0); } /* Another obsolete API function, paired with the previous one. */ -int LZ4_decompress_fast_withPrefix64k(const char *source, char *dest, int originalSize) { +int LZ4_decompress_fast_withPrefix64k(const char *src, char *dest, int originalSize) { /* LZ4_decompress_fast doesn't validate match offsets, * and thus serves well with any prefixed dictionary. */ - return LZ4_decompress_fast(source, dest, originalSize); + return LZ4_decompress_fast(src, dest, originalSize); } LZ4_FORCE_O2_GCC_PPC64LE -static int LZ4_decompress_safe_withSmallPrefix(const char *source, char *dest, int compressedSize, int maxOutputSize, +static int LZ4_decompress_safe_withSmallPrefix(const char *src, char *dest, int compressedSize, int maxOutputSize, size_t prefixSize) { - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, + return LZ4_decompress_generic(src, dest, compressedSize, maxOutputSize, endOnInputSize, decode_full_block, noDict, (BYTE *)dest - prefixSize, NULL, 0); } LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe_forceExtDict(const char *source, char *dest, +int LZ4_decompress_safe_forceExtDict(const char *src, char *dest, int compressedSize, int maxOutputSize, const void *dictStart, size_t dictSize) { - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, + return LZ4_decompress_generic(src, dest, compressedSize, maxOutputSize, endOnInputSize, decode_full_block, usingExtDict, (BYTE *)dest, (const BYTE *)dictStart, dictSize); } LZ4_FORCE_O2_GCC_PPC64LE -static int LZ4_decompress_fast_extDict(const char *source, char *dest, int originalSize, +static int LZ4_decompress_fast_extDict(const char *src, char *dest, int originalSize, const void *dictStart, size_t dictSize) { - return LZ4_decompress_generic(source, dest, 0, originalSize, + return LZ4_decompress_generic(src, dest, 0, originalSize, endOnOutputSize, decode_full_block, usingExtDict, (BYTE *)dest, (const BYTE *)dictStart, dictSize); } @@ -2212,17 +2212,17 @@ static int LZ4_decompress_fast_extDict(const char *source, char *dest, int origi * These routines are used only once, in LZ4_decompress_*_continue(). */ LZ4_FORCE_INLINE -int LZ4_decompress_safe_doubleDict(const char *source, char *dest, int compressedSize, int maxOutputSize, +int LZ4_decompress_safe_doubleDict(const char *src, char *dest, int compressedSize, int maxOutputSize, size_t prefixSize, const void *dictStart, size_t dictSize) { - return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, + return LZ4_decompress_generic(src, dest, compressedSize, maxOutputSize, endOnInputSize, decode_full_block, usingExtDict, (BYTE *)dest - prefixSize, (const BYTE *)dictStart, dictSize); } LZ4_FORCE_INLINE -int LZ4_decompress_fast_doubleDict(const char *source, char *dest, int originalSize, +int LZ4_decompress_fast_doubleDict(const char *src, char *dest, int originalSize, size_t prefixSize, const void *dictStart, size_t dictSize) { - return LZ4_decompress_generic(source, dest, 0, originalSize, + return LZ4_decompress_generic(src, dest, 0, originalSize, endOnOutputSize, decode_full_block, usingExtDict, (BYTE *)dest - prefixSize, (const BYTE *)dictStart, dictSize); } @@ -2282,26 +2282,26 @@ int LZ4_decoderRingBufferSize(int maxBlockSize) { and indicate where it stands using LZ4_setStreamDecode() */ LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *source, char *dest, int compressedSize, int maxOutputSize) { +int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dest, int compressedSize, int maxOutputSize) { LZ4_streamDecode_t_internal *lz4sd = &LZ4_streamDecode->internal_donotuse; int result; if (lz4sd->prefixSize == 0) { /* The first call, no dictionary yet. */ assert(lz4sd->extDictSize == 0); - result = LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize); + result = LZ4_decompress_safe(src, dest, compressedSize, maxOutputSize); if (result <= 0) return result; lz4sd->prefixSize = (size_t)result; lz4sd->prefixEnd = (BYTE *)dest + result; } else if (lz4sd->prefixEnd == (BYTE *)dest) { /* They're rolling the current segment. */ if (lz4sd->prefixSize >= 64 KB - 1) - result = LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize); + result = LZ4_decompress_safe_withPrefix64k(src, dest, compressedSize, maxOutputSize); else if (lz4sd->extDictSize == 0) - result = LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, + result = LZ4_decompress_safe_withSmallPrefix(src, dest, compressedSize, maxOutputSize, lz4sd->prefixSize); else - result = LZ4_decompress_safe_doubleDict(source, dest, compressedSize, maxOutputSize, + result = LZ4_decompress_safe_doubleDict(src, dest, compressedSize, maxOutputSize, lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; lz4sd->prefixSize += (size_t)result; @@ -2310,7 +2310,7 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const cha /* The buffer wraps around, or they're switching to another buffer. */ lz4sd->extDictSize = lz4sd->prefixSize; lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize; - result = LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, + result = LZ4_decompress_safe_forceExtDict(src, dest, compressedSize, maxOutputSize, lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; lz4sd->prefixSize = (size_t)result; @@ -2321,22 +2321,22 @@ int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const cha } LZ4_FORCE_O2_GCC_PPC64LE -int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *source, char *dest, int originalSize) { +int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dest, int originalSize) { LZ4_streamDecode_t_internal *lz4sd = &LZ4_streamDecode->internal_donotuse; int result; assert(originalSize >= 0); if (lz4sd->prefixSize == 0) { assert(lz4sd->extDictSize == 0); - result = LZ4_decompress_fast(source, dest, originalSize); + result = LZ4_decompress_fast(src, dest, originalSize); if (result <= 0) return result; lz4sd->prefixSize = (size_t)originalSize; lz4sd->prefixEnd = (BYTE *)dest + originalSize; } else if (lz4sd->prefixEnd == (BYTE *)dest) { if (lz4sd->prefixSize >= 64 KB - 1 || lz4sd->extDictSize == 0) - result = LZ4_decompress_fast(source, dest, originalSize); + result = LZ4_decompress_fast(src, dest, originalSize); else - result = LZ4_decompress_fast_doubleDict(source, dest, originalSize, + result = LZ4_decompress_fast_doubleDict(src, dest, originalSize, lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; lz4sd->prefixSize += (size_t)originalSize; @@ -2344,7 +2344,7 @@ int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, const cha } else { lz4sd->extDictSize = lz4sd->prefixSize; lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize; - result = LZ4_decompress_fast_extDict(source, dest, originalSize, + result = LZ4_decompress_fast_extDict(src, dest, originalSize, lz4sd->externalDict, lz4sd->extDictSize); if (result <= 0) return result; lz4sd->prefixSize = (size_t)originalSize; @@ -2362,25 +2362,25 @@ Advanced decoding functions : the dictionary must be explicitly provided within parameters */ -int LZ4_decompress_safe_usingDict(const char *source, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize) { +int LZ4_decompress_safe_usingDict(const char *src, char *dest, int compressedSize, int maxOutputSize, const char *dictStart, int dictSize) { if (dictSize == 0) - return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize); + return LZ4_decompress_safe(src, dest, compressedSize, maxOutputSize); if (dictStart + dictSize == dest) { if (dictSize >= 64 KB - 1) { - return LZ4_decompress_safe_withPrefix64k(source, dest, compressedSize, maxOutputSize); + return LZ4_decompress_safe_withPrefix64k(src, dest, compressedSize, maxOutputSize); } assert(dictSize >= 0); - return LZ4_decompress_safe_withSmallPrefix(source, dest, compressedSize, maxOutputSize, (size_t)dictSize); + return LZ4_decompress_safe_withSmallPrefix(src, dest, compressedSize, maxOutputSize, (size_t)dictSize); } assert(dictSize >= 0); - return LZ4_decompress_safe_forceExtDict(source, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize); + return LZ4_decompress_safe_forceExtDict(src, dest, compressedSize, maxOutputSize, dictStart, (size_t)dictSize); } -int LZ4_decompress_fast_usingDict(const char *source, char *dest, int originalSize, const char *dictStart, int dictSize) { +int LZ4_decompress_fast_usingDict(const char *src, char *dest, int originalSize, const char *dictStart, int dictSize) { if (dictSize == 0 || dictStart + dictSize == dest) - return LZ4_decompress_fast(source, dest, originalSize); + return LZ4_decompress_fast(src, dest, originalSize); assert(dictSize >= 0); - return LZ4_decompress_fast_extDict(source, dest, originalSize, dictStart, (size_t)dictSize); + return LZ4_decompress_fast_extDict(src, dest, originalSize, dictStart, (size_t)dictSize); } @@ -2388,8 +2388,8 @@ int LZ4_decompress_fast_usingDict(const char *source, char *dest, int originalSi * Obsolete Functions ***************************************************/ /* obsolete compression functions */ -int LZ4_compress_limitedOutput(const char *source, char *dest, int inputSize, int maxOutputSize) { - return LZ4_compress_default(source, dest, inputSize, maxOutputSize); +int LZ4_compress_limitedOutput(const char *src, char *dest, int inputSize, int maxOutputSize) { + return LZ4_compress_default(src, dest, inputSize, maxOutputSize); } int LZ4_compress(const char *src, char *dest, int srcSize) { return LZ4_compress_default(src, dest, srcSize, LZ4_compressBound(srcSize)); @@ -2403,8 +2403,8 @@ int LZ4_compress_withState(void *state, const char *src, char *dst, int srcSize) int LZ4_compress_limitedOutput_continue(LZ4_stream_t *LZ4_stream, const char *src, char *dst, int srcSize, int dstCapacity) { return LZ4_compress_fast_continue(LZ4_stream, src, dst, srcSize, dstCapacity, 1); } -int LZ4_compress_continue(LZ4_stream_t *LZ4_stream, const char *source, char *dest, int inputSize) { - return LZ4_compress_fast_continue(LZ4_stream, source, dest, inputSize, LZ4_compressBound(inputSize), 1); +int LZ4_compress_continue(LZ4_stream_t *LZ4_stream, const char *src, char *dest, int inputSize) { + return LZ4_compress_fast_continue(LZ4_stream, src, dest, inputSize, LZ4_compressBound(inputSize), 1); } /* @@ -2413,11 +2413,11 @@ They are only provided here for compatibility with older user programs. - LZ4_uncompress is totally equivalent to LZ4_decompress_fast - LZ4_uncompress_unknownOutputSize is totally equivalent to LZ4_decompress_safe */ -int LZ4_uncompress(const char *source, char *dest, int outputSize) { - return LZ4_decompress_fast(source, dest, outputSize); +int LZ4_uncompress(const char *src, char *dest, int outputSize) { + return LZ4_decompress_fast(src, dest, outputSize); } -int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize, int maxOutputSize) { - return LZ4_decompress_safe(source, dest, isize, maxOutputSize); +int LZ4_uncompress_unknownOutputSize(const char *src, char *dest, int isize, int maxOutputSize) { + return LZ4_decompress_safe(src, dest, isize, maxOutputSize); } /* Obsolete Streaming functions */ diff --git a/common/lz4/lz4.h b/common/lz4/lz4.h index c4ea38094..fe0733a33 100644 --- a/common/lz4/lz4.h +++ b/common/lz4/lz4.h @@ -184,7 +184,7 @@ LZ4LIB_API int LZ4_decompress_safe(const char *src, char *dst, int compressedSiz return : maximum output size in a "worst case" scenario or 0, if input size is incorrect (too large or negative) */ -LZ4LIB_API int LZ4_compressBound(int inputSize); +LZ4LIB_API int LZ4_compressBound(int isize); /*! LZ4_compress_fast() : Same as LZ4_compress_default(), but allows selection of "acceleration" factor.