Btrfs-progs: satisfy compiler and change printf modifier
PATCH 1/1 Btrfs-progs: satisfy compiler and change printf modifier
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]
--- extent-tree.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
extent-tree.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.5.4
Am 14.11.2011 16:30, schrieb Christian Parpart:
Quoted 7 lines · On Mon, Nov 14, 2011 at 4:24 PM, Arnd Hannemann <[email protected]…
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]
Quoted 8 lines
[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