linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: satisfy compiler and change printf modifier
@ 2011-11-14 15:24 Arnd Hannemann
       [not found] ` <CA+qvzFPH8qsdGap4U1rLexMhNzaC8f+HoaqZoGB424OqmS6nTQ@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Hannemann @ 2011-11-14 15:24 UTC (permalink / raw)
  To: linux-btrfs; +Cc: chris.mason, Arnd Hannemann

One-liner which fixes the gcc warning:
warning: format '%u' expects argument of type 'unsigned int',
but argument 3 has type 'long unsigned int' [-Wformat]

Signed-off-by: Arnd Hannemann <arnd@arndnet.de>
---
 extent-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/extent-tree.c b/extent-tree.c
index 5bed3c2..5211bee 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -1067,7 +1067,7 @@ static int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
 	}
 #endif
 	if (item_size < sizeof(*ei)) {
-		printf("Size is %u, needs to be %u, slot %d\n", item_size,
+		printf("Size is %u, needs to be %zu, slot %d\n", item_size,
 		       sizeof(*ei), path->slots[0]);
 		btrfs_print_leaf(root, leaf);
 		return -EINVAL;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Btrfs-progs: satisfy compiler and change printf modifier
       [not found] ` <CA+qvzFPH8qsdGap4U1rLexMhNzaC8f+HoaqZoGB424OqmS6nTQ@mail.gmail.com>
@ 2011-11-14 15:51   ` Arnd Hannemann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Hannemann @ 2011-11-14 15:51 UTC (permalink / raw)
  To: Christian Parpart; +Cc: linux-btrfs, chris.mason

Am 14.11.2011 16:30, schrieb Christian Parpart:
> On Mon, Nov 14, 2011 at 4:24 PM, Arnd Hannemann <arnd@arndnet.de <mailto:arnd@arndnet.de>> wrote:
> 
>     One-liner which fixes the gcc warning:
>     warning: format '%u' expects argument of type 'unsigned int',
>     but argument 3 has type 'long unsigned int' [-Wformat]
> 
> 
> [snip] 
> 
>     -               printf("Size is %u, needs to be %u, slot %d\n", item_size,
>     +               printf("Size is %u, needs to be %zu, slot %d\n", item_size,
>                           sizeof(*ei), path->slots[0]);
> 
> 
> shouldn't it be %lu then (instead of %zu) ? 

No, the return type of sizeof() is size_t which is of different size on different
architectures (eg. amd64 versus i386)

If %lu would be used, there would be a warning when compiled on an architecture where
long is 32 bit.

Best regards,
Arnd


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-14 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-14 15:24 [PATCH] Btrfs-progs: satisfy compiler and change printf modifier Arnd Hannemann
     [not found] ` <CA+qvzFPH8qsdGap4U1rLexMhNzaC8f+HoaqZoGB424OqmS6nTQ@mail.gmail.com>
2011-11-14 15:51   ` Arnd Hannemann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).