From 6011d7ca4c3207661ca247be4a39f861d93b8065 Mon Sep 17 00:00:00 2001 From: Matt Hauck Date: Wed, 1 Mar 2017 10:45:43 -0800 Subject: Fix gcc 4.1 build (#1035) (#1913) * Fix gcc 4.1.2 compilation of map_field_inl.h Fixes "error: object missing in reference to '...'" errors from #1035 * Disable 64-bit map keys on gcc <= 4.1 * Add missing case statements --- src/google/protobuf/map_field_inl.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/google/protobuf/map_field_inl.h') diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h index 01c9b89a..2d84b0a3 100644 --- a/src/google/protobuf/map_field_inl.h +++ b/src/google/protobuf/map_field_inl.h @@ -339,9 +339,9 @@ MapField::Swap( MapFieldLiteType* other) { MapField* down_other = down_cast(other); - std::swap(MapFieldBase::repeated_field_, down_other->repeated_field_); + std::swap(this->MapFieldBase::repeated_field_, down_other->repeated_field_); MapFieldLiteType::Swap(other); - std::swap(MapFieldBase::state_, down_other->state_); + std::swap(this->MapFieldBase::state_, down_other->state_); } template ::SetEntryDescriptor( const Descriptor** descriptor) { - MapFieldBase::entry_descriptor_ = descriptor; + this->MapFieldBase::entry_descriptor_ = descriptor; } template ::SetAssignDescriptorCallback(void (*callback)()) { - MapFieldBase::assign_descriptor_callback_ = callback; + this->MapFieldBase::assign_descriptor_callback_ = callback; } template ::SyncRepeatedFieldWithMapNoLock() const { - if (MapFieldBase::repeated_field_ == NULL) { - if (MapFieldBase::arena_ == NULL) { - MapFieldBase::repeated_field_ = new RepeatedPtrField(); + if (this->MapFieldBase::repeated_field_ == NULL) { + if (this->MapFieldBase::arena_ == NULL) { + this->MapFieldBase::repeated_field_ = new RepeatedPtrField(); } else { - MapFieldBase::repeated_field_ = + this->MapFieldBase::repeated_field_ = Arena::CreateMessage >( - MapFieldBase::arena_); + this->MapFieldBase::arena_); } } const Map& map = GetInternalMap(); RepeatedPtrField* repeated_field = reinterpret_cast*>( - MapFieldBase::repeated_field_); + this->MapFieldBase::repeated_field_); repeated_field->Clear(); @@ -413,7 +413,7 @@ MapField(default_entry_->New(MapFieldBase::arena_)); + down_cast(default_entry_->New(this->MapFieldBase::arena_)); repeated_field->AddAllocated(new_entry); (*new_entry->mutable_key()) = it->first; (*new_entry->mutable_value()) = it->second; @@ -430,8 +430,8 @@ MapField* map = const_cast(this)->MutableInternalMap(); RepeatedPtrField* repeated_field = reinterpret_cast*>( - MapFieldBase::repeated_field_); - GOOGLE_CHECK(MapFieldBase::repeated_field_ != NULL); + this->MapFieldBase::repeated_field_); + GOOGLE_CHECK(this->MapFieldBase::repeated_field_ != NULL); map->clear(); for (typename RepeatedPtrField::iterator it = repeated_field->begin(); it != repeated_field->end(); ++it) { @@ -452,8 +452,8 @@ int MapField::SpaceUsedExcludingSelfNoLock() const { int size = 0; - if (MapFieldBase::repeated_field_ != NULL) { - size += MapFieldBase::repeated_field_->SpaceUsedExcludingSelf(); + if (this->MapFieldBase::repeated_field_ != NULL) { + size += this->MapFieldBase::repeated_field_->SpaceUsedExcludingSelf(); } Map* map = const_cast(this)->MutableInternalMap(); size += sizeof(*map); @@ -475,10 +475,10 @@ MapFieldMapFieldBase::entry_descriptor_ != NULL); default_entry_ = down_cast( MessageFactory::generated_factory()->GetPrototype( - *MapFieldBase::entry_descriptor_)); + *this->MapFieldBase::entry_descriptor_)); } } -- cgit v1.2.3