From 1833be1cf0e545f8b24bb4a786e274a9e419e280 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 7 Dec 2016 12:59:05 +0100 Subject: fixed gcc warnings --- lib/lz4hc.c | 2 +- lib/lz4opt.h | 16 +++++++--------- programs/lz4io.c | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 9dc6be1..de7a55c 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -84,7 +84,7 @@ * Local Macros **************************************/ #define HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-LZ4HC_HASH_LOG)) -#define DELTANEXTMAXD(p) chainTable[(p) & LZ4HC_MAXD_MASK] /* flexible, LZ4HC_MAXD dependent */ +#define DELTANEXTMAXD(p) chainTable[(p) & LZ4HC_MAXD_MASK] /* flexible, LZ4HC_MAXD dependent */ #define DELTANEXTU16(p) chainTable[(U16)(p)] /* faster */ static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); } diff --git a/lib/lz4opt.h b/lib/lz4opt.h index cc51ec5..6922e35 100644 --- a/lib/lz4opt.h +++ b/lib/lz4opt.h @@ -94,8 +94,8 @@ FORCE_INLINE int LZ4HC_BinTree_GetAllMatches ( const BYTE* match; int nbAttempts = ctx->searchNum; int mnum = 0; - U16 *ptr0, *ptr1; - U32 matchIndex, delta0, delta1; + U16 *ptr0, *ptr1, delta0, delta1; + U32 matchIndex; size_t mlt = 0; U32* HashPos; @@ -129,8 +129,8 @@ FORCE_INLINE int LZ4HC_BinTree_GetAllMatches ( } else { - match = dictBase + matchIndex; const BYTE* vLimit = ip + (dictLimit - matchIndex); + match = dictBase + matchIndex; if (vLimit > iHighLimit) vLimit = iHighLimit; mlt = LZ4_count(ip, match, vLimit); if ((ip+mlt == vLimit) && (vLimit < iHighLimit)) @@ -245,9 +245,8 @@ static int LZ4HC_compress_optimal ( if (last_pos < MINMATCH) { ip++; continue; } - opt[0].mlen = opt[1].mlen = 1; - /* check further positions */ + opt[0].mlen = opt[1].mlen = 1; for (cur = 1; cur <= last_pos; cur++) { inr = ip + cur; @@ -285,7 +284,7 @@ static int LZ4HC_compress_optimal ( goto encode; } - // set prices using matches at position = cur + /* set prices using matches at position = cur */ for (i = 0; i < match_num; i++) { mlen = (i>0) ? (size_t)matches[i-1].len+1 : MINMATCH; cur2 = cur; @@ -312,13 +311,13 @@ static int LZ4HC_compress_optimal ( mlen++; } } - } // for (cur = 1; cur <= last_pos; cur++) + } /* for (cur = 1; cur <= last_pos; cur++) */ best_mlen = opt[last_pos].mlen; best_off = opt[last_pos].off; cur = last_pos - best_mlen; -encode: // cur, last_pos, best_mlen, best_off have to be set +encode: /* cur, last_pos, best_mlen, best_off have to be set */ for (i = 1; i <= last_pos; i++) { LZ4_LOG_PARSER("%d: price[%d/%d]=%d off=%d mlen=%d litlen=%d\n", (int)(ip-source+i), i, last_pos, opt[i].price, opt[i].off, opt[i].mlen, opt[i].litlen); } @@ -363,7 +362,6 @@ encode: // cur, last_pos, best_mlen, best_off have to be set /* Encode Last Literals */ { int lastRun = (int)(iend - anchor); - // if (inputSize > LASTLITERALS && lastRun < LASTLITERALS) { printf("ERROR: lastRun=%d\n", lastRun); } if ((limit) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize)) return 0; /* Check output limit */ if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK< 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; } else *op++ = (BYTE)(lastRun<