From a2a32c20434807e9966e3f48375f9419134d1b55 Mon Sep 17 00:00:00 2001 From: "kenton@google.com" Date: Fri, 14 Nov 2008 17:29:32 +0000 Subject: Support HP C++ on Tru64. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch (mostly) by Vincent Choinière . --- src/google/protobuf/descriptor.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/google/protobuf/descriptor.cc') 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(label())); - proto->set_type(static_cast(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( + implicit_cast(label()))); + proto->set_type(static_cast( + implicit_cast(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(proto.type()); - result->label_ = static_cast(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( + implicit_cast(proto.type())); + result->label_ = static_cast( + implicit_cast(proto.label())); + // Some of these may be filled in when cross-linking. result->containing_type_ = NULL; result->extension_scope_ = NULL; -- cgit v1.2.3