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/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 9d32293..8010b8c 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -8,6 +8,7 @@
#include <string>
#include <base/bind.h>
+#include <base/format_macros.h>
#include <base/location.h>
#include <base/logging.h>
#include <base/strings/string_util.h>
@@ -132,10 +133,10 @@
}
// Create a string representation of the desired range.
- string range_str = (end_offset ?
- base::StringPrintf("%jd-%zu", resume_offset_,
- end_offset) :
- base::StringPrintf("%jd-", resume_offset_));
+ string range_str = base::StringPrintf(
+ "%" PRIu64 "-", static_cast<uint64_t>(resume_offset_));
+ if (end_offset)
+ range_str += std::to_string(end_offset);
CHECK_EQ(curl_easy_setopt(curl_handle_, CURLOPT_RANGE, range_str.c_str()),
CURLE_OK);
}