| Index: net/cookies/cookie_util.cc
|
| diff --git a/net/cookies/cookie_util.cc b/net/cookies/cookie_util.cc
|
| index 3c80566e7a3e15c02e8815b2af196fc5f2e9444a..fa45a5919883f4124999c0c89d13c7529c277186 100644
|
| --- a/net/cookies/cookie_util.cc
|
| +++ b/net/cookies/cookie_util.cc
|
| @@ -26,8 +26,7 @@ std::string GetEffectiveDomain(const std::string& scheme,
|
| const std::string& host) {
|
| if (scheme == "http" || scheme == "https") {
|
| return registry_controlled_domains::GetDomainAndRegistry(
|
| - host,
|
| - registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
|
| + host, registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
|
| }
|
|
|
| if (!DomainIsHostOnly(host))
|
| @@ -72,10 +71,12 @@ bool GetCookieDomainWithString(const GURL& url,
|
| // Ensure |url_host| is |cookie_domain| or one of its subdomains. Given that
|
| // we know the domain+registry are the same from the above checks, this is
|
| // basically a simple string suffix check.
|
| - const bool is_suffix = (url_host.length() < cookie_domain.length()) ?
|
| - (cookie_domain != ("." + url_host)) :
|
| - (url_host.compare(url_host.length() - cookie_domain.length(),
|
| - cookie_domain.length(), cookie_domain) != 0);
|
| + const bool is_suffix =
|
| + (url_host.length() < cookie_domain.length())
|
| + ? (cookie_domain != ("." + url_host))
|
| + : (url_host.compare(url_host.length() - cookie_domain.length(),
|
| + cookie_domain.length(),
|
| + cookie_domain) != 0);
|
| if (is_suffix)
|
| return false;
|
|
|
| @@ -92,8 +93,8 @@ bool GetCookieDomainWithString(const GURL& url,
|
| // An average cookie expiration will look something like this:
|
| // Sat, 15-Apr-17 21:01:22 GMT
|
| base::Time ParseCookieTime(const std::string& time_string) {
|
| - static const char* kMonths[] = { "jan", "feb", "mar", "apr", "may", "jun",
|
| - "jul", "aug", "sep", "oct", "nov", "dec" };
|
| + static const char* kMonths[] = {"jan", "feb", "mar", "apr", "may", "jun",
|
| + "jul", "aug", "sep", "oct", "nov", "dec"};
|
| static const int kMonthsLen = arraysize(kMonths);
|
| // We want to be pretty liberal, and support most non-ascii and non-digit
|
| // characters as a delimiter. We can't treat : as a delimiter, because it
|
| @@ -138,7 +139,7 @@ base::Time ParseCookieTime(const std::string& time_string) {
|
| // but this DCHECK should pass for well-formed data.
|
| // DCHECK(token == "GMT");
|
| }
|
| - // Numeric field w/ a colon
|
| + // Numeric field w/ a colon
|
| } else if (token.find(':') != std::string::npos) {
|
| if (!found_time &&
|
| #ifdef COMPILER_MSVC
|
| @@ -146,8 +147,11 @@ base::Time ParseCookieTime(const std::string& time_string) {
|
| #else
|
| sscanf(
|
| #endif
|
| - token.c_str(), "%2u:%2u:%2u", &exploded.hour,
|
| - &exploded.minute, &exploded.second) == 3) {
|
| + token.c_str(),
|
| + "%2u:%2u:%2u",
|
| + &exploded.hour,
|
| + &exploded.minute,
|
| + &exploded.second) == 3) {
|
| found_time = true;
|
| } else {
|
| // We should only ever encounter one time-like thing. If we're here,
|
| @@ -155,7 +159,7 @@ base::Time ParseCookieTime(const std::string& time_string) {
|
| // the first. This check should be ok for well-formed input:
|
| // NOTREACHED();
|
| }
|
| - // Numeric field
|
| + // Numeric field
|
| } else {
|
| // Overflow with atoi() is unspecified, so we enforce a max length.
|
| if (!found_day_of_month && token.length() <= 2) {
|
| @@ -188,9 +192,9 @@ base::Time ParseCookieTime(const std::string& time_string) {
|
|
|
| // If our values are within their correct ranges, we got our time.
|
| if (exploded.day_of_month >= 1 && exploded.day_of_month <= 31 &&
|
| - exploded.month >= 1 && exploded.month <= 12 &&
|
| - exploded.year >= 1601 && exploded.year <= 30827 &&
|
| - exploded.hour <= 23 && exploded.minute <= 59 && exploded.second <= 59) {
|
| + exploded.month >= 1 && exploded.month <= 12 && exploded.year >= 1601 &&
|
| + exploded.year <= 30827 && exploded.hour <= 23 && exploded.minute <= 59 &&
|
| + exploded.second <= 59) {
|
| return base::Time::FromUTCExploded(exploded);
|
| }
|
|
|
| @@ -212,4 +216,3 @@ GURL CookieOriginToURL(const std::string& domain, bool is_https) {
|
|
|
| } // namespace cookie_utils
|
| } // namespace net
|
| -
|
|
|