[experimental-ims] d0be5ad Add __printflike and fix everything that brings to light

Geoff Simmons geoff at varnish-cache.org
Mon Jan 16 17:58:31 CET 2012


commit d0be5ad9818095aa17f5dda12adf42d5e63c3ddf
Author: Rogier 'DocWilco' Mulhuijzen <github at bsdchicks.com>
Date:   Sun Jan 15 17:37:03 2012 +0100

    Add __printflike and fix everything that brings to light

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 6b0d0a9..356d138 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -809,7 +809,8 @@ void http_PutStatus(struct http *to, uint16_t status);
 void http_PutResponse(struct worker *w, unsigned vsl_id, const struct http *to,
     const char *response);
 void http_PrintfHeader(struct worker *w, unsigned vsl_id, struct http *to,
-    const char *fmt, ...);
+    const char *fmt, ...)
+    __printflike(4, 5);
 void http_SetHeader(struct worker *w, unsigned vsl_id, struct http *to,
     const char *hdr);
 void http_SetH(const struct http *to, unsigned n, const char *fm);
@@ -928,10 +929,13 @@ void *VSM_Alloc(unsigned size, const char *class, const char *type,
     const char *ident);
 void VSM_Free(void *ptr);
 #ifdef VSL_ENDMARKER
-void VSL(enum VSL_tag_e tag, int id, const char *fmt, ...);
+void VSL(enum VSL_tag_e tag, int id, const char *fmt, ...)
+    __printflike(3, 4);
 void WSLR(struct worker *w, enum VSL_tag_e tag, int id, txt t);
-void WSL(struct worker *w, enum VSL_tag_e tag, int id, const char *fmt, ...);
-void WSLB(struct worker *w, enum VSL_tag_e tag, const char *fmt, ...);
+void WSL(struct worker *w, enum VSL_tag_e tag, int id, const char *fmt, ...)
+    __printflike(4, 5);
+void WSLB(struct worker *w, enum VSL_tag_e tag, const char *fmt, ...)
+    __printflike(3, 4);
 
 void WSL_Flush(struct worker *w, int overflow);
 
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index 69e854e..d80842a 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -1776,7 +1776,7 @@ cli_debug_srandom(struct cli *cli, const char * const *av, void *priv)
 		seed = strtoul(av[2], NULL, 0);
 	srandom(seed);
 	srand48(random());
-	VCLI_Out(cli, "Random(3) seeded with %lu", seed);
+	VCLI_Out(cli, "Random(3) seeded with %u", seed);
 }
 
 static struct cli_proto debug_cmds[] = {
diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index c29f5a1..a839f5a 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -236,6 +236,10 @@ WSLR(struct worker *wrk, enum VSL_tag_e tag, int id, txt t)
 
 static void
 wsl(struct worker *wrk, enum VSL_tag_e tag, int id, const char *fmt, va_list ap)
+    __printflike(4, 0);
+
+static void
+wsl(struct worker *wrk, enum VSL_tag_e tag, int id, const char *fmt, va_list ap)
 {
 	char *p;
 	unsigned n, mlen;
diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index 6b3b846..93d82f9 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -104,7 +104,8 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
 		AN(w);
 		if (strcmp(x, nm)) {
 			VCLI_Out(cli, "Loading VMOD %s from %s:\n", nm, path);
-			VCLI_Out(cli, "File contain wrong VMOD (\"%s\")\n", x);
+			VCLI_Out(cli, "File contain wrong VMOD (\"%s\")\n",
+			    (char *) x);
 			VCLI_Out(cli, "Check relative pathnames ?.\n");
 			(void)dlclose(v->hdl);
 			FREE_OBJ(v);
diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h
index 0e3eb9e..ffaef56 100644
--- a/bin/varnishd/mgt/mgt.h
+++ b/bin/varnishd/mgt/mgt.h
@@ -50,7 +50,8 @@ void MGT_Child_Cli_Fail(void);
 typedef void mgt_cli_close_f(void *priv);
 void mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident,
     mgt_cli_close_f *close_func, void *priv);
-int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...);
+int mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...)
+    __printflike(3, 4);
 void mgt_cli_start_child(int fdi, int fdo);
 void mgt_cli_stop_child(void);
 void mgt_cli_telnet(const char *T_arg);
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index c488f23..8123bfc 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -261,7 +261,7 @@ tweak_generic_uint(struct cli *cli, volatile unsigned *dest, const char *arg,
 		}
 		*dest = u;
 	} else if (*dest == UINT_MAX) {
-		VCLI_Out(cli, "unlimited", *dest);
+		VCLI_Out(cli, "unlimited");
 	} else {
 		VCLI_Out(cli, "%u", *dest);
 	}
diff --git a/bin/varnishreplay/varnishreplay.c b/bin/varnishreplay/varnishreplay.c
index 8e694da..02ad83e 100644
--- a/bin/varnishreplay/varnishreplay.c
+++ b/bin/varnishreplay/varnishreplay.c
@@ -44,6 +44,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "vdef.h"
 #include "vapi/vsl.h"
 #include "vapi/vsm.h"
 #include "vas.h"
@@ -171,6 +172,10 @@ static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 static void
 thread_log(int lvl, int errcode, const char *fmt, ...)
+    __printflike(3, 4);
+
+static void
+thread_log(int lvl, int errcode, const char *fmt, ...)
 {
 	va_list ap;
 
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 9581b3c..b8556ce 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -449,7 +449,7 @@ cmd_random(CMD_ARGS)
 		l = random();
 		if (l == random_expect[i])
 			continue;
-		vtc_log(vl, 4, "random[%d] = 0x%x (expect 0x%x)",
+		vtc_log(vl, 4, "random[%d] = 0x%x (expect 0x%lx)",
 		    i, l, random_expect[i]);
 		vtc_log(vl, 1, "SKIPPING test: unknown srandom(1) sequence.");
 		vtc_stop = 1;
@@ -538,17 +538,17 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
 
 	/* Apply extmacro definitions */
 	VTAILQ_FOREACH(m, &extmacro_list, list)
-		macro_def(vltop, NULL, m->name, m->val);
+		macro_def(vltop, NULL, m->name, "%s", m->val);
 
 	/* Other macro definitions */
 	cwd = getcwd(NULL, PATH_MAX);
-	macro_def(vltop, NULL, "pwd", cwd);
+	macro_def(vltop, NULL, "pwd", "%s", cwd);
 	macro_def(vltop, NULL, "topbuild", "%s/%s", cwd, TOP_BUILDDIR);
 	macro_def(vltop, NULL, "bad_ip", "10.255.255.255");
 
 	/* Move into our tmpdir */
 	AZ(chdir(tmpdir));
-	macro_def(vltop, NULL, "tmpdir", tmpdir);
+	macro_def(vltop, NULL, "tmpdir", "%s", tmpdir);
 
 	/* Drop file to tell what was going on here */
 	f = fopen("INFO", "w");
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index ee5308a..be20cb9 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -77,7 +77,8 @@ void cmd_server_genvcl(struct vsb *vsb);
 void vtc_loginit(char *buf, unsigned buflen);
 struct vtclog *vtc_logopen(const char *id);
 void vtc_logclose(struct vtclog *vl);
-void vtc_log(struct vtclog *vl, int lvl, const char *fmt, ...);
+void vtc_log(struct vtclog *vl, int lvl, const char *fmt, ...)
+    __printflike(3, 4);
 void 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,
@@ -87,7 +88,9 @@ int exec_file(const char *fn, const char *script, const char *tmpdir,
     char *logbuf, unsigned loglen);
 
 void macro_def(struct vtclog *vl, const char *instance, const char *name,
-    const char *fmt, ...);
+    const char *fmt, ...)
+    __printflike(4, 5);
 struct vsb *macro_expand(struct vtclog *vl, const char *text);
 
-void extmacro_def(const char *name, const char *fmt, ...);
+void extmacro_def(const char *name, const char *fmt, ...)
+    __printflike(2, 3);
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index d3753a5..00be0be 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -133,13 +133,13 @@ synth_body(const char *len, int rnd)
 static void
 http_write(const struct http *hp, int lvl, const char *pfx)
 {
-	int l;
+	ssize_t l;
 
 	AZ(VSB_finish(hp->vsb));
 	vtc_dump(hp->vl, lvl, pfx, VSB_data(hp->vsb), VSB_len(hp->vsb));
 	l = write(hp->fd, VSB_data(hp->vsb), VSB_len(hp->vsb));
 	if (l != VSB_len(hp->vsb))
-		vtc_log(hp->vl, hp->fatal, "Write failed: (%d vs %d) %s",
+		vtc_log(hp->vl, hp->fatal, "Write failed: (%zd vs %zd) %s",
 		    l, VSB_len(hp->vsb), strerror(errno));
 }
 
@@ -387,7 +387,7 @@ http_rxchunk(struct http *hp)
 	bprintf(hp->chunklen, "%d", i);
 	if ((q == hp->rxbuf + l) ||
 		(*q != '\0' && !vct_islws(*q))) {
-		vtc_log(hp->vl, hp->fatal, "chunked fail %02x @ %d",
+		vtc_log(hp->vl, hp->fatal, "chunked fail %02x @ %td",
 		    *q, q - (hp->rxbuf + l));
 	}
 	assert(q != hp->rxbuf + l);
diff --git a/bin/varnishtest/vtc_sema.c b/bin/varnishtest/vtc_sema.c
index 48d4c68..fd4c561 100644
--- a/bin/varnishtest/vtc_sema.c
+++ b/bin/varnishtest/vtc_sema.c
@@ -63,7 +63,7 @@ sema_new(char *name, struct vtclog *vl)
 	AN(r);
 	r->name = name;
 	if (*name != 'r')
-		vtc_log(vl, 0, "Sema name must start with 'r' (%s)", *name);
+		vtc_log(vl, 0, "Sema name must start with 'r' (%s)", name);
 
 	AZ(pthread_mutex_init(&r->mtx, NULL));
 	AZ(pthread_cond_init(&r->cond, NULL));
diff --git a/include/vcli_common.h b/include/vcli_common.h
index 8d0a623..fbb4e9f 100644
--- a/include/vcli_common.h
+++ b/include/vcli_common.h
@@ -28,6 +28,8 @@
  *
  */
 
+#include "vdef.h"
+
 struct vlu;
 struct VCLS;
 
diff --git a/include/vcli_priv.h b/include/vcli_priv.h
index a265d2e..0129b83 100644
--- a/include/vcli_priv.h
+++ b/include/vcli_priv.h
@@ -53,6 +53,7 @@ struct cli_proto {
 
 /* The implementation must provide these functions */
 int VCLI_Overflow(struct cli *cli);
-void VCLI_Out(struct cli *cli, const char *fmt, ...);
+void VCLI_Out(struct cli *cli, const char *fmt, ...)
+    __printflike(2, 3);
 void VCLI_Quote(struct cli *cli, const char *str);
 void VCLI_SetResult(struct cli *cli, unsigned r);
diff --git a/include/vdef.h b/include/vdef.h
index c9b24c5..63a2a6b 100644
--- a/include/vdef.h
+++ b/include/vdef.h
@@ -1,10 +1,14 @@
 /*-
  * Copyright (c) 2006 Verdens Gang AS
- * Copyright (c) 2006-2011 Varnish Software AS
+ * Copyright (c) 2006-2012 Varnish Software AS
+ * Copyright (c) 2012 Fastly Inc
  * All rights reserved.
  *
  * Author: Poul-Henning Kamp <phk at phk.freebsd.dk>
+ * Author: Rogier 'DocWilco' Mulhuijzen <rogier at fastly.com>
  *
+ * Inspired by FreeBSD's <sys/cdefs.h>
+ * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -28,6 +32,9 @@
  *
  */
 
+#ifndef VDEF_H_INCLUDED
+#define VDEF_H_INCLUDED
+
 /* Safe printf into a fixed-size buffer */
 #define bprintf(buf, fmt, ...)						\
 	do {								\
@@ -42,3 +49,22 @@
 		    < sizeof buf);					\
 	} while (0)
 
+
+#ifndef __GNUC_PREREQ
+# if defined __GNUC__ && defined __GNUC_MINOR__
+#  define __GNUC_PREREQ(maj, min) \
+	(__GNUC__ > (maj) || (__GNUC__ == (maj) && __GNUC_MINOR__ >= (min)))
+# else
+#  define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+
+#ifndef __printflike
+# if __GNUC_PREREQ(2, 95) || defined(__INTEL_COMPILER)
+#  define __printflike(f,a) __attribute__((format(printf, f, a)))
+# else
+#  define __printflike(f,a)
+# endif
+#endif
+
+#endif /* VDEF_H_INCLUDED */
diff --git a/include/vsb.h b/include/vsb.h
index 0a8e2bf..e17fe5b 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -31,6 +31,8 @@
 #ifndef VSB_H_INCLUDED
 #define VSB_H_INCLUDED
 
+#include "vdef.h"
+
 /*
  * Structure definition
  */
@@ -49,10 +51,6 @@ struct vsb {
 	int		 s_flags;	/* flags */
 };
 
-#ifndef __printflike
-#define __printflike(a,b)
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index accef82..5f992cf 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -39,6 +39,7 @@
 
 #include "miniobj.h"
 #include "vas.h"
+#include "vdef.h"
 
 #include "vapi/vsc.h"
 #include "vapi/vsm.h"
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 6950c1b..8e7001a 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -41,6 +41,7 @@
 
 #include "miniobj.h"
 #include "vas.h"
+#include "vdef.h"
 
 #include "vapi/vsl.h"
 #include "vapi/vsm.h"
diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c
index 068d539..8587fb1 100644
--- a/lib/libvarnishapi/vsl_arg.c
+++ b/lib/libvarnishapi/vsl_arg.c
@@ -43,6 +43,7 @@
 
 #include "miniobj.h"
 #include "vas.h"
+#include "vdef.h"
 
 #include "vapi/vsl.h"
 #include "vapi/vsm.h"
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index e11fe26..c175f10 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -44,6 +44,7 @@
 
 #include "miniobj.h"
 #include "vas.h"
+#include "vdef.h"
 
 #include "vapi/vsm.h"
 #include "vapi/vsm_int.h"
diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h
index 79be982..af99798 100644
--- a/lib/libvarnishapi/vsm_api.h
+++ b/lib/libvarnishapi/vsm_api.h
@@ -51,6 +51,7 @@ struct VSM_data {
 	struct vsl		*vsl;
 };
 
-int vsm_diag(struct VSM_data *vd, const char *fmt, ...);
+int vsm_diag(struct VSM_data *vd, const char *fmt, ...)
+    __printflike(2, 3);
 void VSC_Delete(struct VSM_data *vd);
 void VSL_Delete(struct VSM_data *vd);
diff --git a/lib/libvcl/vcc_acl.c b/lib/libvcl/vcc_acl.c
index c962044..e6a1065 100644
--- a/lib/libvcl/vcc_acl.c
+++ b/lib/libvcl/vcc_acl.c
@@ -362,12 +362,12 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
 
 	Fh(tl, 0, "\n");
 	Fh(tl, 0, "\ta = p;\n");
-	Fh(tl, 0, "\tVRT_memmove(&fam, a + %d, sizeof fam);\n",
+	Fh(tl, 0, "\tVRT_memmove(&fam, a + %zd, sizeof fam);\n",
 	    offsetof(struct sockaddr, sa_family));
 	Fh(tl, 0, "\tif (fam == %d)\n", PF_INET);
-	Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in, sin_addr));
+	Fh(tl, 0, "\t\ta += %zd;\n", offsetof(struct sockaddr_in, sin_addr));
 	Fh(tl, 0, "\telse if (fam == %d)\n", PF_INET6);
-	Fh(tl, 0, "\t\ta += %d;\n", offsetof(struct sockaddr_in6, sin6_addr));
+	Fh(tl, 0, "\t\ta += %zd;\n", offsetof(struct sockaddr_in6, sin6_addr));
 	Fh(tl, 0, "\telse {\n");
 	Fh(tl, 0, "\t\tVRT_acl_log(sp, \"NO_FAM %s\");\n", acln);
 	Fh(tl, 0, "\t\treturn(0);\n");
@@ -422,8 +422,7 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon)
 
 		if (!anon) {
 			Fh(tl, 0, "\t%*sVRT_acl_log(sp, \"%sMATCH %s \" ",
-			    -i, "", ae->not ? "NEG_" : "", acln,
-			    PF(ae->t_addr));
+			    -i, "", ae->not ? "NEG_" : "", acln);
 			EncToken(tl->fh, ae->t_addr);
 			if (ae->t_mask != NULL)
 				Fh(tl, 0, " \"/%.*s\" ", PF(ae->t_mask));
diff --git a/lib/libvcl/vcc_backend.c b/lib/libvcl/vcc_backend.c
index 03482c4..fb160e7 100644
--- a/lib/libvcl/vcc_backend.c
+++ b/lib/libvcl/vcc_backend.c
@@ -353,7 +353,7 @@ vcc_ParseProbeSpec(struct vcc *tl)
 	if (t_initial != NULL)
 		Fh(tl, 0, "\t.initial = %u,\n", initial);
 	else
-		Fh(tl, 0, "\t.initial = ~0U,\n", initial);
+		Fh(tl, 0, "\t.initial = ~0U,\n");
 	if (status > 0)
 		Fh(tl, 0, "\t.exp_status = %u,\n", status);
 	Fh(tl, 0, "};\n");
diff --git a/lib/libvcl/vcc_compile.c b/lib/libvcl/vcc_compile.c
index 27447fe..66d89f5 100644
--- a/lib/libvcl/vcc_compile.c
+++ b/lib/libvcl/vcc_compile.c
@@ -286,7 +286,7 @@ LocTable(const struct vcc *tl)
 				pos++;
 
 		}
-		Fc(tl, 0, "  [%3u] = { %d, %8u, %4u, %3u, 0, ",
+		Fc(tl, 0, "  [%3u] = { %d, %8tu, %4u, %3u, 0, ",
 		    t->cnt, sp->idx, t->b - sp->b, lin, pos + 1);
 		if (t->tok == CSRC)
 			Fc(tl, 0, " \"C{\"},\n");
diff --git a/lib/libvcl/vcc_compile.h b/lib/libvcl/vcc_compile.h
index caacd73..b64564e 100644
--- a/lib/libvcl/vcc_compile.h
+++ b/lib/libvcl/vcc_compile.h
@@ -247,11 +247,16 @@ extern struct method method_tab[];
  * I -> Initializer function
  * F -> Finish function
  */
-void Fh(const struct vcc *tl, int indent, const char *fmt, ...);
-void Fc(const struct vcc *tl, int indent, const char *fmt, ...);
-void Fb(const struct vcc *tl, int indent, const char *fmt, ...);
-void Fi(const struct vcc *tl, int indent, const char *fmt, ...);
-void Ff(const struct vcc *tl, int indent, const char *fmt, ...);
+void Fh(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Fc(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Fb(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Fi(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
+void Ff(const struct vcc *tl, int indent, const char *fmt, ...)
+    __printflike(3, 4);
 void EncToken(struct vsb *sb, const struct token *t);
 int IsMethod(const struct token *t);
 void *TlAlloc(struct vcc *tl, unsigned len);
diff --git a/lib/libvcl/vcc_dir_dns.c b/lib/libvcl/vcc_dir_dns.c
index 174d1ab..55ed921 100644
--- a/lib/libvcl/vcc_dir_dns.c
+++ b/lib/libvcl/vcc_dir_dns.c
@@ -92,9 +92,9 @@ print_backend(struct vcc *tl,
 
 	Fb(tl, 0, "\t.hosthdr = \"");
 	if (b_defaults.hostheader != NULL)
-		Fb(tl,0, b_defaults.hostheader);
+		Fb(tl, 0, "%s", b_defaults.hostheader);
 	else
-		Fb(tl,0, strip);
+		Fb(tl, 0, "%s", strip);
 	Fb(tl, 0, "\",\n");
 
 	Fb(tl, 0, "\t.saintmode_threshold = %d,\n",b_defaults.saint);
diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 3dfeeaa..82e53ef 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -253,6 +253,10 @@ vcc_new_expr(void)
 
 static struct expr *
 vcc_mk_expr(enum var_type fmt, const char *str, ...)
+    __printflike(2, 3);
+
+static struct expr *
+vcc_mk_expr(enum var_type fmt, const char *str, ...)
 {
 	va_list ap;
 	struct expr *e;
@@ -537,7 +541,7 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
 			r = strchr(sym->name, '.');
 			AN(r);
 			e1 = vcc_mk_expr(VOID, "&vmod_priv_%.*s",
-			    r - sym->name, sym->name);
+			    (int) (r - sym->name), sym->name);
 			p += strlen(p) + 1;
 		} else if (fmt == VOID && !strcmp(p, "PRIV_CALL")) {
 			bprintf(buf, "vmod_priv_%u", tl->nvmodpriv++);
diff --git a/lib/libvcl/vcc_parse.c b/lib/libvcl/vcc_parse.c
index 4023287..d8e74a4 100644
--- a/lib/libvcl/vcc_parse.c
+++ b/lib/libvcl/vcc_parse.c
@@ -154,7 +154,7 @@ vcc_Compound(struct vcc *tl)
 			return;
 		case CSRC:
 			Fb(tl, 1, "%.*s\n",
-			    tl->t->e - (tl->t->b + 2),
+			    (int) (tl->t->e - (tl->t->b + 2)),
 			    tl->t->b + 1);
 			vcc_NextToken(tl);
 			break;
@@ -274,7 +274,7 @@ vcc_Parse(struct vcc *tl)
 		switch (tl->t->tok) {
 		case CSRC:
 			Fc(tl, 0, "%.*s\n",
-			    tl->t->e - (tl->t->b + 4), tl->t->b + 2);
+			    (int) (tl->t->e - (tl->t->b + 4)), tl->t->b + 2);
 			vcc_NextToken(tl);
 			break;
 		case EOI:



More information about the varnish-commit mailing list