summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-29 17:58:25 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-29 17:58:25 +0000
commitdce5df54b85ca90d4bd2d2a04c9f78d3a149072c (patch)
treedaf26e83779b6492f9c83e3f2f4d8874990e25fe /net
parent8e064c0d4889fc93fdc28dec7745002aadb668dc (diff)
downloadchromium_src-dce5df54b85ca90d4bd2d2a04c9f78d3a149072c.zip
chromium_src-dce5df54b85ca90d4bd2d2a04c9f78d3a149072c.tar.gz
chromium_src-dce5df54b85ca90d4bd2d2a04c9f78d3a149072c.tar.bz2
Use C99 standard format macros for 64-bit values.
Currently we have several uses of %I64d in format strings to indicate a 64-bit value. This does not work on Mac or Linux, where 'I' indicates the use of locale specific digits. Instead, we introduce base/format_macros.h which mimic the C99 standard macros for 64-bit values in a cross-platform manner. Dean pointed out that V8 is handling this themselves rather than use inttypes.h. Maybe we'll end up going down the same path but, for the moment, we'll try and do it the 'correct' way and see how it works out. http://codereview.chromium.org/147154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19500 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/cookie_monster.cc9
-rw-r--r--net/disk_cache/stats.cc3
2 files changed, 7 insertions, 5 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 31d55dc..e20c03d 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -47,6 +47,7 @@
#include <algorithm>
#include "base/basictypes.h"
+#include "base/format_macros.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/string_tokenizer.h"
@@ -351,12 +352,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) {
-
+#ifdef COMPILER_MSVC
+ sscanf_s(
#else
- sscanf(pc.MaxAge().c_str(), " %llu", &max_age) == 1) {
+ sscanf(
#endif
+ pc.MaxAge().c_str(), " %" PRIu64, &max_age) == 1) {
return current + TimeDelta::FromSeconds(max_age);
}
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc
index 702b2a36..a351a6c 100644
--- a/net/disk_cache/stats.cc
+++ b/net/disk_cache/stats.cc
@@ -4,6 +4,7 @@
#include "net/disk_cache/stats.h"
+#include "base/format_macros.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "net/disk_cache/backend_impl.h"
@@ -263,7 +264,7 @@ void Stats::GetItems(StatsItems* items) {
for (int i = MIN_COUNTER + 1; i < MAX_COUNTER; i++) {
item.first = kCounterNames[i];
- item.second = StringPrintf("0x%I64x", counters_[i]);
+ item.second = StringPrintf("0x%" PRIx64, counters_[i]);
items->push_back(item);
}
}