]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed clang signed/unsigned warning in chunkcopy_safe.
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 27 Mar 2022 20:44:58 +0000 (13:44 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 29 Mar 2022 11:14:18 +0000 (13:14 +0200)
inflate_p.h:159:18: warning: comparison of integers of different signs: 'int32_t' (aka 'int') and 'size_t' (aka 'unsigned long') [-Wsign-compare]
        tocopy = MIN(non_olap_size, len);
                 ^   ~~~~~~~~~~~~~  ~~~
zbuild.h:74:24: note: expanded from macro 'MIN'
#define MIN(a, b) ((a) > (b) ? (b) : (a))
                    ~  ^  ~

inflate_p.h

index 87529aa6d40fc54f6bd7128a6a4f54dd1598821c..ecc1060642e7d4319a126a79a318cae7e79b996e 100644 (file)
@@ -146,7 +146,7 @@ static inline uint8_t* chunkcopy_safe(uint8_t *out, uint8_t *from, size_t len, u
      * initial bulk memcpy of the nonoverlapping region. Then, we can leverage the size of this to determine the safest
      * atomic memcpy size we can pick such that we have non-overlapping regions. This effectively becomes a safe look
      * behind or lookahead distance */
-    int32_t non_olap_size = (int32_t)((from > out) ? from - out : out - from);
+    size_t non_olap_size = ((from > out) ? from - out : out - from);
 
     memcpy(out, from, non_olap_size);
     out += non_olap_size;