* [PATCH] svndump.c: Fix a printf format compiler warning
@ 2011-01-11 18:17 Ramsay Jones
2011-01-11 18:39 ` Jonathan Nieder
0 siblings, 1 reply; 3+ messages in thread
From: Ramsay Jones @ 2011-01-11 18:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: GIT Mailing-list, Jonathan Nieder
In particular, on systems that define uint32_t as an unsigned long,
gcc complains as follows:
CC vcs-svn/svndump.o
vcs-svn/svndump.c: In function `svndump_read':
vcs-svn/svndump.c:215: warning: int format, uint32_t arg (arg 2)
In order to suppress the warning we use the C99 format specifier
macro PRIu32 from <inttypes.h>.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
vcs-svn/svndump.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index fa580e6..2ad2c30 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -211,7 +211,7 @@ void svndump_read(const char *url)
if (key == keys.svn_fs_dump_format_version) {
dump_ctx.version = atoi(val);
if (dump_ctx.version > 2)
- die("expected svn dump format version <= 2, found %d",
+ die("expected svn dump format version <= 2, found %"PRIu32,
dump_ctx.version);
} else if (key == keys.uuid) {
dump_ctx.uuid = pool_intern(val);
--
1.7.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] svndump.c: Fix a printf format compiler warning
2011-01-11 18:17 [PATCH] svndump.c: Fix a printf format compiler warning Ramsay Jones
@ 2011-01-11 18:39 ` Jonathan Nieder
2011-01-15 18:06 ` Ramsay Jones
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2011-01-11 18:39 UTC (permalink / raw)
To: Ramsay Jones
Cc: Junio C Hamano, GIT Mailing-list, David Barr, Ramkumar Ramachandra
Ramsay Jones wrote:
> --- a/vcs-svn/svndump.c
> +++ b/vcs-svn/svndump.c
> @@ -211,7 +211,7 @@ void svndump_read(const char *url)
> if (key == keys.svn_fs_dump_format_version) {
> dump_ctx.version = atoi(val);
> if (dump_ctx.version > 2)
> - die("expected svn dump format version <= 2, found %d",
> + die("expected svn dump format version <= 2, found %"PRIu32,
> dump_ctx.version);
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
I think we should just use "int", but that is a wider sweeping change
for another time. Thanks.
Does gcc or sparse provide a warning that could have caught this
mistake?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] svndump.c: Fix a printf format compiler warning
2011-01-11 18:39 ` Jonathan Nieder
@ 2011-01-15 18:06 ` Ramsay Jones
0 siblings, 0 replies; 3+ messages in thread
From: Ramsay Jones @ 2011-01-15 18:06 UTC (permalink / raw)
To: Jonathan Nieder
Cc: Junio C Hamano, GIT Mailing-list, David Barr, Ramkumar Ramachandra
Jonathan Nieder wrote:
> Ramsay Jones wrote:
>
>> --- a/vcs-svn/svndump.c
>> +++ b/vcs-svn/svndump.c
>> @@ -211,7 +211,7 @@ void svndump_read(const char *url)
>> if (key == keys.svn_fs_dump_format_version) {
>> dump_ctx.version = atoi(val);
>> if (dump_ctx.version > 2)
>> - die("expected svn dump format version <= 2, found %d",
>> + die("expected svn dump format version <= 2, found %"PRIu32,
>> dump_ctx.version);
>
> Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Thanks!
> I think we should just use "int", but that is a wider sweeping change
> for another time. Thanks.
>
> Does gcc or sparse provide a warning that could have caught this
> mistake?
None that I know of, no ... :(
ATB,
Ramsay Jones
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-15 18:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11 18:17 [PATCH] svndump.c: Fix a printf format compiler warning Ramsay Jones
2011-01-11 18:39 ` Jonathan Nieder
2011-01-15 18:06 ` Ramsay Jones
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.