From 779f61c6a3ce02a119e28e802f229e61b69b9046 Mon Sep 17 00:00:00 2001 From: temporal Date: Wed, 13 Aug 2008 03:15:00 +0000 Subject: Integrate recent changes from google3. protoc - New flags --encode and --decode can be used to convert between protobuf text format and binary format from the command-line. - New flag --descriptor_set_out can be used to write FileDescriptorProtos for all parsed files directly into a single output file. This is particularly useful if you wish to parse .proto files from programs written in languages other than C++: just run protoc as a background process and have it output a FileDescriptorList, then parse that natively. C++ - Reflection objects are now per-class rather than per-instance. To make this possible, the Reflection interface had to be changed such that all methods take the Message instance as a parameter. This change improves performance significantly in memory-bandwidth-limited use cases, since it makes the message objects smaller. Note that source-incompatible interface changes like this will not be made again after the library leaves beta. Python - MergeFrom(message) and CopyFrom(message) are now implemented. - SerializeToString() raises an exception if the message is missing required fields. - Code organization improvements. - Fixed doc comments for RpcController and RpcChannel, which had somehow been swapped. --- src/google/protobuf/unknown_field_set_unittest.cc | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src/google/protobuf/unknown_field_set_unittest.cc') diff --git a/src/google/protobuf/unknown_field_set_unittest.cc b/src/google/protobuf/unknown_field_set_unittest.cc index 39b005f4..63f1dffd 100644 --- a/src/google/protobuf/unknown_field_set_unittest.cc +++ b/src/google/protobuf/unknown_field_set_unittest.cc @@ -176,8 +176,7 @@ TEST_F(UnknownFieldSetTest, ParseViaReflection) { io::ArrayInputStream raw_input(all_fields_data_.data(), all_fields_data_.size()); io::CodedInputStream input(&raw_input); - ASSERT_TRUE(WireFormat::ParseAndMergePartial(message.GetDescriptor(), &input, - message.GetReflection())); + ASSERT_TRUE(WireFormat::ParseAndMergePartial(&input, &message)); EXPECT_EQ(message.DebugString(), empty_message_.DebugString()); } @@ -191,12 +190,9 @@ TEST_F(UnknownFieldSetTest, SerializeViaReflection) { { io::StringOutputStream raw_output(&data); io::CodedOutputStream output(&raw_output); - int size = WireFormat::ByteSize(empty_message_.GetDescriptor(), - empty_message_.GetReflection()); + int size = WireFormat::ByteSize(empty_message_); ASSERT_TRUE( - WireFormat::SerializeWithCachedSizes(empty_message_.GetDescriptor(), - empty_message_.GetReflection(), - size, &output)); + WireFormat::SerializeWithCachedSizes(empty_message_, size, &output)); } // Don't use EXPECT_EQ because we don't want to dump raw binary data to @@ -290,9 +286,7 @@ TEST_F(UnknownFieldSetTest, WrongTypeTreatedAsUnknownViaReflection) { string bizarro_data = GetBizarroData(); io::ArrayInputStream raw_input(bizarro_data.data(), bizarro_data.size()); io::CodedInputStream input(&raw_input); - ASSERT_TRUE(WireFormat::ParseAndMergePartial( - all_types_message.GetDescriptor(), &input, - all_types_message.GetReflection())); + ASSERT_TRUE(WireFormat::ParseAndMergePartial(&input, &all_types_message)); ASSERT_TRUE(empty_message.ParseFromString(bizarro_data)); EXPECT_EQ(empty_message.DebugString(), all_types_message.DebugString()); @@ -315,8 +309,7 @@ TEST_F(UnknownFieldSetTest, UnknownExtensionsReflection) { io::ArrayInputStream raw_input(all_fields_data_.data(), all_fields_data_.size()); io::CodedInputStream input(&raw_input); - ASSERT_TRUE(WireFormat::ParseAndMergePartial(message.GetDescriptor(), &input, - message.GetReflection())); + ASSERT_TRUE(WireFormat::ParseAndMergePartial(&input, &message)); EXPECT_EQ(message.DebugString(), empty_message_.DebugString()); } -- cgit v1.2.3