diff mbox series

[2/5] diskpart_handler: Fix printf format warnings

Message ID 20200206111000.889-3-ceggers@arri.de
State Accepted
Headers show
Series Another bunch of build fixes | expand

Commit Message

Christian Eggers Feb. 6, 2020, 11:09 a.m. UTC
- include <inttypes.h> instead of <stdint.h>
  o <inttypes.h> provides PRIu64
  o <inttypes.h> includes <stdint.h> (see inttypes.h(0P))
- use "%zu" instead of "%lu" for formatting size_t values
- use PRIu64 instead of "%lu" for formatting uint64_t values

Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 handlers/diskpart_handler.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c
index b61d574..cd3b042 100644
--- a/handlers/diskpart_handler.c
+++ b/handlers/diskpart_handler.c
@@ -8,7 +8,7 @@ 
 #include <stdio.h>
 #include <sys/stat.h>
 #include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
@@ -177,7 +177,7 @@  static int diskpart(struct img_type *img,
 			elem = LIST_NEXT(elem, next);
 		}
 
-		TRACE("partition-%lu:%s size %lu start %lu type %s",
+		TRACE("partition-%zu:%s size %" PRIu64 " start %zu type %s",
 			part->partno,
 			part->name,
 			part->size,
@@ -253,7 +253,7 @@  static int diskpart(struct img_type *img,
 				WARN("I cannot set all partition's parameters");
 			}
 			if (fdisk_add_partition(cxt, newpa, &partno) < 0) {
-				ERROR("I cannot add partition %lu(%s)", part->partno, part->name);
+				ERROR("I cannot add partition %zu(%s)", part->partno, part->name);
 			}
 			fdisk_unref_partition(newpa);
 		} else {
@@ -262,7 +262,7 @@  static int diskpart(struct img_type *img,
 				WARN("I cannot set all partition's parameters");
 			}
 			if (fdisk_set_partition(cxt, part->partno, pa) < 0) {
-				ERROR("I cannot modify partition %lu(%s)", part->partno, part->name);
+				ERROR("I cannot modify partition %zu(%s)", part->partno, part->name);
 			}
 			fdisk_unref_partition(pa);
 		}