update_engine: Use portable string format functions.
Replace usage of %zu by PRIuS or calls to std::to_string when possible.
This patch includes other minor linter fixes.
BUG=None
TEST=emerge-link update_engine
Change-Id: I9ff2b3677ed4218a140f9e91a2389cc756941b03
Reviewed-on: https://chromium-review.googlesource.com/293629
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/delta_performer.cc b/delta_performer.cc
index 81477de..0c06c8b 100644
--- a/delta_performer.cc
+++ b/delta_performer.cc
@@ -128,12 +128,12 @@
string total_operations_str("?");
string completed_percentage_str("");
if (num_total_operations_) {
- total_operations_str = base::StringPrintf("%zu", num_total_operations_);
+ total_operations_str = std::to_string(num_total_operations_);
// Upcasting to 64-bit to avoid overflow, back to size_t for formatting.
completed_percentage_str =
base::StringPrintf(" (%" PRIu64 "%%)",
- IntRatio(next_operation_num_, num_total_operations_,
- 100));
+ IntRatio(next_operation_num_, num_total_operations_,
+ 100));
}
// Format download total count and percentage.
@@ -141,11 +141,11 @@
string payload_size_str("?");
string downloaded_percentage_str("");
if (payload_size) {
- payload_size_str = base::StringPrintf("%zu", payload_size);
+ payload_size_str = std::to_string(payload_size);
// Upcasting to 64-bit to avoid overflow, back to size_t for formatting.
downloaded_percentage_str =
base::StringPrintf(" (%" PRIu64 "%%)",
- IntRatio(total_bytes_received_, payload_size, 100));
+ IntRatio(total_bytes_received_, payload_size, 100));
}
LOG(INFO) << (message_prefix ? message_prefix : "") << next_operation_num_