Browse Source

Regenerate proto files

Jon Skeet 10 years ago
parent
commit
fb1547b388

+ 30 - 22
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;
     }

+ 1 - 1
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;
           }
         }

+ 1 - 1
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;
           }
         }

+ 40 - 36
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;
           }
         }

File diff suppressed because it is too large
+ 242 - 215
csharp/src/ProtocolBuffers.Test/TestProtos/UnittestProto3.cs


File diff suppressed because it is too large
+ 238 - 170
csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs


Some files were not shown because too many files changed in this diff