Closed GoogleCodeExporter closed 9 years ago
Looks good except for the following:
+bool CefParseURL(const CefString& url,
+ CefURLParts& parts)
+{
+ GURL gurl(url.ToString());
+ if (!gurl.is_valid())
+ return false;
+
+ cef_string_copy(UTF8ToWide(gurl.host()).c_str(), gurl.host().length(),
+ &parts.host);
+ cef_string_copy(UTF8ToWide(gurl.path()).c_str(), gurl.path().length(),
+ &parts.path);
+ cef_string_copy(UTF8ToWide(gurl.query()).c_str(), gurl.query().length(),
+ &parts.query);
+ cef_string_copy(UTF8ToWide(gurl.scheme()).c_str(), gurl.scheme().length(),
+ &parts.scheme);
+ cef_string_copy(UTF8ToWide(gurl.spec()).c_str(), gurl.spec().length(),
+ &parts.spec);
+
+ return true;
+}
We can't assume that the CefString underlying type will be wide. Instead, use
this approach to wrap each of the CefURLParts members and perform automatic
type conversion if needed:
CefString hostStr(&parts.host);
hostStr = gurl.host();
Original comment by magreenb...@gmail.com
on 31 Jan 2011 at 5:50
Thanks for the tip, I didn't realize I could associate the CefString and
cef_string_t like that. I've attached a new patch with that change.
Original comment by emerick
on 31 Jan 2011 at 6:18
Attachments:
Committed as revision 177 with support for additional URL components (username,
password, port) and a unit test.
Original comment by magreenb...@gmail.com
on 31 Jan 2011 at 8:48
Original issue reported on code.google.com by
emerick
on 31 Jan 2011 at 5:23Attachments: