2010-07-05 Gonzalo Paniagua Javier <gonzalo@novell.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 5 Jul 2010 18:22:25 +0000 (18:22 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 5 Jul 2010 18:22:25 +0000 (18:22 -0000)
* TimeSpan.cs: two consecutive colons produce an error now.
Fixes bug #598467.

svn path=/trunk/mcs/; revision=159919

mcs/class/corlib/System/ChangeLog
mcs/class/corlib/System/TimeSpan.cs

index 0b57e739377d1815eb351d78ea3de67330e96b7e..58715a299d7e0b98161401e4d41dcc80fbd4c6c8 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-05 Gonzalo Paniagua Javier <gonzalo@novell.com>
+
+       * TimeSpan.cs: two consecutive colons produce an error now.
+       Fixes bug #598467.
+
 2010-06-29  Sebastien Pouliot  <sebastien@ximian.com>
 
        * Attribute.cs: Fix GetHashCode to match MS behavior (needed for
index 6270aa83137cd41b76484084ce0936530793ce20..7bc83f09a2052d80e8a55b07d6cc5185879b4afc 100644 (file)
@@ -1072,11 +1072,15 @@ namespace System
                                value1 = ParseInt (false);
                                if (!ParseOptDaysSeparator ()) // Parse either day separator or colon
                                        ParseColon (false);
+                               int p = _cur;
                                value2 = ParseInt (true);
-                               ParseColon (true);
-                               value3 = ParseInt (true);
-                               ParseColon (true);
-                               value4 = ParseInt (true);
+                               value3 = value4 = 0;
+                               if (p < _cur) {
+                                       ParseColon (true);
+                                       value3 = ParseInt (true);
+                                       ParseColon (true);
+                                       value4 = ParseInt (true);
+                               }
 
                                // We know the precise separator for ticks, so there's no need to guess.
                                if (ParseOptDecimalSeparator ())
@@ -1177,9 +1181,13 @@ namespace System
                                        days = 0;
                                }
                                ParseColon(false);
+                               int p = _cur;
                                minutes = ParseInt (true);
-                               ParseColon (true);
-                               seconds = ParseInt (true);
+                               seconds = 0;
+                               if (p < _cur) {
+                                       ParseColon (true);
+                                       seconds = ParseInt (true);
+                               }
 
                                if ( ParseOptDot () ) {
                                        ticks = ParseTicks ();