소스 검색

Changes from review e805fdfd3a6b

csharptest 14 년 전
부모
커밋
304ff3a838

+ 4 - 0
src/ProtoGen/FieldGeneratorBase.cs

@@ -72,6 +72,10 @@ namespace Google.ProtocolBuffers.ProtoGen
             return true;
         }
 
+        /// <summary>
+        /// This returns true if the field has a non-default default value.  For instance this returns 
+        /// false for numerics with a default of zero '0', or booleans with a default of false.
+        /// </summary>
         protected bool HasDefaultValue
         {
             get

+ 1 - 1
src/ProtocolBuffers/CodedOutputStream.cs

@@ -370,7 +370,7 @@ namespace Google.ProtocolBuffers
             WriteRawVarint32(value);
         }
 
-        public void WriteEnum(int fieldNumber, string fieldName, int value, object textValue)
+        public void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue)
         {
             WriteTag(fieldNumber, WireFormat.WireType.Varint);
             WriteRawVarint32((uint) value);

+ 4 - 3
src/ProtocolBuffers/Collections/PopsicleList.cs

@@ -42,7 +42,7 @@ namespace Google.ProtocolBuffers.Collections
     /// </summary>
     public sealed class PopsicleList<T> : IPopsicleList<T>, ICastArray
     {
-        private static readonly IEnumerable<T> EmptySet = new T[0];
+        private static readonly T[] EmptySet = new T[0];
 
         private List<T> items;
         private bool readOnly;
@@ -134,7 +134,8 @@ namespace Google.ProtocolBuffers.Collections
 
         public IEnumerator<T> GetEnumerator()
         {
-            return items == null ? EmptySet.GetEnumerator() : items.GetEnumerator();
+            IEnumerable<T> tenum = (IEnumerable<T>)items ?? EmptySet;
+            return tenum.GetEnumerator();
         }
 
         IEnumerator IEnumerable.GetEnumerator()
@@ -171,7 +172,7 @@ namespace Google.ProtocolBuffers.Collections
         {
             if (items == null)
             {
-                return new TItemType[0];
+                return PopsicleList<TItemType>.EmptySet;
             }
             return (TItemType[]) (object) items.ToArray();
         }

+ 1 - 0
src/ProtocolBuffers/ProtocolBuffers.csproj

@@ -88,6 +88,7 @@
   <ItemGroup>
     <Reference Include="mscorlib" />
     <Reference Include="System" />
+    <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>