Wed Sep 11 15:26:34 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mcs / class / corlib / System / UInt32.cs
index 911a90967857d781b2c893419dab5d5e5dba2a77..aa409a9288013e327b3b7ada699ad308d7d04114 100644 (file)
@@ -19,7 +19,7 @@ namespace System {
                public const uint MaxValue = 0xffffffff;
                public const uint MinValue = 0;
                
-               public uint value;
+               internal uint value;
 
                public int CompareTo (object v)
                {
@@ -58,6 +58,7 @@ namespace System {
                        int len;
                        int i;
                        bool digits_seen = false;
+                       bool has_negative_sign = false;
                        
                        if (s == null)
                                throw new ArgumentNullException (Locale.GetText ("s is null"));
@@ -76,6 +77,11 @@ namespace System {
 
                        if (s [i] == '+')
                                i++;
+                       else
+                               if (s[i] == '-'){
+                                       i++;
+                                       has_negative_sign = true;
+                               }
 
                        for (; i < len; i++){
                                c = s [i];
@@ -99,8 +105,10 @@ namespace System {
                        if (!digits_seen)
                                throw new FormatException ();
                        
-                       return val;
+                       if (has_negative_sign)
+                               throw new OverflowException ();
 
+                       return val;
                }
 
                [CLSCompliant(false)]
@@ -298,7 +306,7 @@ namespace System {
                                        pos = Int32.JumpOverWhite (pos, s, false);
                        }
 
-                       if (pos < s.Length)
+                       if (pos < s.Length && s [pos] != '\u0000')
                                throw new FormatException ("Input string was not in the correct format.");
 
                        if (negative)