diff options
author | Abseil Team <absl-team@google.com> | 2022-08-17 09:17:56 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-08-17 09:18:39 -0700 |
commit | fcfc7a6d15eab5aff86d7b90c9e38fa386a103fa (patch) | |
tree | ec697cf6574f311f9f373df7d19f307d9c185781 /absl/strings/internal/str_format/extension.cc | |
parent | 934f613818ffcb26c942dff4a80be9a4031c662c (diff) |
Fix "unsafe narrowing" warnings in absl, 5/n.
Addresses failures with the following, in some files:
-Wshorten-64-to-32
-Wimplicit-int-conversion
-Wsign-compare
-Wsign-conversion
-Wtautological-unsigned-zero-compare
(This specific CL focuses on .cc files in strings/internal/.)
Bug: chromium:1292951
PiperOrigin-RevId: 468215101
Change-Id: I07fa487bcf2cf62d403489c3be7a5997cdef8987
Diffstat (limited to 'absl/strings/internal/str_format/extension.cc')
-rw-r--r-- | absl/strings/internal/str_format/extension.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/absl/strings/internal/str_format/extension.cc b/absl/strings/internal/str_format/extension.cc index f93153d5..2a0ceb13 100644 --- a/absl/strings/internal/str_format/extension.cc +++ b/absl/strings/internal/str_format/extension.cc @@ -58,7 +58,8 @@ constexpr FormatConversionCharSet FormatConversionCharSetInternal::kPointer; bool FormatSinkImpl::PutPaddedString(string_view value, int width, int precision, bool left) { size_t space_remaining = 0; - if (width >= 0) space_remaining = width; + if (width >= 0) + space_remaining = static_cast<size_t>(width); size_t n = value.size(); if (precision >= 0) n = std::min(n, static_cast<size_t>(precision)); string_view shown(value.data(), n); |