Skip to content

Commit

Permalink
Merge pull request protocolbuffers#4517 from rcane/feature/vc2017_bui…
Browse files Browse the repository at this point in the history
…ld_fix

Fixed a Visual Studio 2017 build error. (protocolbuffers#4488)
  • Loading branch information
Adam Cozzette authored Apr 16, 2018
2 parents a9d9326 + 7d6d5f9 commit 9497a65
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/google/protobuf/compiler/cpp/cpp_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ FieldGeneratorMap::FieldGeneratorMap(const Descriptor* descriptor,
SCCAnalyzer* scc_analyzer)
: descriptor_(descriptor),
options_(options),
field_generators_(
new std::unique_ptr<FieldGenerator>[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(
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/cpp/cpp_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class FieldGeneratorMap {
private:
const Descriptor* descriptor_;
const Options& options_;
std::unique_ptr<std::unique_ptr<FieldGenerator> []> field_generators_;
std::vector<std::unique_ptr<FieldGenerator>> field_generators_;

static FieldGenerator* MakeGenerator(const FieldDescriptor* field,
const Options& options,
Expand Down
6 changes: 2 additions & 4 deletions src/google/protobuf/compiler/java/java_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ template <>
FieldGeneratorMap<ImmutableFieldGenerator>::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.
Expand All @@ -234,8 +233,7 @@ template <>
FieldGeneratorMap<ImmutableFieldLiteGenerator>::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;
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/compiler/java/java_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class FieldGeneratorMap {
const Descriptor* descriptor_;
Context* context_;
ClassNameResolver* name_resolver_;
std::unique_ptr<std::unique_ptr<FieldGeneratorType> []> field_generators_;
std::vector<std::unique_ptr<FieldGeneratorType>> field_generators_;

GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
};
Expand Down
6 changes: 2 additions & 4 deletions src/google/protobuf/compiler/java/java_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<MessageGenerator>[file->message_type_count()]),
extension_generators_(
new std::unique_ptr<ExtensionGenerator>[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),
Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/compiler/java/java_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ class FileGenerator {
string java_package_;
string classname_;

std::unique_ptr<std::unique_ptr<MessageGenerator> []> message_generators_;
std::unique_ptr<std::unique_ptr<ExtensionGenerator> []> extension_generators_;
std::vector<std::unique_ptr<MessageGenerator>> message_generators_;
std::vector<std::unique_ptr<ExtensionGenerator>> extension_generators_;
std::unique_ptr<GeneratorFactory> generator_factory_;
std::unique_ptr<Context> context_;
ClassNameResolver* name_resolver_;
Expand Down
6 changes: 2 additions & 4 deletions src/google/protobuf/compiler/objectivec/objectivec_field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<FieldGenerator>[descriptor->field_count()]),
extension_generators_(
new std::unique_ptr<FieldGenerator>[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(
Expand Down
4 changes: 2 additions & 2 deletions src/google/protobuf/compiler/objectivec/objectivec_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ class FieldGeneratorMap {

private:
const Descriptor* descriptor_;
std::unique_ptr<std::unique_ptr<FieldGenerator>[]> field_generators_;
std::unique_ptr<std::unique_ptr<FieldGenerator>[]> extension_generators_;
std::vector<std::unique_ptr<FieldGenerator>> field_generators_;
std::vector<std::unique_ptr<FieldGenerator>> extension_generators_;

GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorMap);
};
Expand Down

0 comments on commit 9497a65

Please sign in to comment.