Merge branch 'master' into msbuilddll2
[mono.git] / mcs / class / corlib / System / NumberFormatter.cs
index 8cda5e437f9a01cd5cbeb8df538d6b36b1c63830..dc0fb5a1e11800578f51294235ee4d2d5884cb05 100644 (file)
@@ -557,9 +557,7 @@ namespace System
 
                private void Resize (int len)
                {
-                       char[] newBuf = new char [len];
-                       Array.Copy (_cbuf, newBuf, _ind);
-                       _cbuf = newBuf;
+                       Array.Resize (ref _cbuf, len);
                }
 
                private void Append (char c)
@@ -783,6 +781,7 @@ namespace System
                        threadNumberFormatter = null;
                        if (res == null)
                                return new NumberFormatter (Thread.CurrentThread);
+                       res.CurrentCulture = Thread.CurrentThread.CurrentCulture;
                        return res;
                }
 
@@ -791,12 +790,6 @@ namespace System
                        threadNumberFormatter = this;
                }
 
-               internal static void SetThreadCurrentCulture (CultureInfo culture)
-               {
-                       if (threadNumberFormatter != null)
-                               threadNumberFormatter.CurrentCulture = culture;
-               }
-
                public static string NumberToString (string format, sbyte value, IFormatProvider fp)
                {
                        NumberFormatter inst = GetInstance();
@@ -1956,19 +1949,19 @@ namespace System
                                int[] lens = new int [3];
                                int index = 0;
                                int lastPos = 0;
-                               char literal = '\0';
+                               bool quoted = false;
+
                                for (int i = 0; i < format.Length; i++) {
                                        char c = format [i];
 
-                                       if (c == literal || (literal == '\0' && (c == '\"' || c == '\''))) {
-                                               if (literal == '\0')
-                                                       literal = c;
-                                               else
-                                                       literal = '\0';
+                                       if (c == '\"' || c == '\'') {
+                                               if (i == 0 || format [i - 1] != '\\')
+                                                       quoted = !quoted;
+
                                                continue;
                                        }
 
-                                       if (literal == '\0' && format [i] == ';' && (i == 0 || format [i - 1] != '\\')) {
+                                       if (c == ';' && !quoted && (i == 0 || format [i - 1] != '\\')) {
                                                lens [index++] = i - lastPos;
                                                lastPos = i + 1;
                                                if (index == 3)