diff --git a/src/google/protobuf/compiler/cpp/cpp_field.cc b/src/google/protobuf/compiler/cpp/cpp_field.cc index 33ffe574c3..0de20f84ff 100644 --- a/src/google/protobuf/compiler/cpp/cpp_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_field.cc @@ -117,8 +117,7 @@ FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, SCCAnalyzer* scc_analyzer) : descriptor_(descriptor), options_(options), - field_generators_( - new std::unique_ptr[descriptor->field_count()]) { + field_generators_(descriptor->field_count()) { // Construct all the FieldGenerators. for (int i = 0; i < descriptor->field_count(); i++) { field_generators_[i].reset( diff --git a/src/google/protobuf/compiler/cpp/cpp_field.h b/src/google/protobuf/compiler/cpp/cpp_field.h index 6cb466a87a..8cdbe88635 100644 --- a/src/google/protobuf/compiler/cpp/cpp_field.h +++ b/src/google/protobuf/compiler/cpp/cpp_field.h @@ -203,7 +203,7 @@ class FieldGeneratorMap { private: const Descriptor* descriptor_; const Options& options_; - std::unique_ptr []> field_generators_; + std::vector> field_generators_; static FieldGenerator* MakeGenerator(const FieldDescriptor* field, const Options& options, diff --git a/src/google/protobuf/compiler/java/java_field.cc b/src/google/protobuf/compiler/java/java_field.cc index d731968166..93de0229ae 100644 --- a/src/google/protobuf/compiler/java/java_field.cc +++ b/src/google/protobuf/compiler/java/java_field.cc @@ -211,8 +211,7 @@ template <> FieldGeneratorMap::FieldGeneratorMap( const Descriptor* descriptor, Context* context) : descriptor_(descriptor), - field_generators_(new std::unique_ptr< - ImmutableFieldGenerator>[descriptor->field_count()]) { + field_generators_(descriptor->field_count()) { // Construct all the FieldGenerators and assign them bit indices for their // bit fields. @@ -234,8 +233,7 @@ template <> FieldGeneratorMap::FieldGeneratorMap( const Descriptor* descriptor, Context* context) : descriptor_(descriptor), - field_generators_(new std::unique_ptr< - ImmutableFieldLiteGenerator>[descriptor->field_count()]) { + field_generators_(descriptor->field_count()) { // Construct all the FieldGenerators and assign them bit indices for their // bit fields. int messageBitIndex = 0; diff --git a/src/google/protobuf/compiler/java/java_field.h b/src/google/protobuf/compiler/java/java_field.h index 04bbe24aa4..7275c0998a 100644 --- a/src/google/protobuf/compiler/java/java_field.h +++ b/src/google/protobuf/compiler/java/java_field.h @@ -138,7 +138,7 @@ class FieldGeneratorMap { const Descriptor* descriptor_; Context* context_; ClassNameResolver* name_resolver_; - std::unique_ptr []> field_generators_; + std::vector> field_generators_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); }; diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc index 5ee04e5a2d..d8f11d807f 100644 --- a/src/google/protobuf/compiler/java/java_file.cc +++ b/src/google/protobuf/compiler/java/java_file.cc @@ -186,10 +186,8 @@ FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options, bool immutable_api) : file_(file), java_package_(FileJavaPackage(file, immutable_api)), - message_generators_( - new std::unique_ptr[file->message_type_count()]), - extension_generators_( - new std::unique_ptr[file->extension_count()]), + message_generators_(file->message_type_count()), + extension_generators_(file->extension_count()), context_(new Context(file, options)), name_resolver_(context_->GetNameResolver()), options_(options), diff --git a/src/google/protobuf/compiler/java/java_file.h b/src/google/protobuf/compiler/java/java_file.h index 9ad7937c81..78833a4589 100644 --- a/src/google/protobuf/compiler/java/java_file.h +++ b/src/google/protobuf/compiler/java/java_file.h @@ -98,8 +98,8 @@ class FileGenerator { string java_package_; string classname_; - std::unique_ptr []> message_generators_; - std::unique_ptr []> extension_generators_; + std::vector> message_generators_; + std::vector> extension_generators_; std::unique_ptr generator_factory_; std::unique_ptr context_; ClassNameResolver* name_resolver_; diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.cc b/src/google/protobuf/compiler/objectivec/objectivec_field.cc index 67b026c362..f74599ba85 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_field.cc +++ b/src/google/protobuf/compiler/objectivec/objectivec_field.cc @@ -410,10 +410,8 @@ bool RepeatedFieldGenerator::RuntimeUsesHasBit(void) const { FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor, const Options& options) : descriptor_(descriptor), - field_generators_( - new std::unique_ptr[descriptor->field_count()]), - extension_generators_( - new std::unique_ptr[descriptor->extension_count()]) { + field_generators_(descriptor->field_count()), + extension_generators_(descriptor->extension_count()) { // Construct all the FieldGenerators. for (int i = 0; i < descriptor->field_count(); i++) { field_generators_[i].reset( diff --git a/src/google/protobuf/compiler/objectivec/objectivec_field.h b/src/google/protobuf/compiler/objectivec/objectivec_field.h index 888cfefc65..216034d067 100644 --- a/src/google/protobuf/compiler/objectivec/objectivec_field.h +++ b/src/google/protobuf/compiler/objectivec/objectivec_field.h @@ -182,8 +182,8 @@ class FieldGeneratorMap { private: const Descriptor* descriptor_; - std::unique_ptr[]> field_generators_; - std::unique_ptr[]> extension_generators_; + std::vector> field_generators_; + std::vector> extension_generators_; GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap); };