summaryrefslogtreecommitdiffstats
path: root/lib/lz4.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2019-04-12 23:49:01 (GMT)
committerYann Collet <cyan@fb.com>2019-04-12 23:49:01 (GMT)
commitf8b760503445610c43cad813fb3eda29bb3fc763 (patch)
treec75ffb9f4e0bbcbadaf3eb51db02b8a963cfa6c2 /lib/lz4.c
parent9c49e3ca07673949c58d9cffb23034ad0865fefb (diff)
downloadlz4-f8b760503445610c43cad813fb3eda29bb3fc763.zip
lz4-f8b760503445610c43cad813fb3eda29bb3fc763.tar.gz
lz4-f8b760503445610c43cad813fb3eda29bb3fc763.tar.bz2
fixed minor Visual warnings
since Visual 2017, worries about potential overflow, which are actually impossible. Replaced (c * a) by (c ? a : 0). Will likely replaced a * by a cmov. Probably harmless for performance.
Diffstat (limited to 'lib/lz4.c')
-rw-r--r--lib/lz4.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index ca3684f..031f8c1 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -983,7 +983,7 @@ _next_match:
assert(dictEnd > match);
if (limit > matchlimit) limit = matchlimit;
matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
- ip += MINMATCH + matchCode;
+ ip += (size_t)matchCode + MINMATCH;
if (ip==limit) {
unsigned const more = LZ4_count(limit, (const BYTE*)source, matchlimit);
matchCode += more;
@@ -992,7 +992,7 @@ _next_match:
DEBUGLOG(6, " with matchLength=%u starting in extDict", matchCode+MINMATCH);
} else {
matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
- ip += MINMATCH + matchCode;
+ ip += (size_t)matchCode + MINMATCH;
DEBUGLOG(6, " with matchLength=%u", matchCode+MINMATCH);
}