[master] 73e85b5 Be agnostic about size of VCL_INT and VCL_BYTES

Poul-Henning Kamp phk at FreeBSD.org
Tue Mar 6 10:12:06 UTC 2018


commit 73e85b57c0bbef23b30f2ed24e719a453ab95c2c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Mar 6 10:09:51 2018 +0000

    Be agnostic about size of VCL_INT and VCL_BYTES

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 053db5c..164c121 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -462,11 +462,11 @@ VRT_IP_string(VRT_CTX, VCL_IP ip)
 }
 
 VCL_STRING v_matchproto_()
-VRT_INT_string(VRT_CTX, long num)
+VRT_INT_string(VRT_CTX, VCL_INT num)
 {
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	return (WS_Printf(ctx->ws, "%ld", num));
+	return (WS_Printf(ctx->ws, "%jd", (intmax_t)num));
 }
 
 VCL_STRING v_matchproto_()
@@ -499,7 +499,7 @@ VRT_BACKEND_string(VCL_BACKEND d)
 }
 
 VCL_STRING v_matchproto_()
-VRT_BOOL_string(unsigned val)
+VRT_BOOL_string(VCL_BOOL val)
 {
 
 	return (val ? "true" : "false");
diff --git a/lib/libvmod_blob/vmod_blob.c b/lib/libvmod_blob/vmod_blob.c
index 6e5a198..a53d8c4 100644
--- a/lib/libvmod_blob/vmod_blob.c
+++ b/lib/libvmod_blob/vmod_blob.c
@@ -581,8 +581,9 @@ vmod_sub(VRT_CTX, VCL_BLOB b, VCL_BYTES n, VCL_BYTES off)
 	}
 	assert(b->len >= 0);
 	if (off + n > b->len) {
-		VERR(ctx, "size %lld from offset %lld requires more bytes than "
-		     "blob length %d in blob.sub()", n, off, b->len);
+		VERR(ctx, "size %jd from offset %jd requires more bytes than "
+		     "blob length %d in blob.sub()",
+		     (intmax_t)n, (intmax_t)off, b->len);
 		return NULL;
 	}
 
@@ -595,7 +596,7 @@ vmod_sub(VRT_CTX, VCL_BLOB b, VCL_BYTES n, VCL_BYTES off)
 		return NULL;
 	}
 	if ((sub->priv = WS_Alloc(ctx->ws, n)) == NULL) {
-		VERRNOMEM(ctx, "Allocating %lld bytes in blob.sub()", n);
+		VERRNOMEM(ctx, "Allocating %jd bytes in blob.sub()", (intmax_t)n);
 		WS_Reset(ctx->ws, snap);
 		return NULL;
 	}
diff --git a/lib/libvmod_directors/shard_cfg.c b/lib/libvmod_directors/shard_cfg.c
index adec623..ccd64c2 100644
--- a/lib/libvmod_directors/shard_cfg.c
+++ b/lib/libvmod_directors/shard_cfg.c
@@ -278,9 +278,9 @@ shardcfg_hashcircle(struct sharddir *shardd, VCL_INT replicas)
 	for (i = 0; i < shardd->n_backend; i++)
 		for (j = 0; j < replicas; j++)
 			SHDBG(SHDBG_CIRCLE, shardd,
-			    "hashcircle[%5ld] = "
+			    "hashcircle[%5jd] = "
 			    "{point = %8x, host = %2u}\n",
-			    i * replicas + j,
+			    (intmax_t)(i * replicas + j),
 			    shardd->hashcircle[i * replicas + j].point,
 			    shardd->hashcircle[i * replicas + j].host);
 }
diff --git a/lib/libvmod_directors/vmod_shard.c b/lib/libvmod_directors/vmod_shard.c
index 0e90a40..1ecd9f3 100644
--- a/lib/libvmod_directors/vmod_shard.c
+++ b/lib/libvmod_directors/vmod_shard.c
@@ -506,8 +506,9 @@ shard_param_args(VRT_CTX,
 			}
 			if (key_int < 0 || key_int > UINT32_MAX) {
 				VRT_fail(ctx, "%s %s: "
-					 "invalid key argument %ld with by=%s",
-					 who, p->vcl_name, key_int, by_s);
+					 "invalid key argument %jd with by=%s",
+					 who, p->vcl_name,
+					 (intmax_t)key_int, by_s);
 				return (NULL);
 			}
 			assert(key_int >= 0);
@@ -561,8 +562,8 @@ shard_param_args(VRT_CTX,
 	if (args & arg_alt) {
 		if (alt < 0) {
 			VRT_fail(ctx, "%s %s: "
-				 "invalid alt argument %ld",
-				 who, p->vcl_name, alt);
+				 "invalid alt argument %jd",
+				 who, p->vcl_name, (intmax_t)alt);
 			return (NULL);
 		}
 		p->alt = alt;


More information about the varnish-commit mailing list