From 7f51ef5ed2740dab2bbf53c4dd5931b6e8ec6a5b Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 28 Jul 2022 07:45:06 -0700 Subject: Fix "unsafe narrowing" warnings in absl, 1/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 .h and win32 .inc files.) Bug: chromium:1292951 PiperOrigin-RevId: 463835431 Change-Id: If8e5f7f651d5cd96035e23e4623bdb08a7fedabe --- absl/strings/cord_buffer.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'absl/strings/cord_buffer.h') diff --git a/absl/strings/cord_buffer.h b/absl/strings/cord_buffer.h index 56a6ce6f..09a74ad5 100644 --- a/absl/strings/cord_buffer.h +++ b/absl/strings/cord_buffer.h @@ -330,8 +330,7 @@ class CordBuffer { // Returns the available area of the internal SSO data absl::Span short_available() { - assert(is_short()); - const size_t length = (short_rep.raw_size >> 1); + const size_t length = short_length(); return absl::Span(short_rep.data + length, kInlineCapacity - length); } @@ -347,7 +346,7 @@ class CordBuffer { // Returns the length of the internal SSO data. size_t short_length() const { assert(is_short()); - return short_rep.raw_size >> 1; + return static_cast(short_rep.raw_size >> 1); } // Sets the length of the internal SSO data. -- cgit v1.2.3