From ff334a60eb2e74722867dd41b78d7c8c90bc8d0c Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Wed, 5 Aug 2015 11:23:38 +0100 Subject: Change ReadTag and PeekTag to just use 0 as a return value for "end of stream", rather than using an awkward out parameter. This simplifies quite a lot of code. Generated code in next commit. --- csharp/src/Google.Protobuf/Collections/MapField.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'csharp/src/Google.Protobuf/Collections/MapField.cs') diff --git a/csharp/src/Google.Protobuf/Collections/MapField.cs b/csharp/src/Google.Protobuf/Collections/MapField.cs index fed3d062..5eb2c2fc 100644 --- a/csharp/src/Google.Protobuf/Collections/MapField.cs +++ b/csharp/src/Google.Protobuf/Collections/MapField.cs @@ -627,12 +627,8 @@ namespace Google.Protobuf.Collections public void MergeFrom(CodedInputStream input) { uint tag; - while (input.ReadTag(out tag)) + while ((tag = input.ReadTag()) != 0) { - if (tag == 0) - { - throw InvalidProtocolBufferException.InvalidTag(); - } if (tag == codec.keyCodec.Tag) { Key = codec.keyCodec.Read(input); -- cgit v1.2.3