aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-01 21:55:17 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-03-01 22:34:45 +0100
commitaaf7e68c75a907c3c08e83dfd2972665a0f1c1a3 (patch)
treef15c080e765cd92e531dee7f868b6b79fec829cd
parent39bfcc7f27b5c5173455140abf902b38c21f0acb (diff)
Fix printf format specifies for sqfs_u64
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--include/compat.h9
-rw-r--r--lib/common/statistics.c13
2 files changed, 16 insertions, 6 deletions
diff --git a/include/compat.h b/include/compat.h
index 5f73158..b67d27f 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -31,6 +31,15 @@
# error I do not know how to trap integer overflows with this compiler
#endif
+#if defined(_WIN32) || defined(__WINDOWS__)
+# define PRI_U64 "%I64u"
+# define PRI_U32 "%I32u"
+#else
+# include <inttypes.h>
+# define PRI_U64 PRIu64
+# define PRI_U32 PRIu32
+#endif
+
#if SIZEOF_SIZE_T <= SIZEOF_INT
# define PRI_SZ "%u"
#elif SIZEOF_SIZE_T == SIZEOF_LONG
diff --git a/lib/common/statistics.c b/lib/common/statistics.c
index 92d365c..2f729cb 100644
--- a/lib/common/statistics.c
+++ b/lib/common/statistics.c
@@ -36,17 +36,18 @@ void sqfs_print_statistics(const sqfs_super_t *super,
printf("Data compression ratio: " PRI_SZ "%%\n", ratio);
fputc('\n', stdout);
- printf("Data blocks written: %lu\n", wr_stats->blocks_written);
- printf("Out of which where fragment blocks: %lu\n",
+ printf("Data blocks written: " PRI_U64 "\n", wr_stats->blocks_written);
+ printf("Out of which where fragment blocks: " PRI_U64 "\n",
proc_stats->frag_block_count);
- printf("Duplicate blocks omitted: %lu\n",
+ printf("Duplicate blocks omitted: " PRI_U64 "\n",
wr_stats->blocks_submitted - wr_stats->blocks_written);
- printf("Sparse blocks omitted: %lu\n", proc_stats->sparse_block_count);
+ printf("Sparse blocks omitted: " PRI_U64 "\n",
+ proc_stats->sparse_block_count);
fputc('\n', stdout);
- printf("Fragments actually written: %lu\n",
+ printf("Fragments actually written: " PRI_U64 "\n",
proc_stats->actual_frag_count);
- printf("Duplicated fragments omitted: %lu\n",
+ printf("Duplicated fragments omitted: " PRI_U64 "\n",
proc_stats->total_frag_count - proc_stats->actual_frag_count);
printf("Total number of inodes: %u\n", super->inode_count);
printf("Number of unique group/user IDs: %u\n", super->id_count);