From fb1547b3884ace3be6acf9e947686d627ff90179 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Fri, 12 Jun 2015 13:11:54 +0100 Subject: [PATCH] Regenerate proto files --- csharp/src/AddressBook/Addressbook.cs | 52 +- .../TestProtos/UnittestImportProto3.cs | 2 +- .../TestProtos/UnittestImportPublicProto3.cs | 2 +- .../TestProtos/UnittestIssues.cs | 76 +- .../TestProtos/UnittestProto3.cs | 781 ++++++++++-------- .../DescriptorProtos/DescriptorProtoFile.cs | 608 ++++++++------ 6 files changed, 844 insertions(+), 677 deletions(-) diff --git a/csharp/src/AddressBook/Addressbook.cs b/csharp/src/AddressBook/Addressbook.cs index 5b513982e..4acb8cac3 100644 --- a/csharp/src/AddressBook/Addressbook.cs +++ b/csharp/src/AddressBook/Addressbook.cs @@ -130,39 +130,43 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Id != 0) hash ^= Id.GetHashCode(); - if (Email != "") hash ^= Email.GetHashCode(); + if (Email.Length != 0) hash ^= Email.GetHashCode(); hash ^= phone_.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } if (Id != 0) { output.WriteInt32(2, Id); } - if (Email != "") { + if (Email.Length != 0) { output.WriteString(3, Email); } - output.WriteMessageArray(4, phone_); + if (phone_.Count > 0) { + output.WriteMessageArray(4, phone_); + } } public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } if (Id != 0) { size += pb::CodedOutputStream.ComputeInt32Size(2, Id); } - if (Email != "") { + if (Email.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(3, Email); } - foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in phone_) { - size += pb::CodedOutputStream.ComputeMessageSize(4, element); + if (phone_.Count > 0) { + foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in phone_) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } } return size; } @@ -170,13 +174,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } if (other.Id != 0) { Id = other.Id; } - if (other.Email != "") { + if (other.Email.Length != 0) { Email = other.Email; } phone_.Add(other.phone_); @@ -194,15 +198,15 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 16: { - id_ = input.ReadInt32(); + Id = input.ReadInt32(); break; } case 26: { - email_ = input.ReadString(); + Email = input.ReadString(); break; } case 34: { @@ -275,13 +279,13 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public override int GetHashCode() { int hash = 0; - if (Number != "") hash ^= Number.GetHashCode(); + if (Number.Length != 0) hash ^= Number.GetHashCode(); if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) hash ^= Type.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Number != "") { + if (Number.Length != 0) { output.WriteString(1, Number); } if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { @@ -291,7 +295,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { public int CalculateSize() { int size = 0; - if (Number != "") { + if (Number.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Number); } if (Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { @@ -303,7 +307,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { if (other == null) { return; } - if (other.Number != "") { + if (other.Number.Length != 0) { Number = other.Number; } if (other.Type != global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME) { @@ -323,7 +327,7 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } break; case 10: { - number_ = input.ReadString(); + Number = input.ReadString(); break; } case 16: { @@ -388,13 +392,17 @@ namespace Google.ProtocolBuffers.Examples.AddressBook { } public void WriteTo(pb::CodedOutputStream output) { - output.WriteMessageArray(1, person_); + if (person_.Count > 0) { + output.WriteMessageArray(1, person_); + } } public int CalculateSize() { int size = 0; - foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in person_) { - size += pb::CodedOutputStream.ComputeMessageSize(1, element); + if (person_.Count > 0) { + foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in person_) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } } return size; } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs index 1bd4e22b2..f4bbbc5f0 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportProto3.cs @@ -141,7 +141,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - d_ = input.ReadInt32(); + D = input.ReadInt32(); break; } } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs index 32123d532..a79fa70ed 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestImportPublicProto3.cs @@ -126,7 +126,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - e_ = input.ReadInt32(); + E = input.ReadInt32(); break; } } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs index d8c8995b5..6e59f205e 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestIssues.cs @@ -157,8 +157,12 @@ namespace UnitTest.Issues.TestProtos { if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) { output.WriteEnum(1, (int) Value); } - output.WriteEnumArray(2, values_); - output.WritePackedEnumArray(3, packedValues_); + if (values_.Count > 0) { + output.WriteEnumArray(2, values_); + } + if (packedValues_.Count > 0) { + output.WritePackedEnumArray(3, packedValues_); + } } public int CalculateSize() { @@ -166,26 +170,22 @@ namespace UnitTest.Issues.TestProtos { if (Value != global::UnitTest.Issues.TestProtos.NegativeEnum.NEGATIVE_ENUM_ZERO) { size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Value); } - { + if (values_.Count > 0) { int dataSize = 0; - if (values_.Count > 0) { - foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in values_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 1 * values_.Count; + foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in values_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); } + size += dataSize; + size += 1 * values_.Count; } - { + if (packedValues_.Count > 0) { int dataSize = 0; - if (packedValues_.Count > 0) { - foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in packedValues_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 1; - size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in packedValues_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); } + size += dataSize; + size += 1; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); } return size; } @@ -399,15 +399,21 @@ namespace UnitTest.Issues.TestProtos { if (PrimitiveValue != 0) { output.WriteInt32(1, PrimitiveValue); } - output.WritePackedInt32Array(2, primitiveArray_); + if (primitiveArray_.Count > 0) { + output.WritePackedInt32Array(2, primitiveArray_); + } if (messageValue_ != null) { output.WriteMessage(3, MessageValue); } - output.WriteMessageArray(4, messageArray_); + if (messageArray_.Count > 0) { + output.WriteMessageArray(4, messageArray_); + } if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) { output.WriteEnum(5, (int) EnumValue); } - output.WritePackedEnumArray(6, enumArray_); + if (enumArray_.Count > 0) { + output.WritePackedEnumArray(6, enumArray_); + } } public int CalculateSize() { @@ -415,35 +421,33 @@ namespace UnitTest.Issues.TestProtos { if (PrimitiveValue != 0) { size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveValue); } - { + if (primitiveArray_.Count > 0) { int dataSize = 0; foreach (int element in primitiveArray_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); } size += dataSize; - if (primitiveArray_.Count != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } if (messageValue_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(3, MessageValue); } - foreach (global::UnitTest.Issues.TestProtos.DeprecatedChild element in messageArray_) { - size += pb::CodedOutputStream.ComputeMessageSize(4, element); + if (messageArray_.Count > 0) { + foreach (global::UnitTest.Issues.TestProtos.DeprecatedChild element in messageArray_) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } } if (EnumValue != global::UnitTest.Issues.TestProtos.DeprecatedEnum.DEPRECATED_ZERO) { size += pb::CodedOutputStream.ComputeEnumSize(5, (int) EnumValue); } - { + if (enumArray_.Count > 0) { int dataSize = 0; - if (enumArray_.Count > 0) { - foreach (global::UnitTest.Issues.TestProtos.DeprecatedEnum element in enumArray_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 1; - size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + foreach (global::UnitTest.Issues.TestProtos.DeprecatedEnum element in enumArray_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); } + size += dataSize; + size += 1; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); } return size; } @@ -480,7 +484,7 @@ namespace UnitTest.Issues.TestProtos { } break; case 8: { - primitiveValue_ = input.ReadInt32(); + PrimitiveValue = input.ReadInt32(); break; } case 18: @@ -596,7 +600,7 @@ namespace UnitTest.Issues.TestProtos { } break; case 8: { - item_ = input.ReadInt32(); + Item = input.ReadInt32(); break; } } diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs index 4c4dabab9..7e731a83d 100644 --- a/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs @@ -747,7 +747,7 @@ namespace Google.Protobuf.TestProtos { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofString ? (string) oneofField_ : ""; } set { oneofField_ = value ?? ""; - oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofString; + oneofFieldCase_ = OneofFieldOneofCase.OneofString; } } @@ -756,7 +756,7 @@ namespace Google.Protobuf.TestProtos { get { return oneofFieldCase_ == OneofFieldOneofCase.OneofBytes ? (pb::ByteString) oneofField_ : pb::ByteString.Empty; } set { oneofField_ = value ?? pb::ByteString.Empty; - oneofFieldCase_ = value == null ? OneofFieldOneofCase.None : OneofFieldOneofCase.OneofBytes; + oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; } } @@ -850,8 +850,8 @@ namespace Google.Protobuf.TestProtos { if (SingleFloat != 0F) hash ^= SingleFloat.GetHashCode(); if (SingleDouble != 0D) hash ^= SingleDouble.GetHashCode(); if (SingleBool != false) hash ^= SingleBool.GetHashCode(); - if (SingleString != "") hash ^= SingleString.GetHashCode(); - if (SingleBytes != pb::ByteString.Empty) hash ^= SingleBytes.GetHashCode(); + if (SingleString.Length != 0) hash ^= SingleString.GetHashCode(); + if (SingleBytes.Length != 0) hash ^= SingleBytes.GetHashCode(); if (singleNestedMessage_ != null) hash ^= SingleNestedMessage.GetHashCode(); if (singleForeignMessage_ != null) hash ^= SingleForeignMessage.GetHashCode(); if (singleImportMessage_ != null) hash ^= SingleImportMessage.GetHashCode(); @@ -928,10 +928,10 @@ namespace Google.Protobuf.TestProtos { if (SingleBool != false) { output.WriteBool(13, SingleBool); } - if (SingleString != "") { + if (SingleString.Length != 0) { output.WriteString(14, SingleString); } - if (SingleBytes != pb::ByteString.Empty) { + if (SingleBytes.Length != 0) { output.WriteBytes(15, SingleBytes); } if (singleNestedMessage_ != null) { @@ -955,28 +955,72 @@ namespace Google.Protobuf.TestProtos { if (singlePublicImportMessage_ != null) { output.WriteMessage(26, SinglePublicImportMessage); } - output.WritePackedInt32Array(31, repeatedInt32_); - output.WritePackedInt64Array(32, repeatedInt64_); - output.WritePackedUInt32Array(33, repeatedUint32_); - output.WritePackedUInt64Array(34, repeatedUint64_); - output.WritePackedSInt32Array(35, repeatedSint32_); - output.WritePackedSInt64Array(36, repeatedSint64_); - output.WritePackedFixed32Array(37, repeatedFixed32_); - output.WritePackedFixed64Array(38, repeatedFixed64_); - output.WritePackedSFixed32Array(39, repeatedSfixed32_); - output.WritePackedSFixed64Array(40, repeatedSfixed64_); - output.WritePackedFloatArray(41, repeatedFloat_); - output.WritePackedDoubleArray(42, repeatedDouble_); - output.WritePackedBoolArray(43, repeatedBool_); - output.WriteStringArray(44, repeatedString_); - output.WriteBytesArray(45, repeatedBytes_); - output.WriteMessageArray(48, repeatedNestedMessage_); - output.WriteMessageArray(49, repeatedForeignMessage_); - output.WriteMessageArray(50, repeatedImportMessage_); - output.WritePackedEnumArray(51, repeatedNestedEnum_); - output.WritePackedEnumArray(52, repeatedForeignEnum_); - output.WritePackedEnumArray(53, repeatedImportEnum_); - output.WriteMessageArray(54, repeatedPublicImportMessage_); + if (repeatedInt32_.Count > 0) { + output.WritePackedInt32Array(31, repeatedInt32_); + } + if (repeatedInt64_.Count > 0) { + output.WritePackedInt64Array(32, repeatedInt64_); + } + if (repeatedUint32_.Count > 0) { + output.WritePackedUInt32Array(33, repeatedUint32_); + } + if (repeatedUint64_.Count > 0) { + output.WritePackedUInt64Array(34, repeatedUint64_); + } + if (repeatedSint32_.Count > 0) { + output.WritePackedSInt32Array(35, repeatedSint32_); + } + if (repeatedSint64_.Count > 0) { + output.WritePackedSInt64Array(36, repeatedSint64_); + } + if (repeatedFixed32_.Count > 0) { + output.WritePackedFixed32Array(37, repeatedFixed32_); + } + if (repeatedFixed64_.Count > 0) { + output.WritePackedFixed64Array(38, repeatedFixed64_); + } + if (repeatedSfixed32_.Count > 0) { + output.WritePackedSFixed32Array(39, repeatedSfixed32_); + } + if (repeatedSfixed64_.Count > 0) { + output.WritePackedSFixed64Array(40, repeatedSfixed64_); + } + if (repeatedFloat_.Count > 0) { + output.WritePackedFloatArray(41, repeatedFloat_); + } + if (repeatedDouble_.Count > 0) { + output.WritePackedDoubleArray(42, repeatedDouble_); + } + if (repeatedBool_.Count > 0) { + output.WritePackedBoolArray(43, repeatedBool_); + } + if (repeatedString_.Count > 0) { + output.WriteStringArray(44, repeatedString_); + } + if (repeatedBytes_.Count > 0) { + output.WriteBytesArray(45, repeatedBytes_); + } + if (repeatedNestedMessage_.Count > 0) { + output.WriteMessageArray(48, repeatedNestedMessage_); + } + if (repeatedForeignMessage_.Count > 0) { + output.WriteMessageArray(49, repeatedForeignMessage_); + } + if (repeatedImportMessage_.Count > 0) { + output.WriteMessageArray(50, repeatedImportMessage_); + } + if (repeatedNestedEnum_.Count > 0) { + output.WritePackedEnumArray(51, repeatedNestedEnum_); + } + if (repeatedForeignEnum_.Count > 0) { + output.WritePackedEnumArray(52, repeatedForeignEnum_); + } + if (repeatedImportEnum_.Count > 0) { + output.WritePackedEnumArray(53, repeatedImportEnum_); + } + if (repeatedPublicImportMessage_.Count > 0) { + output.WriteMessageArray(54, repeatedPublicImportMessage_); + } if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { output.WriteUInt32(111, OneofUint32); } @@ -1032,10 +1076,10 @@ namespace Google.Protobuf.TestProtos { if (SingleBool != false) { size += pb::CodedOutputStream.ComputeBoolSize(13, SingleBool); } - if (SingleString != "") { + if (SingleString.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(14, SingleString); } - if (SingleBytes != pb::ByteString.Empty) { + if (SingleBytes.Length != 0) { size += pb::CodedOutputStream.ComputeBytesSize(15, SingleBytes); } if (singleNestedMessage_ != null) { @@ -1059,123 +1103,97 @@ namespace Google.Protobuf.TestProtos { if (singlePublicImportMessage_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(26, SinglePublicImportMessage); } - { + if (repeatedInt32_.Count > 0) { int dataSize = 0; foreach (int element in repeatedInt32_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); } size += dataSize; - if (repeatedInt32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedInt64_.Count > 0) { int dataSize = 0; foreach (long element in repeatedInt64_) { dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); } size += dataSize; - if (repeatedInt64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedUint32_.Count > 0) { int dataSize = 0; foreach (uint element in repeatedUint32_) { dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); } size += dataSize; - if (repeatedUint32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedUint64_.Count > 0) { int dataSize = 0; foreach (ulong element in repeatedUint64_) { dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); } size += dataSize; - if (repeatedUint64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedSint32_.Count > 0) { int dataSize = 0; foreach (int element in repeatedSint32_) { dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); } size += dataSize; - if (repeatedSint32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedSint64_.Count > 0) { int dataSize = 0; foreach (long element in repeatedSint64_) { dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); } size += dataSize; - if (repeatedSint64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedFixed32_.Count > 0) { int dataSize = 0; dataSize = 4 * repeatedFixed32_.Count; size += dataSize; - if (repeatedFixed32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedFixed64_.Count > 0) { int dataSize = 0; dataSize = 8 * repeatedFixed64_.Count; size += dataSize; - if (repeatedFixed64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedSfixed32_.Count > 0) { int dataSize = 0; dataSize = 4 * repeatedSfixed32_.Count; size += dataSize; - if (repeatedSfixed32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedSfixed64_.Count > 0) { int dataSize = 0; dataSize = 8 * repeatedSfixed64_.Count; size += dataSize; - if (repeatedSfixed64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedFloat_.Count > 0) { int dataSize = 0; dataSize = 4 * repeatedFloat_.Count; size += dataSize; - if (repeatedFloat_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedDouble_.Count > 0) { int dataSize = 0; dataSize = 8 * repeatedDouble_.Count; size += dataSize; - if (repeatedDouble_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedBool_.Count > 0) { int dataSize = 0; dataSize = 1 * repeatedBool_.Count; size += dataSize; - if (repeatedBool_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedString_.Count > 0) { int dataSize = 0; foreach (string element in repeatedString_) { dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); @@ -1183,7 +1201,7 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * repeatedString_.Count; } - { + if (repeatedBytes_.Count > 0) { int dataSize = 0; foreach (pb::ByteString element in repeatedBytes_) { dataSize += pb::CodedOutputStream.ComputeBytesSizeNoTag(element); @@ -1191,50 +1209,52 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * repeatedBytes_.Count; } - foreach (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage element in repeatedNestedMessage_) { - size += pb::CodedOutputStream.ComputeMessageSize(48, element); - } - foreach (global::Google.Protobuf.TestProtos.ForeignMessage element in repeatedForeignMessage_) { - size += pb::CodedOutputStream.ComputeMessageSize(49, element); - } - foreach (global::Google.Protobuf.TestProtos.ImportMessage element in repeatedImportMessage_) { - size += pb::CodedOutputStream.ComputeMessageSize(50, element); - } - { - int dataSize = 0; - if (repeatedNestedEnum_.Count > 0) { - foreach (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum element in repeatedNestedEnum_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 2; - size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + if (repeatedNestedMessage_.Count > 0) { + foreach (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage element in repeatedNestedMessage_) { + size += pb::CodedOutputStream.ComputeMessageSize(48, element); } } - { - int dataSize = 0; - if (repeatedForeignEnum_.Count > 0) { - foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in repeatedForeignEnum_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 2; - size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + if (repeatedForeignMessage_.Count > 0) { + foreach (global::Google.Protobuf.TestProtos.ForeignMessage element in repeatedForeignMessage_) { + size += pb::CodedOutputStream.ComputeMessageSize(49, element); } } - { - int dataSize = 0; - if (repeatedImportEnum_.Count > 0) { - foreach (global::Google.Protobuf.TestProtos.ImportEnum element in repeatedImportEnum_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 2; - size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + if (repeatedImportMessage_.Count > 0) { + foreach (global::Google.Protobuf.TestProtos.ImportMessage element in repeatedImportMessage_) { + size += pb::CodedOutputStream.ComputeMessageSize(50, element); } } - foreach (global::Google.Protobuf.TestProtos.PublicImportMessage element in repeatedPublicImportMessage_) { - size += pb::CodedOutputStream.ComputeMessageSize(54, element); + if (repeatedNestedEnum_.Count > 0) { + int dataSize = 0; + foreach (global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedEnum element in repeatedNestedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + if (repeatedForeignEnum_.Count > 0) { + int dataSize = 0; + foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in repeatedForeignEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + if (repeatedImportEnum_.Count > 0) { + int dataSize = 0; + foreach (global::Google.Protobuf.TestProtos.ImportEnum element in repeatedImportEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + if (repeatedPublicImportMessage_.Count > 0) { + foreach (global::Google.Protobuf.TestProtos.PublicImportMessage element in repeatedPublicImportMessage_) { + size += pb::CodedOutputStream.ComputeMessageSize(54, element); + } } if (oneofFieldCase_ == OneofFieldOneofCase.OneofUint32) { size += pb::CodedOutputStream.ComputeUInt32Size(111, OneofUint32); @@ -1293,10 +1313,10 @@ namespace Google.Protobuf.TestProtos { if (other.SingleBool != false) { SingleBool = other.SingleBool; } - if (other.SingleString != "") { + if (other.SingleString.Length != 0) { SingleString = other.SingleString; } - if (other.SingleBytes != pb::ByteString.Empty) { + if (other.SingleBytes.Length != 0) { SingleBytes = other.SingleBytes; } if (other.singleNestedMessage_ != null) { @@ -1383,63 +1403,63 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - singleInt32_ = input.ReadInt32(); + SingleInt32 = input.ReadInt32(); break; } case 16: { - singleInt64_ = input.ReadInt64(); + SingleInt64 = input.ReadInt64(); break; } case 24: { - singleUint32_ = input.ReadUInt32(); + SingleUint32 = input.ReadUInt32(); break; } case 32: { - singleUint64_ = input.ReadUInt64(); + SingleUint64 = input.ReadUInt64(); break; } case 40: { - singleSint32_ = input.ReadSInt32(); + SingleSint32 = input.ReadSInt32(); break; } case 48: { - singleSint64_ = input.ReadSInt64(); + SingleSint64 = input.ReadSInt64(); break; } case 61: { - singleFixed32_ = input.ReadFixed32(); + SingleFixed32 = input.ReadFixed32(); break; } case 65: { - singleFixed64_ = input.ReadFixed64(); + SingleFixed64 = input.ReadFixed64(); break; } case 77: { - singleSfixed32_ = input.ReadSFixed32(); + SingleSfixed32 = input.ReadSFixed32(); break; } case 81: { - singleSfixed64_ = input.ReadSFixed64(); + SingleSfixed64 = input.ReadSFixed64(); break; } case 93: { - singleFloat_ = input.ReadFloat(); + SingleFloat = input.ReadFloat(); break; } case 97: { - singleDouble_ = input.ReadDouble(); + SingleDouble = input.ReadDouble(); break; } case 104: { - singleBool_ = input.ReadBool(); + SingleBool = input.ReadBool(); break; } case 114: { - singleString_ = input.ReadString(); + SingleString = input.ReadString(); break; } case 122: { - singleBytes_ = input.ReadBytes(); + SingleBytes = input.ReadBytes(); break; } case 146: { @@ -1587,9 +1607,8 @@ namespace Google.Protobuf.TestProtos { break; } case 888: { - oneofField_ = input.ReadUInt32() - ;oneofFieldCase_ = OneofFieldOneofCase.OneofUint32; - break; + OneofUint32 = input.ReadUInt32() + ;break; } case 898: { global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage subBuilder = new global::Google.Protobuf.TestProtos.TestAllTypes.Types.NestedMessage(); @@ -1601,14 +1620,12 @@ namespace Google.Protobuf.TestProtos { break; } case 906: { - oneofField_ = input.ReadString() - ;oneofFieldCase_ = OneofFieldOneofCase.OneofString; - break; + OneofString = input.ReadString() + ;break; } case 914: { - oneofField_ = input.ReadBytes() - ;oneofFieldCase_ = OneofFieldOneofCase.OneofBytes; - break; + OneofBytes = input.ReadBytes() + ;break; } } } @@ -1707,7 +1724,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - bb_ = input.ReadInt32(); + Bb = input.ReadInt32(); break; } } @@ -1790,7 +1807,9 @@ namespace Google.Protobuf.TestProtos { if (payload_ != null) { output.WriteMessage(2, Payload); } - output.WriteMessageArray(3, repeatedChild_); + if (repeatedChild_.Count > 0) { + output.WriteMessageArray(3, repeatedChild_); + } } public int CalculateSize() { @@ -1801,8 +1820,10 @@ namespace Google.Protobuf.TestProtos { if (payload_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(2, Payload); } - foreach (global::Google.Protobuf.TestProtos.NestedTestAllTypes element in repeatedChild_) { - size += pb::CodedOutputStream.ComputeMessageSize(3, element); + if (repeatedChild_.Count > 0) { + foreach (global::Google.Protobuf.TestProtos.NestedTestAllTypes element in repeatedChild_) { + size += pb::CodedOutputStream.ComputeMessageSize(3, element); + } } return size; } @@ -1943,7 +1964,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - deprecatedInt32_ = input.ReadInt32(); + DeprecatedInt32 = input.ReadInt32(); break; } } @@ -2034,7 +2055,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - c_ = input.ReadInt32(); + C = input.ReadInt32(); break; } } @@ -2307,11 +2328,11 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - a_ = input.ReadInt32(); + A = input.ReadInt32(); break; } case 2147483640: { - bb_ = input.ReadInt32(); + Bb = input.ReadInt32(); break; } } @@ -2429,7 +2450,7 @@ namespace Google.Protobuf.TestProtos { break; } case 16: { - i_ = input.ReadInt32(); + I = input.ReadInt32(); break; } } @@ -2642,7 +2663,7 @@ namespace Google.Protobuf.TestProtos { break; } case 16: { - optionalInt32_ = input.ReadInt32(); + OptionalInt32 = input.ReadInt32(); break; } } @@ -2749,7 +2770,7 @@ namespace Google.Protobuf.TestProtos { public override int GetHashCode() { int hash = 0; if (PrimitiveField != 0) hash ^= PrimitiveField.GetHashCode(); - if (StringField != "") hash ^= StringField.GetHashCode(); + if (StringField.Length != 0) hash ^= StringField.GetHashCode(); if (EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) hash ^= EnumField.GetHashCode(); if (messageField_ != null) hash ^= MessageField.GetHashCode(); hash ^= repeatedPrimitiveField_.GetHashCode(); @@ -2763,7 +2784,7 @@ namespace Google.Protobuf.TestProtos { if (PrimitiveField != 0) { output.WriteInt32(1, PrimitiveField); } - if (StringField != "") { + if (StringField.Length != 0) { output.WriteString(2, StringField); } if (EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) { @@ -2772,10 +2793,18 @@ namespace Google.Protobuf.TestProtos { if (messageField_ != null) { output.WriteMessage(4, MessageField); } - output.WritePackedInt32Array(7, repeatedPrimitiveField_); - output.WriteStringArray(8, repeatedStringField_); - output.WritePackedEnumArray(9, repeatedEnumField_); - output.WriteMessageArray(10, repeatedMessageField_); + if (repeatedPrimitiveField_.Count > 0) { + output.WritePackedInt32Array(7, repeatedPrimitiveField_); + } + if (repeatedStringField_.Count > 0) { + output.WriteStringArray(8, repeatedStringField_); + } + if (repeatedEnumField_.Count > 0) { + output.WritePackedEnumArray(9, repeatedEnumField_); + } + if (repeatedMessageField_.Count > 0) { + output.WriteMessageArray(10, repeatedMessageField_); + } } public int CalculateSize() { @@ -2783,7 +2812,7 @@ namespace Google.Protobuf.TestProtos { if (PrimitiveField != 0) { size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveField); } - if (StringField != "") { + if (StringField.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(2, StringField); } if (EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) { @@ -2792,17 +2821,15 @@ namespace Google.Protobuf.TestProtos { if (messageField_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(4, MessageField); } - { + if (repeatedPrimitiveField_.Count > 0) { int dataSize = 0; foreach (int element in repeatedPrimitiveField_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); } size += dataSize; - if (repeatedPrimitiveField_.Count != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedStringField_.Count > 0) { int dataSize = 0; foreach (string element in repeatedStringField_) { dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); @@ -2810,19 +2837,19 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 1 * repeatedStringField_.Count; } - { + if (repeatedEnumField_.Count > 0) { int dataSize = 0; - if (repeatedEnumField_.Count > 0) { - foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in repeatedEnumField_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 1; - size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in repeatedEnumField_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); } + size += dataSize; + size += 1; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); } - foreach (global::Google.Protobuf.TestProtos.ForeignMessage element in repeatedMessageField_) { - size += pb::CodedOutputStream.ComputeMessageSize(10, element); + if (repeatedMessageField_.Count > 0) { + foreach (global::Google.Protobuf.TestProtos.ForeignMessage element in repeatedMessageField_) { + size += pb::CodedOutputStream.ComputeMessageSize(10, element); + } } return size; } @@ -2833,7 +2860,7 @@ namespace Google.Protobuf.TestProtos { if (other.PrimitiveField != 0) { PrimitiveField = other.PrimitiveField; } - if (other.StringField != "") { + if (other.StringField.Length != 0) { StringField = other.StringField; } if (other.EnumField != global::Google.Protobuf.TestProtos.ForeignEnum.FOREIGN_UNSPECIFIED) { @@ -2863,11 +2890,11 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - primitiveField_ = input.ReadInt32(); + PrimitiveField = input.ReadInt32(); break; } case 18: { - stringField_ = input.ReadString(); + StringField = input.ReadString(); break; } case 24: { @@ -2974,7 +3001,7 @@ namespace Google.Protobuf.TestProtos { public override int GetHashCode() { int hash = 0; - if (MyString != "") hash ^= MyString.GetHashCode(); + if (MyString.Length != 0) hash ^= MyString.GetHashCode(); if (MyInt != 0L) hash ^= MyInt.GetHashCode(); if (MyFloat != 0F) hash ^= MyFloat.GetHashCode(); if (singleNestedMessage_ != null) hash ^= SingleNestedMessage.GetHashCode(); @@ -2985,7 +3012,7 @@ namespace Google.Protobuf.TestProtos { if (MyInt != 0L) { output.WriteInt64(1, MyInt); } - if (MyString != "") { + if (MyString.Length != 0) { output.WriteString(11, MyString); } if (MyFloat != 0F) { @@ -2998,7 +3025,7 @@ namespace Google.Protobuf.TestProtos { public int CalculateSize() { int size = 0; - if (MyString != "") { + if (MyString.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(11, MyString); } if (MyInt != 0L) { @@ -3016,7 +3043,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } - if (other.MyString != "") { + if (other.MyString.Length != 0) { MyString = other.MyString; } if (other.MyInt != 0L) { @@ -3045,15 +3072,15 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - myInt_ = input.ReadInt64(); + MyInt = input.ReadInt64(); break; } case 90: { - myString_ = input.ReadString(); + MyString = input.ReadString(); break; } case 813: { - myFloat_ = input.ReadFloat(); + MyFloat = input.ReadFloat(); break; } case 1602: { @@ -3171,11 +3198,11 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - bb_ = input.ReadInt32(); + Bb = input.ReadInt32(); break; } case 16: { - oo_ = input.ReadInt64(); + Oo = input.ReadInt64(); break; } } @@ -3324,19 +3351,19 @@ namespace Google.Protobuf.TestProtos { public override int GetHashCode() { int hash = 0; - if (Data != "") hash ^= Data.GetHashCode(); + if (Data.Length != 0) hash ^= Data.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Data != "") { + if (Data.Length != 0) { output.WriteString(1, Data); } } public int CalculateSize() { int size = 0; - if (Data != "") { + if (Data.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Data); } return size; @@ -3345,7 +3372,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } - if (other.Data != "") { + if (other.Data.Length != 0) { Data = other.Data; } } @@ -3362,7 +3389,7 @@ namespace Google.Protobuf.TestProtos { } break; case 10: { - data_ = input.ReadString(); + Data = input.ReadString(); break; } } @@ -3418,12 +3445,14 @@ namespace Google.Protobuf.TestProtos { } public void WriteTo(pb::CodedOutputStream output) { - output.WriteStringArray(1, data_); + if (data_.Count > 0) { + output.WriteStringArray(1, data_); + } } public int CalculateSize() { int size = 0; - { + if (data_.Count > 0) { int dataSize = 0; foreach (string element in data_) { dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); @@ -3505,19 +3534,19 @@ namespace Google.Protobuf.TestProtos { public override int GetHashCode() { int hash = 0; - if (Data != pb::ByteString.Empty) hash ^= Data.GetHashCode(); + if (Data.Length != 0) hash ^= Data.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Data != pb::ByteString.Empty) { + if (Data.Length != 0) { output.WriteBytes(1, Data); } } public int CalculateSize() { int size = 0; - if (Data != pb::ByteString.Empty) { + if (Data.Length != 0) { size += pb::CodedOutputStream.ComputeBytesSize(1, Data); } return size; @@ -3526,7 +3555,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } - if (other.Data != pb::ByteString.Empty) { + if (other.Data.Length != 0) { Data = other.Data; } } @@ -3543,7 +3572,7 @@ namespace Google.Protobuf.TestProtos { } break; case 10: { - data_ = input.ReadBytes(); + Data = input.ReadBytes(); break; } } @@ -3596,19 +3625,19 @@ namespace Google.Protobuf.TestProtos { public override int GetHashCode() { int hash = 0; - if (Data != pb::ByteString.Empty) hash ^= Data.GetHashCode(); + if (Data.Length != 0) hash ^= Data.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Data != pb::ByteString.Empty) { + if (Data.Length != 0) { output.WriteBytes(1, Data); } } public int CalculateSize() { int size = 0; - if (Data != pb::ByteString.Empty) { + if (Data.Length != 0) { size += pb::CodedOutputStream.ComputeBytesSize(1, Data); } return size; @@ -3617,7 +3646,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } - if (other.Data != pb::ByteString.Empty) { + if (other.Data.Length != 0) { Data = other.Data; } } @@ -3634,7 +3663,7 @@ namespace Google.Protobuf.TestProtos { } break; case 10: { - data_ = input.ReadBytes(); + Data = input.ReadBytes(); break; } } @@ -3725,7 +3754,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - data_ = input.ReadInt32(); + Data = input.ReadInt32(); break; } } @@ -3816,7 +3845,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - data_ = input.ReadUInt32(); + Data = input.ReadUInt32(); break; } } @@ -3907,7 +3936,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - data_ = input.ReadInt64(); + Data = input.ReadInt64(); break; } } @@ -3998,7 +4027,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - data_ = input.ReadUInt64(); + Data = input.ReadUInt64(); break; } } @@ -4089,7 +4118,7 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - data_ = input.ReadBool(); + Data = input.ReadBool(); break; } } @@ -4131,7 +4160,7 @@ namespace Google.Protobuf.TestProtos { get { return fooCase_ == FooOneofCase.FooString ? (string) foo_ : ""; } set { foo_ = value ?? ""; - fooCase_ = value == null ? FooOneofCase.None : FooOneofCase.FooString; + fooCase_ = FooOneofCase.FooString; } } @@ -4240,14 +4269,12 @@ namespace Google.Protobuf.TestProtos { } break; case 8: { - foo_ = input.ReadInt32() - ;fooCase_ = FooOneofCase.FooInt; - break; + FooInt = input.ReadInt32() + ;break; } case 18: { - foo_ = input.ReadString() - ;fooCase_ = FooOneofCase.FooString; - break; + FooString = input.ReadString() + ;break; } case 26: { global::Google.Protobuf.TestProtos.TestAllTypes subBuilder = new global::Google.Protobuf.TestProtos.TestAllTypes(); @@ -4415,150 +4442,150 @@ namespace Google.Protobuf.TestProtos { } public void WriteTo(pb::CodedOutputStream output) { - output.WritePackedInt32Array(90, packedInt32_); - output.WritePackedInt64Array(91, packedInt64_); - output.WritePackedUInt32Array(92, packedUint32_); - output.WritePackedUInt64Array(93, packedUint64_); - output.WritePackedSInt32Array(94, packedSint32_); - output.WritePackedSInt64Array(95, packedSint64_); - output.WritePackedFixed32Array(96, packedFixed32_); - output.WritePackedFixed64Array(97, packedFixed64_); - output.WritePackedSFixed32Array(98, packedSfixed32_); - output.WritePackedSFixed64Array(99, packedSfixed64_); - output.WritePackedFloatArray(100, packedFloat_); - output.WritePackedDoubleArray(101, packedDouble_); - output.WritePackedBoolArray(102, packedBool_); - output.WritePackedEnumArray(103, packedEnum_); + if (packedInt32_.Count > 0) { + output.WritePackedInt32Array(90, packedInt32_); + } + if (packedInt64_.Count > 0) { + output.WritePackedInt64Array(91, packedInt64_); + } + if (packedUint32_.Count > 0) { + output.WritePackedUInt32Array(92, packedUint32_); + } + if (packedUint64_.Count > 0) { + output.WritePackedUInt64Array(93, packedUint64_); + } + if (packedSint32_.Count > 0) { + output.WritePackedSInt32Array(94, packedSint32_); + } + if (packedSint64_.Count > 0) { + output.WritePackedSInt64Array(95, packedSint64_); + } + if (packedFixed32_.Count > 0) { + output.WritePackedFixed32Array(96, packedFixed32_); + } + if (packedFixed64_.Count > 0) { + output.WritePackedFixed64Array(97, packedFixed64_); + } + if (packedSfixed32_.Count > 0) { + output.WritePackedSFixed32Array(98, packedSfixed32_); + } + if (packedSfixed64_.Count > 0) { + output.WritePackedSFixed64Array(99, packedSfixed64_); + } + if (packedFloat_.Count > 0) { + output.WritePackedFloatArray(100, packedFloat_); + } + if (packedDouble_.Count > 0) { + output.WritePackedDoubleArray(101, packedDouble_); + } + if (packedBool_.Count > 0) { + output.WritePackedBoolArray(102, packedBool_); + } + if (packedEnum_.Count > 0) { + output.WritePackedEnumArray(103, packedEnum_); + } } public int CalculateSize() { int size = 0; - { + if (packedInt32_.Count > 0) { int dataSize = 0; foreach (int element in packedInt32_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); } size += dataSize; - if (packedInt32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedInt64_.Count > 0) { int dataSize = 0; foreach (long element in packedInt64_) { dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); } size += dataSize; - if (packedInt64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedUint32_.Count > 0) { int dataSize = 0; foreach (uint element in packedUint32_) { dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); } size += dataSize; - if (packedUint32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedUint64_.Count > 0) { int dataSize = 0; foreach (ulong element in packedUint64_) { dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); } size += dataSize; - if (packedUint64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedSint32_.Count > 0) { int dataSize = 0; foreach (int element in packedSint32_) { dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); } size += dataSize; - if (packedSint32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedSint64_.Count > 0) { int dataSize = 0; foreach (long element in packedSint64_) { dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); } size += dataSize; - if (packedSint64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedFixed32_.Count > 0) { int dataSize = 0; dataSize = 4 * packedFixed32_.Count; size += dataSize; - if (packedFixed32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedFixed64_.Count > 0) { int dataSize = 0; dataSize = 8 * packedFixed64_.Count; size += dataSize; - if (packedFixed64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedSfixed32_.Count > 0) { int dataSize = 0; dataSize = 4 * packedSfixed32_.Count; size += dataSize; - if (packedSfixed32_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedSfixed64_.Count > 0) { int dataSize = 0; dataSize = 8 * packedSfixed64_.Count; size += dataSize; - if (packedSfixed64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedFloat_.Count > 0) { int dataSize = 0; dataSize = 4 * packedFloat_.Count; size += dataSize; - if (packedFloat_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedDouble_.Count > 0) { int dataSize = 0; dataSize = 8 * packedDouble_.Count; size += dataSize; - if (packedDouble_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedBool_.Count > 0) { int dataSize = 0; dataSize = 1 * packedBool_.Count; size += dataSize; - if (packedBool_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (packedEnum_.Count > 0) { int dataSize = 0; - if (packedEnum_.Count > 0) { - foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in packedEnum_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 2; - size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in packedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); } return size; } @@ -4820,25 +4847,53 @@ namespace Google.Protobuf.TestProtos { } public void WriteTo(pb::CodedOutputStream output) { - output.WriteInt32Array(90, unpackedInt32_); - output.WriteInt64Array(91, unpackedInt64_); - output.WriteUInt32Array(92, unpackedUint32_); - output.WriteUInt64Array(93, unpackedUint64_); - output.WriteSInt32Array(94, unpackedSint32_); - output.WriteSInt64Array(95, unpackedSint64_); - output.WriteFixed32Array(96, unpackedFixed32_); - output.WriteFixed64Array(97, unpackedFixed64_); - output.WriteSFixed32Array(98, unpackedSfixed32_); - output.WriteSFixed64Array(99, unpackedSfixed64_); - output.WriteFloatArray(100, unpackedFloat_); - output.WriteDoubleArray(101, unpackedDouble_); - output.WriteBoolArray(102, unpackedBool_); - output.WriteEnumArray(103, unpackedEnum_); + if (unpackedInt32_.Count > 0) { + output.WriteInt32Array(90, unpackedInt32_); + } + if (unpackedInt64_.Count > 0) { + output.WriteInt64Array(91, unpackedInt64_); + } + if (unpackedUint32_.Count > 0) { + output.WriteUInt32Array(92, unpackedUint32_); + } + if (unpackedUint64_.Count > 0) { + output.WriteUInt64Array(93, unpackedUint64_); + } + if (unpackedSint32_.Count > 0) { + output.WriteSInt32Array(94, unpackedSint32_); + } + if (unpackedSint64_.Count > 0) { + output.WriteSInt64Array(95, unpackedSint64_); + } + if (unpackedFixed32_.Count > 0) { + output.WriteFixed32Array(96, unpackedFixed32_); + } + if (unpackedFixed64_.Count > 0) { + output.WriteFixed64Array(97, unpackedFixed64_); + } + if (unpackedSfixed32_.Count > 0) { + output.WriteSFixed32Array(98, unpackedSfixed32_); + } + if (unpackedSfixed64_.Count > 0) { + output.WriteSFixed64Array(99, unpackedSfixed64_); + } + if (unpackedFloat_.Count > 0) { + output.WriteFloatArray(100, unpackedFloat_); + } + if (unpackedDouble_.Count > 0) { + output.WriteDoubleArray(101, unpackedDouble_); + } + if (unpackedBool_.Count > 0) { + output.WriteBoolArray(102, unpackedBool_); + } + if (unpackedEnum_.Count > 0) { + output.WriteEnumArray(103, unpackedEnum_); + } } public int CalculateSize() { int size = 0; - { + if (unpackedInt32_.Count > 0) { int dataSize = 0; foreach (int element in unpackedInt32_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); @@ -4846,7 +4901,7 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * unpackedInt32_.Count; } - { + if (unpackedInt64_.Count > 0) { int dataSize = 0; foreach (long element in unpackedInt64_) { dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); @@ -4854,7 +4909,7 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * unpackedInt64_.Count; } - { + if (unpackedUint32_.Count > 0) { int dataSize = 0; foreach (uint element in unpackedUint32_) { dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); @@ -4862,7 +4917,7 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * unpackedUint32_.Count; } - { + if (unpackedUint64_.Count > 0) { int dataSize = 0; foreach (ulong element in unpackedUint64_) { dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); @@ -4870,7 +4925,7 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * unpackedUint64_.Count; } - { + if (unpackedSint32_.Count > 0) { int dataSize = 0; foreach (int element in unpackedSint32_) { dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); @@ -4878,7 +4933,7 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * unpackedSint32_.Count; } - { + if (unpackedSint64_.Count > 0) { int dataSize = 0; foreach (long element in unpackedSint64_) { dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); @@ -4886,57 +4941,55 @@ namespace Google.Protobuf.TestProtos { size += dataSize; size += 2 * unpackedSint64_.Count; } - { + if (unpackedFixed32_.Count > 0) { int dataSize = 0; dataSize = 4 * unpackedFixed32_.Count; size += dataSize; size += 2 * unpackedFixed32_.Count; } - { + if (unpackedFixed64_.Count > 0) { int dataSize = 0; dataSize = 8 * unpackedFixed64_.Count; size += dataSize; size += 2 * unpackedFixed64_.Count; } - { + if (unpackedSfixed32_.Count > 0) { int dataSize = 0; dataSize = 4 * unpackedSfixed32_.Count; size += dataSize; size += 2 * unpackedSfixed32_.Count; } - { + if (unpackedSfixed64_.Count > 0) { int dataSize = 0; dataSize = 8 * unpackedSfixed64_.Count; size += dataSize; size += 2 * unpackedSfixed64_.Count; } - { + if (unpackedFloat_.Count > 0) { int dataSize = 0; dataSize = 4 * unpackedFloat_.Count; size += dataSize; size += 2 * unpackedFloat_.Count; } - { + if (unpackedDouble_.Count > 0) { int dataSize = 0; dataSize = 8 * unpackedDouble_.Count; size += dataSize; size += 2 * unpackedDouble_.Count; } - { + if (unpackedBool_.Count > 0) { int dataSize = 0; dataSize = 1 * unpackedBool_.Count; size += dataSize; size += 2 * unpackedBool_.Count; } - { + if (unpackedEnum_.Count > 0) { int dataSize = 0; - if (unpackedEnum_.Count > 0) { - foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in unpackedEnum_) { - dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); - } - size += dataSize; - size += 2 * unpackedEnum_.Count; + foreach (global::Google.Protobuf.TestProtos.ForeignEnum element in unpackedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); } + size += dataSize; + size += 2 * unpackedEnum_.Count; } return size; } @@ -5134,69 +5187,69 @@ namespace Google.Protobuf.TestProtos { } public void WriteTo(pb::CodedOutputStream output) { - output.WritePackedFixed32Array(12, repeatedFixed32_); - output.WritePackedInt32Array(13, repeatedInt32_); - output.WritePackedFixed64Array(2046, repeatedFixed64_); - output.WritePackedInt64Array(2047, repeatedInt64_); - output.WritePackedFloatArray(262142, repeatedFloat_); - output.WritePackedUInt64Array(262143, repeatedUint64_); + if (repeatedFixed32_.Count > 0) { + output.WritePackedFixed32Array(12, repeatedFixed32_); + } + if (repeatedInt32_.Count > 0) { + output.WritePackedInt32Array(13, repeatedInt32_); + } + if (repeatedFixed64_.Count > 0) { + output.WritePackedFixed64Array(2046, repeatedFixed64_); + } + if (repeatedInt64_.Count > 0) { + output.WritePackedInt64Array(2047, repeatedInt64_); + } + if (repeatedFloat_.Count > 0) { + output.WritePackedFloatArray(262142, repeatedFloat_); + } + if (repeatedUint64_.Count > 0) { + output.WritePackedUInt64Array(262143, repeatedUint64_); + } } public int CalculateSize() { int size = 0; - { + if (repeatedFixed32_.Count > 0) { int dataSize = 0; dataSize = 4 * repeatedFixed32_.Count; size += dataSize; - if (repeatedFixed32_.Count != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedInt32_.Count > 0) { int dataSize = 0; foreach (int element in repeatedInt32_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); } size += dataSize; - if (repeatedInt32_.Count != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedFixed64_.Count > 0) { int dataSize = 0; dataSize = 8 * repeatedFixed64_.Count; size += dataSize; - if (repeatedFixed64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedInt64_.Count > 0) { int dataSize = 0; foreach (long element in repeatedInt64_) { dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); } size += dataSize; - if (repeatedInt64_.Count != 0) { - size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedFloat_.Count > 0) { int dataSize = 0; dataSize = 4 * repeatedFloat_.Count; size += dataSize; - if (repeatedFloat_.Count != 0) { - size += 3 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 3 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (repeatedUint64_.Count > 0) { int dataSize = 0; foreach (ulong element in repeatedUint64_) { dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); } size += dataSize; - if (repeatedUint64_.Count != 0) { - size += 3 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 3 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } return size; } @@ -5303,19 +5356,19 @@ namespace Google.Protobuf.TestProtos { public override int GetHashCode() { int hash = 0; - if (A != "") hash ^= A.GetHashCode(); + if (A.Length != 0) hash ^= A.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (A != "") { + if (A.Length != 0) { output.WriteString(1, A); } } public int CalculateSize() { int size = 0; - if (A != "") { + if (A.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, A); } return size; @@ -5324,7 +5377,7 @@ namespace Google.Protobuf.TestProtos { if (other == null) { return; } - if (other.A != "") { + if (other.A.Length != 0) { A = other.A; } } @@ -5341,7 +5394,7 @@ namespace Google.Protobuf.TestProtos { } break; case 10: { - a_ = input.ReadString(); + A = input.ReadString(); break; } } diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs index f4af4e2c1..9a10d6ae4 100644 --- a/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs +++ b/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -324,13 +324,17 @@ namespace Google.Protobuf.DescriptorProtos { } public void WriteTo(pb::CodedOutputStream output) { - output.WriteMessageArray(1, file_); + if (file_.Count > 0) { + output.WriteMessageArray(1, file_); + } } public int CalculateSize() { int size = 0; - foreach (global::Google.Protobuf.DescriptorProtos.FileDescriptorProto element in file_) { - size += pb::CodedOutputStream.ComputeMessageSize(1, element); + if (file_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.FileDescriptorProto element in file_) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } } return size; } @@ -487,8 +491,8 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); - if (Package != "") hash ^= Package.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (Package.Length != 0) hash ^= Package.GetHashCode(); hash ^= dependency_.GetHashCode(); hash ^= publicDependency_.GetHashCode(); hash ^= weakDependency_.GetHashCode(); @@ -498,44 +502,58 @@ namespace Google.Protobuf.DescriptorProtos { hash ^= extension_.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); if (sourceCodeInfo_ != null) hash ^= SourceCodeInfo.GetHashCode(); - if (Syntax != "") hash ^= Syntax.GetHashCode(); + if (Syntax.Length != 0) hash ^= Syntax.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } - if (Package != "") { + if (Package.Length != 0) { output.WriteString(2, Package); } - output.WriteStringArray(3, dependency_); - output.WriteMessageArray(4, messageType_); - output.WriteMessageArray(5, enumType_); - output.WriteMessageArray(6, service_); - output.WriteMessageArray(7, extension_); + if (dependency_.Count > 0) { + output.WriteStringArray(3, dependency_); + } + if (messageType_.Count > 0) { + output.WriteMessageArray(4, messageType_); + } + if (enumType_.Count > 0) { + output.WriteMessageArray(5, enumType_); + } + if (service_.Count > 0) { + output.WriteMessageArray(6, service_); + } + if (extension_.Count > 0) { + output.WriteMessageArray(7, extension_); + } if (options_ != null) { output.WriteMessage(8, Options); } if (sourceCodeInfo_ != null) { output.WriteMessage(9, SourceCodeInfo); } - output.WriteInt32Array(10, publicDependency_); - output.WriteInt32Array(11, weakDependency_); - if (Syntax != "") { + if (publicDependency_.Count > 0) { + output.WriteInt32Array(10, publicDependency_); + } + if (weakDependency_.Count > 0) { + output.WriteInt32Array(11, weakDependency_); + } + if (Syntax.Length != 0) { output.WriteString(12, Syntax); } } public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } - if (Package != "") { + if (Package.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(2, Package); } - { + if (dependency_.Count > 0) { int dataSize = 0; foreach (string element in dependency_) { dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); @@ -543,7 +561,7 @@ namespace Google.Protobuf.DescriptorProtos { size += dataSize; size += 1 * dependency_.Count; } - { + if (publicDependency_.Count > 0) { int dataSize = 0; foreach (int element in publicDependency_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); @@ -551,7 +569,7 @@ namespace Google.Protobuf.DescriptorProtos { size += dataSize; size += 1 * publicDependency_.Count; } - { + if (weakDependency_.Count > 0) { int dataSize = 0; foreach (int element in weakDependency_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); @@ -559,17 +577,25 @@ namespace Google.Protobuf.DescriptorProtos { size += dataSize; size += 1 * weakDependency_.Count; } - foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto element in messageType_) { - size += pb::CodedOutputStream.ComputeMessageSize(4, element); + if (messageType_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto element in messageType_) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto element in enumType_) { - size += pb::CodedOutputStream.ComputeMessageSize(5, element); + if (enumType_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto element in enumType_) { + size += pb::CodedOutputStream.ComputeMessageSize(5, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto element in service_) { - size += pb::CodedOutputStream.ComputeMessageSize(6, element); + if (service_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.ServiceDescriptorProto element in service_) { + size += pb::CodedOutputStream.ComputeMessageSize(6, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto element in extension_) { - size += pb::CodedOutputStream.ComputeMessageSize(7, element); + if (extension_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto element in extension_) { + size += pb::CodedOutputStream.ComputeMessageSize(7, element); + } } if (options_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(8, Options); @@ -577,7 +603,7 @@ namespace Google.Protobuf.DescriptorProtos { if (sourceCodeInfo_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(9, SourceCodeInfo); } - if (Syntax != "") { + if (Syntax.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(12, Syntax); } return size; @@ -586,10 +612,10 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } - if (other.Package != "") { + if (other.Package.Length != 0) { Package = other.Package; } dependency_.Add(other.dependency_); @@ -611,7 +637,7 @@ namespace Google.Protobuf.DescriptorProtos { } SourceCodeInfo.MergeFrom(other.SourceCodeInfo); } - if (other.Syntax != "") { + if (other.Syntax.Length != 0) { Syntax = other.Syntax; } } @@ -628,11 +654,11 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 18: { - package_ = input.ReadString(); + Package = input.ReadString(); break; } case 26: { @@ -680,7 +706,7 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 98: { - syntax_ = input.ReadString(); + Syntax = input.ReadString(); break; } } @@ -796,7 +822,7 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); hash ^= field_.GetHashCode(); hash ^= extension_.GetHashCode(); hash ^= nestedType_.GetHashCode(); @@ -810,52 +836,82 @@ namespace Google.Protobuf.DescriptorProtos { } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } - output.WriteMessageArray(2, field_); - output.WriteMessageArray(3, nestedType_); - output.WriteMessageArray(4, enumType_); - output.WriteMessageArray(5, extensionRange_); - output.WriteMessageArray(6, extension_); + if (field_.Count > 0) { + output.WriteMessageArray(2, field_); + } + if (nestedType_.Count > 0) { + output.WriteMessageArray(3, nestedType_); + } + if (enumType_.Count > 0) { + output.WriteMessageArray(4, enumType_); + } + if (extensionRange_.Count > 0) { + output.WriteMessageArray(5, extensionRange_); + } + if (extension_.Count > 0) { + output.WriteMessageArray(6, extension_); + } if (options_ != null) { output.WriteMessage(7, Options); } - output.WriteMessageArray(8, oneofDecl_); - output.WriteMessageArray(9, reservedRange_); - output.WriteStringArray(10, reservedName_); + if (oneofDecl_.Count > 0) { + output.WriteMessageArray(8, oneofDecl_); + } + if (reservedRange_.Count > 0) { + output.WriteMessageArray(9, reservedRange_); + } + if (reservedName_.Count > 0) { + output.WriteStringArray(10, reservedName_); + } } public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } - foreach (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto element in field_) { - size += pb::CodedOutputStream.ComputeMessageSize(2, element); + if (field_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto element in field_) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto element in extension_) { - size += pb::CodedOutputStream.ComputeMessageSize(6, element); + if (extension_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto element in extension_) { + size += pb::CodedOutputStream.ComputeMessageSize(6, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto element in nestedType_) { - size += pb::CodedOutputStream.ComputeMessageSize(3, element); + if (nestedType_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto element in nestedType_) { + size += pb::CodedOutputStream.ComputeMessageSize(3, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto element in enumType_) { - size += pb::CodedOutputStream.ComputeMessageSize(4, element); + if (enumType_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.EnumDescriptorProto element in enumType_) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange element in extensionRange_) { - size += pb::CodedOutputStream.ComputeMessageSize(5, element); + if (extensionRange_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ExtensionRange element in extensionRange_) { + size += pb::CodedOutputStream.ComputeMessageSize(5, element); + } } - foreach (global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto element in oneofDecl_) { - size += pb::CodedOutputStream.ComputeMessageSize(8, element); + if (oneofDecl_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.OneofDescriptorProto element in oneofDecl_) { + size += pb::CodedOutputStream.ComputeMessageSize(8, element); + } } if (options_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(7, Options); } - foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange element in reservedRange_) { - size += pb::CodedOutputStream.ComputeMessageSize(9, element); + if (reservedRange_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.DescriptorProto.Types.ReservedRange element in reservedRange_) { + size += pb::CodedOutputStream.ComputeMessageSize(9, element); + } } - { + if (reservedName_.Count > 0) { int dataSize = 0; foreach (string element in reservedName_) { dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); @@ -869,7 +925,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } field_.Add(other.field_); @@ -900,7 +956,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 18: { @@ -1050,11 +1106,11 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 8: { - start_ = input.ReadInt32(); + Start = input.ReadInt32(); break; } case 16: { - end_ = input.ReadInt32(); + End = input.ReadInt32(); break; } } @@ -1164,11 +1220,11 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 8: { - start_ = input.ReadInt32(); + Start = input.ReadInt32(); break; } case 16: { - end_ = input.ReadInt32(); + End = input.ReadInt32(); break; } } @@ -1296,23 +1352,23 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Number != 0) hash ^= Number.GetHashCode(); if (Label != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL) hash ^= Label.GetHashCode(); if (Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) hash ^= Type.GetHashCode(); - if (TypeName != "") hash ^= TypeName.GetHashCode(); - if (Extendee != "") hash ^= Extendee.GetHashCode(); - if (DefaultValue != "") hash ^= DefaultValue.GetHashCode(); + if (TypeName.Length != 0) hash ^= TypeName.GetHashCode(); + if (Extendee.Length != 0) hash ^= Extendee.GetHashCode(); + if (DefaultValue.Length != 0) hash ^= DefaultValue.GetHashCode(); if (OneofIndex != 0) hash ^= OneofIndex.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } - if (Extendee != "") { + if (Extendee.Length != 0) { output.WriteString(2, Extendee); } if (Number != 0) { @@ -1324,10 +1380,10 @@ namespace Google.Protobuf.DescriptorProtos { if (Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { output.WriteEnum(5, (int) Type); } - if (TypeName != "") { + if (TypeName.Length != 0) { output.WriteString(6, TypeName); } - if (DefaultValue != "") { + if (DefaultValue.Length != 0) { output.WriteString(7, DefaultValue); } if (options_ != null) { @@ -1340,7 +1396,7 @@ namespace Google.Protobuf.DescriptorProtos { public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } if (Number != 0) { @@ -1352,13 +1408,13 @@ namespace Google.Protobuf.DescriptorProtos { if (Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { size += pb::CodedOutputStream.ComputeEnumSize(5, (int) Type); } - if (TypeName != "") { + if (TypeName.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(6, TypeName); } - if (Extendee != "") { + if (Extendee.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(2, Extendee); } - if (DefaultValue != "") { + if (DefaultValue.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(7, DefaultValue); } if (OneofIndex != 0) { @@ -1373,7 +1429,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } if (other.Number != 0) { @@ -1385,13 +1441,13 @@ namespace Google.Protobuf.DescriptorProtos { if (other.Type != global::Google.Protobuf.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE) { Type = other.Type; } - if (other.TypeName != "") { + if (other.TypeName.Length != 0) { TypeName = other.TypeName; } - if (other.Extendee != "") { + if (other.Extendee.Length != 0) { Extendee = other.Extendee; } - if (other.DefaultValue != "") { + if (other.DefaultValue.Length != 0) { DefaultValue = other.DefaultValue; } if (other.OneofIndex != 0) { @@ -1417,15 +1473,15 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 18: { - extendee_ = input.ReadString(); + Extendee = input.ReadString(); break; } case 24: { - number_ = input.ReadInt32(); + Number = input.ReadInt32(); break; } case 32: { @@ -1437,11 +1493,11 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 50: { - typeName_ = input.ReadString(); + TypeName = input.ReadString(); break; } case 58: { - defaultValue_ = input.ReadString(); + DefaultValue = input.ReadString(); break; } case 66: { @@ -1452,7 +1508,7 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 72: { - oneofIndex_ = input.ReadInt32(); + OneofIndex = input.ReadInt32(); break; } } @@ -1538,19 +1594,19 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } } public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } return size; @@ -1559,7 +1615,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } } @@ -1576,7 +1632,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } } @@ -1643,17 +1699,19 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); hash ^= value_.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } - output.WriteMessageArray(2, value_); + if (value_.Count > 0) { + output.WriteMessageArray(2, value_); + } if (options_ != null) { output.WriteMessage(3, Options); } @@ -1661,11 +1719,13 @@ namespace Google.Protobuf.DescriptorProtos { public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } - foreach (global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto element in value_) { - size += pb::CodedOutputStream.ComputeMessageSize(2, element); + if (value_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.EnumValueDescriptorProto element in value_) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } } if (options_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(3, Options); @@ -1676,7 +1736,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } value_.Add(other.value_); @@ -1700,7 +1760,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 18: { @@ -1780,14 +1840,14 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Number != 0) hash ^= Number.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } if (Number != 0) { @@ -1800,7 +1860,7 @@ namespace Google.Protobuf.DescriptorProtos { public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } if (Number != 0) { @@ -1815,7 +1875,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } if (other.Number != 0) { @@ -1841,11 +1901,11 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 16: { - number_ = input.ReadInt32(); + Number = input.ReadInt32(); break; } case 26: { @@ -1919,17 +1979,19 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); hash ^= method_.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } - output.WriteMessageArray(2, method_); + if (method_.Count > 0) { + output.WriteMessageArray(2, method_); + } if (options_ != null) { output.WriteMessage(3, Options); } @@ -1937,11 +1999,13 @@ namespace Google.Protobuf.DescriptorProtos { public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } - foreach (global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto element in method_) { - size += pb::CodedOutputStream.ComputeMessageSize(2, element); + if (method_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.MethodDescriptorProto element in method_) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } } if (options_ != null) { size += pb::CodedOutputStream.ComputeMessageSize(3, Options); @@ -1952,7 +2016,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } method_.Add(other.method_); @@ -1976,7 +2040,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 18: { @@ -2083,9 +2147,9 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (Name != "") hash ^= Name.GetHashCode(); - if (InputType != "") hash ^= InputType.GetHashCode(); - if (OutputType != "") hash ^= OutputType.GetHashCode(); + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (InputType.Length != 0) hash ^= InputType.GetHashCode(); + if (OutputType.Length != 0) hash ^= OutputType.GetHashCode(); if (options_ != null) hash ^= Options.GetHashCode(); if (ClientStreaming != false) hash ^= ClientStreaming.GetHashCode(); if (ServerStreaming != false) hash ^= ServerStreaming.GetHashCode(); @@ -2093,13 +2157,13 @@ namespace Google.Protobuf.DescriptorProtos { } public void WriteTo(pb::CodedOutputStream output) { - if (Name != "") { + if (Name.Length != 0) { output.WriteString(1, Name); } - if (InputType != "") { + if (InputType.Length != 0) { output.WriteString(2, InputType); } - if (OutputType != "") { + if (OutputType.Length != 0) { output.WriteString(3, OutputType); } if (options_ != null) { @@ -2115,13 +2179,13 @@ namespace Google.Protobuf.DescriptorProtos { public int CalculateSize() { int size = 0; - if (Name != "") { + if (Name.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, Name); } - if (InputType != "") { + if (InputType.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(2, InputType); } - if (OutputType != "") { + if (OutputType.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(3, OutputType); } if (options_ != null) { @@ -2139,13 +2203,13 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.Name != "") { + if (other.Name.Length != 0) { Name = other.Name; } - if (other.InputType != "") { + if (other.InputType.Length != 0) { InputType = other.InputType; } - if (other.OutputType != "") { + if (other.OutputType.Length != 0) { OutputType = other.OutputType; } if (other.options_ != null) { @@ -2174,15 +2238,15 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - name_ = input.ReadString(); + Name = input.ReadString(); break; } case 18: { - inputType_ = input.ReadString(); + InputType = input.ReadString(); break; } case 26: { - outputType_ = input.ReadString(); + OutputType = input.ReadString(); break; } case 34: { @@ -2193,11 +2257,11 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 40: { - clientStreaming_ = input.ReadBool(); + ClientStreaming = input.ReadBool(); break; } case 48: { - serverStreaming_ = input.ReadBool(); + ServerStreaming = input.ReadBool(); break; } } @@ -2374,29 +2438,29 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (JavaPackage != "") hash ^= JavaPackage.GetHashCode(); - if (JavaOuterClassname != "") hash ^= JavaOuterClassname.GetHashCode(); + if (JavaPackage.Length != 0) hash ^= JavaPackage.GetHashCode(); + if (JavaOuterClassname.Length != 0) hash ^= JavaOuterClassname.GetHashCode(); if (JavaMultipleFiles != false) hash ^= JavaMultipleFiles.GetHashCode(); if (JavaGenerateEqualsAndHash != false) hash ^= JavaGenerateEqualsAndHash.GetHashCode(); if (JavaStringCheckUtf8 != false) hash ^= JavaStringCheckUtf8.GetHashCode(); if (OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) hash ^= OptimizeFor.GetHashCode(); - if (GoPackage != "") hash ^= GoPackage.GetHashCode(); + if (GoPackage.Length != 0) hash ^= GoPackage.GetHashCode(); if (CcGenericServices != false) hash ^= CcGenericServices.GetHashCode(); if (JavaGenericServices != false) hash ^= JavaGenericServices.GetHashCode(); if (PyGenericServices != false) hash ^= PyGenericServices.GetHashCode(); if (Deprecated != false) hash ^= Deprecated.GetHashCode(); if (CcEnableArenas != false) hash ^= CcEnableArenas.GetHashCode(); - if (ObjcClassPrefix != "") hash ^= ObjcClassPrefix.GetHashCode(); - if (CsharpNamespace != "") hash ^= CsharpNamespace.GetHashCode(); + if (ObjcClassPrefix.Length != 0) hash ^= ObjcClassPrefix.GetHashCode(); + if (CsharpNamespace.Length != 0) hash ^= CsharpNamespace.GetHashCode(); hash ^= uninterpretedOption_.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (JavaPackage != "") { + if (JavaPackage.Length != 0) { output.WriteString(1, JavaPackage); } - if (JavaOuterClassname != "") { + if (JavaOuterClassname.Length != 0) { output.WriteString(8, JavaOuterClassname); } if (OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) { @@ -2405,7 +2469,7 @@ namespace Google.Protobuf.DescriptorProtos { if (JavaMultipleFiles != false) { output.WriteBool(10, JavaMultipleFiles); } - if (GoPackage != "") { + if (GoPackage.Length != 0) { output.WriteString(11, GoPackage); } if (CcGenericServices != false) { @@ -2429,21 +2493,23 @@ namespace Google.Protobuf.DescriptorProtos { if (CcEnableArenas != false) { output.WriteBool(31, CcEnableArenas); } - if (ObjcClassPrefix != "") { + if (ObjcClassPrefix.Length != 0) { output.WriteString(36, ObjcClassPrefix); } - if (CsharpNamespace != "") { + if (CsharpNamespace.Length != 0) { output.WriteString(37, CsharpNamespace); } - output.WriteMessageArray(999, uninterpretedOption_); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, uninterpretedOption_); + } } public int CalculateSize() { int size = 0; - if (JavaPackage != "") { + if (JavaPackage.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, JavaPackage); } - if (JavaOuterClassname != "") { + if (JavaOuterClassname.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(8, JavaOuterClassname); } if (JavaMultipleFiles != false) { @@ -2458,7 +2524,7 @@ namespace Google.Protobuf.DescriptorProtos { if (OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) { size += pb::CodedOutputStream.ComputeEnumSize(9, (int) OptimizeFor); } - if (GoPackage != "") { + if (GoPackage.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(11, GoPackage); } if (CcGenericServices != false) { @@ -2476,14 +2542,16 @@ namespace Google.Protobuf.DescriptorProtos { if (CcEnableArenas != false) { size += pb::CodedOutputStream.ComputeBoolSize(31, CcEnableArenas); } - if (ObjcClassPrefix != "") { + if (ObjcClassPrefix.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(36, ObjcClassPrefix); } - if (CsharpNamespace != "") { + if (CsharpNamespace.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(37, CsharpNamespace); } - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { - size += pb::CodedOutputStream.ComputeMessageSize(999, element); + if (uninterpretedOption_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } } return size; } @@ -2491,10 +2559,10 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.JavaPackage != "") { + if (other.JavaPackage.Length != 0) { JavaPackage = other.JavaPackage; } - if (other.JavaOuterClassname != "") { + if (other.JavaOuterClassname.Length != 0) { JavaOuterClassname = other.JavaOuterClassname; } if (other.JavaMultipleFiles != false) { @@ -2509,7 +2577,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other.OptimizeFor != global::Google.Protobuf.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED) { OptimizeFor = other.OptimizeFor; } - if (other.GoPackage != "") { + if (other.GoPackage.Length != 0) { GoPackage = other.GoPackage; } if (other.CcGenericServices != false) { @@ -2527,10 +2595,10 @@ namespace Google.Protobuf.DescriptorProtos { if (other.CcEnableArenas != false) { CcEnableArenas = other.CcEnableArenas; } - if (other.ObjcClassPrefix != "") { + if (other.ObjcClassPrefix.Length != 0) { ObjcClassPrefix = other.ObjcClassPrefix; } - if (other.CsharpNamespace != "") { + if (other.CsharpNamespace.Length != 0) { CsharpNamespace = other.CsharpNamespace; } uninterpretedOption_.Add(other.uninterpretedOption_); @@ -2548,11 +2616,11 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - javaPackage_ = input.ReadString(); + JavaPackage = input.ReadString(); break; } case 66: { - javaOuterClassname_ = input.ReadString(); + JavaOuterClassname = input.ReadString(); break; } case 72: { @@ -2560,47 +2628,47 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 80: { - javaMultipleFiles_ = input.ReadBool(); + JavaMultipleFiles = input.ReadBool(); break; } case 90: { - goPackage_ = input.ReadString(); + GoPackage = input.ReadString(); break; } case 128: { - ccGenericServices_ = input.ReadBool(); + CcGenericServices = input.ReadBool(); break; } case 136: { - javaGenericServices_ = input.ReadBool(); + JavaGenericServices = input.ReadBool(); break; } case 144: { - pyGenericServices_ = input.ReadBool(); + PyGenericServices = input.ReadBool(); break; } case 160: { - javaGenerateEqualsAndHash_ = input.ReadBool(); + JavaGenerateEqualsAndHash = input.ReadBool(); break; } case 184: { - deprecated_ = input.ReadBool(); + Deprecated = input.ReadBool(); break; } case 216: { - javaStringCheckUtf8_ = input.ReadBool(); + JavaStringCheckUtf8 = input.ReadBool(); break; } case 248: { - ccEnableArenas_ = input.ReadBool(); + CcEnableArenas = input.ReadBool(); break; } case 290: { - objcClassPrefix_ = input.ReadString(); + ObjcClassPrefix = input.ReadString(); break; } case 298: { - csharpNamespace_ = input.ReadString(); + CsharpNamespace = input.ReadString(); break; } case 7994: { @@ -2724,7 +2792,9 @@ namespace Google.Protobuf.DescriptorProtos { if (MapEntry != false) { output.WriteBool(7, MapEntry); } - output.WriteMessageArray(999, uninterpretedOption_); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, uninterpretedOption_); + } } public int CalculateSize() { @@ -2741,8 +2811,10 @@ namespace Google.Protobuf.DescriptorProtos { if (MapEntry != false) { size += pb::CodedOutputStream.ComputeBoolSize(7, MapEntry); } - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { - size += pb::CodedOutputStream.ComputeMessageSize(999, element); + if (uninterpretedOption_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } } return size; } @@ -2777,19 +2849,19 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 8: { - messageSetWireFormat_ = input.ReadBool(); + MessageSetWireFormat = input.ReadBool(); break; } case 16: { - noStandardDescriptorAccessor_ = input.ReadBool(); + NoStandardDescriptorAccessor = input.ReadBool(); break; } case 24: { - deprecated_ = input.ReadBool(); + Deprecated = input.ReadBool(); break; } case 56: { - mapEntry_ = input.ReadBool(); + MapEntry = input.ReadBool(); break; } case 7994: { @@ -2927,7 +2999,9 @@ namespace Google.Protobuf.DescriptorProtos { if (Weak != false) { output.WriteBool(10, Weak); } - output.WriteMessageArray(999, uninterpretedOption_); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, uninterpretedOption_); + } } public int CalculateSize() { @@ -2950,8 +3024,10 @@ namespace Google.Protobuf.DescriptorProtos { if (Weak != false) { size += pb::CodedOutputStream.ComputeBoolSize(10, Weak); } - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { - size += pb::CodedOutputStream.ComputeMessageSize(999, element); + if (uninterpretedOption_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } } return size; } @@ -2996,15 +3072,15 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 16: { - packed_ = input.ReadBool(); + Packed = input.ReadBool(); break; } case 24: { - deprecated_ = input.ReadBool(); + Deprecated = input.ReadBool(); break; } case 40: { - lazy_ = input.ReadBool(); + Lazy = input.ReadBool(); break; } case 48: { @@ -3012,7 +3088,7 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 80: { - weak_ = input.ReadBool(); + Weak = input.ReadBool(); break; } case 7994: { @@ -3116,7 +3192,9 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { output.WriteBool(3, Deprecated); } - output.WriteMessageArray(999, uninterpretedOption_); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, uninterpretedOption_); + } } public int CalculateSize() { @@ -3127,8 +3205,10 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { size += pb::CodedOutputStream.ComputeBoolSize(3, Deprecated); } - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { - size += pb::CodedOutputStream.ComputeMessageSize(999, element); + if (uninterpretedOption_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } } return size; } @@ -3157,11 +3237,11 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 16: { - allowAlias_ = input.ReadBool(); + AllowAlias = input.ReadBool(); break; } case 24: { - deprecated_ = input.ReadBool(); + Deprecated = input.ReadBool(); break; } case 7994: { @@ -3234,7 +3314,9 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { output.WriteBool(1, Deprecated); } - output.WriteMessageArray(999, uninterpretedOption_); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, uninterpretedOption_); + } } public int CalculateSize() { @@ -3242,8 +3324,10 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { size += pb::CodedOutputStream.ComputeBoolSize(1, Deprecated); } - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { - size += pb::CodedOutputStream.ComputeMessageSize(999, element); + if (uninterpretedOption_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } } return size; } @@ -3269,7 +3353,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 8: { - deprecated_ = input.ReadBool(); + Deprecated = input.ReadBool(); break; } case 7994: { @@ -3342,7 +3426,9 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { output.WriteBool(33, Deprecated); } - output.WriteMessageArray(999, uninterpretedOption_); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, uninterpretedOption_); + } } public int CalculateSize() { @@ -3350,8 +3436,10 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { size += pb::CodedOutputStream.ComputeBoolSize(33, Deprecated); } - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { - size += pb::CodedOutputStream.ComputeMessageSize(999, element); + if (uninterpretedOption_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } } return size; } @@ -3377,7 +3465,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 264: { - deprecated_ = input.ReadBool(); + Deprecated = input.ReadBool(); break; } case 7994: { @@ -3450,7 +3538,9 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { output.WriteBool(33, Deprecated); } - output.WriteMessageArray(999, uninterpretedOption_); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, uninterpretedOption_); + } } public int CalculateSize() { @@ -3458,8 +3548,10 @@ namespace Google.Protobuf.DescriptorProtos { if (Deprecated != false) { size += pb::CodedOutputStream.ComputeBoolSize(33, Deprecated); } - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { - size += pb::CodedOutputStream.ComputeMessageSize(999, element); + if (uninterpretedOption_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption element in uninterpretedOption_) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } } return size; } @@ -3485,7 +3577,7 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 264: { - deprecated_ = input.ReadBool(); + Deprecated = input.ReadBool(); break; } case 7994: { @@ -3595,18 +3687,20 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; hash ^= name_.GetHashCode(); - if (IdentifierValue != "") hash ^= IdentifierValue.GetHashCode(); + if (IdentifierValue.Length != 0) hash ^= IdentifierValue.GetHashCode(); if (PositiveIntValue != 0UL) hash ^= PositiveIntValue.GetHashCode(); if (NegativeIntValue != 0L) hash ^= NegativeIntValue.GetHashCode(); if (DoubleValue != 0D) hash ^= DoubleValue.GetHashCode(); - if (StringValue != pb::ByteString.Empty) hash ^= StringValue.GetHashCode(); - if (AggregateValue != "") hash ^= AggregateValue.GetHashCode(); + if (StringValue.Length != 0) hash ^= StringValue.GetHashCode(); + if (AggregateValue.Length != 0) hash ^= AggregateValue.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - output.WriteMessageArray(2, name_); - if (IdentifierValue != "") { + if (name_.Count > 0) { + output.WriteMessageArray(2, name_); + } + if (IdentifierValue.Length != 0) { output.WriteString(3, IdentifierValue); } if (PositiveIntValue != 0UL) { @@ -3618,20 +3712,22 @@ namespace Google.Protobuf.DescriptorProtos { if (DoubleValue != 0D) { output.WriteDouble(6, DoubleValue); } - if (StringValue != pb::ByteString.Empty) { + if (StringValue.Length != 0) { output.WriteBytes(7, StringValue); } - if (AggregateValue != "") { + if (AggregateValue.Length != 0) { output.WriteString(8, AggregateValue); } } public int CalculateSize() { int size = 0; - foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart element in name_) { - size += pb::CodedOutputStream.ComputeMessageSize(2, element); + if (name_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.UninterpretedOption.Types.NamePart element in name_) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } } - if (IdentifierValue != "") { + if (IdentifierValue.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(3, IdentifierValue); } if (PositiveIntValue != 0UL) { @@ -3643,10 +3739,10 @@ namespace Google.Protobuf.DescriptorProtos { if (DoubleValue != 0D) { size += pb::CodedOutputStream.ComputeDoubleSize(6, DoubleValue); } - if (StringValue != pb::ByteString.Empty) { + if (StringValue.Length != 0) { size += pb::CodedOutputStream.ComputeBytesSize(7, StringValue); } - if (AggregateValue != "") { + if (AggregateValue.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(8, AggregateValue); } return size; @@ -3656,7 +3752,7 @@ namespace Google.Protobuf.DescriptorProtos { return; } name_.Add(other.name_); - if (other.IdentifierValue != "") { + if (other.IdentifierValue.Length != 0) { IdentifierValue = other.IdentifierValue; } if (other.PositiveIntValue != 0UL) { @@ -3668,10 +3764,10 @@ namespace Google.Protobuf.DescriptorProtos { if (other.DoubleValue != 0D) { DoubleValue = other.DoubleValue; } - if (other.StringValue != pb::ByteString.Empty) { + if (other.StringValue.Length != 0) { StringValue = other.StringValue; } - if (other.AggregateValue != "") { + if (other.AggregateValue.Length != 0) { AggregateValue = other.AggregateValue; } } @@ -3692,27 +3788,27 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 26: { - identifierValue_ = input.ReadString(); + IdentifierValue = input.ReadString(); break; } case 32: { - positiveIntValue_ = input.ReadUInt64(); + PositiveIntValue = input.ReadUInt64(); break; } case 40: { - negativeIntValue_ = input.ReadInt64(); + NegativeIntValue = input.ReadInt64(); break; } case 49: { - doubleValue_ = input.ReadDouble(); + DoubleValue = input.ReadDouble(); break; } case 58: { - stringValue_ = input.ReadBytes(); + StringValue = input.ReadBytes(); break; } case 66: { - aggregateValue_ = input.ReadString(); + AggregateValue = input.ReadString(); break; } } @@ -3775,13 +3871,13 @@ namespace Google.Protobuf.DescriptorProtos { public override int GetHashCode() { int hash = 0; - if (NamePart_ != "") hash ^= NamePart_.GetHashCode(); + if (NamePart_.Length != 0) hash ^= NamePart_.GetHashCode(); if (IsExtension != false) hash ^= IsExtension.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - if (NamePart_ != "") { + if (NamePart_.Length != 0) { output.WriteString(1, NamePart_); } if (IsExtension != false) { @@ -3791,7 +3887,7 @@ namespace Google.Protobuf.DescriptorProtos { public int CalculateSize() { int size = 0; - if (NamePart_ != "") { + if (NamePart_.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(1, NamePart_); } if (IsExtension != false) { @@ -3803,7 +3899,7 @@ namespace Google.Protobuf.DescriptorProtos { if (other == null) { return; } - if (other.NamePart_ != "") { + if (other.NamePart_.Length != 0) { NamePart_ = other.NamePart_; } if (other.IsExtension != false) { @@ -3823,11 +3919,11 @@ namespace Google.Protobuf.DescriptorProtos { } break; case 10: { - namePart_ = input.ReadString(); + NamePart_ = input.ReadString(); break; } case 16: { - isExtension_ = input.ReadBool(); + IsExtension = input.ReadBool(); break; } } @@ -3888,13 +3984,17 @@ namespace Google.Protobuf.DescriptorProtos { } public void WriteTo(pb::CodedOutputStream output) { - output.WriteMessageArray(1, location_); + if (location_.Count > 0) { + output.WriteMessageArray(1, location_); + } } public int CalculateSize() { int size = 0; - foreach (global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location element in location_) { - size += pb::CodedOutputStream.ComputeMessageSize(1, element); + if (location_.Count > 0) { + foreach (global::Google.Protobuf.DescriptorProtos.SourceCodeInfo.Types.Location element in location_) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } } return size; } @@ -4003,53 +4103,55 @@ namespace Google.Protobuf.DescriptorProtos { int hash = 0; hash ^= path_.GetHashCode(); hash ^= span_.GetHashCode(); - if (LeadingComments != "") hash ^= LeadingComments.GetHashCode(); - if (TrailingComments != "") hash ^= TrailingComments.GetHashCode(); + if (LeadingComments.Length != 0) hash ^= LeadingComments.GetHashCode(); + if (TrailingComments.Length != 0) hash ^= TrailingComments.GetHashCode(); hash ^= leadingDetachedComments_.GetHashCode(); return hash; } public void WriteTo(pb::CodedOutputStream output) { - output.WritePackedInt32Array(1, path_); - output.WritePackedInt32Array(2, span_); - if (LeadingComments != "") { + if (path_.Count > 0) { + output.WritePackedInt32Array(1, path_); + } + if (span_.Count > 0) { + output.WritePackedInt32Array(2, span_); + } + if (LeadingComments.Length != 0) { output.WriteString(3, LeadingComments); } - if (TrailingComments != "") { + if (TrailingComments.Length != 0) { output.WriteString(4, TrailingComments); } - output.WriteStringArray(6, leadingDetachedComments_); + if (leadingDetachedComments_.Count > 0) { + output.WriteStringArray(6, leadingDetachedComments_); + } } public int CalculateSize() { int size = 0; - { + if (path_.Count > 0) { int dataSize = 0; foreach (int element in path_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); } size += dataSize; - if (path_.Count != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - { + if (span_.Count > 0) { int dataSize = 0; foreach (int element in span_) { dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); } size += dataSize; - if (span_.Count != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); - } + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); } - if (LeadingComments != "") { + if (LeadingComments.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(3, LeadingComments); } - if (TrailingComments != "") { + if (TrailingComments.Length != 0) { size += pb::CodedOutputStream.ComputeStringSize(4, TrailingComments); } - { + if (leadingDetachedComments_.Count > 0) { int dataSize = 0; foreach (string element in leadingDetachedComments_) { dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); @@ -4065,10 +4167,10 @@ namespace Google.Protobuf.DescriptorProtos { } path_.Add(other.path_); span_.Add(other.span_); - if (other.LeadingComments != "") { + if (other.LeadingComments.Length != 0) { LeadingComments = other.LeadingComments; } - if (other.TrailingComments != "") { + if (other.TrailingComments.Length != 0) { TrailingComments = other.TrailingComments; } leadingDetachedComments_.Add(other.leadingDetachedComments_); @@ -4096,11 +4198,11 @@ namespace Google.Protobuf.DescriptorProtos { break; } case 26: { - leadingComments_ = input.ReadString(); + LeadingComments = input.ReadString(); break; } case 34: { - trailingComments_ = input.ReadString(); + TrailingComments = input.ReadString(); break; } case 50: {