diff --git a/src/google/protobuf/inlined_string_field.cc b/src/google/protobuf/inlined_string_field.cc index 3a7015e..c1e298f 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 f10df0b..5ca8868 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" @@ -262,7 +261,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 12a967d..effac7f 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 1d7da03..5405769 100644 --- a/src/google/protobuf/message_lite.cc +++ b/src/google/protobuf/message_lite.cc @@ -26,7 +26,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/span.h" @@ -596,8 +595,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 30cc5f2..2e1a4fe 100644 --- a/src/google/protobuf/parse_context.h +++ b/src/google/protobuf/parse_context.h @@ -24,7 +24,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 "absl/types/span.h" #include "google/protobuf/arena.h" @@ -203,7 +202,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 9da9b0c..3d6e940 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" @@ -223,7 +222,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); // TODO: Remove this suppression. (void)google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( *this, reinterpret_cast(const_cast(output->data())));