[master] ea6fb878b Be consistent about bodylen being a long
Poul-Henning Kamp
phk at FreeBSD.org
Wed Aug 7 09:10:11 UTC 2019
commit ea6fb878bb1e5b6d7bef2fa404ec16fa14aaf700
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Aug 7 08:59:28 2019 +0000
Be consistent about bodylen being a long
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index 61c8dcb2d..2a8480b14 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -131,8 +131,8 @@ void stop_h2(struct http *hp);
void b64_settings(const struct http *hp, const char *s);
/* vtc_gzip.c */
-void vtc_gzip(struct http *, const char *, char **, unsigned *);
-void vtc_gunzip(struct http *, char *, unsigned *);
+void vtc_gzip(const struct http *, const char *, char **, unsigned *);
+void vtc_gunzip(struct http *, char *, long *);
/* vtc_subr.c */
struct vsb *vtc_hex_to_bin(struct vtclog *vl, const char *arg);
diff --git a/bin/varnishtest/vtc_gzip.c b/bin/varnishtest/vtc_gzip.c
index 9eeb67a51..a0b35bc1a 100644
--- a/bin/varnishtest/vtc_gzip.c
+++ b/bin/varnishtest/vtc_gzip.c
@@ -26,6 +26,8 @@
* SUCH DAMAGE.
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -38,7 +40,7 @@
void
-vtc_gzip(struct http *hp, const char *input, char **body, unsigned *bodylen)
+vtc_gzip(const struct http *hp, const char *input, char **body, unsigned *bodylen)
{
unsigned l;
z_stream vz;
@@ -82,7 +84,7 @@ vtc_gzip(struct http *hp, const char *input, char **body, unsigned *bodylen)
}
void
-vtc_gunzip(struct http *hp, char *body, unsigned *bodylen)
+vtc_gunzip(struct http *hp, char *body, long *bodylen)
{
z_stream vz;
char *p;
@@ -111,9 +113,9 @@ vtc_gunzip(struct http *hp, char *body, unsigned *bodylen)
*bodylen = vz.total_out;
memcpy(body, p, *bodylen);
free(p);
- vtc_log(hp->vl, 3, "new bodylen %u", *bodylen);
+ vtc_log(hp->vl, 3, "new bodylen %ld", *bodylen);
vtc_dump(hp->vl, 4, "body", body, *bodylen);
- bprintf(hp->bodylen, "%u", *bodylen);
+ bprintf(hp->bodylen, "%ld", *bodylen);
#ifdef VGZ_EXTENSIONS
vtc_log(hp->vl, 4, "startbit = %ju %ju/%ju",
(uintmax_t)vz.start_bit,
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 2a411a97a..6bbbb79fd 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -763,7 +763,7 @@ cmd_http_gunzip(CMD_ARGS)
(void)vl;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
- vtc_gunzip(hp, hp->body, (unsigned *)&hp->bodyl);
+ vtc_gunzip(hp, hp->body, &hp->bodyl);
}
/**********************************************************************
diff --git a/bin/varnishtest/vtc_http.h b/bin/varnishtest/vtc_http.h
index d9241ff2b..0091eaa1a 100644
--- a/bin/varnishtest/vtc_http.h
+++ b/bin/varnishtest/vtc_http.h
@@ -47,7 +47,7 @@ struct http {
char *rem_port;
char *rem_path;
char *body;
- unsigned bodyl;
+ long bodyl;
char bodylen[20];
char chunklen[20];
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index 4f76c27cf..0c88ba5c7 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -2484,7 +2484,7 @@ cmd_gunzip(CMD_ARGS)
hp = s->hp;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
- vtc_gunzip(s->hp, s->body, (unsigned *)&s->bodylen);
+ vtc_gunzip(s->hp, s->body, &s->bodylen);
}
/* SECTION: stream.spec.write_body
More information about the varnish-commit
mailing list