logd: fix format-extra-args warning.
Bug: 17409250
Change-Id: Id50ebb57754b12d69ed605d0e2901b8e05c607c6
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index a2f27c6..82f9165 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -671,8 +671,11 @@
size_t sizesTotal = p->sizesTotal();
android::String8 sz("");
- sz.appendFormat((sizes != sizesTotal) ? "%zu/%zu" : "%zu",
- sizes, sizesTotal);
+ if (sizes == sizesTotal) {
+ sz.appendFormat("%zu", sizes);
+ } else {
+ sz.appendFormat("%zu/%zu", sizes, sizesTotal);
+ }
android::String8 pd("");
pd.appendFormat("%u%c", pid, p->pidGone() ? '?' : ' ');
@@ -783,12 +786,15 @@
PidStatistics *pp = *pt;
pid_t p = pp->getPid();
- intermediate = string.format(oneline
- ? ((p == PidStatistics::gone)
- ? "%d/?"
- : "%d/%d%c")
- : "%d",
- u, p, pp->pidGone() ? '?' : '\0');
+ if (!oneline) {
+ intermediate = string.format("%d", u);
+ } else if (p == PidStatistics::gone) {
+ intermediate = string.format("%d/?", u);
+ } else if (pp->pidGone()) {
+ intermediate = string.format("%d/%d?", u, p);
+ } else {
+ intermediate = string.format("%d/%d", u, p);
+ }
string.appendFormat(first ? "\n%-12s" : "%-12s",
intermediate.string());
intermediate.clear();