diff options
author | Josh Haberman <jhaberman@gmail.com> | 2015-05-08 16:56:29 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2015-05-08 16:56:29 -0700 |
commit | 3bd691a4975b2267ff04611507e766a7f9f87e83 (patch) | |
tree | e5628144f6f920d9ccf792a1499e55503e6ff4d2 /tests/bindings/googlepb | |
parent | 87fc2c516bff207f880c71526926842fd8dcc77e (diff) |
Google-internal development.
Diffstat (limited to 'tests/bindings/googlepb')
-rw-r--r-- | tests/bindings/googlepb/test_vs_proto2.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/bindings/googlepb/test_vs_proto2.cc b/tests/bindings/googlepb/test_vs_proto2.cc index c89339a..8e68791 100644 --- a/tests/bindings/googlepb/test_vs_proto2.cc +++ b/tests/bindings/googlepb/test_vs_proto2.cc @@ -40,8 +40,8 @@ const unsigned char message2_data[] = { void compare_metadata(const google::protobuf::Descriptor* d, const upb::MessageDef *upb_md) { ASSERT(d->field_count() == upb_md->field_count()); - for (upb::MessageDef::const_iterator i = upb_md->begin(); i != upb_md->end(); - ++i) { + for (upb::MessageDef::const_field_iterator i = upb_md->field_begin(); + i != upb_md->field_end(); ++i) { const upb::FieldDef* upb_f = *i; const google::protobuf::FieldDescriptor *proto2_f = d->FindFieldByNumber(upb_f->number()); @@ -77,13 +77,14 @@ void parse_and_compare(google::protobuf::Message *msg1, cache.GetDecoderMethod(upb::pb::DecoderMethodOptions(protomsg_handlers))); upb::Status status; - upb::pb::Decoder decoder(decoder_method.get(), &status); + upb::Environment env; + env.ReportErrorsTo(&status); upb::Sink protomsg_sink(protomsg_handlers, msg2); - - decoder.ResetOutput(&protomsg_sink); + upb::pb::Decoder* decoder = + upb::pb::Decoder::Create(&env, decoder_method.get(), &protomsg_sink); msg2->Clear(); - bool ok = upb::BufferSource::PutBuffer(str, len, decoder.input()); + bool ok = upb::BufferSource::PutBuffer(str, len, decoder->input()); if (!ok) { fprintf(stderr, "error parsing: %s\n", status.error_message()); print_diff(*msg1, *msg2); |