diff --git a/src/google/protobuf/inlined_string_field.cc b/src/google/protobuf/inlined_string_field.cc index a17f922b6cba9..69ba4743987ba 100644 --- a/src/google/protobuf/inlined_string_field.cc +++ b/src/google/protobuf/inlined_string_field.cc @@ -15,7 +15,6 @@ #include "absl/base/optimization.h" #include "absl/log/absl_check.h" -#include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena.h" #include "google/protobuf/arena_align.h" diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc index b9de939a86e7d..7a951e4e37513 100644 --- a/src/google/protobuf/io/coded_stream.cc +++ b/src/google/protobuf/io/coded_stream.cc @@ -33,7 +33,6 @@ #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/cord.h" -#include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -256,7 +255,7 @@ bool CodedInputStream::ReadString(std::string* buffer, int size) { if (size < 0) return false; // security: size is often user-supplied if (BufferSize() >= size) { - absl::strings_internal::STLStringResizeUninitialized(buffer, size); + buffer->resize(size); std::pair z = as_string_data(buffer); if (z.second) { // Oddly enough, memcpy() requires its first two args to be non-NULL even diff --git a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc index ccacd3ea0dba6..e40e0ab5a328c 100644 --- a/src/google/protobuf/io/zero_copy_stream_impl_lite.cc +++ b/src/google/protobuf/io/zero_copy_stream_impl_lite.cc @@ -24,7 +24,6 @@ #include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include "absl/strings/cord_buffer.h" -#include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/string_view.h" #include "absl/types/span.h" #include "google/protobuf/io/zero_copy_stream.h" @@ -145,8 +144,7 @@ bool StringOutputStream::Next(void** data, int* size) { // Avoid integer overflow in returned '*size'. new_size = std::min(new_size, old_size + std::numeric_limits::max()); // Increase the size, also make sure that it is at least kMinimumSize. - absl::strings_internal::STLStringResizeUninitialized( - target_, + target_->resize( std::max(new_size, kMinimumSize + 0)); // "+ 0" works around GCC4 weirdness. diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc index e9545fd0a613a..ce3b54d64a084 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -28,7 +28,6 @@ #include "absl/log/absl_log.h" #include "absl/strings/cord.h" #include "absl/strings/cord_buffer.h" -#include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "absl/types/optional.h" @@ -594,8 +593,7 @@ bool MessageLite::AppendPartialToString(std::string* output) const { return false; } - absl::strings_internal::STLStringResizeUninitializedAmortized( - output, old_size + byte_size); + output->resize(old_size + byte_size); uint8_t* start = reinterpret_cast(io::mutable_string_data(output) + old_size); SerializeToArrayImpl(*this, start, byte_size); diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h index 6b196994e4213..989ff68dfaa93 100644 --- a/src/google/protobuf/parse_context.h +++ b/src/google/protobuf/parse_context.h @@ -23,7 +23,6 @@ #include "absl/log/absl_check.h" #include "absl/log/absl_log.h" #include "absl/strings/cord.h" -#include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/string_view.h" #include "google/protobuf/arena.h" #include "google/protobuf/arenastring.h" @@ -189,7 +188,7 @@ class PROTOBUF_EXPORT EpsCopyInputStream { // However micro-benchmarks regress on string reading cases. So we copy // the same logic from the old CodedInputStream ReadString. Note: as of // Apr 2021, this is still a significant win over `assign()`. - absl::strings_internal::STLStringResizeUninitialized(s, size); + s->resize(size); char* z = &(*s)[0]; memcpy(z, ptr, size); return ptr + size; diff --git a/src/google/protobuf/unknown_field_set.cc b/src/google/protobuf/unknown_field_set.cc index a4af9a6e65364..9c2123182c899 100644 --- a/src/google/protobuf/unknown_field_set.cc +++ b/src/google/protobuf/unknown_field_set.cc @@ -18,7 +18,6 @@ #include "absl/log/absl_check.h" #include "absl/strings/cord.h" -#include "absl/strings/internal/resize_uninitialized.h" #include "absl/strings/string_view.h" #include "google/protobuf/extension_set.h" #include "google/protobuf/generated_message_tctable_impl.h" @@ -213,7 +212,7 @@ bool UnknownFieldSet::ParseFromArray(const void* data, int size) { bool UnknownFieldSet::SerializeToString(std::string* output) const { const size_t size = google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(*this); - absl::strings_internal::STLStringResizeUninitializedAmortized(output, size); + output->resize(size); google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( *this, reinterpret_cast(const_cast(output->data()))); return true;