فهرست منبع

Two more which should have been in the last commit

Jon Skeet 17 سال پیش
والد
کامیت
cd85190847

+ 7 - 2
csharp/ProtocolBuffers/Descriptors/FieldDescriptor.cs

@@ -321,7 +321,6 @@ namespace Google.ProtocolBuffers.Descriptors {
         }
 
         try {
-          // TODO(jonskeet): Check signage for Int32 and Int64.
           switch (FieldType) {
             case FieldType.Int32:
             case FieldType.SInt32:
@@ -348,7 +347,13 @@ namespace Google.ProtocolBuffers.Descriptors {
               defaultValue = double.Parse(Proto.DefaultValue);
               break;
             case FieldType.Bool:
-              defaultValue = bool.Parse(Proto.DefaultValue); // TODO(jonskeet): Check this will work
+              if (Proto.DefaultValue == "true") {
+                defaultValue = true;
+              } else if (Proto.DefaultValue == "false") {
+                defaultValue = false;
+              } else {
+                throw new FormatException("Boolean values must be \"true\" or \"false\"");
+              }
               break;
             case FieldType.String:
               defaultValue = Proto.DefaultValue;

+ 3 - 1
csharp/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs

@@ -22,7 +22,9 @@ namespace Google.ProtocolBuffers.Descriptors {
     /// The index of this descriptor within its parent descriptor. 
     /// </value>
     /// <remarks>
-    /// TODO(jonskeet): Transcribe appropriately.
+    /// This returns the index of this descriptor within its parent, for
+    /// this descriptor's type. (There can be duplicate values for different
+    /// types, e.g. one enum type with index 0 and one message type with index 0.)
     /// </remarks>
     public int Index {
       get { return index; }