diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-11-14 17:29:32 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2008-11-14 17:29:32 +0000 |
commit | a2a32c20434807e9966e3f48375f9419134d1b55 (patch) | |
tree | 16f115d52249335124cba31e959253275af624c4 /src/google/protobuf/descriptor.cc | |
parent | 8da400ed12284575895cf7d5e4425435d4e43c42 (diff) |
Support HP C++ on Tru64.
Patch (mostly) by Vincent Choinière <Choiniere.Vincent@hydro.qc.ca>.
Diffstat (limited to 'src/google/protobuf/descriptor.cc')
-rw-r--r-- | src/google/protobuf/descriptor.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index b843a06b..882b104b 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -1175,8 +1175,13 @@ void Descriptor::CopyTo(DescriptorProto* proto) const { void FieldDescriptor::CopyTo(FieldDescriptorProto* proto) const { proto->set_name(name()); proto->set_number(number()); - proto->set_label(static_cast<FieldDescriptorProto::Label>(label())); - proto->set_type(static_cast<FieldDescriptorProto::Type>(type())); + + // Some compilers do not allow static_cast directly between two enum types, + // so we must cast to int first. + proto->set_label(static_cast<FieldDescriptorProto::Label>( + implicit_cast<int>(label()))); + proto->set_type(static_cast<FieldDescriptorProto::Type>( + implicit_cast<int>(type()))); if (is_extension()) { proto->set_extendee("."); @@ -2487,10 +2492,15 @@ void DescriptorBuilder::BuildFieldOrExtension(const FieldDescriptorProto& proto, result->full_name_ = full_name; result->file_ = file_; result->number_ = proto.number(); - result->type_ = static_cast<FieldDescriptor::Type>(proto.type()); - result->label_ = static_cast<FieldDescriptor::Label>(proto.label()); result->is_extension_ = is_extension; + // Some compilers do not allow static_cast directly between two enum types, + // so we must cast to int first. + result->type_ = static_cast<FieldDescriptor::Type>( + implicit_cast<int>(proto.type())); + result->label_ = static_cast<FieldDescriptor::Label>( + implicit_cast<int>(proto.label())); + // Some of these may be filled in when cross-linking. result->containing_type_ = NULL; result->extension_scope_ = NULL; |