Use the right printf symbols rather than converting to ints.
Bug: 77333635
Test: make -j incidentd
Change-Id: I3338279c385051b5df334af481e7f47f16d16480
diff --git a/cmds/incidentd/src/PrivacyBuffer.cpp b/cmds/incidentd/src/PrivacyBuffer.cpp
index d753e5e..7a8ebe3 100644
--- a/cmds/incidentd/src/PrivacyBuffer.cpp
+++ b/cmds/incidentd/src/PrivacyBuffer.cpp
@@ -86,8 +86,8 @@
// iterator will point to head of next field
size_t currentAt = mData.rp()->pos();
writeFieldOrSkip(fieldTag, skip);
- VLOG("[Depth %2d]Field %d %ss %d bytes", depth, fieldId, skip ? "skip" : "write",
- (int)(get_varint_size(fieldTag) + mData.rp()->pos() - currentAt));
+ VLOG("[Depth %2d]Field %d %ss %zu bytes", depth, fieldId, skip ? "skip" : "write",
+ get_varint_size(fieldTag) + mData.rp()->pos() - currentAt);
return NO_ERROR;
}
// current field is message type and its sub-fields have extra privacy policies
diff --git a/cmds/incidentd/src/Throttler.cpp b/cmds/incidentd/src/Throttler.cpp
index 2b790ca..11136ec 100644
--- a/cmds/incidentd/src/Throttler.cpp
+++ b/cmds/incidentd/src/Throttler.cpp
@@ -18,6 +18,7 @@
#include "Throttler.h"
+#include <inttypes.h>
#include <utils/SystemClock.h>
namespace android {
@@ -42,15 +43,15 @@
}
void Throttler::addReportSize(size_t reportByteSize) {
- VLOG("The current request took %d bytes to dropbox", (int)reportByteSize);
+ VLOG("The current request took %zu bytes to dropbox", reportByteSize);
mAccumulatedSize += reportByteSize;
}
void Throttler::dump(FILE* out) {
- fprintf(out, "mSizeLimit=%d\n", (int)mSizeLimit);
- fprintf(out, "mAccumulatedSize=%d\n", (int)mAccumulatedSize);
- fprintf(out, "mRefractoryPeriodMs=%d\n", (int)mRefractoryPeriodMs);
- fprintf(out, "mLastRefractoryMs=%d\n", (int)mLastRefractoryMs);
+ fprintf(out, "mSizeLimit=%zu\n", mSizeLimit);
+ fprintf(out, "mAccumulatedSize=%zu\n", mAccumulatedSize);
+ fprintf(out, "mRefractoryPeriodMs=%" PRIi64 "\n", mRefractoryPeriodMs);
+ fprintf(out, "mLastRefractoryMs=%" PRIi64 "\n", mLastRefractoryMs);
}
} // namespace incidentd
diff --git a/cmds/incidentd/tests/Reporter_test.cpp b/cmds/incidentd/tests/Reporter_test.cpp
index cf107c8..1086908 100644
--- a/cmds/incidentd/tests/Reporter_test.cpp
+++ b/cmds/incidentd/tests/Reporter_test.cpp
@@ -176,7 +176,7 @@
ASSERT_EQ(Reporter::REPORT_FINISHED, reporter->runReport(&size));
vector<string> results = InspectFiles();
- ASSERT_EQ((int)results.size(), 1);
+ ASSERT_EQ(results.size(), 1UL);
EXPECT_EQ(results[0],
"\n\x2"
"\b\f\n\x6"