summaryrefslogtreecommitdiff
path: root/absl/strings/cord.cc
diff options
context:
space:
mode:
authorGravatar Thomas Köppe <tkoeppe@google.com>2022-08-04 06:14:14 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-08-04 06:15:05 -0700
commit4b551344e6ba3243636d841d5a2d944a20a3a956 (patch)
tree95f8c347117f509f5aa9fab0b05f3c55d1ce73cf /absl/strings/cord.cc
parent751ade00ee347abef5dac7248db851e3f2012e14 (diff)
Revert change "Fix "unsafe narrowing" warnings in absl, 4/n.".
The change breaks existing code by changing the return type of absl::bit_width. PiperOrigin-RevId: 465295951 Change-Id: Id4ce7c2ac3699ce22aa2b4851a949f9e0104a3d7
Diffstat (limited to 'absl/strings/cord.cc')
-rw-r--r--absl/strings/cord.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/absl/strings/cord.cc b/absl/strings/cord.cc
index 523379e4..b34c03a2 100644
--- a/absl/strings/cord.cc
+++ b/absl/strings/cord.cc
@@ -20,7 +20,6 @@
#include <cstdio>
#include <cstdlib>
#include <iomanip>
-#include <ios>
#include <iostream>
#include <limits>
#include <ostream>
@@ -185,7 +184,7 @@ inline void Cord::InlineRep::reduce_size(size_t n) {
assert(tag >= n);
tag -= n;
memset(data_.as_chars() + tag, 0, n);
- set_inline_size(tag);
+ set_inline_size(static_cast<char>(tag));
}
inline void Cord::InlineRep::remove_prefix(size_t n) {
@@ -1099,7 +1098,7 @@ Cord Cord::ChunkIterator::AdvanceAndReadBytes(size_t n) {
: current_leaf_;
const char* data = payload->IsExternal() ? payload->external()->base
: payload->flat()->Data();
- const size_t offset = static_cast<size_t>(current_chunk_.data() - data);
+ const size_t offset = current_chunk_.data() - data;
auto* tree = CordRepSubstring::Substring(payload, offset, n);
subcord.contents_.EmplaceTree(VerifyTree(tree), method);
@@ -1309,7 +1308,7 @@ static bool VerifyNode(CordRep* root, CordRep* start_node,
std::ostream& operator<<(std::ostream& out, const Cord& cord) {
for (absl::string_view chunk : cord.Chunks()) {
- out.write(chunk.data(), static_cast<std::streamsize>(chunk.size()));
+ out.write(chunk.data(), chunk.size());
}
return out;
}