]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Clean up debug sign conversions in deflate check_match calls. develop
authorMark Adler <git@madler.net>
Sat, 4 Apr 2026 01:57:24 +0000 (18:57 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Wed, 5 Aug 2026 13:33:11 +0000 (15:33 +0200)
Cast match_len/prev_length to int at check_match call sites to
avoid implicit unsigned-to-signed conversion warnings.

Upstream: https://github.com/madler/zlib/commit/f4f34491

deflate_p.h

index ba9c1eb9fa69af6f75b9ec80bc0247678c67611d..a69476a93827bf6549c1d90f6343d30301dd6f04 100644 (file)
 /* ===========================================================================
  * Check that the match at match_start is indeed a match.
  */
 /* ===========================================================================
  * Check that the match at match_start is indeed a match.
  */
-static inline void check_match(deflate_state *s, uint32_t start, uint32_t match, int length) {
+static inline void check_match(deflate_state *s, uint32_t start, uint32_t match, uint32_t length) {
     /* check that the match length is valid*/
     if (length < STD_MIN_MATCH || length > STD_MAX_MATCH) {
     /* check that the match length is valid*/
     if (length < STD_MIN_MATCH || length > STD_MAX_MATCH) {
-        fprintf(stderr, " start %u, match %u, length %d\n", start, match, length);
+        fprintf(stderr, " start %u, match %u, length %u\n", start, match, length);
         z_error("invalid match length");
     }
     /* check that the match isn't at the same position as the start string */
     if (match == start) {
         z_error("invalid match length");
     }
     /* check that the match isn't at the same position as the start string */
     if (match == start) {
-        fprintf(stderr, " start %u, match %u, length %d\n", start, match, length);
+        fprintf(stderr, " start %u, match %u, length %u\n", start, match, length);
         z_error("invalid match position");
     }
     /* check that the match is indeed a match */
     if (memcmp(s->window + match, s->window + start, length) != 0) {
         int32_t i = 0;
         z_error("invalid match position");
     }
     /* check that the match is indeed a match */
     if (memcmp(s->window + match, s->window + start, length) != 0) {
         int32_t i = 0;
-        fprintf(stderr, " start %u, match %u, length %d\n", start, match, length);
+        fprintf(stderr, " start %u, match %u, length %u\n", start, match, length);
         do {
             fprintf(stderr, "  %03d: match [%02x] start [%02x]\n", i++,
                 s->window[match++], s->window[start++]);
         do {
             fprintf(stderr, "  %03d: match [%02x] start [%02x]\n", i++,
                 s->window[match++], s->window[start++]);
@@ -41,7 +41,7 @@ static inline void check_match(deflate_state *s, uint32_t start, uint32_t match,
         z_error("invalid match");
     }
     if (z_verbose > 1) {
         z_error("invalid match");
     }
     if (z_verbose > 1) {
-        fprintf(stderr, "\\[%u,%d]", start-match, length);
+        fprintf(stderr, "\\[%u,%u]", start-match, length);
         do {
             putc(s->window[start++], stderr);
         } while (--length != 0);
         do {
             putc(s->window[start++], stderr);
         } while (--length != 0);