Changed string operations to use StringComparison.Ordinal.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 25 Jul 2014 12:14:16 +0000 (13:14 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 25 Jul 2014 12:14:16 +0000 (13:14 +0100)
mcs/class/System/System/Uri.cs
mcs/class/System/System/UriParseComponents.cs
mcs/class/System/System/UriParser.cs

index 8de286a5dc1e05b1dc59a0eb9e5a2e645b26c13c..e303ff28aeff7f08c6694145423e96641487f5a2 100644 (file)
@@ -290,7 +290,7 @@ namespace System {
                        if (!UriParseComponents.TryParseComponents (baseUri.OriginalString, UriKind.Absolute, null, out baseEl, out error))
                                throw new UriFormatException (error);
 
-                       if (relativeUri.StartsWith (baseEl.scheme + ":"))
+                       if (relativeUri.StartsWith (baseEl.scheme + ":", StringComparison.Ordinal))
                                relativeUri = relativeUri.Substring (baseEl.scheme.Length + 1);
 
                        if (relativeUri.Length >= 1 && relativeUri [0] == '/') {
@@ -509,7 +509,8 @@ namespace System {
                                string unescapedPath = UriHelper.FormatAbsolute (path, scheme,
                                        UriComponents.Path, UriFormat.Unescaped, formatFlags);
 
-                               if (path.StartsWith("/") && !unescapedPath.StartsWith("/"))
+                               if (path.StartsWith ("/", StringComparison.Ordinal) &&
+                                       !unescapedPath.StartsWith ("/", StringComparison.Ordinal))
                                        unescapedPath = "/" + unescapedPath;
 
                                if (IsLocalIdenticalToAbsolutePath ()) {
@@ -969,7 +970,7 @@ namespace System {
                                        if (segments [k] != segments2 [k]) 
                                                break;
                                
-                               for (int i = k; i < segments.Length && segments [i].EndsWith ("/"); i++)
+                               for (int i = k; i < segments.Length && segments [i].EndsWith ("/", StringComparison.Ordinal); i++)
                                        result += "../";
                                for (int i = k; i < segments2.Length; i++)
                                        result += segments2 [i];
index dc93feb3bf8ac2e2b46b32397ac0ac77bf4c3ba6..d2fc42bcc500e293dce2028e748a47069b8adaf2 100644 (file)
@@ -289,7 +289,7 @@ namespace System {
                {
                        var delimiter = Uri.GetSchemeDelimiter (state.elements.scheme);
 
-                       if (!state.remaining.StartsWith (delimiter)) {
+                       if (!state.remaining.StartsWith (delimiter, StringComparison.Ordinal)) {
                                if (UriHelper.IsKnownScheme (state.elements.scheme)) {
                                        state.error = "Invalid URI: The Authority/Host could not be parsed.";
                                        return false;
index 07bfe502259be0542ad42bcdd69835a294b3b5c8..bf2041833531fe3833e109b337e83eb3cd788163 100644 (file)
@@ -153,7 +153,7 @@ namespace System {
                        if ((components & UriComponents.Path) != 0) {
                                string path = elements.path;
                                if ((components & UriComponents.PathAndQuery) != 0 &&
-                                       (path.Length == 0 || !path.StartsWith ("/")) &&
+                                       (path.Length == 0 || !path.StartsWith ("/", StringComparison.Ordinal)) &&
                                        elements.delimiter == Uri.SchemeDelimiter)
                                        sb.Append ("/");
                                sb.Append (UriHelper.FormatAbsolute (path, scheme, UriComponents.Path, format, formatFlags));