From: Nathan Moinvaziri Date: Sun, 27 Mar 2022 20:44:58 +0000 (-0700) Subject: Fixed clang signed/unsigned warning in chunkcopy_safe. X-Git-Tag: 2.1.0-beta1~296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41faa0843d77f100d2f4770cecb92007cc3ea9ca;p=thirdparty%2Fzlib-ng.git Fixed clang signed/unsigned warning in chunkcopy_safe. 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)) ~ ^ ~ --- diff --git a/inflate_p.h b/inflate_p.h index 87529aa6..ecc10606 100644 --- a/inflate_p.h +++ b/inflate_p.h @@ -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;