[6.0] 6fb49fee9 Flexelint a signed/unsigned mix.

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Apr 4 14:33:08 UTC 2024


commit 6fb49fee9d58a32a1a88e6993d10d61a31703642
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 27 13:32:17 2023 +0000

    Flexelint a signed/unsigned mix.

diff --git a/bin/varnishd/http2/cache_http2_hpack.c b/bin/varnishd/http2/cache_http2_hpack.c
index 45cddb34b..e5fcac7af 100644
--- a/bin/varnishd/http2/cache_http2_hpack.c
+++ b/bin/varnishd/http2/cache_http2_hpack.c
@@ -97,7 +97,7 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len, int *flags)
 	int disallow_empty;
 	unsigned n;
 	char *p;
-	int i;
+	unsigned u;
 
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 	AN(b);
@@ -123,7 +123,7 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len, int *flags)
 			disallow_empty = 1;
 
 			/* First field cannot contain SP or CTL */
-			for (p = b, i = 0; i < len; p++, i++) {
+			for (p = b, u = 0; u < len; p++, u++) {
 				if (vct_issp(*p) || vct_isctl(*p))
 					return (H2SE_PROTOCOL_ERROR);
 			}
@@ -134,7 +134,7 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len, int *flags)
 			disallow_empty = 1;
 
 			/* Second field cannot contain LWS or CTL */
-			for (p = b, i = 0; i < len; p++, i++) {
+			for (p = b, u = 0; u < len; p++, u++) {
 				if (vct_islws(*p) || vct_isctl(*p))
 					return (H2SE_PROTOCOL_ERROR);
 			}
@@ -155,13 +155,13 @@ h2h_addhdr(struct http *hp, char *b, size_t namelen, size_t len, int *flags)
 			n = hp->nhd;
 			*flags |= H2H_DECODE_FLAG_SCHEME_SEEN;
 
-			for (p = b + namelen, i = 0; i < len-namelen;
-			    p++, i++) {
+			for (p = b + namelen, u = 0; u < len-namelen;
+			    p++, u++) {
 				if (vct_issp(*p) || vct_isctl(*p))
 					return (H2SE_PROTOCOL_ERROR);
 			}
 
-			if (!i)
+			if (!u)
 				return (H2SE_PROTOCOL_ERROR);
 		} else if (!strncmp(b, ":authority: ", namelen)) {
 			b+=6;


More information about the varnish-commit mailing list