diff options
author | Abseil Team <absl-team@google.com> | 2022-08-04 05:04:38 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-08-04 05:05:57 -0700 |
commit | 07360899e64ded32e9a5e304bd6a3b6a0ff266bc (patch) | |
tree | b50237b302c3c10c03413b5bd92aa0f311f4a2ff /absl/strings/str_cat.cc | |
parent | 16af2bbcb9dd1770c64483aed8cd7d4ae7061064 (diff) |
Fix "unsafe narrowing" warnings in absl, 4/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/, except /internal/.)
Bug: chromium:1292951
PiperOrigin-RevId: 465285043
Change-Id: I37e9d1b4c4e9aa655b720da1467927af2aba995e
Diffstat (limited to 'absl/strings/str_cat.cc')
-rw-r--r-- | absl/strings/str_cat.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/strings/str_cat.cc b/absl/strings/str_cat.cc index f4a77493..2f9df673 100644 --- a/absl/strings/str_cat.cc +++ b/absl/strings/str_cat.cc @@ -56,7 +56,7 @@ AlphaNum::AlphaNum(Dec dec) { *--writer = '0' + (value % 10); value /= 10; } - *--writer = '0' + value; + *--writer = '0' + static_cast<char>(value); if (neg) *--writer = '-'; ptrdiff_t fillers = writer - minfill; @@ -73,7 +73,7 @@ AlphaNum::AlphaNum(Dec dec) { if (add_sign_again) *--writer = '-'; } - piece_ = absl::string_view(writer, end - writer); + piece_ = absl::string_view(writer, static_cast<size_t>(end - writer)); } // ---------------------------------------------------------------------- |