[master] 679c64d06 Signed/unsigned Flexelinting

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 30 06:26:08 UTC 2019


commit 679c64d067b10fc2c6490e6bcde256881bb08bae
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Apr 30 05:46:17 2019 +0000

    Signed/unsigned Flexelinting

diff --git a/bin/varnishtest/hpack.h b/bin/varnishtest/hpack.h
index a443ee4af..b1ad007bb 100644
--- a/bin/varnishtest/hpack.h
+++ b/bin/varnishtest/hpack.h
@@ -52,7 +52,7 @@ struct hpk_hdr {
 	struct txt key;
 	struct txt value;
 	enum hpk_indexed t;
-	int i;
+	unsigned i;
 };
 
 struct hpk_ctx;
diff --git a/bin/varnishtest/huffman_gen.py b/bin/varnishtest/huffman_gen.py
index dd4f8e1e8..1320424d2 100755
--- a/bin/varnishtest/huffman_gen.py
+++ b/bin/varnishtest/huffman_gen.py
@@ -70,7 +70,7 @@ struct ssym {
 };
 
 struct stbl {
-    int msk;
+    unsigned msk;
     struct ssym *syms;
 };
 ''')
diff --git a/bin/varnishtest/tests/c00094.vtc b/bin/varnishtest/tests/c00094.vtc
index ad7a06a4e..d8c7eef72 100644
--- a/bin/varnishtest/tests/c00094.vtc
+++ b/bin/varnishtest/tests/c00094.vtc
@@ -37,6 +37,8 @@ server s1 -listen "${tmpdir}/s1.sock" {
 	barrier b1 sync
 } -start
 
+varnish v1 -cliok "param.set debug +syncvsl"
+
 varnish v1 -vcl {
 
 	backend foo {
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index 9d19f09aa..50f5e8f1a 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -104,7 +104,7 @@ void vtc_fatal(struct vtclog *vl, const char *, ...)
     v_noreturn_ v_printflike_(2,3);
 void vtc_dump(struct vtclog *vl, int lvl, const char *pfx,
     const char *str, int len);
-void vtc_hexdump(struct vtclog *, int , const char *, const void *, int );
+void vtc_hexdump(struct vtclog *, int , const char *, const void *, unsigned);
 
 int vtc_send_proxy(int fd, int version, const struct suckaddr *sac,
     const struct suckaddr *sas);
diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c
index cd0063cf5..99ed617d5 100644
--- a/bin/varnishtest/vtc_barrier.c
+++ b/bin/varnishtest/vtc_barrier.c
@@ -54,9 +54,9 @@ struct barrier {
 	pthread_mutex_t		mtx;
 	pthread_cond_t		cond;
 
-	unsigned		waiters;
-	unsigned		expected;
-	unsigned		cyclic;
+	int			waiters;
+	int			expected;
+	int			cyclic;
 
 	enum barrier_e		type;
 	/* fields below are only for BARRIER_SOCK */
diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index 865b7872d..783246e3e 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -59,7 +59,7 @@ struct client {
 	char			*proxy_spec;
 	int			proxy_version;
 
-	unsigned		repeat;
+	int			repeat;
 	unsigned		keepalive;
 
 	unsigned		running;
@@ -200,7 +200,7 @@ client_thread(void *priv)
 	struct client *c;
 	struct vtclog *vl;
 	int fd;
-	unsigned u;
+	int i;
 	struct vsb *vsb;
 	const char *err;
 
@@ -218,7 +218,7 @@ client_thread(void *priv)
 	if (c->repeat != 1)
 		vtc_log(vl, 2, "Started (%u iterations%s)", c->repeat,
 			c->keepalive ? " using keepalive" : "");
-	for (u = 0; u < c->repeat; u++) {
+	for (i = 0; i < c->repeat; i++) {
 		char *addr = VSB_data(vsb);
 
 		vtc_log(vl, 3, "Connect to %s", addr);
@@ -237,7 +237,7 @@ client_thread(void *priv)
 			fd = http_process(vl, c->spec, fd, NULL, addr,
 			    c->rcvbuf);
 		else
-			while (fd >= 0 && u++ < c->repeat)
+			while (fd >= 0 && i++ < c->repeat)
 				fd = http_process(vl, c->spec, fd, NULL, addr,
 				    c->rcvbuf);
 		vtc_log(vl, 3, "closing fd %d", fd);
diff --git a/bin/varnishtest/vtc_h2_hpack.c b/bin/varnishtest/vtc_h2_hpack.c
index f7343cab1..a00208ad9 100644
--- a/bin/varnishtest/vtc_h2_hpack.c
+++ b/bin/varnishtest/vtc_h2_hpack.c
@@ -254,11 +254,14 @@ str_decode(struct hpk_iter *iter, struct txt *t)
 {
 	uint32_t num;
 	int huff;
+
 	assert(iter->buf < iter->end);
+
 	huff = (*iter->buf & 0x80);
 	if (hpk_more != num_decode(&num, iter, 7))
 		return (hpk_err);
-	if (num > iter->end - iter->buf)
+	assert(iter->buf < iter->end);
+	if (num > (unsigned)(iter->end - iter->buf))
 		return (hpk_err);
 	if (huff) { /*Huffman encoding */
 		t->ptr = malloc((num * 8L) / 5L + 1L);
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index 9b1b27632..41baa8803 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -569,7 +569,8 @@ static void
 parse_settings(const struct stream *s, struct frame *f)
 {
 	struct http *hp;
-	int i, t, v;
+	int t, v;
+	unsigned u;
 	const char *buf;
 	enum hpk_result r;
 	CHECK_OBJ_NOTNULL(f, FRAME_MAGIC);
@@ -580,19 +581,19 @@ parse_settings(const struct stream *s, struct frame *f)
 		vtc_fatal(hp->vl,
 		    "Size should be a multiple of 6, but isn't (%d)", f->size);
 
-	for (i = 0; i <= SETTINGS_MAX; i++)
-		f->md.settings[i] = NAN;
+	for (u = 0; u <= SETTINGS_MAX; u++)
+		f->md.settings[u] = NAN;
 
-	for (i = 0; i < f->size;) {
-		t = vbe16dec(f->data + i);
-		i += 2;
-		v = vbe32dec(f->data + i);
+	for (u = 0; u < f->size;) {
+		t = vbe16dec(f->data + u);
+		u += 2;
+		v = vbe32dec(f->data + u);
 		if (t <= SETTINGS_MAX) {
 			buf = h2_settings[t];
 			f->md.settings[t] = v;
 		} else
 			buf = "unknown";
-		i += 4;
+		u += 4;
 
 		if (t == 1) {
 			r = HPK_ResizeTbl(s->hp->encctx, v);
@@ -2116,7 +2117,7 @@ cmd_rxhdrs(CMD_ARGS)
 	char *p;
 	int loop = 0;
 	unsigned long int times = 1;
-	int rcv = 0;
+	unsigned rcv = 0;
 	enum h2_type expect = TYPE_HEADERS;
 
 	(void)cmd;
@@ -2155,7 +2156,7 @@ cmd_rxcont(CMD_ARGS)
 	char *p;
 	int loop = 0;
 	unsigned long int times = 1;
-	int rcv = 0;
+	unsigned rcv = 0;
 
 	(void)cmd;
 	(void)av;
@@ -2206,7 +2207,7 @@ cmd_rxdata(CMD_ARGS)
 	char *p;
 	int loop = 0;
 	unsigned long int times = 1;
-	int rcv = 0;
+	unsigned rcv = 0;
 
 	(void)cmd;
 	(void)av;
@@ -2307,7 +2308,7 @@ cmd_rxpush(CMD_ARGS)
 	char *p;
 	int loop = 0;
 	unsigned long int times = 1;
-	int rcv = 0;
+	unsigned rcv = 0;
 	enum h2_type expect = TYPE_PUSH_PROMISE;
 
 	(void)cmd;
diff --git a/bin/varnishtest/vtc_log.c b/bin/varnishtest/vtc_log.c
index 60f0576b8..e9b540ee6 100644
--- a/bin/varnishtest/vtc_log.c
+++ b/bin/varnishtest/vtc_log.c
@@ -148,7 +148,7 @@ vtc_leadin(const struct vtclog *vl, int lvl, const char *fmt, ...)
 static void
 vtc_log_emit(const struct vtclog *vl)
 {
-	int l;
+	unsigned l;
 
 	l = VSB_len(vl->vsb);
 	if (l == 0)
@@ -232,7 +232,7 @@ vtc_dump(struct vtclog *vl, int lvl, const char *pfx, const char *str, int len)
 
 void
 vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
-    const void *ptr, int len)
+    const void *ptr, unsigned len)
 {
 	int nl = 1;
 	unsigned l;
diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index 9003516c4..1a4054a4b 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -50,7 +50,7 @@ struct server {
 	VTAILQ_ENTRY(server)	list;
 	char			run;
 
-	unsigned		repeat;
+	int			repeat;
 	unsigned		keepalive;
 	char			*spec;
 
diff --git a/bin/varnishtest/vtc_syslog.c b/bin/varnishtest/vtc_syslog.c
index 419553930..b9862eb50 100644
--- a/bin/varnishtest/vtc_syslog.c
+++ b/bin/varnishtest/vtc_syslog.c
@@ -51,7 +51,7 @@ struct syslog_srv {
 	VTAILQ_ENTRY(syslog_srv)	list;
 	char				run;
 
-	unsigned			repeat;
+	int				repeat;
 	char				*spec;
 
 	int				sock;


More information about the varnish-commit mailing list