diff options
author | Abseil Team <absl-team@google.com> | 2022-08-17 08:34:34 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-08-17 08:35:16 -0700 |
commit | 934f613818ffcb26c942dff4a80be9a4031c662c (patch) | |
tree | ef5ce22bc64d4758de1d7e339e6b4b70d8ff3e09 /absl/strings/str_cat.cc | |
parent | 547802119dfa444540d8f2bb8a9f50bf64252a0f (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: 468205572
Change-Id: Ifce3f1a7a4b2b2c359bf7700a11279bebfef8a15
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)); } // ---------------------------------------------------------------------- |