[master] 20e007a5b Cast to (u)intmax_t for %ju and %jd

Martin Blix Grydeland martin at varnish-software.com
Wed Sep 22 08:40:06 UTC 2021


commit 20e007a5b17c1f68f70ab42080de384f9e192900
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Sep 22 10:35:27 2021 +0200

    Cast to (u)intmax_t for %ju and %jd
    
    This to silence errors on OSX where apparently int64_t isn't type
    equivalent to intmax_t, causing printf-errors when using %jd.
    
    Fixes: #3699

diff --git a/bin/varnishd/http2/cache_http2_panic.c b/bin/varnishd/http2/cache_http2_panic.c
index b9720070a..06ea40c15 100644
--- a/bin/varnishd/http2/cache_http2_panic.c
+++ b/bin/varnishd/http2/cache_http2_panic.c
@@ -31,6 +31,8 @@
 
 #include "config.h"
 
+#include <stdint.h>
+
 #include "cache/cache_varnishd.h"
 
 #include "cache/cache_transport.h"
@@ -108,13 +110,14 @@ h2_sess_panic(struct vsb *vsb, const struct sess *sp)
 		VSB_printf(vsb, "t_send = %f, t_winupd = %f,\n",
 		    r2->t_send, r2->t_winupd);
 		VSB_printf(vsb, "t_window = %jd, r_window = %jd,\n",
-		    r2->t_window, r2->r_window);
+		    (intmax_t)r2->t_window, (intmax_t)r2->r_window);
 
 		if (!PAN_dump_struct(vsb, r2->rxbuf, H2_RXBUF_MAGIC, "rxbuf")) {
 			VSB_printf(vsb, "stvbuf = %p,\n", r2->rxbuf->stvbuf);
 			VSB_printf(vsb,
 			    "{size, tail, head} = {%u, %ju, %ju},\n",
-			    r2->rxbuf->size, r2->rxbuf->tail, r2->rxbuf->head);
+			    r2->rxbuf->size, (uintmax_t)r2->rxbuf->tail,
+			    (uintmax_t)r2->rxbuf->head);
 			VSB_indent(vsb, -2);
 			VSB_cat(vsb, "},\n");
 		}


More information about the varnish-commit mailing list