summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/lz4hc.c2
-rw-r--r--lib/lz4opt.h16
-rw-r--r--programs/lz4io.c2
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<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun > 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; }
else *op++ = (BYTE)(lastRun<<ML_BITS);
diff --git a/programs/lz4io.c b/programs/lz4io.c
index 5e45e72..f8a8f2b 100644
--- a/programs/lz4io.c
+++ b/programs/lz4io.c
@@ -598,7 +598,7 @@ int LZ4IO_compressMultipleFilenames(const char** inFileNamesTable, int ifntSize,
/* loop on each file */
for (i=0; i<ifntSize; i++) {
size_t const ifnSize = strlen(inFileNamesTable[i]);
- if (ofnSize <= ifnSize+suffixSize+1) { free(dstFileName); ofnSize = ifnSize + 20; dstFileName = (char*)malloc(ofnSize); if (dstFileName==NULL) return ifntSize; }
+ if (ofnSize <= ifnSize+suffixSize+1) { free(dstFileName); ofnSize = ifnSize + 20; dstFileName = (char*)malloc(ofnSize); if (dstFileName==NULL) { LZ4IO_freeCResources(ress); return ifntSize; } }
strcpy(dstFileName, inFileNamesTable[i]);
strcat(dstFileName, suffix);