summaryrefslogtreecommitdiffstats
path: root/net/http
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/http
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/http')
-rw-r--r--net/http/http_cache.cc7
-rw-r--r--net/http/http_network_transaction.cc3
-rw-r--r--net/http/partial_data.cc16
3 files changed, 17 insertions, 9 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 1fae4ad..7f4c614 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -12,6 +12,7 @@
#include <unistd.h>
#endif
+#include "base/format_macros.h"
#include "base/message_loop.h"
#include "base/pickle.h"
#include "base/ref_counted.h"
@@ -210,8 +211,10 @@ std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) {
if (mode_ == NORMAL) {
// No valid URL can begin with numerals, so we should not have to worry
// about collisions with normal URLs.
- if (request->upload_data && request->upload_data->identifier())
- url.insert(0, StringPrintf("%lld/", request->upload_data->identifier()));
+ if (request->upload_data && request->upload_data->identifier()) {
+ url.insert(0, StringPrintf("%" PRId64 "/",
+ request->upload_data->identifier()));
+ }
return url;
}
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index e317990..bdf3e3d 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -4,6 +4,7 @@
#include "net/http/http_network_transaction.h"
+#include "base/format_macros.h"
#include "base/scoped_ptr.h"
#include "base/compiler_specific.h"
#include "base/field_trial.h"
@@ -69,7 +70,7 @@ void BuildRequestHeaders(const HttpRequestInfo* request_info,
// Add a content length header?
if (upload_data_stream) {
- StringAppendF(request_headers, "Content-Length: %llu\r\n",
+ StringAppendF(request_headers, "Content-Length: %" PRIu64 "\r\n",
upload_data_stream->size());
} else if (request_info->method == "POST" || request_info->method == "PUT" ||
request_info->method == "HEAD") {
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 162948c..f253dc1 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -4,6 +4,7 @@
#include "net/http/partial_data.h"
+#include "base/format_macros.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "net/base/net_errors.h"
@@ -237,10 +238,12 @@ void PartialData::FixResponseHeaders(HttpResponseHeaders* headers) {
DCHECK(byte_range_.HasFirstBytePosition());
DCHECK(byte_range_.HasLastBytePosition());
- headers->AddHeader(StringPrintf("%s: bytes %lld-%lld/%lld", kRangeHeader,
- byte_range_.first_byte_position(),
- byte_range_.last_byte_position(),
- resource_size_));
+ headers->AddHeader(
+ StringPrintf("%s: bytes %" PRId64 "-%" PRId64 "/%" PRId64,
+ kRangeHeader,
+ byte_range_.first_byte_position(),
+ byte_range_.last_byte_position(),
+ resource_size_));
range_len = byte_range_.last_byte_position() -
byte_range_.first_byte_position() + 1;
} else {
@@ -250,12 +253,13 @@ void PartialData::FixResponseHeaders(HttpResponseHeaders* headers) {
range_len = resource_size_;
}
- headers->AddHeader(StringPrintf("%s: %lld", kLengthHeader, range_len));
+ headers->AddHeader(StringPrintf("%s: %" PRId64, kLengthHeader, range_len));
}
void PartialData::FixContentLength(HttpResponseHeaders* headers) {
headers->RemoveHeader(kLengthHeader);
- headers->AddHeader(StringPrintf("%s: %lld", kLengthHeader, resource_size_));
+ headers->AddHeader(StringPrintf("%s: %" PRId64, kLengthHeader,
+ resource_size_));
}
int PartialData::CacheRead(disk_cache::Entry* entry, IOBuffer* data,