summaryrefslogtreecommitdiffstats
path: root/net/url_request
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/url_request
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/url_request')
-rw-r--r--net/url_request/request_tracker_unittest.cc5
-rw-r--r--net/url_request/url_request_unittest.cc9
-rw-r--r--net/url_request/url_request_view_net_internals_job.cc7
3 files changed, 12 insertions, 9 deletions
diff --git a/net/url_request/request_tracker_unittest.cc b/net/url_request/request_tracker_unittest.cc
index 452d35b..760d5be 100644
--- a/net/url_request/request_tracker_unittest.cc
+++ b/net/url_request/request_tracker_unittest.cc
@@ -5,6 +5,7 @@
#include "net/url_request/request_tracker.h"
#include "base/compiler_specific.h"
+#include "base/format_macros.h"
#include "base/string_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -91,7 +92,7 @@ TEST(RequestTrackerTest, GraveyardBounded) {
for (size_t i = 0;
i < RequestTracker<TestRequest>::kMaxGraveyardSize * 2;
++i) {
- TestRequest req(GURL(StringPrintf("http://req%d", i).c_str()));
+ TestRequest req(GURL(StringPrintf("http://req%" PRIuS, i).c_str()));
tracker.Add(&req);
tracker.Remove(&req);
}
@@ -105,7 +106,7 @@ TEST(RequestTrackerTest, GraveyardBounded) {
for (size_t i = 0; i < RequestTracker<TestRequest>::kMaxGraveyardSize; ++i) {
size_t req_number = i + RequestTracker<TestRequest>::kMaxGraveyardSize;
- GURL url(StringPrintf("http://req%d", req_number).c_str());
+ GURL url(StringPrintf("http://req%" PRIuS, req_number).c_str());
EXPECT_EQ(url, recent_reqs[i].original_url);
}
}
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 0877768..16af0d0 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -17,6 +17,7 @@
#include <string>
#include "base/file_util.h"
+#include "base/format_macros.h"
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process_util.h"
@@ -704,9 +705,9 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) {
{
TestURLRequest r(temp_url, &d);
- r.SetExtraRequestHeaders(StringPrintf("Range: bytes=%d-%d\n",
- first_byte_position,
- last_byte_position));
+ r.SetExtraRequestHeaders(
+ StringPrintf("Range: bytes=%" PRIuS "-%" PRIuS "\n",
+ first_byte_position, last_byte_position));
r.Start();
EXPECT_TRUE(r.is_pending());
@@ -745,7 +746,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) {
{
TestURLRequest r(temp_url, &d);
- r.SetExtraRequestHeaders(StringPrintf("Range: bytes=%d-\n",
+ r.SetExtraRequestHeaders(StringPrintf("Range: bytes=%" PRIuS "-\n",
first_byte_position));
r.Start();
EXPECT_TRUE(r.is_pending());
diff --git a/net/url_request/url_request_view_net_internals_job.cc b/net/url_request/url_request_view_net_internals_job.cc
index b98e9ef..e9682dd 100644
--- a/net/url_request/url_request_view_net_internals_job.cc
+++ b/net/url_request/url_request_view_net_internals_job.cc
@@ -12,6 +12,7 @@
#include <sstream>
+#include "base/format_macros.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "net/base/escape.h"
@@ -216,9 +217,9 @@ class HostResolverCacheSubSection : public SubSection {
return;
}
- out->append(StringPrintf("<ul><li>Size: %u</li>"
- "<li>Capacity: %u</li>"
- "<li>Time to live (ms): %u</li></ul>",
+ out->append(StringPrintf("<ul><li>Size: %" PRIuS "</li>"
+ "<li>Capacity: %" PRIuS "</li>"
+ "<li>Time to live (ms): %" PRIuS "</li></ul>",
host_cache->size(),
host_cache->max_entries(),
host_cache->cache_duration_ms()));