summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
Diffstat (limited to 'absl')
-rw-r--r--absl/strings/cord.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/absl/strings/cord.h b/absl/strings/cord.h
index 62fcb2c6..e8267ab1 100644
--- a/absl/strings/cord.h
+++ b/absl/strings/cord.h
@@ -894,9 +894,8 @@ class Cord {
// memcpy is much faster when operating on a known size. On most supported
// platforms, the small string optimization is large enough that resizing
// to 15 bytes does not cause a memory allocation.
- absl::strings_internal::STLStringResizeUninitialized(dst,
- sizeof(data_) - 1);
- memcpy(&(*dst)[0], &data_, sizeof(data_) - 1);
+ absl::strings_internal::STLStringResizeUninitialized(dst, kMaxInline);
+ memcpy(&(*dst)[0], data_.as_chars(), kMaxInline);
// erase is faster than resize because the logic for memory allocation is
// not needed.
dst->erase(inline_size());
@@ -1189,7 +1188,7 @@ inline cord_internal::CordRepFlat* Cord::InlineRep::MakeFlatWithExtraCapacity(
size_t len = data_.inline_size();
auto* result = CordRepFlat::New(len + extra);
result->length = len;
- memcpy(result->Data(), data_.as_chars(), sizeof(data_));
+ memcpy(result->Data(), data_.as_chars(), InlineRep::kMaxInline);
return result;
}