[6.0] a8dd3c8ca Cast to (u)intmax_t for %ju and %jd

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Apr 8 06:05:09 UTC 2024


commit a8dd3c8cad8bea29f378a68823f96e36a9cbfe17
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 d41eb3b49..0232c72a3 100644
--- a/bin/varnishd/http2/cache_http2_panic.c
+++ b/bin/varnishd/http2/cache_http2_panic.c
@@ -29,6 +29,8 @@
 
 #include "config.h"
 
+#include <stdint.h>
+
 #include "cache/cache_varnishd.h"
 
 #include "cache/cache_transport.h"
@@ -107,7 +109,7 @@ 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);
 
 		VSB_printf(vsb, "rxbuf = %p", r2->rxbuf);
 		if (r2->rxbuf != NULL) {
@@ -117,7 +119,8 @@ h2_sess_panic(struct vsb *vsb, const struct sess *sp)
 			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_printf(vsb, "}");
 		}


More information about the varnish-commit mailing list