Fix format specifier warnings
This fixes 14 warnings that look like:
warning: format specifies type 'long' but the argument has type
'::google::protobuf::int64' (aka 'long long')
Using macros makes it easier to read IMO.
Bug: None
Test: mma. Warnings are gone.
Change-Id: I3e029437e7f5d1550dae29a18c05706be16eac65
diff --git a/tools/bootio/bootio_collector.cpp b/tools/bootio/bootio_collector.cpp
index 7ddf7d0..96aa765 100644
--- a/tools/bootio/bootio_collector.cpp
+++ b/tools/bootio/bootio_collector.cpp
@@ -277,8 +277,11 @@
stats.rbytes += (newerSample->readbytes() - olderSample->readbytes());
stats.wbytes += (newerSample->writebytes() - olderSample->writebytes());
- printf("%5" PRId64 " - %-5" PRId64 " %-13" PRId64 "%-13" PRId64 "%-13" PRId64 "%-13" PRId64 "%-13"
- PRId64 "%-13" PRId64 "%-9.2f\n",
+ // Note that all of these are explicitly `long long`s, not int64_t,
+ // so we can't use PRId64 here.
+#define NUMBER "%-13lld"
+ printf("%5lld - %-5lld " NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER "%-9.2f\n",
+#undef NUMBER
olderSample->uptime(),
newerSample->uptime(),
newerSample->rchar() - olderSample->rchar(),
@@ -291,7 +294,9 @@
isFirstSample = false;
}
printf("-----------------------------------------------------------------------------\n");
- printf("%-15s%-13" PRId64 "%-13" PRId64 "%-13" PRId64 "%-13" PRId64 "%-13" PRId64 "%-13" PRId64 "\n",
+#define NUMBER "%-13lld"
+ printf("%-15s" NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER "\n",
+#undef NUMBER
"Total",
newerSample->rchar(),
newerSample->wchar(),