All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] misc: fix some printf format strings
@ 2017-04-07 11:35 Ruediger Meier
  2017-04-07 11:35 ` [PATCH 2/2] chmem: don't use scanf format for printf Ruediger Meier
  2017-04-10 13:43 ` [PATCH 1/2] misc: fix some printf format strings Karel Zak
  0 siblings, 2 replies; 3+ messages in thread
From: Ruediger Meier @ 2017-04-07 11:35 UTC (permalink / raw)
  To: util-linux

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Fix compiler warnings seen on Linux/i586 and OSX/travis.

  #type            #format   #cast
   unsigned long    %lu       -
   uint64_t         PRIu64    -
   fdisk_sector_t   %ju       (uintmax_t)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 libblkid/src/partitions/gpt.c | 3 ++-
 libfdisk/src/alignment.c      | 2 +-
 sys-utils/blkzone.c           | 8 ++++----
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/libblkid/src/partitions/gpt.c b/libblkid/src/partitions/gpt.c
index b7d050653..52704ed63 100644
--- a/libblkid/src/partitions/gpt.c
+++ b/libblkid/src/partitions/gpt.c
@@ -18,6 +18,7 @@
 #include <stdint.h>
 #include <stddef.h>
 #include <limits.h>
+#include <inttypes.h>
 
 #include "partitions.h"
 #include "crc32.h"
@@ -217,7 +218,7 @@ static struct gpt_header *get_gpt_header(
 
 	ssz = blkid_probe_get_sectorsize(pr);
 
-	DBG(LOWPROBE, ul_debug(" checking for GPT header at %ju", lba));
+	DBG(LOWPROBE, ul_debug(" checking for GPT header at %"PRIu64, lba));
 
 	/* whole sector is allocated for GPT header */
 	h = (struct gpt_header *) get_lba_buffer(pr, lba, ssz);
diff --git a/libfdisk/src/alignment.c b/libfdisk/src/alignment.c
index 2e2069992..327faa03d 100644
--- a/libfdisk/src/alignment.c
+++ b/libfdisk/src/alignment.c
@@ -348,7 +348,7 @@ int fdisk_apply_user_device_properties(struct fdisk_context *cxt)
 
 		if (cxt->sector_size != old_secsz) {
 			cxt->total_sectors = (old_total * (old_secsz/512)) / (cxt->sector_size >> 9);
-			DBG(CXT, ul_debugobj(cxt, "new total sectors: %ju", cxt->total_sectors));
+			DBG(CXT, ul_debugobj(cxt, "new total sectors: %ju", (uintmax_t)cxt->total_sectors));
 		}
 	}
 
diff --git a/sys-utils/blkzone.c b/sys-utils/blkzone.c
index e2c33770c..1457225c9 100644
--- a/sys-utils/blkzone.c
+++ b/sys-utils/blkzone.c
@@ -195,7 +195,7 @@ static int blkzone_report(struct blkzone_control *ctl)
 			err(EXIT_FAILURE, _("%s: BLKREPORTZONE ioctl failed"), ctl->devname);
 
 		if (ctl->verbose)
-			printf(_("Found %d zones from 0x%lx\n"),
+			printf(_("Found %d zones from 0x%"PRIx64"\n"),
 				zi->nr_zones, ctl->offset);
 
 		if (!zi->nr_zones) {
@@ -216,7 +216,7 @@ static int blkzone_report(struct blkzone_control *ctl)
 				break;
 			}
 
-			printf(_("  start: 0x%09lx, len 0x%06lx, wptr 0x%06lx"
+			printf(_("  start: 0x%09"PRIx64", len 0x%06"PRIx64", wptr 0x%06"PRIx64
 			 	" reset:%u non-seq:%u, zcond:%2u(%s) [type: %u(%s)]\n"),
 				start, len, (type == 0x1) ? 0 : wp - start,
 				entry->reset, entry->non_seq,
@@ -254,7 +254,7 @@ static int blkzone_reset(struct blkzone_control *ctl)
 
 	if (ctl->offset & (zonesize - 1))
 		errx(EXIT_FAILURE, _("%s: offset %" PRIu64 " is not aligned "
-			"to zone size %" PRIu64),
+			"to zone size %lu"),
 			ctl->devname, ctl->offset, zonesize);
 
 	if (ctl->offset > ctl->total_sectors)
@@ -273,7 +273,7 @@ static int blkzone_reset(struct blkzone_control *ctl)
 	    (zlen & (zonesize - 1)) &&
 	    ctl->offset + zlen != ctl->total_sectors)
 		errx(EXIT_FAILURE, _("%s: number of sectors %" PRIu64 " is not aligned "
-			"to zone size %" PRIu64),
+			"to zone size %lu"),
 			ctl->devname, ctl->length, zonesize);
 
 	za.sector = ctl->offset;
-- 
2.12.0


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

* [PATCH 2/2] chmem: don't use scanf format for printf
  2017-04-07 11:35 [PATCH 1/2] misc: fix some printf format strings Ruediger Meier
@ 2017-04-07 11:35 ` Ruediger Meier
  2017-04-10 13:43 ` [PATCH 1/2] misc: fix some printf format strings Karel Zak
  1 sibling, 0 replies; 3+ messages in thread
From: Ruediger Meier @ 2017-04-07 11:35 UTC (permalink / raw)
  To: util-linux; +Cc: Heiko Carstens

From: Ruediger Meier <ruediger.meier@ga-group.nl>

The compiler had not complained here because both macros are
probably the same.

But gettext issued a funny warning:
sys-utils/chmem.c:67: warning: Although being used in a format string position, the msgid is not a valid C format string. Reason: The string ends in the middle of a directive.

CC: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 sys-utils/chmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/chmem.c b/sys-utils/chmem.c
index ad394ac4c..44733bf76 100644
--- a/sys-utils/chmem.c
+++ b/sys-utils/chmem.c
@@ -64,7 +64,7 @@ static void idxtostr(struct chmem_desc *desc, uint64_t idx, char *buf, size_t bu
 	start = idx * desc->block_size;
 	end = start + desc->block_size - 1;
 	snprintf(buf, bufsz,
-		 _("Memory Block %"SCNu64" (0x%016"PRIx64"-0x%016"PRIx64")"),
+		 _("Memory Block %"PRIu64" (0x%016"PRIx64"-0x%016"PRIx64")"),
 		 idx, start, end);
 }
 
-- 
2.12.0


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

* Re: [PATCH 1/2] misc: fix some printf format strings
  2017-04-07 11:35 [PATCH 1/2] misc: fix some printf format strings Ruediger Meier
  2017-04-07 11:35 ` [PATCH 2/2] chmem: don't use scanf format for printf Ruediger Meier
@ 2017-04-10 13:43 ` Karel Zak
  1 sibling, 0 replies; 3+ messages in thread
From: Karel Zak @ 2017-04-10 13:43 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux

On Fri, Apr 07, 2017 at 01:35:58PM +0200, Ruediger Meier wrote:
>  libblkid/src/partitions/gpt.c | 3 ++-
>  libfdisk/src/alignment.c      | 2 +-
>  sys-utils/blkzone.c           | 8 ++++----
>  3 files changed, 7 insertions(+), 6 deletions(-)

 All applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

end of thread, other threads:[~2017-04-10 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-07 11:35 [PATCH 1/2] misc: fix some printf format strings Ruediger Meier
2017-04-07 11:35 ` [PATCH 2/2] chmem: don't use scanf format for printf Ruediger Meier
2017-04-10 13:43 ` [PATCH 1/2] misc: fix some printf format strings Karel Zak

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.