From 3bd691a4975b2267ff04611507e766a7f9f87e83 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Fri, 8 May 2015 16:56:29 -0700 Subject: Google-internal development. --- tests/bindings/googlepb/test_vs_proto2.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/bindings/googlepb') 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); -- cgit v1.2.3