Canged CodedInputStream.ReadTag to use boolean result with out params to
support reading a field name rather than a field tag.
diff --git a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
index 47bdcb6..445d127 100644
--- a/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
+++ b/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs
@@ -247,11 +247,12 @@
}
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)) {
@@ -274,6 +275,8 @@
}
}
}
+
+ return this;
}
@@ -541,11 +544,12 @@
}
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)) {
@@ -568,6 +572,8 @@
}
}
}
+
+ return this;
}
@@ -876,11 +882,12 @@
}
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)) {
@@ -911,6 +918,8 @@
}
}
}
+
+ return this;
}
@@ -1321,11 +1330,12 @@
}
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)) {
@@ -1369,6 +1379,8 @@
}
}
}
+
+ return this;
}
@@ -1706,11 +1718,12 @@
}
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)) {
@@ -1725,6 +1738,8 @@
}
}
}
+
+ return this;
}