2006-12-01 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Fri, 1 Dec 2006 07:45:08 +0000 (07:45 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 1 Dec 2006 07:45:08 +0000 (07:45 -0000)
* DateTime.cs :
  When comparing enumerations, two or more enumeration values might
  match. Thus basically we should do complete matching, but right
  now just do reverse order search since only numbered abbrev month
  names matter (and full iteration is a mess). Fixed bug #80094.

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

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

index 25c194794dc3801237e648ab5d5985695df9908c..9e93b69737975601c4aa3f0c93d28ac437adfd09 100644 (file)
@@ -1,3 +1,11 @@
+2006-12-01  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * DateTime.cs :
+         When comparing enumerations, two or more enumeration values might
+         match. Thus basically we should do complete matching, but right
+         now just do reverse order search since only numbered abbrev month
+         names matter (and full iteration is a mess). Fixed bug #80094.
+
 2006-12-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * DateTime.cs :
index 91558171f1d25d41ffa74fb029eca95f4d0b5f8b..9d047e3cda9dbd0693bcaee778efc7ababedeb3a 100644 (file)
@@ -881,7 +881,13 @@ namespace System
                {
                        int i;
 
-                       for (i = 0; i < values.Length; i++) {
+                       // FIXME: I know this is somehow lame code. Probably
+                       // it should iterate all the enum value and return
+                       // the longest match. However right now I don't see
+                       // anything but "1" and "10" - "12" that might match
+                       // two or more values. (They are only abbrev month
+                       // names, so do reverse order search). See bug #80094.
+                       for (i = values.Length - 1; i >= 0; i--) {
                                if (s.Length - sPos < values[i].Length)
                                        continue;
                                else if (values [i].Length == 0)