Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: url/url_canon_fileurl.cc

Issue 1878083002: Implement IsAsciiUpper and IsAsciiLower in base/strings/string_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Functions for canonicalizing "file:" URLs. 5 // Functions for canonicalizing "file:" URLs.
6 6
7 #include "base/strings/string_util.h"
7 #include "url/url_canon.h" 8 #include "url/url_canon.h"
8 #include "url/url_canon_internal.h" 9 #include "url/url_canon_internal.h"
9 #include "url/url_file.h" 10 #include "url/url_file.h"
10 #include "url/url_parse_internal.h" 11 #include "url/url_parse_internal.h"
11 12
12 namespace url { 13 namespace url {
13 14
14 namespace { 15 namespace {
15 16
16 #ifdef WIN32 17 #ifdef WIN32
(...skipping 15 matching lines...) Expand all
32 return begin; // Haven't consumed any characters 33 return begin; // Haven't consumed any characters
33 34
34 // A drive spec is the start of a path, so we need to add a slash for the 35 // A drive spec is the start of a path, so we need to add a slash for the
35 // authority terminator (typically the third slash). 36 // authority terminator (typically the third slash).
36 output->push_back('/'); 37 output->push_back('/');
37 38
38 // DoesBeginWindowsDriveSpec will ensure that the drive letter is valid 39 // DoesBeginWindowsDriveSpec will ensure that the drive letter is valid
39 // and that it is followed by a colon/pipe. 40 // and that it is followed by a colon/pipe.
40 41
41 // Normalize Windows drive letters to uppercase 42 // Normalize Windows drive letters to uppercase
42 if (spec[after_slashes] >= 'a' && spec[after_slashes] <= 'z') 43 if (base::IsAsciiLower(spec[after_slashes]))
43 output->push_back(static_cast<char>(spec[after_slashes] - 'a' + 'A')); 44 output->push_back(static_cast<char>(spec[after_slashes] - 'a' + 'A'));
44 else 45 else
45 output->push_back(static_cast<char>(spec[after_slashes])); 46 output->push_back(static_cast<char>(spec[after_slashes]));
46 47
47 // Normalize the character following it to a colon rather than pipe. 48 // Normalize the character following it to a colon rather than pipe.
48 output->push_back(':'); 49 output->push_back(':');
49 return after_slashes + 2; 50 return after_slashes + 2;
50 } 51 }
51 52
52 #endif // WIN32 53 #endif // WIN32
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 Parsed* new_parsed) { 181 Parsed* new_parsed) {
181 RawCanonOutput<1024> utf8; 182 RawCanonOutput<1024> utf8;
182 URLComponentSource<char> source(base); 183 URLComponentSource<char> source(base);
183 Parsed parsed(base_parsed); 184 Parsed parsed(base_parsed);
184 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); 185 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed);
185 return DoCanonicalizeFileURL<char, unsigned char>( 186 return DoCanonicalizeFileURL<char, unsigned char>(
186 source, parsed, query_converter, output, new_parsed); 187 source, parsed, query_converter, output, new_parsed);
187 } 188 }
188 189
189 } // namespace url 190 } // namespace url
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698