Skip to contentSkip to conversation

The type expected by %zd is ssize_t, but it was being passed a size_t.

PATCH New Gabe Black 3 participants 4 messages Oct 28, 2011 – Nov 4, 2011

lore
Share & tools
lore

Gabe Black

author
#0 lore raw

PATCH 1/1 The type expected by %zd is ssize_t, but it was being passed a size_t.

---
 common/cmd_nvedit.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_nvedit.c +1 -1
index 396a171..d9dc3f2 100644
@@ -862,7 +862,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
 				" - truncated\n", MAX_ENV_SIZE);
 		}
 		++size;
-		printf("## Info: input data size = %zd = 0x%zX\n", size, size);
+		printf("## Info: input data size = %zu = 0x%zX\n", size, size);
 	}
 
 	if (chk) {
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/1 The type expected by %zd is ssize_t, but it was being passed a size_t.

generally the subject/changelog should be more of the form:

cmd_nvedit: fix printf warning

gcc warns when using %zd with size_t types since the correct format is %zu:
<insert gcc warning here>

otherwise, the change (in theory) makes perfect sense to me ... i would ack if not for the commit summary/log ;)
-mike

#2 lore raw

PATCH 1/1 The type expected by %zd is ssize_t, but it was being passed a size_t.

This was necessary at one point, but I've been trying to get that warning to happen again so I can add it to the change message and it won't. These early patches were done 5 or 6 months ago with a different version of the repository, a different compiler, on a different system, etc., so it'd be tricky to figure out exactly what was triggering this before.

I think the changed version is genuinely more correct, but since I can't get gcc to complain now it doesn't seem like that serious a problem. I'd say take it or leave it as you see fit, and I'll try a few more things to see if I can get it to happen again.

Gabe

Quoted 11 lines · Mike Frysinger

generally the subject/changelog should be more of the form:

cmd_nvedit: fix printf warning

gcc warns when using %zd with size_t types since the correct format is %zu:
<insert gcc warning here>

otherwise, the change (in theory) makes perfect sense to me ... i would ack if not for the commit summary/log ;)
-mike

#3 lore raw

PATCH 1/1 The type expected by %zd is ssize_t, but it was being passed a size_t.

Quoted 10 lines · On Monday 31 October 2011 23:09:39 Gabe Black wrote:

This was necessary at one point, but I've been trying to get that warning to happen again so I can add it to the change message and it won't. These early patches were done 5 or 6 months ago with a different version of the repository, a different compiler, on a different system, etc., so it'd be tricky to figure out exactly what was triggering this before.

I think the changed version is genuinely more correct, but since I can't get gcc to complain now it doesn't seem like that serious a problem. I'd say take it or leave it as you see fit, and I'll try a few more things to see if I can get it to happen again.

your change was correct. but it seems a newer patch by Simon includes this fix among others, so it's no longer needed.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111103/82bbf245/attachment.pgp