OLD | NEW |
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 "url/url_canon.h" | 7 #include "url/url_canon.h" |
8 #include "url/url_canon_internal.h" | 8 #include "url/url_canon_internal.h" |
9 #include "url/url_file.h" | 9 #include "url/url_file.h" |
10 #include "url/url_parse_internal.h" | 10 #include "url/url_parse_internal.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // A drive spec is the start of a path, so we need to add a slash for the | 34 // 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). | 35 // authority terminator (typically the third slash). |
36 output->push_back('/'); | 36 output->push_back('/'); |
37 | 37 |
38 // DoesBeginWindowsDriveSpec will ensure that the drive letter is valid | 38 // DoesBeginWindowsDriveSpec will ensure that the drive letter is valid |
39 // and that it is followed by a colon/pipe. | 39 // and that it is followed by a colon/pipe. |
40 | 40 |
41 // Normalize Windows drive letters to uppercase | 41 // Normalize Windows drive letters to uppercase |
42 if (spec[after_slashes] >= 'a' && spec[after_slashes] <= 'z') | 42 if (spec[after_slashes] >= 'a' && spec[after_slashes] <= 'z') |
43 output->push_back(spec[after_slashes] - 'a' + 'A'); | 43 output->push_back(static_cast<char>(spec[after_slashes] - 'a' + 'A')); |
44 else | 44 else |
45 output->push_back(static_cast<char>(spec[after_slashes])); | 45 output->push_back(static_cast<char>(spec[after_slashes])); |
46 | 46 |
47 // Normalize the character following it to a colon rather than pipe. | 47 // Normalize the character following it to a colon rather than pipe. |
48 output->push_back(':'); | 48 output->push_back(':'); |
49 return after_slashes + 2; | 49 return after_slashes + 2; |
50 } | 50 } |
51 | 51 |
52 #endif // WIN32 | 52 #endif // WIN32 |
53 | 53 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 Parsed* new_parsed) { | 180 Parsed* new_parsed) { |
181 RawCanonOutput<1024> utf8; | 181 RawCanonOutput<1024> utf8; |
182 URLComponentSource<char> source(base); | 182 URLComponentSource<char> source(base); |
183 Parsed parsed(base_parsed); | 183 Parsed parsed(base_parsed); |
184 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); | 184 SetupUTF16OverrideComponents(base, replacements, &utf8, &source, &parsed); |
185 return DoCanonicalizeFileURL<char, unsigned char>( | 185 return DoCanonicalizeFileURL<char, unsigned char>( |
186 source, parsed, query_converter, output, new_parsed); | 186 source, parsed, query_converter, output, new_parsed); |
187 } | 187 } |
188 | 188 |
189 } // namespace url | 189 } // namespace url |
OLD | NEW |