summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2020-08-10 17:46:31 (GMT)
committerW. Felix Handte <w@felixhandte.com>2020-08-10 17:47:08 (GMT)
commita78235e6ad87049f2d1c5f98ecc0ccd16ca71f95 (patch)
tree31d8ecf7a4a0c1f4a39934fa4a63f401976e5545
parent9af86f084101b08e87e7c1509e19aa05d27271ed (diff)
downloadlz4-a78235e6ad87049f2d1c5f98ecc0ccd16ca71f95.zip
lz4-a78235e6ad87049f2d1c5f98ecc0ccd16ca71f95.tar.gz
lz4-a78235e6ad87049f2d1c5f98ecc0ccd16ca71f95.tar.bz2
Fix Enum Casts
Fixes `-Wsign-compare` issues.
-rw-r--r--lib/lz4.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 148827e..6322434 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -762,9 +762,9 @@ LZ4_prepareTable(LZ4_stream_t_internal* const cctx,
* therefore safe to use no matter what mode we're in. Otherwise, we figure
* out if it's safe to leave as is or whether it needs to be reset.
*/
- if (cctx->tableType != clearedTable) {
+ if ((tableType_t)cctx->tableType != clearedTable) {
assert(inputSize >= 0);
- if (cctx->tableType != tableType
+ if ((tableType_t)cctx->tableType != tableType
|| ((tableType == byU16) && cctx->currentOffset + (unsigned)inputSize >= 0xFFFFU)
|| ((tableType == byU32) && cctx->currentOffset > 1 GB)
|| tableType == byPtr
@@ -773,7 +773,7 @@ LZ4_prepareTable(LZ4_stream_t_internal* const cctx,
DEBUGLOG(4, "LZ4_prepareTable: Resetting table in %p", cctx);
MEM_INIT(cctx->hashTable, 0, LZ4_HASHTABLESIZE);
cctx->currentOffset = 0;
- cctx->tableType = clearedTable;
+ cctx->tableType = (U32)clearedTable;
} else {
DEBUGLOG(4, "LZ4_prepareTable: Re-use hash table (no reset)");
}
@@ -864,7 +864,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
cctx->dictSize += (U32)inputSize;
}
cctx->currentOffset += (U32)inputSize;
- cctx->tableType = (U16)tableType;
+ cctx->tableType = (U32)tableType;
if (inputSize<LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */
@@ -1428,7 +1428,7 @@ int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize)
base = dictEnd - dict->currentOffset;
dict->dictionary = p;
dict->dictSize = (U32)(dictEnd - p);
- dict->tableType = tableType;
+ dict->tableType = (U32)tableType;
while (p <= dictEnd-HASH_UNIT) {
LZ4_putPosition(p, dict->hashTable, tableType, base);