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

Unified Diff: src/url_parse.cc

Issue 8974033: Fix the GURL change [compile error, two small changes to make things safe while (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/url_canon_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/url_parse.cc
===================================================================
--- src/url_parse.cc (revision 166)
+++ src/url_parse.cc (working copy)
@@ -312,7 +312,30 @@
ParsePath(spec, full_path, &parsed->path, &parsed->query, &parsed->ref);
}
+// The main parsing function for standard URLs. Standard URLs have a scheme,
+// host, path, etc.
template<typename CHAR>
+void DoParseStandardURL(const CHAR* spec, int spec_len, Parsed* parsed) {
+ DCHECK(spec_len >= 0);
+
+ // Strip leading & trailing spaces and control characters.
+ int begin = 0;
+ TrimURL(spec, &begin, &spec_len);
+
+ int after_scheme;
+ if (DoExtractScheme(spec, spec_len, &parsed->scheme)) {
+ after_scheme = parsed->scheme.end() + 1; // Skip past the colon.
+ } else {
+ // Say there's no scheme when there is no colon. We could also say that
+ // everything is the scheme. Both would produce an invalid URL, but this way
+ // seems less wrong in more cases.
+ parsed->scheme.reset();
+ after_scheme = begin;
+ }
+ DoParseAfterScheme(spec, spec_len, after_scheme, parsed);
+}
+
+template<typename CHAR>
void DoParseFileSystemURL(const CHAR* spec, int spec_len, Parsed* parsed) {
DCHECK(spec_len >= 0);
@@ -428,29 +451,6 @@
parsed->inner_parsed()->path.len = new_inner_path_length;
}
-// The main parsing function for standard URLs. Standard URLs have a scheme,
-// host, path, etc.
-template<typename CHAR>
-void DoParseStandardURL(const CHAR* spec, int spec_len, Parsed* parsed) {
- DCHECK(spec_len >= 0);
-
- // Strip leading & trailing spaces and control characters.
- int begin = 0;
- TrimURL(spec, &begin, &spec_len);
-
- int after_scheme;
- if (DoExtractScheme(spec, spec_len, &parsed->scheme)) {
- after_scheme = parsed->scheme.end() + 1; // Skip past the colon.
- } else {
- // Say there's no scheme when there is no colon. We could also say that
- // everything is the scheme. Both would produce an invalid URL, but this way
- // seems less wrong in more cases.
- parsed->scheme.reset();
- after_scheme = begin;
- }
- DoParseAfterScheme(spec, spec_len, after_scheme, parsed);
-}
-
// Initializes a path URL which is merely a scheme followed by a path. Examples
// include "about:foo" and "javascript:alert('bar');"
template<typename CHAR>
« no previous file with comments | « src/url_canon_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698