]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed possible loss of data warning in LONGEST_MATCH.
authorNathan Moinvaziri <nathan@nathanm.com>
Sat, 4 Jul 2020 03:31:36 +0000 (20:31 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Fri, 14 Aug 2020 20:20:50 +0000 (22:20 +0200)
    match_tpl.h(69,64): warning C4244: '=': conversion from 'unsigned int' to 'Pos', possible loss of data

match_tpl.h

index ddfaf4082baad1df5e5d559d4538711f51406b55..24bf01de79d12493651e1fbc26cabaa4dceccb1e 100644 (file)
@@ -66,7 +66,7 @@ ZLIB_INTERNAL int32_t LONGEST_MATCH(deflate_state *const s, Pos cur_match) {
      * Stop when cur_match becomes <= limit. To simplify the code,
      * we prevent matches with the string of window index 0
      */
-    limit = strstart > MAX_DIST(s) ? strstart - MAX_DIST(s) : 0;
+    limit = strstart > MAX_DIST(s) ? (Pos)(strstart - MAX_DIST(s)) : 0;
 
     scan_start = *(bestcmp_t *)(scan);
     scan_end = *(bestcmp_t *)(scan+best_len-1);