"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: lib/delta.c uint64_t warning
To:
Thomas Adam <thomas@xteddy.org>
Cc:
gameoftrees@openbsd.org
Date:
Sat, 26 Jul 2025 22:33:27 +0200

Download raw body.

Thread
Thomas Adam:

> On Sat, Jul 26, 2025 at 08:28:45PM +0000, Christian Weisgerber wrote:
> > (1) We can cast the argument to long long.  There are numerous
> >     precedents for this in the code, but the ones I've checked
> >     concern types such as time_t or off_t whose size isn't known
> >     anyway in a portable context.
> 
> This one, please.  tmux does the same thing, and ther's been no fallout from
> that across systems.

OK?

-----------------------------------------------
commit 6bf359ef16458e4d1401f495486e7df021d29c66 (main)
from: Christian Weisgerber <naddy@mips.inka.de>
date: Sat Jul 26 20:31:19 2025 UTC
 
 fix potential type mismatch between format specifier and argument
   
 Cast argument of type uint64_t to unsigned long long to match the %llu
 format specifier on platforms where this might not be the case.
 
diff 64af9ac04decbf54ce6b650fd2f6a28f235b7332 6bf359ef16458e4d1401f495486e7df021d29c66
commit - 64af9ac04decbf54ce6b650fd2f6a28f235b7332
commit + 6bf359ef16458e4d1401f495486e7df021d29c66
blob - 111b5f80283a779cf10f175b7652acea1cd5fccf
blob + 05e36fee9259d7988eb9952ef343645c8b8865c5
--- lib/delta.c
+++ lib/delta.c
@@ -323,7 +323,8 @@ got_delta_apply_in_mem(uint8_t *base_buf, size_t base_
 	if (err == NULL && *outsize != result_size)
 		err = got_error_fmt(GOT_ERR_BAD_DELTA,
 		    "delta application result size mismatch: actual: %zd "
-		    "expected: %llu", *outsize, result_size);
+		    "expected: %llu", *outsize,
+		    (unsigned long long)result_size);
 
 	return err;
 }
@@ -392,7 +393,8 @@ got_delta_apply(FILE *base_file, const uint8_t *delta_
 	if (err == NULL && *outsize != result_size)
 		err = got_error_fmt(GOT_ERR_BAD_DELTA,
 		    "delta application result size mismatch: actual: %zd "
-		    "expected: %llu", *outsize, result_size);
+		    "expected: %llu", *outsize,
+		    (unsigned long long)result_size);
 
 	if (memstream != NULL) {
 		if (fclose(memstream) == EOF && err == NULL)

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de