summaryrefslogtreecommitdiffstats
path: root/webkit/glue
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 /webkit/glue
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 'webkit/glue')
-rw-r--r--webkit/glue/dom_serializer.cc6
-rw-r--r--webkit/glue/media/buffered_data_source_unittest.cc7
-rw-r--r--webkit/glue/media/media_resource_loader_bridge_factory.cc8
3 files changed, 15 insertions, 6 deletions
diff --git a/webkit/glue/dom_serializer.cc b/webkit/glue/dom_serializer.cc
index a7b469b..d8cf3a4 100644
--- a/webkit/glue/dom_serializer.cc
+++ b/webkit/glue/dom_serializer.cc
@@ -49,6 +49,10 @@
// override the incorrect base URL and make sure we alway load correct local
// saved resource files.
+// We must include format_macros up here, before any WebKit headers
+// include inttypes.h.
+#include "base/format_macros.h"
+
#include "config.h"
#include "base/compiler_specific.h"
@@ -87,7 +91,7 @@ namespace {
// Default "mark of the web" declaration
static const char* const kDefaultMarkOfTheWeb =
- "\n<!-- saved from url=(%04d)%s -->\n";
+ "\n<!-- saved from url=(%04" PRIuS ")%s -->\n";
// Default meat content for writing correct charset declaration.
static const wchar_t* const kDefaultMetaContent =
diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc
index f96bac1..9b6151d 100644
--- a/webkit/glue/media/buffered_data_source_unittest.cc
+++ b/webkit/glue/media/buffered_data_source_unittest.cc
@@ -4,6 +4,7 @@
#include <algorithm>
+#include "base/format_macros.h"
#include "base/string_util.h"
#include "media/base/filters.h"
#include "media/base/mock_filter_host.h"
@@ -92,7 +93,8 @@ class BufferedResourceLoaderTest : public testing::Test {
EXPECT_CALL(*this, StartCallback(net::OK));
ResourceLoaderBridge::ResponseInfo info;
std::string header = StringPrintf("HTTP/1.1 200 OK\n"
- "Content-Length: %lld", instance_size);
+ "Content-Length: %" PRId64,
+ instance_size);
replace(header.begin(), header.end(), '\n', '\0');
info.headers = new net::HttpResponseHeaders(header);
info.content_length = instance_size;
@@ -108,7 +110,8 @@ class BufferedResourceLoaderTest : public testing::Test {
int64 content_length = last_position - first_position + 1;
ResourceLoaderBridge::ResponseInfo info;
std::string header = StringPrintf("HTTP/1.1 206 Partial Content\n"
- "Content-Range: bytes %lld-%lld/%lld",
+ "Content-Range: bytes "
+ "%" PRId64 "-%" PRId64 "/%" PRId64,
first_position,
last_position,
instance_size);
diff --git a/webkit/glue/media/media_resource_loader_bridge_factory.cc b/webkit/glue/media/media_resource_loader_bridge_factory.cc
index 03684c8..0c3d6ab 100644
--- a/webkit/glue/media/media_resource_loader_bridge_factory.cc
+++ b/webkit/glue/media/media_resource_loader_bridge_factory.cc
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/string_util.h"
#include "webkit/glue/media/media_resource_loader_bridge_factory.h"
+#include "base/format_macros.h"
+#include "base/string_util.h"
+
namespace {
// A constant for an unknown position.
@@ -57,12 +59,12 @@ const std::string MediaResourceLoaderBridgeFactory::GenerateHeaders (
if (first_byte_position > kPositionNotSpecified &&
last_byte_position > kPositionNotSpecified) {
if (first_byte_position <= last_byte_position) {
- header = StringPrintf("Range: bytes=%lld-%lld",
+ header = StringPrintf("Range: bytes=%" PRId64 "-%" PRId64,
first_byte_position,
last_byte_position);
}
} else if (first_byte_position > kPositionNotSpecified) {
- header = StringPrintf("Range: bytes=%lld-", first_byte_position);
+ header = StringPrintf("Range: bytes=%" PRId64 "-", first_byte_position);
} else if (last_byte_position > kPositionNotSpecified) {
NOTIMPLEMENTED() << "Suffix range not implemented";
}