From 03e11c4fa62c852cd7a906d87c49adb39cb1a4d5 Mon Sep 17 00:00:00 2001 From: lahiker42 Date: Thu, 11 Jun 2009 12:49:24 +0000 Subject: [PATCH] Issue 20: Update for UnknownField API change (by dcreager). See: http://code.google.com/p/protobuf-c/issues/detail?id=20 git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@188 00440858-1255-0410-a3e6-75ea37f81c3a --- src/test/cxx-generate-packed-data.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/cxx-generate-packed-data.cc b/src/test/cxx-generate-packed-data.cc index aa6e2e0..23191f6 100644 --- a/src/test/cxx-generate-packed-data.cc +++ b/src/test/cxx-generate-packed-data.cc @@ -757,18 +757,32 @@ static void dump_test_unknown_fields (void) EmptyMess mess; const google::protobuf::Message::Reflection *reflection = mess.GetReflection(); google::protobuf::UnknownFieldSet *fs = reflection->MutableUnknownFields(&mess); + +#if PROTOC_VERSION >= 2001000 + fs->AddVarint(5454, 255); + fs->AddFixed32(5555, 260); +#else google::protobuf::UnknownField *f; f = fs->AddField(5454); f->add_varint(255); f = fs->AddField(5555); f->add_fixed32(260); +#endif + dump_message_bytes (&mess, "test_unknown_fields_0"); fs->Clear(); + +#if PROTOC_VERSION >= 2001000 + fs->AddLengthDelimited(6666, "xxxxxxxx"); + fs->AddFixed64(7777, 0x10101); +#else f = fs->AddField(6666); f->add_length_delimited("xxxxxxxx"); f = fs->AddField(7777); f->add_fixed64(0x10101); +#endif + dump_message_bytes (&mess, "test_unknown_fields_1"); }