diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 21:19:45 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-18 21:19:45 +0000 |
commit | 318076b4adca3868e0f2438953e69f2ce2d6336f (patch) | |
tree | 98d4c5d4a5442c86c526cca6538a099de4f04360 | |
parent | 3c9185a2ddfbe06f42d0aca50d1a6e33b3ed3a8b (diff) | |
download | chromium_src-318076b4adca3868e0f2438953e69f2ce2d6336f.zip chromium_src-318076b4adca3868e0f2438953e69f2ce2d6336f.tar.gz chromium_src-318076b4adca3868e0f2438953e69f2ce2d6336f.tar.bz2 |
url: Build it as a static library.
This is temporary just to avoid weird link issues in Windows XP.
- Update the gyp file.
- Rename the gyp file from googleurl.gyp to url.gyp, so it matches the directory
name.
- Update the header include paths.
- Update the header include guards.
- Rename the target name from googleurl to url and googleurl_unittests to
url_unittests.
- Remove GURL_API (this will be replaced by URL_EXPORT when we componentize it again).
- Remove url_common.h (will be replaced by url_export.h when we componentize it again).
BUG=229660
TEST=url_unittests
R=brettw@chromium.org
Review URL: https://codereview.chromium.org/13998025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195005 0039d316-1c4b-4281-b951-d872f2087c98
37 files changed, 648 insertions, 716 deletions
diff --git a/url/googleurl.gyp b/url/googleurl.gyp deleted file mode 100644 index 2f6f89a..0000000 --- a/url/googleurl.gyp +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# TODO(mark): Upstream this file to googleurl. -{ - 'variables': { - 'chromium_code': 1, - }, - 'targets': [ - { - 'target_name': 'googleurl', - 'type': '<(component)', - 'dependencies': [ - '../../base/base.gyp:base', - '../../third_party/icu/icu.gyp:icudata', - '../../third_party/icu/icu.gyp:icui18n', - '../../third_party/icu/icu.gyp:icuuc', - ], - 'sources': [ - '../../googleurl/src/gurl.cc', - '../../googleurl/src/gurl.h', - '../../googleurl/src/url_canon.h', - '../../googleurl/src/url_canon_etc.cc', - '../../googleurl/src/url_canon_fileurl.cc', - '../../googleurl/src/url_canon_filesystemurl.cc', - '../../googleurl/src/url_canon_host.cc', - '../../googleurl/src/url_canon_icu.cc', - '../../googleurl/src/url_canon_icu.h', - '../../googleurl/src/url_canon_internal.cc', - '../../googleurl/src/url_canon_internal.h', - '../../googleurl/src/url_canon_internal_file.h', - '../../googleurl/src/url_canon_ip.cc', - '../../googleurl/src/url_canon_ip.h', - '../../googleurl/src/url_canon_mailtourl.cc', - '../../googleurl/src/url_canon_path.cc', - '../../googleurl/src/url_canon_pathurl.cc', - '../../googleurl/src/url_canon_query.cc', - '../../googleurl/src/url_canon_relative.cc', - '../../googleurl/src/url_canon_stdstring.h', - '../../googleurl/src/url_canon_stdurl.cc', - '../../googleurl/src/url_file.h', - '../../googleurl/src/url_parse.cc', - '../../googleurl/src/url_parse.h', - '../../googleurl/src/url_parse_file.cc', - '../../googleurl/src/url_parse_internal.h', - '../../googleurl/src/url_util.cc', - '../../googleurl/src/url_util.h', - ], - 'direct_dependent_settings': { - 'include_dirs': [ - '../..', - ], - }, - 'defines': [ - 'FULL_FILESYSTEM_URL_SUPPORT=1', - ], - 'conditions': [ - ['component=="shared_library"', { - 'defines': [ - 'GURL_DLL', - 'GURL_IMPLEMENTATION=1', - ], - 'direct_dependent_settings': { - 'defines': [ - 'GURL_DLL', - ], - }, - }], - ], - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - 'msvs_disabled_warnings': [4267, ], - }, - { - 'target_name': 'googleurl_unittests', - 'type': 'executable', - 'dependencies': [ - 'googleurl', - '../../base/base.gyp:base_i18n', - '../../base/base.gyp:run_all_unittests', - '../../testing/gtest.gyp:gtest', - '../../third_party/icu/icu.gyp:icuuc', - ], - 'sources': [ - '../../googleurl/src/gurl_unittest.cc', - '../../googleurl/src/url_canon_unittest.cc', - '../../googleurl/src/url_parse_unittest.cc', - '../../googleurl/src/url_test_utils.h', - '../../googleurl/src/url_util_unittest.cc', - ], - 'defines': [ - 'FULL_FILESYSTEM_URL_SUPPORT=1', - ], - 'conditions': [ - ['os_posix==1 and OS!="mac" and OS!="ios"', { - 'conditions': [ - ['linux_use_tcmalloc==1', { - 'dependencies': [ - '../../base/allocator/allocator.gyp:allocator', - ], - }], - ], - }], - ], - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - 'msvs_disabled_warnings': [4267, ], - }, - ], -} diff --git a/url/gurl.cc b/url/gurl.cc index 05f65da..1a87017 100644 --- a/url/gurl.cc +++ b/url/gurl.cc @@ -36,11 +36,11 @@ #include <algorithm> #include <ostream> -#include "googleurl/src/gurl.h" +#include "url/gurl.h" #include "base/logging.h" -#include "googleurl/src/url_canon_stdstring.h" -#include "googleurl/src/url_util.h" +#include "url/url_canon_stdstring.h" +#include "url/url_util.h" namespace { @@ -27,17 +27,16 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLEURL_SRC_GURL_H__ -#define GOOGLEURL_SRC_GURL_H__ +#ifndef URL_GURL_H_ +#define URL_GURL_H_ #include <iosfwd> #include <string> #include "base/string16.h" -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_stdstring.h" -#include "googleurl/src/url_common.h" -#include "googleurl/src/url_parse.h" +#include "url/url_canon.h" +#include "url/url_canon_stdstring.h" +#include "url/url_parse.h" class GURL { public: @@ -45,11 +44,11 @@ class GURL { typedef url_canon::StdStringReplacements<string16> ReplacementsW; // Creates an empty, invalid URL. - GURL_API GURL(); + GURL(); // Copy construction is relatively inexpensive, with most of the time going // to reallocating the string. It does not re-parse. - GURL_API GURL(const GURL& other); + GURL(const GURL& other); // The narrow version requires the input be UTF-8. Invalid UTF-8 input will // result in an invalid URL. @@ -58,20 +57,20 @@ class GURL { // encode the query parameters. It is probably sufficient for the narrow // version to assume the query parameter encoding should be the same as the // input encoding. - GURL_API explicit GURL(const std::string& url_string - /*, output_param_encoding*/); - GURL_API explicit GURL(const string16& url_string - /*, output_param_encoding*/); + explicit GURL(const std::string& url_string + /*, output_param_encoding*/); + explicit GURL(const string16& url_string + /*, output_param_encoding*/); // Constructor for URLs that have already been parsed and canonicalized. This // is used for conversions from KURL, for example. The caller must supply all // information associated with the URL, which must be correct and consistent. - GURL_API GURL(const char* canonical_spec, size_t canonical_spec_len, - const url_parse::Parsed& parsed, bool is_valid); + GURL(const char* canonical_spec, size_t canonical_spec_len, + const url_parse::Parsed& parsed, bool is_valid); - GURL_API ~GURL(); + ~GURL(); - GURL_API GURL& operator=(const GURL& other); + GURL& operator=(const GURL& other); // Returns true when this object represents a valid parsed URL. When not // valid, other functions will still succeed, but you will not get canonical @@ -103,7 +102,7 @@ class GURL { // Used invalid_spec() below to get the unusable spec of an invalid URL. This // separation is designed to prevent errors that may cause security problems // that could result from the mistaken use of an invalid URL. - GURL_API const std::string& spec() const; + const std::string& spec() const; // Returns the potentially invalid spec for a the URL. This spec MUST NOT be // modified or sent over the network. It is designed to be displayed in error @@ -155,8 +154,8 @@ class GURL { // // It is an error to resolve a URL relative to an invalid URL. The result // will be the empty URL. - GURL_API GURL Resolve(const std::string& relative) const; - GURL_API GURL Resolve(const string16& relative) const; + GURL Resolve(const std::string& relative) const; + GURL Resolve(const string16& relative) const; // Like Resolve() above but takes a character set encoder which will be used // for any query text specified in the input. The charset converter parameter @@ -165,10 +164,10 @@ class GURL { // TODO(brettw): These should be replaced with versions that take something // more friendly than a raw CharsetConverter (maybe like an ICU character set // name). - GURL_API GURL ResolveWithCharsetConverter( + GURL ResolveWithCharsetConverter( const std::string& relative, url_canon::CharsetConverter* charset_converter) const; - GURL_API GURL ResolveWithCharsetConverter( + GURL ResolveWithCharsetConverter( const string16& relative, url_canon::CharsetConverter* charset_converter) const; @@ -183,9 +182,9 @@ class GURL { // // Note that we use the more general url_canon::Replacements type to give // callers extra flexibility rather than our override. - GURL_API GURL ReplaceComponents( + GURL ReplaceComponents( const url_canon::Replacements<char>& replacements) const; - GURL_API GURL ReplaceComponents( + GURL ReplaceComponents( const url_canon::Replacements<char16>& replacements) const; // A helper function that is equivalent to replacing the path with a slash @@ -197,7 +196,7 @@ class GURL { // // It is an error to get an empty path on an invalid URL. The result // will be the empty URL. - GURL_API GURL GetWithEmptyPath() const; + GURL GetWithEmptyPath() const; // A helper function to return a GURL containing just the scheme, host, // and port from a URL. Equivalent to clearing any username and password, @@ -208,19 +207,19 @@ class GURL { // // It is an error to get the origin of an invalid URL. The result // will be the empty URL. - GURL_API GURL GetOrigin() const; + GURL GetOrigin() const; // Returns true if the scheme for the current URL is a known "standard" // scheme. Standard schemes have an authority and a path section. This // includes file: and filesystem:, which some callers may want to filter out // explicitly by calling SchemeIsFile[System]. - GURL_API bool IsStandard() const; + bool IsStandard() const; // Returns true if the given parameter (should be lower-case ASCII to match // the canonicalized scheme) is the scheme for this URL. This call is more // efficient than getting the scheme and comparing it because no copies or // object constructions are done. - GURL_API bool SchemeIs(const char* lower_ascii_scheme) const; + bool SchemeIs(const char* lower_ascii_scheme) const; // We often need to know if this is a file URL. File URLs are "standard", but // are often treated separately by some programs. @@ -242,7 +241,7 @@ class GURL { // Returns true if the hostname is an IP address. Note: this function isn't // as cheap as a simple getter because it re-parses the hostname to verify. // This currently identifies only IPv4 addresses (bug 822685). - GURL_API bool HostIsIPAddress() const; + bool HostIsIPAddress() const; // Getters for various components of the URL. The returned string will be // empty if the component is empty or is not present. @@ -308,24 +307,24 @@ class GURL { // Returns a parsed version of the port. Can also be any of the special // values defined in Parsed for ExtractPort. - GURL_API int IntPort() const; + int IntPort() const; // Returns the port number of the url, or the default port number. // If the scheme has no concept of port (or unknown default) returns // PORT_UNSPECIFIED. - GURL_API int EffectiveIntPort() const; + int EffectiveIntPort() const; // Extracts the filename portion of the path and returns it. The filename // is everything after the last slash in the path. This may be empty. - GURL_API std::string ExtractFileName() const; + std::string ExtractFileName() const; // Returns the path that should be sent to the server. This is the path, // parameter, and query portions of the URL. It is guaranteed to be ASCII. - GURL_API std::string PathForRequest() const; + std::string PathForRequest() const; // Returns the host, excluding the square brackets surrounding IPv6 address // literals. This can be useful for passing to getaddrinfo(). - GURL_API std::string HostNoBrackets() const; + std::string HostNoBrackets() const; // Returns true if this URL's host matches or is in the same domain as // the given input string. For example if this URL was "www.google.com", @@ -337,7 +336,7 @@ class GURL { // // If function DomainIs has parameter domain_len, which means the parameter // lower_ascii_domain does not gurantee to terminate with NULL character. - GURL_API bool DomainIs(const char* lower_ascii_domain, int domain_len) const; + bool DomainIs(const char* lower_ascii_domain, int domain_len) const; // If function DomainIs only has parameter lower_ascii_domain, which means // domain string should be terminate with NULL character. @@ -348,12 +347,12 @@ class GURL { // Swaps the contents of this GURL object with the argument without doing // any memory allocations. - GURL_API void Swap(GURL* other); + void Swap(GURL* other); // Returns a reference to a singleton empty GURL. This object is for callers // who return references but don't have anything to return in some cases. // This function may be called from any thread. - GURL_API static const GURL& EmptyGURL(); + static const GURL& EmptyGURL(); // Returns the inner URL of a nested URL [currently only non-null for // filesystem: URLs]. @@ -387,6 +386,6 @@ class GURL { }; // Stream operator so GURL can be used in assertion statements. -GURL_API std::ostream& operator<<(std::ostream& out, const GURL& url); +std::ostream& operator<<(std::ostream& out, const GURL& url); -#endif // GOOGLEURL_SRC_GURL_H__ +#endif // URL_GURL_H_ diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc index 81177bd..cb289cb 100644 --- a/url/gurl_unittest.cc +++ b/url/gurl_unittest.cc @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "googleurl/src/gurl.h" -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" +#include "url/url_canon.h" +#include "url/url_test_utils.h" // Some implementations of base/basictypes.h may define ARRAYSIZE. // If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro diff --git a/url/url.gyp b/url/url.gyp new file mode 100644 index 0000000..4f86e5d --- /dev/null +++ b/url/url.gyp @@ -0,0 +1,99 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'targets': [ + { + 'target_name': 'url', + 'type': 'static_library', + 'dependencies': [ + '../base/base.gyp:base', + '../third_party/icu/icu.gyp:icudata', + '../third_party/icu/icu.gyp:icui18n', + '../third_party/icu/icu.gyp:icuuc', + ], + 'sources': [ + 'gurl.cc', + 'gurl.h', + 'url_canon.h', + 'url_canon_etc.cc', + 'url_canon_filesystemurl.cc', + 'url_canon_fileurl.cc', + 'url_canon_host.cc', + 'url_canon_icu.cc', + 'url_canon_icu.h', + 'url_canon_internal.cc', + 'url_canon_internal.h', + 'url_canon_internal_file.h', + 'url_canon_ip.cc', + 'url_canon_ip.h', + 'url_canon_mailtourl.cc', + 'url_canon_path.cc', + 'url_canon_pathurl.cc', + 'url_canon_query.cc', + 'url_canon_relative.cc', + 'url_canon_stdstring.h', + 'url_canon_stdurl.cc', + 'url_file.h', + 'url_parse.cc', + 'url_parse.h', + 'url_parse_file.cc', + 'url_parse_internal.h', + 'url_util.cc', + 'url_util.h', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '..', + ], + }, + 'defines': [ + 'FULL_FILESYSTEM_URL_SUPPORT=1', + ], + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + 'msvs_disabled_warnings': [4267, ], + }, + { + 'target_name': 'url_unittests', + 'type': 'executable', + 'dependencies': [ + '../base/base.gyp:base_i18n', + '../base/base.gyp:run_all_unittests', + '../testing/gtest.gyp:gtest', + '../third_party/icu/icu.gyp:icuuc', + 'url', + ], + 'sources': [ + 'gurl_unittest.cc', + 'url_canon_unittest.cc', + 'url_parse_unittest.cc', + 'url_test_utils.h', + 'url_util_unittest.cc', + ], + 'defines': [ + 'FULL_FILESYSTEM_URL_SUPPORT=1', + ], + 'conditions': [ + ['os_posix==1 and OS!="mac" and OS!="ios"', + { + 'conditions': [ + ['linux_use_tcmalloc==1', + { + 'dependencies': [ + '../base/allocator/allocator.gyp:allocator', + ], + } + ], + ], + } + ], + ], + # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. + 'msvs_disabled_warnings': [4267, ], + }, + ], +} diff --git a/url/url_canon.h b/url/url_canon.h index 00ae715..75aa805 100644 --- a/url/url_canon.h +++ b/url/url_canon.h @@ -26,15 +26,15 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLEURL_SRC_URL_CANON_H__ -#define GOOGLEURL_SRC_URL_CANON_H__ -#include <string.h> +#ifndef URL_URL_CANON_H_ +#define URL_URL_CANON_H_ + #include <stdlib.h> +#include <string.h> #include "base/string16.h" -#include "googleurl/src/url_common.h" -#include "googleurl/src/url_parse.h" +#include "url/url_parse.h" namespace url_canon { @@ -249,12 +249,12 @@ class CharsetConverter { // // Therefore, callers should not use the buffer, since it may actuall be empty, // use the computed pointer and |*output_len| instead. -GURL_API const char* RemoveURLWhitespace(const char* input, int input_len, - CanonOutputT<char>* buffer, - int* output_len); -GURL_API const char16* RemoveURLWhitespace(const char16* input, int input_len, - CanonOutputT<char16>* buffer, - int* output_len); +const char* RemoveURLWhitespace(const char* input, int input_len, + CanonOutputT<char>* buffer, + int* output_len); +const char16* RemoveURLWhitespace(const char16* input, int input_len, + CanonOutputT<char16>* buffer, + int* output_len); // IDN ------------------------------------------------------------------------ @@ -267,7 +267,7 @@ GURL_API const char16* RemoveURLWhitespace(const char16* input, int input_len, // the length of the output will be set to the length of the new host name. // // On error, returns false. The output in this case is undefined. -GURL_API bool IDNToASCII(const char16* src, int src_len, CanonOutputW* output); +bool IDNToASCII(const char16* src, int src_len, CanonOutputW* output); // Piece-by-piece canonicalizers ---------------------------------------------- // @@ -293,14 +293,14 @@ GURL_API bool IDNToASCII(const char16* src, int src_len, CanonOutputW* output); // URLs. // // The 8-bit version requires UTF-8 encoding. -GURL_API bool CanonicalizeScheme(const char* spec, - const url_parse::Component& scheme, - CanonOutput* output, - url_parse::Component* out_scheme); -GURL_API bool CanonicalizeScheme(const char16* spec, - const url_parse::Component& scheme, - CanonOutput* output, - url_parse::Component* out_scheme); +bool CanonicalizeScheme(const char* spec, + const url_parse::Component& scheme, + CanonOutput* output, + url_parse::Component* out_scheme); +bool CanonicalizeScheme(const char16* spec, + const url_parse::Component& scheme, + CanonOutput* output, + url_parse::Component* out_scheme); // User info: username/password. If present, this will add the delimiters so // the output will be "<username>:<password>@" or "<username>@". Empty @@ -312,20 +312,20 @@ GURL_API bool CanonicalizeScheme(const char16* spec, // is legal as long as the two components don't overlap. // // The 8-bit version requires UTF-8 encoding. -GURL_API bool CanonicalizeUserInfo(const char* username_source, - const url_parse::Component& username, - const char* password_source, - const url_parse::Component& password, - CanonOutput* output, - url_parse::Component* out_username, - url_parse::Component* out_password); -GURL_API bool CanonicalizeUserInfo(const char16* username_source, - const url_parse::Component& username, - const char16* password_source, - const url_parse::Component& password, - CanonOutput* output, - url_parse::Component* out_username, - url_parse::Component* out_password); +bool CanonicalizeUserInfo(const char* username_source, + const url_parse::Component& username, + const char* password_source, + const url_parse::Component& password, + CanonOutput* output, + url_parse::Component* out_username, + url_parse::Component* out_password); +bool CanonicalizeUserInfo(const char16* username_source, + const url_parse::Component& username, + const char16* password_source, + const url_parse::Component& password, + CanonOutput* output, + url_parse::Component* out_username, + url_parse::Component* out_password); // This structure holds detailed state exported from the IP/Host canonicalizers. @@ -378,27 +378,27 @@ struct CanonHostInfo { // // The 8-bit version requires UTF-8 encoding. Use this version when you only // need to know whether canonicalization succeeded. -GURL_API bool CanonicalizeHost(const char* spec, - const url_parse::Component& host, - CanonOutput* output, - url_parse::Component* out_host); -GURL_API bool CanonicalizeHost(const char16* spec, - const url_parse::Component& host, - CanonOutput* output, - url_parse::Component* out_host); +bool CanonicalizeHost(const char* spec, + const url_parse::Component& host, + CanonOutput* output, + url_parse::Component* out_host); +bool CanonicalizeHost(const char16* spec, + const url_parse::Component& host, + CanonOutput* output, + url_parse::Component* out_host); // Extended version of CanonicalizeHost, which returns additional information. // Use this when you need to know whether the hostname was an IP address. // A successful return is indicated by host_info->family != BROKEN. See the // definition of CanonHostInfo above for details. -GURL_API void CanonicalizeHostVerbose(const char* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); -GURL_API void CanonicalizeHostVerbose(const char16* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); +void CanonicalizeHostVerbose(const char* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); +void CanonicalizeHostVerbose(const char16* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); // IP addresses. @@ -411,34 +411,34 @@ GURL_API void CanonicalizeHostVerbose(const char16* spec, // This is called AUTOMATICALLY from the host canonicalizer, which ensures that // the input is unescaped and name-prepped, etc. It should not normally be // necessary or wise to call this directly. -GURL_API void CanonicalizeIPAddress(const char* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); -GURL_API void CanonicalizeIPAddress(const char16* spec, - const url_parse::Component& host, - CanonOutput* output, - CanonHostInfo* host_info); +void CanonicalizeIPAddress(const char* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); +void CanonicalizeIPAddress(const char16* spec, + const url_parse::Component& host, + CanonOutput* output, + CanonHostInfo* host_info); // Port: this function will add the colon for the port if a port is present. // The caller can pass url_parse::PORT_UNSPECIFIED as the // default_port_for_scheme argument if there is no default port. // // The 8-bit version requires UTF-8 encoding. -GURL_API bool CanonicalizePort(const char* spec, - const url_parse::Component& port, - int default_port_for_scheme, - CanonOutput* output, - url_parse::Component* out_port); -GURL_API bool CanonicalizePort(const char16* spec, - const url_parse::Component& port, - int default_port_for_scheme, - CanonOutput* output, - url_parse::Component* out_port); +bool CanonicalizePort(const char* spec, + const url_parse::Component& port, + int default_port_for_scheme, + CanonOutput* output, + url_parse::Component* out_port); +bool CanonicalizePort(const char16* spec, + const url_parse::Component& port, + int default_port_for_scheme, + CanonOutput* output, + url_parse::Component* out_port); // Returns the default port for the given canonical scheme, or PORT_UNSPECIFIED // if the scheme is unknown. -GURL_API int DefaultPortForScheme(const char* scheme, int scheme_len); +int DefaultPortForScheme(const char* scheme, int scheme_len); // Path. If the input does not begin in a slash (including if the input is // empty), we'll prepend a slash to the path to make it canonical. @@ -449,14 +449,14 @@ GURL_API int DefaultPortForScheme(const char* scheme, int scheme_len); // an issue. Somebody giving us an 8-bit path is responsible for generating // the path that the server expects (we'll escape high-bit characters), so // if something is invalid, it's their problem. -GURL_API bool CanonicalizePath(const char* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); -GURL_API bool CanonicalizePath(const char16* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); +bool CanonicalizePath(const char* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); +bool CanonicalizePath(const char16* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); // Canonicalizes the input as a file path. This is like CanonicalizePath except // that it also handles Windows drive specs. For example, the path can begin @@ -464,14 +464,14 @@ GURL_API bool CanonicalizePath(const char16* spec, // The string will be appended to |*output| and |*out_path| will be updated. // // The 8-bit version requires UTF-8 encoding. -GURL_API bool FileCanonicalizePath(const char* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); -GURL_API bool FileCanonicalizePath(const char16* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); +bool FileCanonicalizePath(const char* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); +bool FileCanonicalizePath(const char16* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); // Query: Prepends the ? if needed. // @@ -485,16 +485,16 @@ GURL_API bool FileCanonicalizePath(const char16* spec, // if necessary, for ASCII input, no conversions are necessary. // // The converter can be NULL. In this case, the output encoding will be UTF-8. -GURL_API void CanonicalizeQuery(const char* spec, - const url_parse::Component& query, - CharsetConverter* converter, - CanonOutput* output, - url_parse::Component* out_query); -GURL_API void CanonicalizeQuery(const char16* spec, - const url_parse::Component& query, - CharsetConverter* converter, - CanonOutput* output, - url_parse::Component* out_query); +void CanonicalizeQuery(const char* spec, + const url_parse::Component& query, + CharsetConverter* converter, + CanonOutput* output, + url_parse::Component* out_query); +void CanonicalizeQuery(const char16* spec, + const url_parse::Component& query, + CharsetConverter* converter, + CanonOutput* output, + url_parse::Component* out_query); // Ref: Prepends the # if needed. The output will be UTF-8 (this is the only // canonicalizer that does not produce ASCII output). The output is @@ -502,14 +502,14 @@ GURL_API void CanonicalizeQuery(const char16* spec, // // This function will not fail. If the input is invalid UTF-8/UTF-16, we'll use // the "Unicode replacement character" for the confusing bits and copy the rest. -GURL_API void CanonicalizeRef(const char* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); -GURL_API void CanonicalizeRef(const char16* spec, - const url_parse::Component& path, - CanonOutput* output, - url_parse::Component* out_path); +void CanonicalizeRef(const char* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); +void CanonicalizeRef(const char16* spec, + const url_parse::Component& path, + CanonOutput* output, + url_parse::Component* out_path); // Full canonicalizer --------------------------------------------------------- // @@ -522,75 +522,75 @@ GURL_API void CanonicalizeRef(const char16* spec, // The 8-bit versions require UTF-8 encoding. // Use for standard URLs with authorities and paths. -GURL_API bool CanonicalizeStandardURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool CanonicalizeStandardURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool CanonicalizeStandardURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool CanonicalizeStandardURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for file URLs. -GURL_API bool CanonicalizeFileURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool CanonicalizeFileURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool CanonicalizeFileURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool CanonicalizeFileURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for filesystem URLs. -GURL_API bool CanonicalizeFileSystemURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool CanonicalizeFileSystemURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool CanonicalizeFileSystemURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool CanonicalizeFileSystemURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for path URLs such as javascript. This does not modify the path in any // way, for example, by escaping it. -GURL_API bool CanonicalizePathURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool CanonicalizePathURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool CanonicalizePathURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool CanonicalizePathURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Use for mailto URLs. This "canonicalizes" the url into a path and query // component. It does not attempt to merge "to" fields. It uses UTF-8 for // the query encoding if there is a query. This is because a mailto URL is // really intended for an external mail program, and the encoding of a page, // etc. which would influence a query encoding normally are irrelevant. -GURL_API bool CanonicalizeMailtoURL(const char* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool CanonicalizeMailtoURL(const char16* spec, - int spec_len, - const url_parse::Parsed& parsed, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool CanonicalizeMailtoURL(const char* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool CanonicalizeMailtoURL(const char16* spec, + int spec_len, + const url_parse::Parsed& parsed, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Part replacer -------------------------------------------------------------- @@ -775,74 +775,74 @@ class Replacements { }; // The base must be an 8-bit canonical URL. -GURL_API bool ReplaceStandardURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool ReplaceStandardURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool ReplaceStandardURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool ReplaceStandardURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Filesystem URLs can only have the path, query, or ref replaced. // All other components will be ignored. -GURL_API bool ReplaceFileSystemURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool ReplaceFileSystemURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool ReplaceFileSystemURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool ReplaceFileSystemURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Replacing some parts of a file URL is not permitted. Everything except // the host, path, query, and ref will be ignored. -GURL_API bool ReplaceFileURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool ReplaceFileURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool ReplaceFileURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool ReplaceFileURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Path URLs can only have the scheme and path replaced. All other components // will be ignored. -GURL_API bool ReplacePathURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool ReplacePathURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool ReplacePathURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool ReplacePathURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Mailto URLs can only have the scheme, path, and query replaced. // All other components will be ignored. -GURL_API bool ReplaceMailtoURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); -GURL_API bool ReplaceMailtoURL(const char* base, - const url_parse::Parsed& base_parsed, - const Replacements<char16>& replacements, - CanonOutput* output, - url_parse::Parsed* new_parsed); +bool ReplaceMailtoURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); +bool ReplaceMailtoURL(const char* base, + const url_parse::Parsed& base_parsed, + const Replacements<char16>& replacements, + CanonOutput* output, + url_parse::Parsed* new_parsed); // Relative URL --------------------------------------------------------------- @@ -857,20 +857,20 @@ GURL_API bool ReplaceMailtoURL(const char* base, // not). Failure means that the combination of URLs doesn't make any sense. // // The base URL should always be canonical, therefore is ASCII. -GURL_API bool IsRelativeURL(const char* base, - const url_parse::Parsed& base_parsed, - const char* fragment, - int fragment_len, - bool is_base_hierarchical, - bool* is_relative, - url_parse::Component* relative_component); -GURL_API bool IsRelativeURL(const char* base, - const url_parse::Parsed& base_parsed, - const char16* fragment, - int fragment_len, - bool is_base_hierarchical, - bool* is_relative, - url_parse::Component* relative_component); +bool IsRelativeURL(const char* base, + const url_parse::Parsed& base_parsed, + const char* fragment, + int fragment_len, + bool is_base_hierarchical, + bool* is_relative, + url_parse::Component* relative_component); +bool IsRelativeURL(const char* base, + const url_parse::Parsed& base_parsed, + const char16* fragment, + int fragment_len, + bool is_base_hierarchical, + bool* is_relative, + url_parse::Component* relative_component); // Given a canonical parsed source URL, a URL fragment known to be relative, // and the identified relevant portion of the relative URL (computed by @@ -890,23 +890,23 @@ GURL_API bool IsRelativeURL(const char* base, // Returns true on success. On failure, the output will be "something // reasonable" that will be consistent and valid, just probably not what // was intended by the web page author or caller. -GURL_API bool ResolveRelativeURL(const char* base_url, - const url_parse::Parsed& base_parsed, - bool base_is_file, - const char* relative_url, - const url_parse::Component& relative_component, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* out_parsed); -GURL_API bool ResolveRelativeURL(const char* base_url, - const url_parse::Parsed& base_parsed, - bool base_is_file, - const char16* relative_url, - const url_parse::Component& relative_component, - CharsetConverter* query_converter, - CanonOutput* output, - url_parse::Parsed* out_parsed); +bool ResolveRelativeURL(const char* base_url, + const url_parse::Parsed& base_parsed, + bool base_is_file, + const char* relative_url, + const url_parse::Component& relative_component, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* out_parsed); +bool ResolveRelativeURL(const char* base_url, + const url_parse::Parsed& base_parsed, + bool base_is_file, + const char16* relative_url, + const url_parse::Component& relative_component, + CharsetConverter* query_converter, + CanonOutput* output, + url_parse::Parsed* out_parsed); } // namespace url_canon -#endif // GOOGLEURL_SRC_URL_CANON_H__ +#endif // URL_URL_CANON_H_ diff --git a/url/url_canon_etc.cc b/url/url_canon_etc.cc index 318c906..65c0678 100644 --- a/url/url_canon_etc.cc +++ b/url/url_canon_etc.cc @@ -31,8 +31,8 @@ #include <string.h> -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" namespace url_canon { diff --git a/url/url_canon_filesystemurl.cc b/url/url_canon_filesystemurl.cc index 7f79208..f00b653 100644 --- a/url/url_canon_filesystemurl.cc +++ b/url/url_canon_filesystemurl.cc @@ -29,12 +29,12 @@ // Functions for canonicalizing "filesystem:file:" URLs. -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" -#include "googleurl/src/url_file.h" -#include "googleurl/src/url_parse_internal.h" -#include "googleurl/src/url_util.h" -#include "googleurl/src/url_util_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" +#include "url/url_file.h" +#include "url/url_parse_internal.h" +#include "url/url_util.h" +#include "url/url_util_internal.h" namespace url_canon { diff --git a/url/url_canon_fileurl.cc b/url/url_canon_fileurl.cc index 97023eb..7d83df8 100644 --- a/url/url_canon_fileurl.cc +++ b/url/url_canon_fileurl.cc @@ -29,10 +29,10 @@ // Functions for canonicalizing "file:" URLs. -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" -#include "googleurl/src/url_file.h" -#include "googleurl/src/url_parse_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" +#include "url/url_file.h" +#include "url/url_parse_internal.h" namespace url_canon { diff --git a/url/url_canon_host.cc b/url/url_canon_host.cc index 6642004..f4c837d 100644 --- a/url/url_canon_host.cc +++ b/url/url_canon_host.cc @@ -28,8 +28,8 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "base/logging.h" -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" namespace url_canon { diff --git a/url/url_canon_icu.cc b/url/url_canon_icu.cc index eaae643..028b995 100644 --- a/url/url_canon_icu.cc +++ b/url/url_canon_icu.cc @@ -35,10 +35,9 @@ #include <unicode/ucnv_cb.h> #include <unicode/uidna.h> -#include "googleurl/src/url_canon_icu.h" -#include "googleurl/src/url_canon_internal.h" // for _itoa_s - #include "base/logging.h" +#include "url/url_canon_icu.h" +#include "url/url_canon_internal.h" // for _itoa_s namespace url_canon { diff --git a/url/url_canon_icu.h b/url/url_canon_icu.h index e529fcb..3984fa2 100644 --- a/url/url_canon_icu.h +++ b/url/url_canon_icu.h @@ -27,12 +27,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// ICU integration functions. +#ifndef URL_URL_CANON_ICU_H_ +#define URL_URL_CANON_ICU_H_ -#ifndef GOOGLEURL_SRC_URL_CANON_ICU_H__ -#define GOOGLEURL_SRC_URL_CANON_ICU_H__ +// ICU integration functions. -#include "googleurl/src/url_canon.h" +#include "url/url_canon.h" typedef struct UConverter UConverter; @@ -45,13 +45,13 @@ class ICUCharsetConverter : public CharsetConverter { // Constructs a converter using an already-existing ICU character set // converter. This converter is NOT owned by this object; the lifetime must // be managed by the creator such that it is alive as long as this is. - GURL_API ICUCharsetConverter(UConverter* converter); + ICUCharsetConverter(UConverter* converter); - GURL_API virtual ~ICUCharsetConverter(); + virtual ~ICUCharsetConverter(); - GURL_API virtual void ConvertFromUTF16(const char16* input, - int input_len, - CanonOutput* output); + virtual void ConvertFromUTF16(const char16* input, + int input_len, + CanonOutput* output); private: // The ICU converter, not owned by this class. @@ -60,4 +60,4 @@ class ICUCharsetConverter : public CharsetConverter { } // namespace url_canon -#endif // GOOGLEURL_SRC_URL_CANON_ICU_H__ +#endif // URL_URL_CANON_ICU_H_ diff --git a/url/url_canon_internal.cc b/url/url_canon_internal.cc index cd791bb..e74929b 100644 --- a/url/url_canon_internal.cc +++ b/url/url_canon_internal.cc @@ -27,12 +27,13 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include <cstdio> #include <errno.h> #include <stdlib.h> + +#include <cstdio> #include <string> -#include "googleurl/src/url_canon_internal.h" +#include "url/url_canon_internal.h" namespace url_canon { diff --git a/url/url_canon_internal.h b/url/url_canon_internal.h index 9165398..30ad369 100644 --- a/url/url_canon_internal.h +++ b/url/url_canon_internal.h @@ -27,18 +27,18 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#ifndef URL_URL_CANON_INTERNAL_H_ +#define URL_URL_CANON_INTERNAL_H_ + // This file is intended to be included in another C++ file where the character // types are defined. This allows us to write mostly generic code, but not have // templace bloat because everything is inlined when anybody calls any of our // functions. -#ifndef GOOGLEURL_SRC_URL_CANON_INTERNAL_H__ -#define GOOGLEURL_SRC_URL_CANON_INTERNAL_H__ - #include <stdlib.h> #include "base/logging.h" -#include "googleurl/src/url_canon.h" +#include "url/url_canon.h" namespace url_canon { @@ -108,7 +108,7 @@ void AppendStringOfType(const char16* source, int length, // Maps the hex numerical values 0x0 to 0xf to the corresponding ASCII digit // that will be used to represent it. -GURL_API extern const char kHexCharLookup[0x10]; +extern const char kHexCharLookup[0x10]; // This lookup table allows fast conversion between ASCII hex letters and their // corresponding numerical value. The 8-bit range is divided up into 8 @@ -175,8 +175,8 @@ extern const char16 kUnicodeReplacementCharacter; // (for a single-byte ASCII character, it will not be changed). // // Implementation is in url_canon_icu.cc. -GURL_API bool ReadUTFChar(const char* str, int* begin, int length, - unsigned* code_point_out); +bool ReadUTFChar(const char* str, int* begin, int length, + unsigned* code_point_out); // Generic To-UTF-8 converter. This will call the given append method for each // character that should be appended, with the given output method. Wrappers @@ -252,8 +252,8 @@ inline void AppendUTF8EscapedValue(unsigned char_value, CanonOutput* output) { // (for a single-16-bit-word character, it will not be changed). // // Implementation is in url_canon_icu.cc. -GURL_API bool ReadUTFChar(const char16* str, int* begin, int length, - unsigned* code_point); +bool ReadUTFChar(const char16* str, int* begin, int length, + unsigned* code_point); // Equivalent to U16_APPEND_UNSAFE in ICU but uses our output method. inline void AppendUTF16Value(unsigned code_point, @@ -371,10 +371,10 @@ void AppendInvalidNarrowString(const char16* spec, int begin, int end, // replacing the invalid characters with the "invalid character". It will // return false in the failure case, and the caller should not continue as // normal. -GURL_API bool ConvertUTF16ToUTF8(const char16* input, int input_len, - CanonOutput* output); -GURL_API bool ConvertUTF8ToUTF16(const char* input, int input_len, - CanonOutputT<char16>* output); +bool ConvertUTF16ToUTF8(const char16* input, int input_len, + CanonOutput* output); +bool ConvertUTF8ToUTF16(const char* input, int input_len, + CanonOutputT<char16>* output); // Converts from UTF-16 to 8-bit using the character set converter. If the // converter is NULL, this will use UTF-8. @@ -433,9 +433,9 @@ bool CanonicalizePartialPath(const char16* spec, #ifndef WIN32 // Implementations of Windows' int-to-string conversions -GURL_API int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix); -GURL_API int _itow_s(int value, char16* buffer, size_t size_in_chars, - int radix); +int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix); +int _itow_s(int value, char16* buffer, size_t size_in_chars, + int radix); // Secure template overloads for these functions template<size_t N> @@ -458,4 +458,4 @@ inline unsigned long long _strtoui64(const char* nptr, } // namespace url_canon -#endif // GOOGLEURL_SRC_URL_CANON_INTERNAL_H__ +#endif // URL_URL_CANON_INTERNAL_H_ diff --git a/url/url_canon_internal_file.h b/url/url_canon_internal_file.h index 63a9c5b..43b1402 100644 --- a/url/url_canon_internal_file.h +++ b/url/url_canon_internal_file.h @@ -27,6 +27,9 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#ifndef URL_URL_CANON_INTERNAL_FILE_H_ +#define URL_URL_CANON_INTERNAL_FILE_H_ + // As with url_canon_internal.h, this file is intended to be included in // another C++ file where the template types are defined. This allows the // programmer to use this to use these functions for their own strings @@ -36,11 +39,9 @@ // *** This file must be included after url_canon_internal as we depend on some // functions in it. *** -#ifndef GOOGLEURL_SRC_URL_CANON_INTERNAL_FILE_H__ -#define GOOGLEURL_SRC_URL_CANON_INTERNAL_FILE_H__ -#include "googleurl/src/url_file.h" -#include "googleurl/src/url_parse_internal.h" +#include "url/url_file.h" +#include "url/url_parse_internal.h" using namespace url_canon; @@ -154,4 +155,4 @@ static bool DoCanonicalizeFileURL(const URLComponentSource<CHAR>& source, return success; } -#endif // GOOGLEURL_SRC_URL_CANON_INTERNAL_FILE_H__ +#endif // URL_URL_CANON_INTERNAL_FILE_H_ diff --git a/url/url_canon_ip.cc b/url/url_canon_ip.cc index 1421e79..cd6e17d 100644 --- a/url/url_canon_ip.cc +++ b/url/url_canon_ip.cc @@ -27,13 +27,13 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "googleurl/src/url_canon_ip.h" +#include "url/url_canon_ip.h" #include <stdlib.h> #include "base/basictypes.h" #include "base/logging.h" -#include "googleurl/src/url_canon_internal.h" +#include "url/url_canon_internal.h" namespace url_canon { diff --git a/url/url_canon_ip.h b/url/url_canon_ip.h index a2900c6..6ebab91 100644 --- a/url/url_canon_ip.h +++ b/url/url_canon_ip.h @@ -27,23 +27,22 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLEURL_SRC_URL_CANON_IP_H__ -#define GOOGLEURL_SRC_URL_CANON_IP_H__ +#ifndef URL_URL_CANON_IP_H_ +#define URL_URL_CANON_IP_H_ #include "base/string16.h" -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_common.h" -#include "googleurl/src/url_parse.h" +#include "url/url_canon.h" +#include "url/url_parse.h" namespace url_canon { // Writes the given IPv4 address to |output|. -GURL_API void AppendIPv4Address(const unsigned char address[4], - CanonOutput* output); +void AppendIPv4Address(const unsigned char address[4], + CanonOutput* output); // Writes the given IPv6 address to |output|. -GURL_API void AppendIPv6Address(const unsigned char address[16], - CanonOutput* output); +void AppendIPv6Address(const unsigned char address[16], + CanonOutput* output); // Searches the host name for the portions of the IPv4 address. On success, // each component will be placed into |components| and it will return true. @@ -63,11 +62,11 @@ GURL_API void AppendIPv6Address(const unsigned char address[16], // Mozilla), so this code path never gets hit. Our host canonicalization will // notice these spaces and escape them, which will make IP address finding // fail. This seems like better behavior than stripping after a space. -GURL_API bool FindIPv4Components(const char* spec, - const url_parse::Component& host, +bool FindIPv4Components(const char* spec, + const url_parse::Component& host, url_parse::Component components[4]); -GURL_API bool FindIPv4Components(const char16* spec, - const url_parse::Component& host, +bool FindIPv4Components(const char16* spec, + const url_parse::Component& host, url_parse::Component components[4]); // Converts an IPv4 address to a 32-bit number (network byte order). @@ -81,12 +80,12 @@ GURL_API bool FindIPv4Components(const char16* spec, // // On success, |num_ipv4_components| will be populated with the number of // components in the IPv4 address. -GURL_API CanonHostInfo::Family IPv4AddressToNumber( +CanonHostInfo::Family IPv4AddressToNumber( const char* spec, const url_parse::Component& host, unsigned char address[4], int* num_ipv4_components); -GURL_API CanonHostInfo::Family IPv4AddressToNumber( +CanonHostInfo::Family IPv4AddressToNumber( const char16* spec, const url_parse::Component& host, unsigned char address[4], @@ -97,13 +96,13 @@ GURL_API CanonHostInfo::Family IPv4AddressToNumber( // // NOTE that |host| is expected to be surrounded by square brackets. // i.e. "[::1]" rather than "::1". -GURL_API bool IPv6AddressToNumber(const char* spec, - const url_parse::Component& host, - unsigned char address[16]); -GURL_API bool IPv6AddressToNumber(const char16* spec, - const url_parse::Component& host, - unsigned char address[16]); +bool IPv6AddressToNumber(const char* spec, + const url_parse::Component& host, + unsigned char address[16]); +bool IPv6AddressToNumber(const char16* spec, + const url_parse::Component& host, + unsigned char address[16]); } // namespace url_canon -#endif // GOOGLEURL_SRC_URL_CANON_IP_H__ +#endif // URL_URL_CANON_IP_H_ diff --git a/url/url_canon_mailtourl.cc b/url/url_canon_mailtourl.cc index 97868b8..a23f901 100644 --- a/url/url_canon_mailtourl.cc +++ b/url/url_canon_mailtourl.cc @@ -29,10 +29,10 @@ // Functions for canonicalizing "mailto:" URLs. -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" -#include "googleurl/src/url_file.h" -#include "googleurl/src/url_parse_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" +#include "url/url_file.h" +#include "url/url_parse_internal.h" namespace url_canon { diff --git a/url/url_canon_path.cc b/url/url_canon_path.cc index d86643a..8edd5b9 100644 --- a/url/url_canon_path.cc +++ b/url/url_canon_path.cc @@ -29,9 +29,9 @@ // Canonicalization functions for the paths of URLs. #include "base/logging.h" -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" -#include "googleurl/src/url_parse_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" +#include "url/url_parse_internal.h" namespace url_canon { diff --git a/url/url_canon_pathurl.cc b/url/url_canon_pathurl.cc index 4a990c7..21469508 100644 --- a/url/url_canon_pathurl.cc +++ b/url/url_canon_pathurl.cc @@ -31,8 +31,8 @@ // of a URL, these are URLs that have no authority section, only a path. For // example, "javascript:" and "data:". -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" namespace url_canon { diff --git a/url/url_canon_query.cc b/url/url_canon_query.cc index cee8774..e7fb7e6 100644 --- a/url/url_canon_query.cc +++ b/url/url_canon_query.cc @@ -27,8 +27,8 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" // Query canonicalization in IE // ---------------------------- diff --git a/url/url_canon_relative.cc b/url/url_canon_relative.cc index 63630b4..08e7c25 100644 --- a/url/url_canon_relative.cc +++ b/url/url_canon_relative.cc @@ -30,11 +30,11 @@ // Canonicalizer functions for working with and resolving relative URLs. #include "base/logging.h" -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" -#include "googleurl/src/url_file.h" -#include "googleurl/src/url_parse_internal.h" -#include "googleurl/src/url_util_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" +#include "url/url_file.h" +#include "url/url_parse_internal.h" +#include "url/url_util_internal.h" namespace url_canon { diff --git a/url/url_canon_stdstring.h b/url/url_canon_stdstring.h index 21272e0..3829ac2 100644 --- a/url/url_canon_stdstring.h +++ b/url/url_canon_stdstring.h @@ -27,15 +27,16 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#ifndef URL_URL_CANON_STDSTRING_H_ +#define URL_URL_CANON_STDSTRING_H_ + // This header file defines a canonicalizer output method class for STL // strings. Because the canonicalizer tries not to be dependent on the STL, // we have segregated it here. -#ifndef GOOGLEURL_SRC_URL_CANON_STDSTRING_H__ -#define GOOGLEURL_SRC_URL_CANON_STDSTRING_H__ - #include <string> -#include "googleurl/src/url_canon.h" + +#include "url/url_canon.h" namespace url_canon { @@ -130,5 +131,4 @@ class StdStringReplacements : } // namespace url_canon -#endif // GOOGLEURL_SRC_URL_CANON_STDSTRING_H__ - +#endif // URL_URL_CANON_STDSTRING_H_ diff --git a/url/url_canon_stdurl.cc b/url/url_canon_stdurl.cc index 1e21a14..f7f1eaf 100644 --- a/url/url_canon_stdurl.cc +++ b/url/url_canon_stdurl.cc @@ -30,8 +30,8 @@ // Functions to canonicalize "standard" URLs, which are ones that have an // authority section including a host name. -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_internal.h" +#include "url/url_canon.h" +#include "url/url_canon_internal.h" namespace url_canon { diff --git a/url/url_canon_unittest.cc b/url/url_canon_unittest.cc index 0c57f55..55b349f 100644 --- a/url/url_canon_unittest.cc +++ b/url/url_canon_unittest.cc @@ -30,13 +30,13 @@ #include <errno.h> #include <unicode/ucnv.h> -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_icu.h" -#include "googleurl/src/url_canon_internal.h" -#include "googleurl/src/url_canon_stdstring.h" -#include "googleurl/src/url_parse.h" -#include "googleurl/src/url_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/url_canon.h" +#include "url/url_canon_icu.h" +#include "url/url_canon_internal.h" +#include "url/url_canon_stdstring.h" +#include "url/url_parse.h" +#include "url/url_test_utils.h" // Some implementations of base/basictypes.h may define ARRAYSIZE. // If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro diff --git a/url/url_common.h b/url/url_common.h deleted file mode 100644 index ac045a8..0000000 --- a/url/url_common.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2010, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef GOOGLEURL_SRC_URL_COMMON_H__ -#define GOOGLEURL_SRC_URL_COMMON_H__ - -#if !defined(GURL_IMPLEMENTATION) -#define GURL_IMPLEMENTATION 0 -#endif - -#if defined(GURL_DLL) -#if defined(WIN32) -#if GURL_IMPLEMENTATION -#define GURL_API __declspec(dllexport) -#else -#define GURL_API __declspec(dllimport) -#endif -#else -// Non-Windows DLLs. -#define GURL_API __attribute__((visibility("default"))) -#endif -#else -// Not a DLL. -#define GURL_API -#endif - -#endif // GOOGLEURL_SRC_URL_COMMON_H__ - diff --git a/url/url_file.h b/url/url_file.h index c1b8ac9..8a838dc 100644 --- a/url/url_file.h +++ b/url/url_file.h @@ -27,13 +27,13 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#ifndef URL_URL_FILE_H_ +#define URL_URL_FILE_H_ + // Provides shared functions used by the internals of the parser and // canonicalizer for file URLs. Do not use outside of these modules. -#ifndef GOOGLEURL_SRC_URL_FILE_H__ -#define GOOGLEURL_SRC_URL_FILE_H__ - -#include "googleurl/src/url_parse_internal.h" +#include "url/url_parse_internal.h" namespace url_parse { @@ -105,4 +105,4 @@ inline bool DoesBeginUNCPath(const CHAR* text, } // namespace url_parse -#endif // GOOGLEURL_SRC_URL_FILE_H__ +#endif // URL_URL_FILE_H_ diff --git a/url/url_parse.cc b/url/url_parse.cc index b06f4bb..6b6af44 100644 --- a/url/url_parse.cc +++ b/url/url_parse.cc @@ -34,14 +34,14 @@ * * ***** END LICENSE BLOCK ***** */ -#include "googleurl/src/url_parse.h" +#include "url/url_parse.h" #include <stdlib.h> #include "base/logging.h" -#include "googleurl/src/url_parse_internal.h" -#include "googleurl/src/url_util.h" -#include "googleurl/src/url_util_internal.h" +#include "url/url_parse_internal.h" +#include "url/url_util.h" +#include "url/url_util_internal.h" namespace url_parse { diff --git a/url/url_parse.h b/url/url_parse.h index 3dbe98a..d1c3593 100644 --- a/url/url_parse.h +++ b/url/url_parse.h @@ -27,14 +27,13 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLEURL_SRC_URL_PARSE_H__ -#define GOOGLEURL_SRC_URL_PARSE_H__ +#ifndef URL_URL_PARSE_H_ +#define URL_URL_PARSE_H_ #include <string> #include "base/basictypes.h" #include "base/string16.h" -#include "googleurl/src/url_common.h" namespace url_parse { @@ -121,10 +120,10 @@ struct Parsed { // The default constructor is sufficient for the components, but inner_parsed_ // requires special handling. - GURL_API Parsed(); - GURL_API Parsed(const Parsed&); - GURL_API Parsed& operator=(const Parsed&); - GURL_API ~Parsed(); + Parsed(); + Parsed(const Parsed&); + Parsed& operator=(const Parsed&); + ~Parsed(); // Returns the length of the URL (the end of the last component). // @@ -132,7 +131,7 @@ struct Parsed { // of the string. For example "http://": the parsed structure will only // contain an entry for the four-character scheme, and it doesn't know about // the "://". For all other last-components, it will return the real length. - GURL_API int Length() const; + int Length() const; // Returns the number of characters before the given component if it exists, // or where the component would be if it did exist. This will return the @@ -160,8 +159,8 @@ struct Parsed { // *QUERY: 14 15 <- // *REF: 20 20 // - GURL_API int CountCharactersBefore(ComponentType type, - bool include_delimiter) const; + int CountCharactersBefore(ComponentType type, + bool include_delimiter) const; // Scheme without the colon: "http://foo"/ would have a scheme of "http". // The length will be -1 if no scheme is specified ("foo.com"), or 0 if there @@ -246,32 +245,32 @@ struct Parsed { // StandardURL is for when the scheme is known to be one that has an // authority (host) like "http". This function will not handle weird ones // like "about:" and "javascript:", or do the right thing for "file:" URLs. -GURL_API void ParseStandardURL(const char* url, int url_len, Parsed* parsed); -GURL_API void ParseStandardURL(const char16* url, int url_len, Parsed* parsed); +void ParseStandardURL(const char* url, int url_len, Parsed* parsed); +void ParseStandardURL(const char16* url, int url_len, Parsed* parsed); // PathURL is for when the scheme is known not to have an authority (host) // section but that aren't file URLs either. The scheme is parsed, and // everything after the scheme is considered as the path. This is used for // things like "about:" and "javascript:" -GURL_API void ParsePathURL(const char* url, int url_len, Parsed* parsed); -GURL_API void ParsePathURL(const char16* url, int url_len, Parsed* parsed); +void ParsePathURL(const char* url, int url_len, Parsed* parsed); +void ParsePathURL(const char16* url, int url_len, Parsed* parsed); // FileURL is for file URLs. There are some special rules for interpreting // these. -GURL_API void ParseFileURL(const char* url, int url_len, Parsed* parsed); -GURL_API void ParseFileURL(const char16* url, int url_len, Parsed* parsed); +void ParseFileURL(const char* url, int url_len, Parsed* parsed); +void ParseFileURL(const char16* url, int url_len, Parsed* parsed); // Filesystem URLs are structured differently than other URLs. -GURL_API void ParseFileSystemURL(const char* url, - int url_len, - Parsed* parsed); -GURL_API void ParseFileSystemURL(const char16* url, - int url_len, - Parsed* parsed); +void ParseFileSystemURL(const char* url, + int url_len, + Parsed* parsed); +void ParseFileSystemURL(const char16* url, + int url_len, + Parsed* parsed); // MailtoURL is for mailto: urls. They are made up scheme,path,query -GURL_API void ParseMailtoURL(const char* url, int url_len, Parsed* parsed); -GURL_API void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed); +void ParseMailtoURL(const char* url, int url_len, Parsed* parsed); +void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed); // Helper functions ----------------------------------------------------------- @@ -295,27 +294,27 @@ GURL_API void ParseMailtoURL(const char16* url, int url_len, Parsed* parsed); // end of the string). // // The 8-bit version requires UTF-8 encoding. -GURL_API bool ExtractScheme(const char* url, int url_len, Component* scheme); -GURL_API bool ExtractScheme(const char16* url, int url_len, Component* scheme); +bool ExtractScheme(const char* url, int url_len, Component* scheme); +bool ExtractScheme(const char16* url, int url_len, Component* scheme); // Returns true if ch is a character that terminates the authority segment // of a URL. -GURL_API bool IsAuthorityTerminator(char16 ch); +bool IsAuthorityTerminator(char16 ch); // Does a best effort parse of input |spec|, in range |auth|. If a particular // component is not found, it will be set to invalid. -GURL_API void ParseAuthority(const char* spec, - const Component& auth, - Component* username, - Component* password, - Component* hostname, - Component* port_num); -GURL_API void ParseAuthority(const char16* spec, - const Component& auth, - Component* username, - Component* password, - Component* hostname, - Component* port_num); +void ParseAuthority(const char* spec, + const Component& auth, + Component* username, + Component* password, + Component* hostname, + Component* port_num); +void ParseAuthority(const char16* spec, + const Component& auth, + Component* username, + Component* password, + Component* hostname, + Component* port_num); // Computes the integer port value from the given port component. The port // component should have been identified by one of the init functions on @@ -324,8 +323,8 @@ GURL_API void ParseAuthority(const char16* spec, // The return value will be a positive integer between 0 and 64K, or one of // the two special values below. enum SpecialPort { PORT_UNSPECIFIED = -1, PORT_INVALID = -2 }; -GURL_API int ParsePort(const char* url, const Component& port); -GURL_API int ParsePort(const char16* url, const Component& port); +int ParsePort(const char* url, const Component& port); +int ParsePort(const char16* url, const Component& port); // Extracts the range of the file name in the given url. The path must // already have been computed by the parse function, and the matching URL @@ -337,12 +336,12 @@ GURL_API int ParsePort(const char16* url, const Component& port); // following the last slash. // // The 8-bit version requires UTF-8 encoding. -GURL_API void ExtractFileName(const char* url, - const Component& path, - Component* file_name); -GURL_API void ExtractFileName(const char16* url, - const Component& path, - Component* file_name); +void ExtractFileName(const char* url, + const Component& path, + Component* file_name); +void ExtractFileName(const char16* url, + const Component& path, + Component* file_name); // Extract the first key/value from the range defined by |*query|. Updates // |*query| to start at the end of the extracted key/value pair. This is @@ -359,15 +358,15 @@ GURL_API void ExtractFileName(const char16* url, // // If no key/value are found |*key| and |*value| will be unchanged and it will // return false. -GURL_API bool ExtractQueryKeyValue(const char* url, - Component* query, - Component* key, - Component* value); -GURL_API bool ExtractQueryKeyValue(const char16* url, - Component* query, - Component* key, - Component* value); +bool ExtractQueryKeyValue(const char* url, + Component* query, + Component* key, + Component* value); +bool ExtractQueryKeyValue(const char16* url, + Component* query, + Component* key, + Component* value); } // namespace url_parse -#endif // GOOGLEURL_SRC_URL_PARSE_H__ +#endif // URL_URL_PARSE_H_ diff --git a/url/url_parse_file.cc b/url/url_parse_file.cc index 2e8429f..d944333d 100644 --- a/url/url_parse_file.cc +++ b/url/url_parse_file.cc @@ -28,9 +28,9 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "base/logging.h" -#include "googleurl/src/url_file.h" -#include "googleurl/src/url_parse.h" -#include "googleurl/src/url_parse_internal.h" +#include "url/url_file.h" +#include "url/url_parse.h" +#include "url/url_parse_internal.h" // Interesting IE file:isms... // diff --git a/url/url_parse_internal.h b/url/url_parse_internal.h index 61bd068..eec0282 100644 --- a/url/url_parse_internal.h +++ b/url/url_parse_internal.h @@ -27,12 +27,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Contains common inline helper functions used by the URL parsing routines. +#ifndef URL_URL_PARSE_INTERNAL_H_ +#define URL_URL_PARSE_INTERNAL_H_ -#ifndef GOOGLEURL_SRC_URL_PARSE_INTERNAL_H__ -#define GOOGLEURL_SRC_URL_PARSE_INTERNAL_H__ +// Contains common inline helper functions used by the URL parsing routines. -#include "googleurl/src/url_parse.h" +#include "url/url_parse.h" namespace url_parse { @@ -109,4 +109,4 @@ void ParseAfterScheme(const char16* spec, } // namespace url_parse -#endif // GOOGLEURL_SRC_URL_PARSE_INTERNAL_H__ +#endif // URL_URL_PARSE_INTERNAL_H_ diff --git a/url/url_parse_unittest.cc b/url/url_parse_unittest.cc index 8454806..1a9c09f 100644 --- a/url/url_parse_unittest.cc +++ b/url/url_parse_unittest.cc @@ -30,8 +30,8 @@ #include "url/url_parse.h" #include "base/basictypes.h" -#include "googleurl/src/url_parse.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/url_parse.h" // Some implementations of base/basictypes.h may define ARRAYSIZE. // If it's not defined, we define it to the ARRAYSIZE_UNSAFE macro diff --git a/url/url_test_utils.h b/url/url_test_utils.h index 6278e3f..f196bc9 100644 --- a/url/url_test_utils.h +++ b/url/url_test_utils.h @@ -27,17 +27,17 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#ifndef URL_URL_TEST_UTILS_H_ +#define URL_URL_TEST_UTILS_H_ + // Convenience functions for string conversions. // These are mostly intended for use in unit tests. -#ifndef GOOGLEURL_SRC_URL_TEST_UTILS_H__ -#define GOOGLEURL_SRC_URL_TEST_UTILS_H__ - #include <string> #include "base/string16.h" -#include "googleurl/src/url_canon_internal.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/url_canon_internal.h" namespace url_test_utils { @@ -75,4 +75,4 @@ inline std::string ConvertUTF16ToUTF8(const string16& src) { } // namespace url_test_utils -#endif // GOOGLEURL_SRC_URL_TEST_UTILS_H__ +#endif // URL_URL_TEST_UTILS_H_ diff --git a/url/url_util.cc b/url/url_util.cc index 9d621bc2..bb1708f 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -27,15 +27,15 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include "url/url_util.h" + #include <string.h> #include <vector> -#include "googleurl/src/url_util.h" - #include "base/logging.h" -#include "googleurl/src/url_canon_internal.h" -#include "googleurl/src/url_file.h" -#include "googleurl/src/url_util_internal.h" +#include "url/url_canon_internal.h" +#include "url/url_file.h" +#include "url/url_util_internal.h" namespace url_util { diff --git a/url/url_util.h b/url/url_util.h index 9e53d2d..46d507b 100644 --- a/url/url_util.h +++ b/url/url_util.h @@ -27,15 +27,14 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLEURL_SRC_URL_UTIL_H__ -#define GOOGLEURL_SRC_URL_UTIL_H__ +#ifndef URL_URL_UTIL_H_ +#define URL_URL_UTIL_H_ #include <string> #include "base/string16.h" -#include "googleurl/src/url_common.h" -#include "googleurl/src/url_parse.h" -#include "googleurl/src/url_canon.h" +#include "url/url_canon.h" +#include "url/url_parse.h" namespace url_util { @@ -52,13 +51,13 @@ namespace url_util { // "noop", unless Shutdown() was called in the mean time. This will also be a // "noop" if other calls to the library have forced an initialization // beforehand. -GURL_API void Initialize(); +void Initialize(); // Cleanup is not required, except some strings may leak. For most user // applications, this is fine. If you're using it in a library that may get // loaded and unloaded, you'll want to unload to properly clean up your // library. -GURL_API void Shutdown(); +void Shutdown(); // Schemes -------------------------------------------------------------------- @@ -66,7 +65,7 @@ GURL_API void Shutdown(); // schemes. This function is not threadsafe and can not be called concurrently // with any other url_util function. It will assert if the list of standard // schemes has been locked (see LockStandardSchemes). -GURL_API void AddStandardScheme(const char* new_scheme); +void AddStandardScheme(const char* new_scheme); // Sets a flag to prevent future calls to AddStandardScheme from succeeding. // @@ -80,7 +79,7 @@ GURL_API void AddStandardScheme(const char* new_scheme); // We could have had AddStandardScheme use a lock instead, but that would add // some platform-specific dependencies we don't otherwise have now, and is // overkill considering the normal usage is so simple. -GURL_API void LockStandardSchemes(); +void LockStandardSchemes(); // Locates the scheme in the given string and places it into |found_scheme|, // which may be NULL to indicate the caller does not care about the range. @@ -88,14 +87,14 @@ GURL_API void LockStandardSchemes(); // Returns whether the given |compare| scheme matches the scheme found in the // input (if any). The |compare| scheme must be a valid canonical scheme or // the result of the comparison is undefined. -GURL_API bool FindAndCompareScheme(const char* str, - int str_len, - const char* compare, - url_parse::Component* found_scheme); -GURL_API bool FindAndCompareScheme(const char16* str, - int str_len, - const char* compare, - url_parse::Component* found_scheme); +bool FindAndCompareScheme(const char* str, + int str_len, + const char* compare, + url_parse::Component* found_scheme); +bool FindAndCompareScheme(const char16* str, + int str_len, + const char* compare, + url_parse::Component* found_scheme); inline bool FindAndCompareScheme(const std::string& str, const char* compare, url_parse::Component* found_scheme) { @@ -111,10 +110,10 @@ inline bool FindAndCompareScheme(const string16& str, // Returns true if the given string represents a standard URL. This means that // either the scheme is in the list of known standard schemes. -GURL_API bool IsStandard(const char* spec, - const url_parse::Component& scheme); -GURL_API bool IsStandard(const char16* spec, - const url_parse::Component& scheme); +bool IsStandard(const char* spec, + const url_parse::Component& scheme); +bool IsStandard(const char16* spec, + const url_parse::Component& scheme); // TODO(brettw) remove this. This is a temporary compatibility hack to avoid // breaking the WebKit build when this version is synced via Chrome. @@ -135,16 +134,16 @@ inline bool IsStandard(const char* spec, int spec_len, // Returns true if a valid URL was produced, false if not. On failure, the // output and parsed structures will still be filled and will be consistent, // but they will not represent a loadable URL. -GURL_API bool Canonicalize(const char* spec, - int spec_len, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); -GURL_API bool Canonicalize(const char16* spec, - int spec_len, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); +bool Canonicalize(const char* spec, + int spec_len, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); +bool Canonicalize(const char16* spec, + int spec_len, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); // Resolves a potentially relative URL relative to the given parsed base URL. // The base MUST be valid. The resulting canonical URL and parsed information @@ -156,28 +155,28 @@ GURL_API bool Canonicalize(const char16* spec, // // Returns true if the output is valid, false if the input could not produce // a valid URL. -GURL_API bool ResolveRelative(const char* base_spec, - int base_spec_len, - const url_parse::Parsed& base_parsed, - const char* relative, - int relative_length, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); -GURL_API bool ResolveRelative(const char* base_spec, - int base_spec_len, - const url_parse::Parsed& base_parsed, - const char16* relative, - int relative_length, - url_canon::CharsetConverter* charset_converter, - url_canon::CanonOutput* output, - url_parse::Parsed* output_parsed); +bool ResolveRelative(const char* base_spec, + int base_spec_len, + const url_parse::Parsed& base_parsed, + const char* relative, + int relative_length, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); +bool ResolveRelative(const char* base_spec, + int base_spec_len, + const url_parse::Parsed& base_parsed, + const char16* relative, + int relative_length, + url_canon::CharsetConverter* charset_converter, + url_canon::CanonOutput* output, + url_parse::Parsed* output_parsed); // Replaces components in the given VALID input url. The new canonical URL info // is written to output and out_parsed. // // Returns true if the resulting URL is valid. -GURL_API bool ReplaceComponents( +bool ReplaceComponents( const char* spec, int spec_len, const url_parse::Parsed& parsed, @@ -185,7 +184,7 @@ GURL_API bool ReplaceComponents( url_canon::CharsetConverter* charset_converter, url_canon::CanonOutput* output, url_parse::Parsed* out_parsed); -GURL_API bool ReplaceComponents( +bool ReplaceComponents( const char* spec, int spec_len, const url_parse::Parsed& parsed, @@ -202,27 +201,27 @@ GURL_API bool ReplaceComponents( // // The versions of this function that don't take a b_end assume that the b // string is NULL terminated. -GURL_API bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b); -GURL_API bool LowerCaseEqualsASCII(const char* a_begin, - const char* a_end, - const char* b_begin, - const char* b_end); -GURL_API bool LowerCaseEqualsASCII(const char16* a_begin, - const char16* a_end, - const char* b); +bool LowerCaseEqualsASCII(const char* a_begin, + const char* a_end, + const char* b); +bool LowerCaseEqualsASCII(const char* a_begin, + const char* a_end, + const char* b_begin, + const char* b_end); +bool LowerCaseEqualsASCII(const char16* a_begin, + const char16* a_end, + const char* b); // Unescapes the given string using URL escaping rules. -GURL_API void DecodeURLEscapeSequences(const char* input, int length, - url_canon::CanonOutputW* output); +void DecodeURLEscapeSequences(const char* input, int length, + url_canon::CanonOutputW* output); // Escapes the given string as defined by the JS method encodeURIComponent. See // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent -GURL_API void EncodeURIComponent(const char* input, int length, - url_canon::CanonOutput* output); +void EncodeURIComponent(const char* input, int length, + url_canon::CanonOutput* output); } // namespace url_util -#endif // GOOGLEURL_SRC_URL_UTIL_H__ +#endif // URL_URL_UTIL_H_ diff --git a/url/url_util_internal.h b/url/url_util_internal.h index 1fbb46a..ee0b40e 100644 --- a/url/url_util_internal.h +++ b/url/url_util_internal.h @@ -27,14 +27,13 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#ifndef GOOGLEURL_SRC_URL_UTIL_INTERNAL_H__ -#define GOOGLEURL_SRC_URL_UTIL_INTERNAL_H__ +#ifndef URL_URL_UTIL_INTERNAL_H_ +#define URL_URL_UTIL_INTERNAL_H_ #include <string> #include "base/string16.h" -#include "googleurl/src/url_common.h" -#include "googleurl/src/url_parse.h" +#include "url/url_parse.h" namespace url_util { @@ -53,4 +52,4 @@ bool CompareSchemeComponent(const char16* spec, } // namespace url_util -#endif // GOOGLEURL_SRC_URL_UTIL_INTERNAL_H__ +#endif // URL_URL_UTIL_INTERNAL_H_ diff --git a/url/url_util_unittest.cc b/url/url_util_unittest.cc index c7b39fe..6d210fc 100644 --- a/url/url_util_unittest.cc +++ b/url/url_util_unittest.cc @@ -27,12 +27,12 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "googleurl/src/url_canon.h" -#include "googleurl/src/url_canon_stdstring.h" -#include "googleurl/src/url_parse.h" -#include "googleurl/src/url_test_utils.h" -#include "googleurl/src/url_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/url_canon.h" +#include "url/url_canon_stdstring.h" +#include "url/url_parse.h" +#include "url/url_test_utils.h" +#include "url/url_util.h" TEST(URLUtilTest, FindAndCompareScheme) { url_parse::Component found_scheme; |