diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 16:20:02 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-21 16:20:02 +0000 |
commit | 7fad3d83abe5281e6be62f5a809da4015ad6b222 (patch) | |
tree | ab84b802185c39e77f8334e18459b86b32416a32 /net/base/cookie_monster.cc | |
parent | f25387b62a3cccde48622d0b7fca57cd6fb16ab7 (diff) | |
download | chromium_src-7fad3d83abe5281e6be62f5a809da4015ad6b222.zip chromium_src-7fad3d83abe5281e6be62f5a809da4015ad6b222.tar.gz chromium_src-7fad3d83abe5281e6be62f5a809da4015ad6b222.tar.bz2 |
Port cookie_monster, net_util, and registry_controlled_domain to POSIXish platforms
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1154 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/cookie_monster.cc')
-rw-r--r-- | net/base/cookie_monster.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc index b8dd8e7..12b1b46d7 100644 --- a/net/base/cookie_monster.cc +++ b/net/base/cookie_monster.cc @@ -192,8 +192,13 @@ Time CookieMonster::ParseCookieTime(const std::string& time_string) { // Numeric field w/ a colon } else if (token.find(':') != std::string::npos) { if (!found_time && - sscanf_s(token.c_str(), "%2hu:%2hu:%2hu", &exploded.hour, - &exploded.minute, &exploded.second) == 3) { +#ifdef COMPILER_MSVC + sscanf_s( +#else + sscanf( +#endif + 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, @@ -334,7 +339,12 @@ static Time CanonExpiration(const CookieMonster::ParsedCookie& pc, // First, try the Max-Age attribute. uint64 max_age = 0; if (pc.HasMaxAge() && +#if defined(COMPILER_MSVC) sscanf_s(pc.MaxAge().c_str(), " %I64u", &max_age) == 1) { + +#else + sscanf(pc.MaxAge().c_str(), " %llu", &max_age) == 1) { +#endif return current + TimeDelta::FromSeconds(max_age); } @@ -420,6 +430,7 @@ bool CookieMonster::SetCookieWithCreationTime(const GURL& url, // We should have only purged at most one matching cookie. int num_deleted = DeleteEquivalentCookies(cookie_domain, *cc); + DCHECK(num_deleted <= 1); COOKIE_DLOG(INFO) << "SetCookie() cc: " << cc->DebugString(); |