summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 06:53:28 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 06:53:28 +0000
commit34b2b007db875a6acb853c5cd2a247fbb32c0f88 (patch)
tree6dc39bc9f10d6e8eedcdf14821ba9e96b5ccab51 /net/base
parent24b857793e27aded8d804a112a5fe6c77e28b081 (diff)
downloadchromium_src-34b2b007db875a6acb853c5cd2a247fbb32c0f88.zip
chromium_src-34b2b007db875a6acb853c5cd2a247fbb32c0f88.tar.gz
chromium_src-34b2b007db875a6acb853c5cd2a247fbb32c0f88.tar.bz2
Add compiler-specific "examine printf format" attributes to printfs.
Functions that take a printf-style format get a new annotation, which produces a bunch of compiler warnings when you use printf impoperly. This change adds the annotations and fixes the warnings. We now must use PRId64 for 64-bit numbers and the PRIsz for size_t. Review URL: http://codereview.chromium.org/339059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32600 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/cookie_monster.cc4
-rw-r--r--net/base/host_cache_unittest.cc3
-rw-r--r--net/base/load_log_util.cc3
-rw-r--r--net/base/net_util_unittest.cc20
4 files changed, 16 insertions, 14 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 01b68a1..2af8a72 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -1172,9 +1172,9 @@ bool CookieMonster::CanonicalCookie::IsOnPath(
}
std::string CookieMonster::CanonicalCookie::DebugString() const {
- return StringPrintf("name: %s value: %s path: %s creation: %llu",
+ return StringPrintf("name: %s value: %s path: %s creation: %" PRId64,
name_.c_str(), value_.c_str(), path_.c_str(),
- creation_date_.ToTimeT());
+ static_cast<int64>(creation_date_.ToTimeT()));
}
} // namespace
diff --git a/net/base/host_cache_unittest.cc b/net/base/host_cache_unittest.cc
index a879bed..b51b2e0 100644
--- a/net/base/host_cache_unittest.cc
+++ b/net/base/host_cache_unittest.cc
@@ -4,6 +4,7 @@
#include "net/base/host_cache.h"
+#include "base/format_macros.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "net/base/net_errors.h"
@@ -302,7 +303,7 @@ TEST(HostCacheTest, KeyComparators) {
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%d]", i));
+ SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]", i));
const HostCache::Key& key1 = tests[i].key1;
const HostCache::Key& key2 = tests[i].key2;
diff --git a/net/base/load_log_util.cc b/net/base/load_log_util.cc
index df31218..3905f4a 100644
--- a/net/base/load_log_util.cc
+++ b/net/base/load_log_util.cc
@@ -4,6 +4,7 @@
#include "net/base/load_log_util.h"
+#include "base/format_macros.h"
#include "base/string_util.h"
namespace net {
@@ -31,7 +32,7 @@ class FormatHelper {
for (size_t i = 0; i < entries_.size(); ++i) {
if (log->num_entries_truncated() > 0 && i + 1 == entries_.size()) {
- result += StringPrintf(" ... Truncated %d entries ...\n",
+ result += StringPrintf(" ... Truncated %" PRIuS " entries ...\n",
log->num_entries_truncated());
}
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index 308ef80..1057402 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -2,15 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/string_util.h"
-#include "base/sys_string_conversions.h"
-#include "base/time.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/escape.h"
#include "net/base/net_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_WIN)
#include <ws2tcpip.h>
@@ -18,6 +10,14 @@
#include <netdb.h>
#endif
+#include "base/file_path.h"
+#include "base/format_macros.h"
+#include "base/string_util.h"
+#include "base/sys_string_conversions.h"
+#include "base/time.h"
+#include "googleurl/src/gurl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
namespace {
class NetUtilTest : public testing::Test {
@@ -579,7 +579,7 @@ TEST(NetUtilTest, GetIdentityFromURL) {
},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, tests[i].input_url));
+ SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, tests[i].input_url));
GURL url(tests[i].input_url);
std::wstring username, password;
@@ -1587,7 +1587,7 @@ TEST(NetUtilTest, SimplifyUrlForRequest) {
},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, tests[i].input_url));
+ SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, tests[i].input_url));
GURL input_url(GURL(tests[i].input_url));
GURL expected_url(GURL(tests[i].expected_simplified_url));
EXPECT_EQ(expected_url, net::SimplifyUrlForRequest(input_url));