From 123e534914df3dbdcd918ec4f8d79c47a3bf85e5 Mon Sep 17 00:00:00 2001 From: csharptest Date: Fri, 3 Jun 2011 14:15:21 -0500 Subject: Canged CodedInputStream.ReadTag to use boolean result with out params to support reading a field name rather than a field tag. --- .../TestProtos/UnitTestImportLiteProtoFile.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs') diff --git a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs index 2002d8df..db26d728 100644 --- a/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs +++ b/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -207,11 +207,12 @@ namespace Google.ProtocolBuffers.TestProtos { } public override Builder MergeFrom(pb::CodedInputStream input, pb::ExtensionRegistry extensionRegistry) { - while (true) { - uint tag = input.ReadTag(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { switch (tag) { case 0: { - return this; + throw InvalidProtocolBufferException.InvalidTag(); } default: { if (pb::WireFormat.IsEndGroupTag(tag)) { @@ -226,6 +227,8 @@ namespace Google.ProtocolBuffers.TestProtos { } } } + + return this; } -- cgit v1.2.3