summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-25 02:25:06 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-25 02:25:06 +0000
commitd8eb842474ce559113a9b0ead0610973985bf693 (patch)
tree817d637b7bfffa8bebe3d1de0af0aea05d72a8a7
parent928930d76cb018b8a496dbdf7166178ef8fab1bf (diff)
downloadchromium_src-d8eb842474ce559113a9b0ead0610973985bf693.zip
chromium_src-d8eb842474ce559113a9b0ead0610973985bf693.tar.gz
chromium_src-d8eb842474ce559113a9b0ead0610973985bf693.tar.bz2
net: Append base:: in the StringPrintf calls.
(Note: This is a TODO in string_util.h) BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3390026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60555 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/base/cookie_monster.cc39
-rw-r--r--net/base/cookie_monster_perftest.cc20
-rw-r--r--net/base/cookie_monster_unittest.cc11
-rw-r--r--net/base/escape_unittest.cc3
-rw-r--r--net/base/host_cache_unittest.cc9
-rw-r--r--net/base/host_port_pair.cc6
-rw-r--r--net/base/host_resolver_impl_unittest.cc3
-rw-r--r--net/base/net_util.cc12
-rw-r--r--net/base/net_util_unittest.cc15
-rw-r--r--net/base/pem_tokenizer.cc5
-rw-r--r--net/disk_cache/backend_impl.cc23
-rw-r--r--net/disk_cache/backend_unittest.cc3
-rw-r--r--net/disk_cache/block_files.cc3
-rw-r--r--net/disk_cache/sparse_control.cc5
-rw-r--r--net/disk_cache/stats.cc9
-rw-r--r--net/ftp/ftp_directory_listing_buffer_unittest.cc4
-rw-r--r--net/ftp/ftp_directory_listing_parser_ls_unittest.cc6
-rw-r--r--net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc6
-rw-r--r--net/ftp/ftp_directory_listing_parser_netware_unittest.cc6
-rw-r--r--net/ftp/ftp_directory_listing_parser_vms_unittest.cc6
-rw-r--r--net/ftp/ftp_directory_listing_parser_windows_unittest.cc6
-rw-r--r--net/ftp/ftp_util_unittest.cc15
-rw-r--r--net/http/http_auth_cache_unittest.cc5
-rw-r--r--net/http/http_auth_gssapi_posix.cc82
-rw-r--r--net/http/http_auth_handler.cc3
-rw-r--r--net/http/http_auth_handler_digest.cc3
-rw-r--r--net/http/http_auth_handler_negotiate.cc8
-rw-r--r--net/http/http_cache.cc7
-rw-r--r--net/http/http_cache_unittest.cc12
-rw-r--r--net/http/http_net_log_params.h10
-rw-r--r--net/http/http_network_transaction.cc15
-rw-r--r--net/http/http_proxy_client_socket.cc3
-rw-r--r--net/http/http_stream_request.cc11
-rw-r--r--net/http/http_transaction_unittest.h7
-rw-r--r--net/http/mock_gssapi_library_posix.cc7
-rw-r--r--net/http/partial_data.cc20
-rw-r--r--net/ocsp/nss_ocsp.cc15
-rw-r--r--net/proxy/multi_threaded_proxy_resolver.cc3
-rw-r--r--net/proxy/multi_threaded_proxy_resolver_unittest.cc9
-rw-r--r--net/proxy/proxy_bypass_rules_unittest.cc3
-rw-r--r--net/proxy/proxy_config_service_linux_unittest.cc15
-rw-r--r--net/proxy/proxy_resolver_v8_unittest.cc5
-rw-r--r--net/server/http_listen_socket.cc43
-rw-r--r--net/socket/client_socket_pool_base_unittest.cc8
-rw-r--r--net/socket/ssl_client_socket_nss.cc9
-rw-r--r--net/socket_stream/socket_stream.cc5
-rw-r--r--net/spdy/spdy_session.cc10
-rw-r--r--net/tools/dump_cache/dump_cache.cc7
-rw-r--r--net/tools/dump_cache/url_to_filename_encoder_unittest.cc4
-rw-r--r--net/tools/dump_cache/url_utilities_unittest.cc5
-rw-r--r--net/tools/hresolv/hresolv.cc42
-rw-r--r--net/url_request/url_request_unittest.cc18
-rw-r--r--net/websockets/websocket_handshake.cc3
-rw-r--r--net/websockets/websocket_handshake_unittest.cc7
-rw-r--r--net/websockets/websocket_net_log_params.h3
-rw-r--r--net/websockets/websocket_throttle.cc24
56 files changed, 361 insertions, 285 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 3353019..f9ec08f 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -53,6 +53,7 @@
#include "base/scoped_ptr.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_canon.h"
#include "net/base/net_util.h"
@@ -216,12 +217,12 @@ void CookieMonster::InitStore() {
if (creation_times.insert(cookie_creation_time).second) {
InternalInsertCookie(GetKey((*it)->Domain()), *it, false);
} else {
- LOG(ERROR) << StringPrintf("Found cookies with duplicate creation "
- "times in backing store: "
- "{name='%s', domain='%s', path='%s'}",
- (*it)->Name().c_str(),
- (*it)->Domain().c_str(),
- (*it)->Path().c_str());
+ LOG(ERROR) << base::StringPrintf("Found cookies with duplicate creation "
+ "times in backing store: "
+ "{name='%s', domain='%s', path='%s'}",
+ (*it)->Name().c_str(),
+ (*it)->Domain().c_str(),
+ (*it)->Path().c_str());
// We've been given ownership of the cookie and are throwing it
// away; reclaim the space.
delete (*it);
@@ -359,13 +360,14 @@ int CookieMonster::TrimDuplicateCookiesForKey(
// is the most recent one, so we will keep it. The rest are duplicates.
dupes.erase(dupes.begin());
- LOG(ERROR) << StringPrintf("Found %d duplicate cookies for host='%s', "
- "with {name='%s', domain='%s', path='%s'}",
- static_cast<int>(dupes.size()),
- key.c_str(),
- signature.name.c_str(),
- signature.domain.c_str(),
- signature.path.c_str());
+ LOG(ERROR) << base::StringPrintf(
+ "Found %d duplicate cookies for host='%s', "
+ "with {name='%s', domain='%s', path='%s'}",
+ static_cast<int>(dupes.size()),
+ key.c_str(),
+ signature.name.c_str(),
+ signature.domain.c_str(),
+ signature.path.c_str());
// Remove all the cookies identified by |dupes|. It is valid to delete our
// list of iterators one at a time, since |cookies_| is a multimap (they
@@ -1883,11 +1885,12 @@ bool CookieMonster::CanonicalCookie::IsDomainMatch(
}
std::string CookieMonster::CanonicalCookie::DebugString() const {
- return StringPrintf("name: %s value: %s domain: %s path: %s creation: %"
- PRId64,
- name_.c_str(), value_.c_str(),
- domain_.c_str(), path_.c_str(),
- static_cast<int64>(creation_date_.ToTimeT()));
+ return base::StringPrintf(
+ "name: %s value: %s domain: %s path: %s creation: %"
+ PRId64,
+ name_.c_str(), value_.c_str(),
+ domain_.c_str(), path_.c_str(),
+ static_cast<int64>(creation_date_.ToTimeT()));
}
} // namespace
diff --git a/net/base/cookie_monster_perftest.cc b/net/base/cookie_monster_perftest.cc
index f74d954..5326654 100644
--- a/net/base/cookie_monster_perftest.cc
+++ b/net/base/cookie_monster_perftest.cc
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "net/base/cookie_monster.h"
#include "base/perftimer.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "googleurl/src/gurl.h"
+#include "net/base/cookie_monster.h"
#include "net/base/cookie_monster_store_test.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -46,7 +47,7 @@ TEST(CookieMonsterTest, TestAddCookiesOnSingleHost) {
scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL));
std::vector<std::string> cookies;
for (int i = 0; i < kNumCookies; i++) {
- cookies.push_back(StringPrintf("a%03d=b", i));
+ cookies.push_back(base::StringPrintf("a%03d=b", i));
}
// Add a bunch of cookies on a single host
@@ -74,7 +75,7 @@ TEST(CookieMonsterTest, TestAddCookieOnManyHosts) {
std::string cookie(kCookieLine);
std::vector<GURL> gurls; // just wanna have ffffuunnn
for (int i = 0; i < kNumCookies; ++i) {
- gurls.push_back(GURL(StringPrintf("http://a%04d.izzle", i)));
+ gurls.push_back(GURL(base::StringPrintf("http://a%04d.izzle", i)));
}
// Add a cookie on a bunch of host
@@ -136,8 +137,8 @@ TEST(CookieMonsterTest, TestDomainTree) {
for (std::vector<std::string>::const_iterator it = domain_list.begin();
it != domain_list.end(); it++) {
GURL gurl("https://" + *it + "/");
- const std::string cookie = StringPrintf(domain_cookie_format_tree,
- it->c_str());
+ const std::string cookie = base::StringPrintf(domain_cookie_format_tree,
+ it->c_str());
EXPECT_TRUE(cm->SetCookie(gurl, cookie));
}
EXPECT_EQ(31u, cm->GetAllCookies().size());
@@ -178,8 +179,8 @@ TEST(CookieMonsterTest, TestDomainLine) {
for (std::vector<std::string>::const_iterator it = domain_list.begin();
it != domain_list.end(); it++) {
GURL gurl("https://" + *it + "/");
- const std::string cookie = StringPrintf(domain_cookie_format_line,
- i, it->c_str());
+ const std::string cookie = base::StringPrintf(domain_cookie_format_line,
+ i, it->c_str());
EXPECT_TRUE(cm->SetCookie(gurl, cookie));
}
}
@@ -203,10 +204,11 @@ TEST(CookieMonsterTest, TestImport) {
int64 time_tick(base::Time::Now().ToInternalValue());
for (int domain_num = 0; domain_num < 300; domain_num++) {
- std::string domain_name(StringPrintf(".Domain_%d.com", domain_num));
+ std::string domain_name(base::StringPrintf(".Domain_%d.com", domain_num));
std::string gurl("www" + domain_name);
for (int cookie_num = 0; cookie_num < 50; cookie_num++) {
- std::string cookie_line(StringPrintf("Cookie_%d=1; Path=/", cookie_num));
+ std::string cookie_line(base::StringPrintf("Cookie_%d=1; Path=/",
+ cookie_num));
AddCookieToList(gurl, cookie_line,
base::Time::FromInternalValue(time_tick++),
&initial_cookies);
diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc
index c59dc80..83c7f7d 100644
--- a/net/base/cookie_monster_unittest.cc
+++ b/net/base/cookie_monster_unittest.cc
@@ -11,6 +11,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "net/base/cookie_monster.h"
@@ -1042,7 +1043,7 @@ static void TestHostGarbageCollectHelper(int domain_max_cookies,
scoped_refptr<net::CookieMonster> cm(new net::CookieMonster(NULL, NULL));
cm->SetKeyScheme(new_key_scheme);
for (int i = 0; i < more_than_enough_cookies; ++i) {
- std::string cookie = StringPrintf("a%03d=b", i);
+ std::string cookie = base::StringPrintf("a%03d=b", i);
EXPECT_TRUE(cm->SetCookie(url_google, cookie));
std::string cookies = cm->GetCookies(url_google);
// Make sure we find it in the cookies.
@@ -1063,9 +1064,9 @@ static void TestHostGarbageCollectHelper(int domain_max_cookies,
scoped_refptr<net::CookieMonster> cm(new net::CookieMonster(NULL, NULL));
cm->SetKeyScheme(new_key_scheme);
for (int i = 0; i < more_than_enough_cookies; ++i) {
- std::string cookie_general = StringPrintf("a%03d=b", i);
+ std::string cookie_general = base::StringPrintf("a%03d=b", i);
EXPECT_TRUE(cm->SetCookie(url_google, cookie_general));
- std::string cookie_specific = StringPrintf("c%03d=b", i);
+ std::string cookie_specific = base::StringPrintf("c%03d=b", i);
EXPECT_TRUE(cm->SetCookie(url_google_specific, cookie_specific));
std::string cookies_general = cm->GetCookies(url_google);
EXPECT_NE(cookies_general.find(cookie_general), std::string::npos);
@@ -1117,7 +1118,7 @@ TEST(CookieMonsterTest, TestTotalGarbageCollection) {
// Add a bunch of cookies on a bunch of host, some should get purged.
const GURL sticky_cookie("http://a0000.izzle");
for (int i = 0; i < 4000; ++i) {
- GURL url(StringPrintf("http://a%04d.izzle", i));
+ GURL url(base::StringPrintf("http://a%04d.izzle", i));
EXPECT_TRUE(cm->SetCookie(url, "a=b"));
EXPECT_EQ("a=b", cm->GetCookies(url));
@@ -1132,7 +1133,7 @@ TEST(CookieMonsterTest, TestTotalGarbageCollection) {
// Check that cookies that still exist.
for (int i = 0; i < 4000; ++i) {
- GURL url(StringPrintf("http://a%04d.izzle", i));
+ GURL url(base::StringPrintf("http://a%04d.izzle", i));
if ((i == 0) || (i > 1001)) {
// Cookies should still be around.
EXPECT_FALSE(cm->GetCookies(url).empty());
diff --git a/net/base/escape_unittest.cc b/net/base/escape_unittest.cc
index 28972cb..01cd9e1 100644
--- a/net/base/escape_unittest.cc
+++ b/net/base/escape_unittest.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/i18n/icu_string_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -95,7 +96,7 @@ TEST(EscapeTest, EscapeTextForFormSubmission) {
EXPECT_EQ(out, std::string("+"));
} else if (no_escape.find(in) == std::string::npos) {
// Check %hex escaping
- std::string expected = StringPrintf("%%%02X", i);
+ std::string expected = base::StringPrintf("%%%02X", i);
EXPECT_EQ(expected, out);
} else {
// No change for things in the no_escape list.
diff --git a/net/base/host_cache_unittest.cc b/net/base/host_cache_unittest.cc
index 54a64c4..e534695 100644
--- a/net/base/host_cache_unittest.cc
+++ b/net/base/host_cache_unittest.cc
@@ -7,6 +7,7 @@
#include "base/format_macros.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/net_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -178,14 +179,14 @@ TEST(HostCacheTest, Compact) {
// Add five valid entries at t=10.
for (int i = 0; i < 5; ++i) {
- std::string hostname = StringPrintf("valid%d", i);
+ std::string hostname = base::StringPrintf("valid%d", i);
cache.Set(Key(hostname), OK, AddressList(), now);
}
EXPECT_EQ(5U, cache.size());
// Add 3 expired entries at t=0.
for (int i = 0; i < 3; ++i) {
- std::string hostname = StringPrintf("expired%d", i);
+ std::string hostname = base::StringPrintf("expired%d", i);
base::TimeTicks t = now - base::TimeDelta::FromSeconds(10);
cache.Set(Key(hostname), OK, AddressList(), t);
}
@@ -193,7 +194,7 @@ TEST(HostCacheTest, Compact) {
// Add 2 negative entries at t=10
for (int i = 0; i < 2; ++i) {
- std::string hostname = StringPrintf("negative%d", i);
+ std::string hostname = base::StringPrintf("negative%d", i);
cache.Set(Key(hostname), ERR_NAME_NOT_RESOLVED, AddressList(), now);
}
EXPECT_EQ(10U, cache.size());
@@ -452,7 +453,7 @@ TEST(HostCacheTest, KeyComparators) {
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]", i));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]", i));
const HostCache::Key& key1 = tests[i].key1;
const HostCache::Key& key2 = tests[i].key2;
diff --git a/net/base/host_port_pair.cc b/net/base/host_port_pair.cc
index bb63765..1c4406f 100644
--- a/net/base/host_port_pair.cc
+++ b/net/base/host_port_pair.cc
@@ -3,7 +3,9 @@
// found in the LICENSE file.
#include "net/base/host_port_pair.h"
+
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "googleurl/src/gurl.h"
namespace net {
@@ -18,14 +20,14 @@ HostPortPair HostPortPair::FromURL(const GURL& url) {
}
std::string HostPortPair::ToString() const {
- return StringPrintf("%s:%u", HostForURL().c_str(), port_);
+ return base::StringPrintf("%s:%u", HostForURL().c_str(), port_);
}
std::string HostPortPair::HostForURL() const {
// Check to see if the host is an IPv6 address. If so, added brackets.
if (host_.find(':') != std::string::npos) {
DCHECK_NE(host_[0], '[');
- return StringPrintf("[%s]", host_.c_str());
+ return base::StringPrintf("[%s]", host_.c_str());
}
return host_;
diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc
index 233ee21..4b28b8c 100644
--- a/net/base/host_resolver_impl_unittest.cc
+++ b/net/base/host_resolver_impl_unittest.cc
@@ -10,6 +10,7 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/base/mock_host_resolver.h"
@@ -137,7 +138,7 @@ class EchoingHostResolverProc : public HostResolverProc {
AddressList* addrlist,
int* os_error) {
// Encode the request's hostname and address_family in the output address.
- std::string ip_literal = StringPrintf("192.%d.%d.%d",
+ std::string ip_literal = base::StringPrintf("192.%d.%d.%d",
static_cast<int>(hostname.size()),
static_cast<int>(hostname[0]),
static_cast<int>(address_family));
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 0935635..ddc1da7 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -50,15 +50,16 @@
#include "base/string_split.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/sys_string_conversions.h"
#include "base/time.h"
#include "base/utf_offset_string_conversions.h"
#include "base/utf_string_conversions.h"
-#include "grit/net_resources.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_canon.h"
#include "googleurl/src/url_canon_ip.h"
#include "googleurl/src/url_parse.h"
+#include "grit/net_resources.h"
#include "net/base/dns_util.h"
#include "net/base/escape.h"
#include "net/base/net_module.h"
@@ -1509,14 +1510,15 @@ bool ParseHostAndPort(const std::string& host_and_port,
std::string GetHostAndPort(const GURL& url) {
// For IPv6 literals, GURL::host() already includes the brackets so it is
// safe to just append a colon.
- return StringPrintf("%s:%d", url.host().c_str(), url.EffectiveIntPort());
+ return base::StringPrintf("%s:%d", url.host().c_str(),
+ url.EffectiveIntPort());
}
std::string GetHostAndOptionalPort(const GURL& url) {
// For IPv6 literals, GURL::host() already includes the brackets
// so it is safe to just append a colon.
if (url.has_port())
- return StringPrintf("%s:%s", url.host().c_str(), url.port().c_str());
+ return base::StringPrintf("%s:%s", url.host().c_str(), url.port().c_str());
return url.host();
}
@@ -1547,10 +1549,10 @@ std::string NetAddressToStringWithPort(const struct addrinfo* net_address) {
if (ip_address_string.find(':') != std::string::npos) {
// Surround with square brackets to avoid ambiguity.
- return StringPrintf("[%s]:%d", ip_address_string.c_str(), port);
+ return base::StringPrintf("[%s]:%d", ip_address_string.c_str(), port);
}
- return StringPrintf("%s:%d", ip_address_string.c_str(), port);
+ return base::StringPrintf("%s:%d", ip_address_string.c_str(), port);
}
std::string GetHostName() {
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index fdf5f07..ad7ccad 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -8,9 +8,10 @@
#include "base/format_macros.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/sys_string_conversions.h"
-#include "base/utf_string_conversions.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "net/base/sys_addrinfo.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -616,7 +617,8 @@ TEST(NetUtilTest, GetIdentityFromURL) {
},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, tests[i].input_url));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ tests[i].input_url));
GURL url(tests[i].input_url);
string16 username, password;
@@ -1866,7 +1868,8 @@ TEST(NetUtilTest, SimplifyUrlForRequest) {
},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, tests[i].input_url));
+ SCOPED_TRACE(base::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));
@@ -2037,9 +2040,9 @@ TEST(NetUtilTest, IPNumberMatchesPrefix) {
},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s, %s", i,
- tests[i].cidr_literal,
- tests[i].ip_literal));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s, %s", i,
+ tests[i].cidr_literal,
+ tests[i].ip_literal));
net::IPAddressNumber ip_number;
EXPECT_TRUE(net::ParseIPLiteralToNumber(tests[i].ip_literal, &ip_number));
diff --git a/net/base/pem_tokenizer.cc b/net/base/pem_tokenizer.cc
index 6e83058..c79eec1 100644
--- a/net/base/pem_tokenizer.cc
+++ b/net/base/pem_tokenizer.cc
@@ -6,6 +6,7 @@
#include "base/base64.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
namespace {
@@ -95,8 +96,8 @@ void PEMTokenizer::Init(
allowed_block_types.begin(); it != allowed_block_types.end(); ++it) {
PEMType allowed_type;
allowed_type.type = *it;
- allowed_type.header = StringPrintf(kPEMBeginBlock, it->c_str());
- allowed_type.footer = StringPrintf(kPEMEndBlock, it->c_str());
+ allowed_type.header = base::StringPrintf(kPEMBeginBlock, it->c_str());
+ allowed_type.footer = base::StringPrintf(kPEMEndBlock, it->c_str());
block_types_.push_back(allowed_type);
}
}
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 1446711..66c789e 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -11,6 +11,7 @@
#include "base/message_loop.h"
#include "base/rand_util.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/sys_info.h"
#include "base/time.h"
#include "base/timer.h"
@@ -20,8 +21,8 @@
#include "net/disk_cache/entry_impl.h"
#include "net/disk_cache/errors.h"
#include "net/disk_cache/experiments.h"
-#include "net/disk_cache/hash.h"
#include "net/disk_cache/file.h"
+#include "net/disk_cache/hash.h"
#include "net/disk_cache/mem_backend_impl.h"
// This has to be defined before including histogram_macros.h from this file.
@@ -74,7 +75,8 @@ size_t GetIndexSize(int table_len) {
// will return "/foo/old_bar_005".
FilePath GetPrefixedName(const FilePath& path, const std::string& name,
int index) {
- std::string tmp = StringPrintf("%s%s_%03d", "old_", name.c_str(), index);
+ std::string tmp = base::StringPrintf("%s%s_%03d", "old_",
+ name.c_str(), index);
return path.AppendASCII(tmp);
}
@@ -191,7 +193,7 @@ bool SetFieldTrialInfo(int size_group) {
// Field trials involve static objects so we have to do this only once.
first = false;
scoped_refptr<FieldTrial> trial1 = new FieldTrial("CacheSize", 10);
- std::string group1 = StringPrintf("CacheSizeGroup_%d", size_group);
+ std::string group1 = base::StringPrintf("CacheSizeGroup_%d", size_group);
trial1->AppendGroup(group1, FieldTrial::kAllRemainingProbability);
scoped_refptr<FieldTrial> trial2 = new FieldTrial("CacheThrottle", 100);
@@ -517,19 +519,19 @@ void BackendImpl::GetStats(StatsItems* stats) {
std::pair<std::string, std::string> item;
item.first = "Entries";
- item.second = StringPrintf("%d", data_->header.num_entries);
+ item.second = base::StringPrintf("%d", data_->header.num_entries);
stats->push_back(item);
item.first = "Pending IO";
- item.second = StringPrintf("%d", num_pending_io_);
+ item.second = base::StringPrintf("%d", num_pending_io_);
stats->push_back(item);
item.first = "Max size";
- item.second = StringPrintf("%d", max_size_);
+ item.second = base::StringPrintf("%d", max_size_);
stats->push_back(item);
item.first = "Current size";
- item.second = StringPrintf("%d", data_->header.num_bytes);
+ item.second = base::StringPrintf("%d", data_->header.num_bytes);
stats->push_back(item);
stats_.GetItems(stats);
@@ -918,7 +920,7 @@ FilePath BackendImpl::GetFileName(Addr address) const {
return FilePath();
}
- std::string tmp = StringPrintf("f_%06x", address.FileNumber());
+ std::string tmp = base::StringPrintf("f_%06x", address.FileNumber());
return path_.AppendASCII(tmp);
}
@@ -1108,8 +1110,9 @@ bool BackendImpl::IsLoaded() const {
std::string BackendImpl::HistogramName(const char* name, int experiment) const {
if (!experiment)
- return StringPrintf("DiskCache.%d.%s", cache_type_, name);
- return StringPrintf("DiskCache.%d.%s_%d", cache_type_, name, experiment);
+ return base::StringPrintf("DiskCache.%d.%s", cache_type_, name);
+ return base::StringPrintf("DiskCache.%d.%s_%d", cache_type_,
+ name, experiment);
}
base::WeakPtr<BackendImpl> BackendImpl::GetWeakPtr() {
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index 3f0018c..43b59e8 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -6,6 +6,7 @@
#include "base/file_util.h"
#include "base/platform_thread.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -752,7 +753,7 @@ void DiskCacheBackendTest::BackendTrimInvalidEntry2() {
// Writing 32 entries to this cache chains most of them.
for (int i = 0; i < 32; i++) {
- std::string key(StringPrintf("some key %d", i));
+ std::string key(base::StringPrintf("some key %d", i));
ASSERT_EQ(net::OK, CreateEntry(key, &entry));
EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false));
entry->Close();
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc
index b81a868..e0021a8 100644
--- a/net/disk_cache/block_files.cc
+++ b/net/disk_cache/block_files.cc
@@ -7,6 +7,7 @@
#include "base/file_util.h"
#include "base/histogram.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/thread_checker.h"
#include "base/time.h"
#include "net/disk_cache/cache_util.h"
@@ -602,7 +603,7 @@ void BlockFiles::GetFileStats(int index, int* used_count, int* load) {
FilePath BlockFiles::Name(int index) {
// The file format allows for 256 files.
DCHECK(index < 256 || index >= 0);
- std::string tmp = StringPrintf("%s%d", kBlockName, index);
+ std::string tmp = base::StringPrintf("%s%d", kBlockName, index);
return path_.AppendASCII(tmp);
}
diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc
index afd3317..2934184 100644
--- a/net/disk_cache/sparse_control.cc
+++ b/net/disk_cache/sparse_control.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/time.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -41,8 +42,8 @@ const int kBlockSize = 1024;
// number of the particular child.
std::string GenerateChildName(const std::string& base_name, int64 signature,
int64 child_id) {
- return StringPrintf("Range_%s:%" PRIx64 ":%" PRIx64, base_name.c_str(),
- signature, child_id);
+ return base::StringPrintf("Range_%s:%" PRIx64 ":%" PRIx64, base_name.c_str(),
+ signature, child_id);
}
// This class deletes the children of a sparse entry.
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc
index b69e70d..f0446fb 100644
--- a/net/disk_cache/stats.cc
+++ b/net/disk_cache/stats.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/disk_cache/backend_impl.h"
namespace {
@@ -260,14 +261,14 @@ int64 Stats::GetCounter(Counters counter) const {
void Stats::GetItems(StatsItems* items) {
std::pair<std::string, std::string> item;
for (int i = 0; i < kDataSizesLength; i++) {
- item.first = StringPrintf("Size%02d", i);
- item.second = StringPrintf("0x%08x", data_sizes_[i]);
+ item.first = base::StringPrintf("Size%02d", i);
+ item.second = base::StringPrintf("0x%08x", data_sizes_[i]);
items->push_back(item);
}
for (int i = MIN_COUNTER + 1; i < MAX_COUNTER; i++) {
item.first = kCounterNames[i];
- item.second = StringPrintf("0x%" PRIx64, counters_[i]);
+ item.second = base::StringPrintf("0x%" PRIx64, counters_[i]);
items->push_back(item);
}
}
diff --git a/net/ftp/ftp_directory_listing_buffer_unittest.cc b/net/ftp/ftp_directory_listing_buffer_unittest.cc
index f07f535..ff7aedf 100644
--- a/net/ftp/ftp_directory_listing_buffer_unittest.cc
+++ b/net/ftp/ftp_directory_listing_buffer_unittest.cc
@@ -61,7 +61,7 @@ TEST(FtpDirectoryListingBufferTest, Parse) {
&mock_current_time));
for (size_t i = 0; i < arraysize(test_files); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, test_files[i]));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, test_files[i]));
net::FtpDirectoryListingBuffer buffer(mock_current_time);
@@ -90,7 +90,7 @@ TEST(FtpDirectoryListingBufferTest, Parse) {
int64 size;
base::StringToInt64(lines[8 * i + 2], &size);
- SCOPED_TRACE(StringPrintf("Filename: %s", name.c_str()));
+ SCOPED_TRACE(base::StringPrintf("Filename: %s", name.c_str()));
int year, month, day_of_month, hour, minute;
base::StringToInt(lines[8 * i + 3], &year);
diff --git a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
index c67c928..44c3eb6 100644
--- a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/format_macros.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/ftp/ftp_directory_listing_parser_ls.h"
namespace {
@@ -77,7 +78,8 @@ TEST_F(FtpDirectoryListingParserLsTest, Good) {
2006, 7, 17, 0, 0 },
};
for (size_t i = 0; i < arraysize(good_cases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ good_cases[i].input));
net::FtpDirectoryListingParserLs parser(mock_current_time);
RunSingleLineTestCase(&parser, good_cases[i]);
diff --git a/net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc b/net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc
index 9663664..1a01f27 100644
--- a/net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_mlsd_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/format_macros.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/ftp/ftp_directory_listing_parser_mlsd.h"
namespace {
@@ -31,7 +32,8 @@ TEST_F(FtpDirectoryListingParserMlsdTest, Good) {
2001, 4, 14, 15, 52 },
};
for (size_t i = 0; i < arraysize(good_cases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ good_cases[i].input));
net::FtpDirectoryListingParserMlsd parser;
RunSingleLineTestCase(&parser, good_cases[i]);
diff --git a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
index 6570846..f5e4a35 100644
--- a/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_netware_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/format_macros.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "net/ftp/ftp_directory_listing_parser_netware.h"
@@ -27,7 +28,8 @@ TEST_F(FtpDirectoryListingParserNetwareTest, Good) {
1994, 11, 11, 18, 25 },
};
for (size_t i = 0; i < arraysize(good_cases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ good_cases[i].input));
net::FtpDirectoryListingParserNetware parser(mock_current_time);
// The parser requires a "total n" like before accepting regular input.
diff --git a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc
index 47cdaa5..ab5366f 100644
--- a/net/ftp/ftp_directory_listing_parser_vms_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_vms_unittest.cc
@@ -7,6 +7,7 @@
#include "base/format_macros.h"
#include "base/string_split.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "net/ftp/ftp_directory_listing_parser_vms.h"
@@ -45,7 +46,8 @@ TEST_F(FtpDirectoryListingParserVmsTest, Good) {
2005, 3, 12, 8, 44 },
};
for (size_t i = 0; i < arraysize(good_cases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ good_cases[i].input));
net::FtpDirectoryListingParserVms parser;
ASSERT_TRUE(
@@ -101,7 +103,7 @@ TEST_F(FtpDirectoryListingParserVmsTest, Bad) {
"Directory ROOT|X.TXT;2 1 12-MAR-2005 08:44:57 [X] (RWED,RRWWEEDD,RE,RE)",
};
for (size_t i = 0; i < arraysize(bad_cases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i]));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i]));
std::vector<std::string> lines;
SplitString(bad_cases[i], '|', &lines);
diff --git a/net/ftp/ftp_directory_listing_parser_windows_unittest.cc b/net/ftp/ftp_directory_listing_parser_windows_unittest.cc
index eaf48ca..c53cfd1 100644
--- a/net/ftp/ftp_directory_listing_parser_windows_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_windows_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/format_macros.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/ftp/ftp_directory_listing_parser_windows.h"
namespace {
@@ -58,7 +59,8 @@ TEST_F(FtpDirectoryListingParserWindowsTest, Good) {
2010, 12, 25, 12, 0 },
};
for (size_t i = 0; i < arraysize(good_cases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ good_cases[i].input));
net::FtpDirectoryListingParserWindows parser;
RunSingleLineTestCase(&parser, good_cases[i]);
diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc
index 20450c2..98ae975 100644
--- a/net/ftp/ftp_util_unittest.cc
+++ b/net/ftp/ftp_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,8 +7,9 @@
#include "base/basictypes.h"
#include "base/format_macros.h"
#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
+#include "base/stringprintf.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -140,9 +141,9 @@ TEST(FtpUtilTest, LsDateListingToTime) {
{ "Dec", "06", "21:00", 1993, 12, 6, 21, 0 },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s %s %s", i,
- kTestCases[i].month, kTestCases[i].day,
- kTestCases[i].rest));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %s %s", i,
+ kTestCases[i].month, kTestCases[i].day,
+ kTestCases[i].rest));
base::Time time;
ASSERT_TRUE(net::FtpUtil::LsDateListingToTime(
@@ -179,8 +180,8 @@ TEST(FtpUtilTest, GetStringPartAfterColumns) {
{ " foo abc ", 2, "" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s %d",
- i, kTestCases[i].text, kTestCases[i].column));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %d", i,
+ kTestCases[i].text, kTestCases[i].column));
EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_result),
net::FtpUtil::GetStringPartAfterColumns(
diff --git a/net/http/http_auth_cache_unittest.cc b/net/http/http_auth_cache_unittest.cc
index bc4a0fb..5773d159 100644
--- a/net/http/http_auth_cache_unittest.cc
+++ b/net/http/http_auth_cache_unittest.cc
@@ -6,6 +6,7 @@
#include "base/string16.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "net/base/net_errors.h"
#include "net/http/http_auth_cache.h"
@@ -379,11 +380,11 @@ class HttpAuthCacheEvictionTest : public testing::Test {
HttpAuthCacheEvictionTest() : origin_("http://www.google.com") { }
std::string GenerateRealm(int realm_i) {
- return StringPrintf("Realm %d", realm_i);
+ return base::StringPrintf("Realm %d", realm_i);
}
std::string GeneratePath(int realm_i, int path_i) {
- return StringPrintf("/%d/%d/x/y", realm_i, path_i);
+ return base::StringPrintf("/%d/%d/x/y", realm_i, path_i);
}
void AddRealm(int realm_i) {
diff --git a/net/http/http_auth_gssapi_posix.cc b/net/http/http_auth_gssapi_posix.cc
index d6f73c4..fdbef63 100644
--- a/net/http/http_auth_gssapi_posix.cc
+++ b/net/http/http_auth_gssapi_posix.cc
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/singleton.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
@@ -96,7 +97,7 @@ std::string DisplayStatus(OM_uint32 major_status,
OM_uint32 minor_status) {
if (major_status == GSS_S_COMPLETE)
return "OK";
- return StringPrintf("0x%08X 0x%08X", major_status, minor_status);
+ return base::StringPrintf("0x%08X 0x%08X", major_status, minor_status);
}
std::string DisplayCode(GSSAPILibrary* gssapi_lib,
@@ -106,7 +107,7 @@ std::string DisplayCode(GSSAPILibrary* gssapi_lib,
const size_t kMaxMsgLength = 4096;
// msg_ctx needs to be outside the loop because it is invoked multiple times.
OM_uint32 msg_ctx = 0;
- std::string rv = StringPrintf("(0x%08X)", status);
+ std::string rv = base::StringPrintf("(0x%08X)", status);
// This loop should continue iterating until msg_ctx is 0 after the first
// iteration. To be cautious and prevent an infinite loop, it stops after
@@ -125,8 +126,8 @@ std::string DisplayCode(GSSAPILibrary* gssapi_lib,
static_cast<int>(kMaxMsgLength) :
static_cast<int>(msg.length);
if (msg_len > 0 && msg.value != NULL) {
- rv += StringPrintf(" %.*s", msg_len,
- static_cast<char*>(msg.value));
+ rv += base::StringPrintf(" %.*s", msg_len,
+ static_cast<char*>(msg.value));
}
}
gssapi_lib->release_buffer(&min_stat, &msg);
@@ -143,7 +144,8 @@ std::string DisplayExtendedStatus(GSSAPILibrary* gssapi_lib,
return "OK";
std::string major = DisplayCode(gssapi_lib, major_status, GSS_C_GSS_CODE);
std::string minor = DisplayCode(gssapi_lib, minor_status, GSS_C_MECH_CODE);
- return StringPrintf("Major: %s | Minor: %s", major.c_str(), minor.c_str());
+ return base::StringPrintf("Major: %s | Minor: %s", major.c_str(),
+ minor.c_str());
}
// ScopedName releases a gss_name_t when it goes out of scope.
@@ -253,11 +255,11 @@ std::string DescribeOid(GSSAPILibrary* gssapi_lib, const gss_OID oid) {
}
}
if (!str[str_length]) {
- output += StringPrintf("\"%s\"", str);
+ output += base::StringPrintf("\"%s\"", str);
return output;
}
}
- output = StringPrintf("(%u) \"", byte_length);
+ output = base::StringPrintf("(%u) \"", byte_length);
if (!oid->elements) {
output += "<NULL>";
return output;
@@ -267,7 +269,7 @@ std::string DescribeOid(GSSAPILibrary* gssapi_lib, const gss_OID oid) {
// Don't print more than |kMaxCharsToPrint| characters.
size_t i = 0;
for ( ; (i < byte_length) && (i < kMaxCharsToPrint); ++i) {
- output += StringPrintf("\\x%02X", elements[i]);
+ output += base::StringPrintf("\\x%02X", elements[i]);
}
if (i >= kMaxCharsToPrint)
output += "...";
@@ -312,19 +314,19 @@ std::string DescribeName(GSSAPILibrary* gssapi_lib, const gss_name_t name) {
ScopedBuffer scoped_output_name(&output_name_buffer, gssapi_lib);
if (major_status != GSS_S_COMPLETE) {
std::string error =
- StringPrintf("Unable to describe name 0x%p, %s",
- name,
- DisplayExtendedStatus(gssapi_lib,
- major_status,
- minor_status).c_str());
+ base::StringPrintf("Unable to describe name 0x%p, %s",
+ name,
+ DisplayExtendedStatus(gssapi_lib,
+ major_status,
+ minor_status).c_str());
return error;
}
int len = output_name_buffer.length;
- std::string description =
- StringPrintf("%*s (Type %s)",
- len,
- reinterpret_cast<const char*>(output_name_buffer.value),
- DescribeOid(gssapi_lib, output_name_type).c_str());
+ std::string description = base::StringPrintf(
+ "%*s (Type %s)",
+ len,
+ reinterpret_cast<const char*>(output_name_buffer.value),
+ DescribeOid(gssapi_lib, output_name_type).c_str());
return description;
}
@@ -352,32 +354,32 @@ std::string DescribeContext(GSSAPILibrary* gssapi_lib,
ScopedName(targ_name, gssapi_lib);
if (major_status != GSS_S_COMPLETE) {
std::string error =
- StringPrintf("Unable to describe context 0x%p, %s",
- context_handle,
- DisplayExtendedStatus(gssapi_lib,
- major_status,
- minor_status).c_str());
+ base::StringPrintf("Unable to describe context 0x%p, %s",
+ context_handle,
+ DisplayExtendedStatus(gssapi_lib,
+ major_status,
+ minor_status).c_str());
return error;
}
std::string source(DescribeName(gssapi_lib, src_name));
std::string target(DescribeName(gssapi_lib, targ_name));
- std::string description = StringPrintf("Context 0x%p: "
- "Source \"%s\", "
- "Target \"%s\", "
- "lifetime %d, "
- "mechanism %s, "
- "flags 0x%08X, "
- "local %d, "
- "open %d",
- context_handle,
- source.c_str(),
- target.c_str(),
- lifetime_rec,
- DescribeOid(gssapi_lib,
- mech_type).c_str(),
- ctx_flags,
- locally_initiated,
- open);
+ std::string description = base::StringPrintf("Context 0x%p: "
+ "Source \"%s\", "
+ "Target \"%s\", "
+ "lifetime %d, "
+ "mechanism %s, "
+ "flags 0x%08X, "
+ "local %d, "
+ "open %d",
+ context_handle,
+ source.c_str(),
+ target.c_str(),
+ lifetime_rec,
+ DescribeOid(gssapi_lib,
+ mech_type).c_str(),
+ ctx_flags,
+ locally_initiated,
+ open);
return description;
}
diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc
index 4858658..ccb8766 100644
--- a/net/http/http_auth_handler.cc
+++ b/net/http/http_auth_handler.cc
@@ -7,6 +7,7 @@
#include "base/histogram.h"
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/net_errors.h"
namespace net {
@@ -27,7 +28,7 @@ HttpAuthHandler::~HttpAuthHandler() {
//static
std::string HttpAuthHandler::GenerateHistogramNameFromScheme(
const std::string& scheme) {
- return StringPrintf("Net.AuthGenerateToken_%s", scheme.c_str());
+ return base::StringPrintf("Net.AuthGenerateToken_%s", scheme.c_str());
}
bool HttpAuthHandler::InitFromChallenge(
diff --git a/net/http/http_auth_handler_digest.cc b/net/http/http_auth_handler_digest.cc
index 289e0c7..7c14a47 100644
--- a/net/http/http_auth_handler_digest.cc
+++ b/net/http/http_auth_handler_digest.cc
@@ -10,6 +10,7 @@
#include "base/md5.h"
#include "base/rand_util.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
@@ -170,7 +171,7 @@ std::string HttpAuthHandlerDigest::AssembleCredentials(
const std::string& cnonce,
int nonce_count) const {
// the nonce-count is an 8 digit hex string.
- std::string nc = StringPrintf("%08x", nonce_count);
+ std::string nc = base::StringPrintf("%08x", nonce_count);
// TODO(eroman): is this the right encoding?
std::string authorization = (std::string("Digest username=") +
diff --git a/net/http/http_auth_handler_negotiate.cc b/net/http/http_auth_handler_negotiate.cc
index e6e226d..a05800a 100644
--- a/net/http/http_auth_handler_negotiate.cc
+++ b/net/http/http_auth_handler_negotiate.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "net/base/address_family.h"
#include "net/base/host_resolver.h"
@@ -168,10 +169,11 @@ std::wstring HttpAuthHandlerNegotiate::CreateSPN(
static const char kSpnSeparator = '@';
#endif
if (port != 80 && port != 443 && use_port_) {
- return ASCIIToWide(StringPrintf("HTTP%c%s:%d", kSpnSeparator,
- server.c_str(), port));
+ return ASCIIToWide(base::StringPrintf("HTTP%c%s:%d", kSpnSeparator,
+ server.c_str(), port));
} else {
- return ASCIIToWide(StringPrintf("HTTP%c%s", kSpnSeparator, server.c_str()));
+ return ASCIIToWide(base::StringPrintf("HTTP%c%s", kSpnSeparator,
+ server.c_str()));
}
}
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index d1c6195..2dd2347 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -18,8 +18,9 @@
#include "base/pickle.h"
#include "base/ref_counted.h"
#include "base/stl_util-inl.h"
-#include "base/string_util.h"
#include "base/string_number_conversions.h"
+#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -458,8 +459,8 @@ std::string HttpCache::GenerateCacheKey(const HttpRequestInfo* request) {
// 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("%" PRId64 "/",
- request->upload_data->identifier()));
+ url.insert(0, base::StringPrintf("%" PRId64 "/",
+ request->upload_data->identifier()));
}
return url;
}
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 86b5e0f..2c8e16d 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,10 +8,11 @@
#include "base/message_loop.h"
#include "base/scoped_vector.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/cache_type.h"
#include "net/base/cert_status_flags.h"
-#include "net/base/net_errors.h"
#include "net/base/load_flags.h"
+#include "net/base/net_errors.h"
#include "net/base/net_log_unittest.h"
#include "net/base/ssl_cert_request_info.h"
#include "net/disk_cache/disk_cache.h"
@@ -893,8 +894,8 @@ void RangeTransactionServer::RangeHandler(const net::HttpRequestInfo* request,
EXPECT_LT(end, 80);
- std::string content_range = StringPrintf("Content-Range: bytes %d-%d/80\n",
- start, end);
+ std::string content_range = base::StringPrintf(
+ "Content-Range: bytes %d-%d/80\n", start, end);
response_headers->append(content_range);
if (!request->extra_headers.HasHeader("If-None-Match") || modified_) {
@@ -908,7 +909,8 @@ void RangeTransactionServer::RangeHandler(const net::HttpRequestInfo* request,
// We also have to fix content-length.
int len = end - start + 1;
EXPECT_EQ(0, len % 10);
- std::string content_length = StringPrintf("Content-Length: %d\n", len);
+ std::string content_length = base::StringPrintf("Content-Length: %d\n",
+ len);
response_headers->replace(response_headers->find("Content-Length:"),
content_length.size(), content_length);
}
diff --git a/net/http/http_net_log_params.h b/net/http/http_net_log_params.h
index a1d3db8..5a5e84b 100644
--- a/net/http/http_net_log_params.h
+++ b/net/http/http_net_log_params.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
+#include "base/stringprintf.h"
#include "base/values.h"
#include "net/base/net_log.h"
#include "net/http/http_request_headers.h"
@@ -32,9 +33,9 @@ class NetLogHttpRequestParameter : public NetLog::EventParameters {
HttpRequestHeaders::Iterator iterator(headers_);
while (iterator.GetNext()) {
headers->Append(
- new StringValue(StringPrintf("%s: %s",
- iterator.name().c_str(),
- iterator.value().c_str())));
+ new StringValue(base::StringPrintf("%s: %s",
+ iterator.name().c_str(),
+ iterator.value().c_str())));
}
dict->Set("headers", headers);
return dict;
@@ -64,7 +65,8 @@ class NetLogHttpResponseParameter : public NetLog::EventParameters {
std::string value;
while (headers_->EnumerateHeaderLines(&iterator, &name, &value)) {
headers->Append(
- new StringValue(StringPrintf("%s: %s", name.c_str(), value.c_str())));
+ new StringValue(base::StringPrintf("%s: %s", name.c_str(),
+ value.c_str())));
}
dict->Set("headers", headers);
return dict;
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 0b570cc..b0bcf89 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -14,8 +14,9 @@
#include "base/scoped_ptr.h"
#include "base/stats_counters.h"
#include "base/stl_util-inl.h"
-#include "base/string_util.h"
#include "base/string_number_conversions.h"
+#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "build/build_config.h"
#include "googleurl/src/gurl.h"
#include "net/base/auth.h"
@@ -67,7 +68,7 @@ void BuildRequestHeaders(const HttpRequestInfo* request_info,
const std::string path = using_proxy ?
HttpUtil::SpecForRequest(request_info->url) :
HttpUtil::PathForRequest(request_info->url);
- *request_line = StringPrintf(
+ *request_line = base::StringPrintf(
"%s %s HTTP/1.1\r\n", request_info->method.c_str(), path.c_str());
request_headers->SetHeader(HttpRequestHeaders::kHost,
GetHostAndOptionalPort(request_info->url));
@@ -1210,9 +1211,10 @@ GURL HttpNetworkTransaction::AuthURL(HttpAuth::Target target) const {
}
}
-#define STATE_CASE(s) case s: \
- description = StringPrintf("%s (0x%08X)", #s, s); \
- break
+#define STATE_CASE(s) \
+ case s: \
+ description = base::StringPrintf("%s (0x%08X)", #s, s); \
+ break
std::string HttpNetworkTransaction::DescribeState(State state) {
std::string description;
@@ -1229,7 +1231,8 @@ std::string HttpNetworkTransaction::DescribeState(State state) {
STATE_CASE(STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE);
STATE_CASE(STATE_NONE);
default:
- description = StringPrintf("Unknown state 0x%08X (%u)", state, state);
+ description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
+ state);
break;
}
return description;
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc
index 76befab..ccc5d5d 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -5,6 +5,7 @@
#include "net/http/http_proxy_client_socket.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "googleurl/src/gurl.h"
#include "net/base/auth.h"
#include "net/base/host_port_pair.h"
@@ -32,7 +33,7 @@ void BuildTunnelRequest(const HttpRequestInfo* request_info,
// RFC 2616 Section 9 says the Host request-header field MUST accompany all
// HTTP/1.1 requests. Add "Proxy-Connection: keep-alive" for compat with
// HTTP/1.0 proxies such as Squid (required for NTLM authentication).
- *request_line = StringPrintf(
+ *request_line = base::StringPrintf(
"CONNECT %s HTTP/1.1\r\n", endpoint.ToString().c_str());
request_headers->SetHeader(HttpRequestHeaders::kHost,
GetHostAndOptionalPort(request_info->url));
diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc
index 0486ac2..d772e9f 100644
--- a/net/http/http_stream_request.cc
+++ b/net/http/http_stream_request.cc
@@ -7,6 +7,7 @@
#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/connection_type_histograms.h"
#include "net/base/net_log.h"
#include "net/base/net_util.h"
@@ -15,11 +16,11 @@
#include "net/http/http_network_session.h"
#include "net/http/http_proxy_client_socket.h"
#include "net/http/http_request_info.h"
+#include "net/socket/client_socket_handle.h"
+#include "net/socket/ssl_client_socket.h"
#include "net/spdy/spdy_http_stream.h"
#include "net/spdy/spdy_session.h"
#include "net/spdy/spdy_session_pool.h"
-#include "net/socket/client_socket_handle.h"
-#include "net/socket/ssl_client_socket.h"
namespace net {
@@ -450,7 +451,7 @@ int HttpStreamRequest::DoInitConnection() {
DCHECK(!connection_group.empty());
if (using_ssl_)
- connection_group = StringPrintf("ssl/%s", connection_group.c_str());
+ connection_group = base::StringPrintf("ssl/%s", connection_group.c_str());
// If the user is refreshing the page, bypass the host cache.
bool disable_resolver_cache =
@@ -518,8 +519,8 @@ int HttpStreamRequest::DoInitConnection() {
socks_version = '5';
else
socks_version = '4';
- connection_group =
- StringPrintf("socks%c/%s", socks_version, connection_group.c_str());
+ connection_group = base::StringPrintf(
+ "socks%c/%s", socks_version, connection_group.c_str());
socks_params = new SOCKSSocketParams(proxy_tcp_params,
socks_version == '5',
diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h
index 47629b5..3149534 100644
--- a/net/http/http_transaction_unittest.h
+++ b/net/http/http_transaction_unittest.h
@@ -16,9 +16,10 @@
#include "base/message_loop.h"
#include "base/string16.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/io_buffer.h"
-#include "net/base/net_errors.h"
#include "net/base/load_flags.h"
+#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_cache.h"
@@ -226,8 +227,8 @@ class MockNetworkTransaction : public net::HttpTransaction {
if (t->handler)
(t->handler)(request, &resp_status, &resp_headers, &resp_data);
- std::string header_data =
- StringPrintf("%s\n%s\n", resp_status.c_str(), resp_headers.c_str());
+ std::string header_data = base::StringPrintf(
+ "%s\n%s\n", resp_status.c_str(), resp_headers.c_str());
std::replace(header_data.begin(), header_data.end(), '\n', '\0');
response_.request_time = base::Time::Now();
diff --git a/net/http/mock_gssapi_library_posix.cc b/net/http/mock_gssapi_library_posix.cc
index fed2ccd..d0a46b1 100644
--- a/net/http/mock_gssapi_library_posix.cc
+++ b/net/http/mock_gssapi_library_posix.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/third_party/gssapi/gssapi.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -312,9 +313,9 @@ OM_uint32 MockGSSAPILibrary::display_status(
gss_buffer_t status_string) {
if (minor_status)
*minor_status = 0;
- std::string msg = StringPrintf("Value: %u, Type %u",
- status_value,
- status_type);
+ std::string msg = base::StringPrintf("Value: %u, Type %u",
+ status_value,
+ status_type);
if (message_context)
*message_context = 0;
BufferFromString(msg, status_string);
diff --git a/net/http/partial_data.cc b/net/http/partial_data.cc
index 8964903..54900b3 100644
--- a/net/http/partial_data.cc
+++ b/net/http/partial_data.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/disk_cache.h"
#include "net/http/http_response_headers.h"
@@ -32,7 +33,7 @@ void AddRangeHeader(int64 start, int64 end, HttpRequestHeaders* headers) {
headers->SetHeader(
HttpRequestHeaders::kRange,
- StringPrintf("bytes=%s-%s", my_start.c_str(), my_end.c_str()));
+ base::StringPrintf("bytes=%s-%s", my_start.c_str(), my_end.c_str()));
}
} // namespace
@@ -349,11 +350,11 @@ void PartialData::FixResponseHeaders(HttpResponseHeaders* headers) {
DCHECK(byte_range_.HasFirstBytePosition());
DCHECK(byte_range_.HasLastBytePosition());
headers->AddHeader(
- StringPrintf("%s: bytes %" PRId64 "-%" PRId64 "/%" PRId64,
- kRangeHeader,
- byte_range_.first_byte_position(),
- byte_range_.last_byte_position(),
- resource_size_));
+ base::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 {
@@ -363,13 +364,14 @@ void PartialData::FixResponseHeaders(HttpResponseHeaders* headers) {
range_len = resource_size_;
}
- headers->AddHeader(StringPrintf("%s: %" PRId64, kLengthHeader, range_len));
+ headers->AddHeader(base::StringPrintf("%s: %" PRId64, kLengthHeader,
+ range_len));
}
void PartialData::FixContentLength(HttpResponseHeaders* headers) {
headers->RemoveHeader(kLengthHeader);
- headers->AddHeader(StringPrintf("%s: %" PRId64, kLengthHeader,
- resource_size_));
+ headers->AddHeader(base::StringPrintf("%s: %" PRId64, kLengthHeader,
+ resource_size_));
}
int PartialData::CacheRead(disk_cache::Entry* entry, IOBuffer* data,
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index bd6a70b..d9b1a26 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -4,11 +4,11 @@
#include "net/ocsp/nss_ocsp.h"
-#include <certt.h>
#include <certdb.h>
-#include <ocsp.h>
+#include <certt.h>
#include <nspr.h>
#include <nss.h>
+#include <ocsp.h>
#include <secerr.h>
#include <string>
@@ -20,6 +20,7 @@
#include "base/message_loop.h"
#include "base/singleton.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/thread.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
@@ -448,11 +449,11 @@ class OCSPServerSession {
// TODO(ukai): If |host| is an IPv6 literal, we need to quote it with
// square brackets [].
- std::string url_string(StringPrintf("%s://%s:%d%s",
- http_protocol_variant,
- host_.c_str(),
- port_,
- path_and_query_string));
+ std::string url_string(base::StringPrintf("%s://%s:%d%s",
+ http_protocol_variant,
+ host_.c_str(),
+ port_,
+ path_and_query_string));
LOG(INFO) << "URL [" << url_string << "]";
GURL url(url_string);
return new OCSPRequestSession(
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc
index 69e9ef7..95071b1 100644
--- a/net/proxy/multi_threaded_proxy_resolver.cc
+++ b/net/proxy/multi_threaded_proxy_resolver.cc
@@ -6,6 +6,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/thread.h"
#include "net/base/capturing_net_log.h"
#include "net/base/net_errors.h"
@@ -315,7 +316,7 @@ MultiThreadedProxyResolver::Executor::Executor(
// Note that it is safe to pass a temporary C-String to Thread(), as it will
// make a copy.
std::string thread_name =
- StringPrintf("PAC thread #%d", thread_number);
+ base::StringPrintf("PAC thread #%d", thread_number);
thread_.reset(new base::Thread(thread_name.c_str()));
thread_->Start();
}
diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
index f06fdea..7027161 100644
--- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc
+++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
@@ -6,12 +6,13 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/waitable_event.h"
#include "googleurl/src/gurl.h"
+#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/net_log_unittest.h"
-#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/proxy/proxy_info.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -619,8 +620,8 @@ TEST(MultiThreadedProxyResolverTest, ThreeThreads_Basic) {
for (int i = 1; i < kNumRequests; ++i) {
rv = resolver.GetProxyForURL(
- GURL(StringPrintf("http://request%d", i)), &results[i], &callback[i],
- &request[i], BoundNetLog());
+ GURL(base::StringPrintf("http://request%d", i)), &results[i],
+ &callback[i], &request[i], BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
}
@@ -725,7 +726,7 @@ TEST(MultiThreadedProxyResolverTest, OneThreadBlocked) {
for (int i = 1; i < kNumRequests; ++i) {
rv = resolver.GetProxyForURL(
- GURL(StringPrintf("http://request%d", i)),
+ GURL(base::StringPrintf("http://request%d", i)),
&results[i], &callback[i], &request[i], BoundNetLog());
EXPECT_EQ(ERR_IO_PENDING, rv);
}
diff --git a/net/proxy/proxy_bypass_rules_unittest.cc b/net/proxy/proxy_bypass_rules_unittest.cc
index 208f9cd..5b6ce04 100644
--- a/net/proxy/proxy_bypass_rules_unittest.cc
+++ b/net/proxy/proxy_bypass_rules_unittest.cc
@@ -5,6 +5,7 @@
#include "net/proxy/proxy_bypass_rules.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/proxy/proxy_config_service_common_unittest.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -275,7 +276,7 @@ TEST(ProxyBypassRulesTest, BypassLocalNames) {
rules.ParseFromString("<local>");
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf(
+ SCOPED_TRACE(base::StringPrintf(
"Test[%d]: %s", static_cast<int>(i), tests[i].url));
EXPECT_EQ(tests[i].expected_is_local, rules.Matches(GURL(tests[i].url)));
}
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 0a541c1..41fe7d2 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -13,6 +13,7 @@
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/task.h"
#include "base/thread.h"
#include "base/waitable_event.h"
@@ -376,7 +377,7 @@ class ProxyConfigServiceLinuxTest : public PlatformTest {
};
// Builds an identifier for each test in an array.
-#define TEST_DESC(desc) StringPrintf("at line %d <%s>", __LINE__, desc)
+#define TEST_DESC(desc) base::StringPrintf("at line %d <%s>", __LINE__, desc)
TEST_F(ProxyConfigServiceLinuxTest, BasicGConfTest) {
std::vector<std::string> empty_ignores;
@@ -605,8 +606,8 @@ TEST_F(ProxyConfigServiceLinuxTest, BasicGConfTest) {
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i,
- tests[i].description.c_str()));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "] %s", i,
+ tests[i].description.c_str()));
MockEnvironment* env = new MockEnvironment;
MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter;
SynchConfigGetter sync_config_getter(
@@ -895,8 +896,8 @@ TEST_F(ProxyConfigServiceLinuxTest, BasicEnvTest) {
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i,
- tests[i].description.c_str()));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "] %s", i,
+ tests[i].description.c_str()));
MockEnvironment* env = new MockEnvironment;
MockGConfSettingGetter* gconf_getter = new MockGConfSettingGetter;
SynchConfigGetter sync_config_getter(
@@ -1292,8 +1293,8 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
- SCOPED_TRACE(StringPrintf("Test[%" PRIuS "] %s", i,
- tests[i].description.c_str()));
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "] %s", i,
+ tests[i].description.c_str()));
MockEnvironment* env = new MockEnvironment;
env->values = tests[i].env_values;
// Force the KDE getter to be used and tell it where the test is.
diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc
index f0bfa1d..9e4a5d7 100644
--- a/net/proxy/proxy_resolver_v8_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -5,6 +5,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
@@ -276,7 +277,7 @@ TEST(ProxyResolverV8Test, SideEffects) {
result = resolver.GetProxyForURL(kQueryUrl, &proxy_info, NULL, NULL,
BoundNetLog());
EXPECT_EQ(OK, result);
- EXPECT_EQ(StringPrintf("sideffect_%d:80", i),
+ EXPECT_EQ(base::StringPrintf("sideffect_%d:80", i),
proxy_info.proxy_server().ToURI());
}
@@ -290,7 +291,7 @@ TEST(ProxyResolverV8Test, SideEffects) {
result = resolver.GetProxyForURL(kQueryUrl, &proxy_info, NULL, NULL,
BoundNetLog());
EXPECT_EQ(OK, result);
- EXPECT_EQ(StringPrintf("sideffect_%d:80", i),
+ EXPECT_EQ(base::StringPrintf("sideffect_%d:80", i),
proxy_info.proxy_server().ToURI());
}
}
diff --git a/net/server/http_listen_socket.cc b/net/server/http_listen_socket.cc
index dd6ec3c..b4f05d9 100644
--- a/net/server/http_listen_socket.cc
+++ b/net/server/http_listen_socket.cc
@@ -15,6 +15,7 @@
#include "base/md5.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/server/http_listen_socket.h"
#include "net/server/http_server_request_info.h"
@@ -109,14 +110,14 @@ void HttpListenSocket::AcceptWebSocket(const HttpServerRequestInfo& request) {
std::string host = GetHeaderValue(request, "Host");
std::string location = "ws://" + host + request.path;
is_web_socket_ = true;
- Send(StringPrintf("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
- "Upgrade: WebSocket\r\n"
- "Connection: Upgrade\r\n"
- "Sec-WebSocket-Origin: %s\r\n"
- "Sec-WebSocket-Location: %s\r\n"
- "\r\n",
- origin.c_str(),
- location.c_str()));
+ Send(base::StringPrintf("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
+ "Upgrade: WebSocket\r\n"
+ "Connection: Upgrade\r\n"
+ "Sec-WebSocket-Origin: %s\r\n"
+ "Sec-WebSocket-Location: %s\r\n"
+ "\r\n",
+ origin.c_str(),
+ location.c_str()));
Send(reinterpret_cast<char*>(digest.a), 16);
}
@@ -131,12 +132,12 @@ void HttpListenSocket::SendOverWebSocket(const std::string& data) {
void HttpListenSocket::Send200(const std::string& data,
const std::string& content_type) {
- Send(StringPrintf("HTTP/1.1 200 OK\r\n"
- "Content-Type:%s\r\n"
- "Content-Length:%d\r\n"
- "\r\n",
- content_type.c_str(),
- static_cast<int>(data.length())));
+ Send(base::StringPrintf("HTTP/1.1 200 OK\r\n"
+ "Content-Type:%s\r\n"
+ "Content-Length:%d\r\n"
+ "\r\n",
+ content_type.c_str(),
+ static_cast<int>(data.length())));
Send(data);
}
@@ -147,13 +148,13 @@ void HttpListenSocket::Send404() {
}
void HttpListenSocket::Send500(const std::string& message) {
- Send(StringPrintf("HTTP/1.1 500 Internal Error\r\n"
- "Content-Type:text/html\r\n"
- "Content-Length:%d\r\n"
- "\r\n"
- "%s",
- static_cast<int>(message.length()),
- message.c_str()));
+ Send(base::StringPrintf("HTTP/1.1 500 Internal Error\r\n"
+ "Content-Type:text/html\r\n"
+ "Content-Length:%d\r\n"
+ "\r\n"
+ "%s",
+ static_cast<int>(message.length()),
+ message.c_str()));
}
//
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index 9d52cf7..f8e3009 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -12,9 +12,9 @@
#include "base/scoped_vector.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/net_log_unittest.h"
-#include "net/base/net_errors.h"
#include "net/base/request_priority.h"
#include "net/base/test_completion_callback.h"
#include "net/http/http_response_headers.h"
@@ -987,9 +987,9 @@ TEST_F(ClientSocketPoolBaseTest, WaitForStalledSocketAtSocketLimit) {
ClientSocketHandle handles[kDefaultMaxSockets];
for (int i = 0; i < kDefaultMaxSockets; ++i) {
TestCompletionCallback callback;
- EXPECT_EQ(OK, handles[i].Init(StringPrintf("Take 2: %d", i), params_,
- kDefaultPriority, &callback, pool_,
- BoundNetLog()));
+ EXPECT_EQ(OK, handles[i].Init(base::StringPrintf("Take 2: %d", i),
+ params_, kDefaultPriority, &callback,
+ pool_, BoundNetLog()));
}
EXPECT_EQ(kDefaultMaxSockets, client_socket_factory_.allocation_count());
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 46e157c..fb5668a 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -55,11 +55,11 @@
#include <keyhi.h>
#include <nspr.h>
#include <nss.h>
+#include <pk11pub.h>
#include <secerr.h>
#include <sechash.h>
#include <ssl.h>
#include <sslerr.h>
-#include <pk11pub.h>
#include "base/compiler_specific.h"
#include "base/histogram.h"
@@ -68,12 +68,13 @@
#include "base/singleton.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/address_list.h"
#include "net/base/cert_status_flags.h"
#include "net/base/cert_verifier.h"
+#include "net/base/dns_util.h"
#include "net/base/dnsrr_resolver.h"
#include "net/base/dnssec_chain_verifier.h"
-#include "net/base/dns_util.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
@@ -575,8 +576,8 @@ int SSLClientSocketNSS::InitializeSSLOptions() {
// rather than the destination server's address in that case.
// TODO(wtc): port in |peer_address| is not the server's port when a proxy is
// used.
- std::string peer_id = StringPrintf("%s:%d", hostname_.c_str(),
- peer_address.GetPort());
+ std::string peer_id = base::StringPrintf("%s:%d", hostname_.c_str(),
+ peer_address.GetPort());
rv = SSL_SetSockPeerID(nss_fd_, const_cast<char*>(peer_id.c_str()));
if (rv != SECSuccess)
LOG(INFO) << "SSL_SetSockPeerID failed: peer_id=" << peer_id;
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc
index a36ca9b..7abf2be 100644
--- a/net/socket_stream/socket_stream.cc
+++ b/net/socket_stream/socket_stream.cc
@@ -14,6 +14,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "net/base/auth.h"
#include "net/base/host_resolver.h"
@@ -25,9 +26,9 @@
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "net/socket/client_socket_factory.h"
-#include "net/socket/ssl_client_socket.h"
#include "net/socket/socks5_client_socket.h"
#include "net/socket/socks_client_socket.h"
+#include "net/socket/ssl_client_socket.h"
#include "net/socket/tcp_client_socket.h"
#include "net/socket_stream/socket_stream_metrics.h"
#include "net/url_request/url_request.h"
@@ -625,7 +626,7 @@ int SocketStream::DoWriteTunnelHeaders() {
": " + auth_token + "\r\n");
}
- tunnel_request_headers_->headers_ = StringPrintf(
+ tunnel_request_headers_->headers_ = base::StringPrintf(
"CONNECT %s HTTP/1.1\r\n"
"Host: %s\r\n"
"Proxy-Connection: keep-alive\r\n",
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 6b80de3..0f72b6e 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -12,8 +12,9 @@
#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
+#include "base/stringprintf.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "net/base/connection_type_histograms.h"
#include "net/base/load_flags.h"
@@ -72,9 +73,8 @@ class NetLogSpdySynParameter : public NetLog::EventParameters {
ListValue* headers_list = new ListValue();
for (spdy::SpdyHeaderBlock::const_iterator it = headers_->begin();
it != headers_->end(); ++it) {
- headers_list->Append(new StringValue(StringPrintf("%s: %s",
- it->first.c_str(),
- it->second.c_str())));
+ headers_list->Append(new StringValue(base::StringPrintf(
+ "%s: %s", it->first.c_str(), it->second.c_str())));
}
dict->SetInteger("flags", flags_);
dict->Set("headers", headers_list);
@@ -103,7 +103,7 @@ class NetLogSpdySettingsParameter : public NetLog::EventParameters {
for (spdy::SpdySettings::const_iterator it = settings_.begin();
it != settings_.end(); ++it) {
settings->Append(new StringValue(
- StringPrintf("[%u:%u]", it->first.id(), it->second)));
+ base::StringPrintf("[%u:%u]", it->first.id(), it->second)));
}
dict->Set("settings", settings);
return dict;
diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc
index d60faa4..9644aae 100644
--- a/net/tools/dump_cache/dump_cache.cc
+++ b/net/tools/dump_cache/dump_cache.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "base/process_util.h"
#include "base/scoped_handle.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/disk_cache/disk_format.h"
@@ -84,9 +85,9 @@ int LaunchSlave(const CommandLine& command_line,
std::wstring new_program;
if (do_upgrade)
- new_program = StringPrintf(L"%ls%d", L"dump_cache_", version);
+ new_program = base::StringPrintf(L"%ls%d", L"dump_cache_", version);
else
- new_program = StringPrintf(L"dump_cache");
+ new_program = base::StringPrintf(L"dump_cache");
hacked_command_line.insert(to_remove, new_program);
diff --git a/net/tools/dump_cache/url_to_filename_encoder_unittest.cc b/net/tools/dump_cache/url_to_filename_encoder_unittest.cc
index de0992e..2e09e0b 100644
--- a/net/tools/dump_cache/url_to_filename_encoder_unittest.cc
+++ b/net/tools/dump_cache/url_to_filename_encoder_unittest.cc
@@ -6,8 +6,10 @@
#include <string>
#include <vector>
+
#include "base/string_piece.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::StringPiece;
@@ -211,7 +213,7 @@ TEST_F(UrlToFilenameEncoderTest, EncodeUrlCorrectly) {
TEST_F(UrlToFilenameEncoderTest, UnescapeUrlsBeforeEncode) {
for (int i = 0; i < 128; ++i) {
string unescaped(1, static_cast<char>(i));
- string escaped = StringPrintf("%%%02X", i);
+ string escaped = base::StringPrintf("%%%02X", i);
ValidateEncodeSame(unescaped, escaped);
}
diff --git a/net/tools/dump_cache/url_utilities_unittest.cc b/net/tools/dump_cache/url_utilities_unittest.cc
index 3e3f122..0f9cb06 100644
--- a/net/tools/dump_cache/url_utilities_unittest.cc
+++ b/net/tools/dump_cache/url_utilities_unittest.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
@@ -76,10 +77,10 @@ TEST(UrlUtilitiesTest, Unescape) {
"%3E%2E%3F%2F"));
for (int c = 0; c < 256; ++c) {
std::string unescaped_char(1, implicit_cast<unsigned char>(c));
- std::string escaped_char = StringPrintf("%%%02X", c);
+ std::string escaped_char = base::StringPrintf("%%%02X", c);
EXPECT_EQ(unescaped_char, UrlUtilities::Unescape(escaped_char))
<< "escaped_char = " << escaped_char;
- escaped_char = StringPrintf("%%%02x", c);
+ escaped_char = base::StringPrintf("%%%02x", c);
EXPECT_EQ(unescaped_char, UrlUtilities::Unescape(escaped_char))
<< "escaped_char = " << escaped_char;
}
diff --git a/net/tools/hresolv/hresolv.cc b/net/tools/hresolv/hresolv.cc
index ae0ee0f..250a6b2 100644
--- a/net/tools/hresolv/hresolv.cc
+++ b/net/tools/hresolv/hresolv.cc
@@ -134,28 +134,28 @@ std::string FormatAddrinfoDetails(const struct addrinfo& ai,
std::string ai_addr = net::NetAddressToString(&ai);
std::string ai_canonname;
if (ai.ai_canonname) {
- ai_canonname = StringPrintf("%s ai_canonname: %s\n",
- indent,
- ai.ai_canonname);
+ ai_canonname = base::StringPrintf("%s ai_canonname: %s\n",
+ indent,
+ ai.ai_canonname);
}
- return StringPrintf("%saddrinfo {\n"
- "%s ai_flags: %s\n"
- "%s ai_family: %s\n"
- "%s ai_socktype: %s\n"
- "%s ai_protocol: %s\n"
- "%s ai_addrlen: %d\n"
- "%s ai_addr: %s\n"
- "%s"
- "%s}\n",
- indent,
- indent, ai_flags.c_str(),
- indent, ai_family,
- indent, ai_socktype,
- indent, ai_protocol,
- indent, ai.ai_addrlen,
- indent, ai_addr.c_str(),
- ai_canonname.c_str(),
- indent);
+ return base::StringPrintf("%saddrinfo {\n"
+ "%s ai_flags: %s\n"
+ "%s ai_family: %s\n"
+ "%s ai_socktype: %s\n"
+ "%s ai_protocol: %s\n"
+ "%s ai_addrlen: %d\n"
+ "%s ai_addr: %s\n"
+ "%s"
+ "%s}\n",
+ indent,
+ indent, ai_flags.c_str(),
+ indent, ai_family,
+ indent, ai_socktype,
+ indent, ai_protocol,
+ indent, ai.ai_addrlen,
+ indent, ai_addr.c_str(),
+ ai_canonname.c_str(),
+ indent);
}
std::string FormatAddressList(const net::AddressList& address_list,
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 5a9b0ae..c8eaad4 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -7,8 +7,8 @@
#include "build/build_config.h"
#if defined(OS_WIN)
-#include <windows.h>
#include <shlobj.h>
+#include <windows.h>
#elif defined(USE_NSS)
#include "base/nss_util.h"
#endif
@@ -21,15 +21,16 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/process_util.h"
-#include "base/string_piece.h"
#include "base/string_number_conversions.h"
+#include "base/string_piece.h"
+#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "net/base/cookie_monster.h"
#include "net/base/cookie_policy.h"
#include "net/base/load_flags.h"
+#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/net_log_unittest.h"
-#include "net/base/net_errors.h"
#include "net/base/net_module.h"
#include "net/base/net_util.h"
#include "net/base/ssl_connection_status_flags.h"
@@ -341,7 +342,7 @@ TEST_F(URLRequestTest, QuitTest) {
// Append the time to avoid problems where the kill page
// is being cached rather than being executed on the server
- std::string page_name = StringPrintf("kill?%u",
+ std::string page_name = base::StringPrintf("kill?%u",
static_cast<int>(base::Time::Now().ToInternalValue()));
int retry_count = 5;
while (retry_count > 0) {
@@ -804,8 +805,9 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) {
net::HttpRequestHeaders headers;
headers.SetHeader(net::HttpRequestHeaders::kRange,
- StringPrintf("bytes=%" PRIuS "-%" PRIuS,
- first_byte_position, last_byte_position));
+ base::StringPrintf(
+ "bytes=%" PRIuS "-%" PRIuS,
+ first_byte_position, last_byte_position));
r.SetExtraRequestHeaders(headers);
r.Start();
EXPECT_TRUE(r.is_pending());
@@ -847,8 +849,8 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) {
net::HttpRequestHeaders headers;
headers.SetHeader(net::HttpRequestHeaders::kRange,
- StringPrintf("bytes=%" PRIuS "-",
- first_byte_position));
+ base::StringPrintf("bytes=%" PRIuS "-",
+ first_byte_position));
r.SetExtraRequestHeaders(headers);
r.Start();
EXPECT_TRUE(r.is_pending());
diff --git a/net/websockets/websocket_handshake.cc b/net/websockets/websocket_handshake.cc
index a9f0c35..480e395 100644
--- a/net/websockets/websocket_handshake.cc
+++ b/net/websockets/websocket_handshake.cc
@@ -13,6 +13,7 @@
#include "base/ref_counted.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
@@ -280,7 +281,7 @@ void WebSocketHandshake::Parameter::GenerateSecWebSocketKey(
*number = rand_(0, max);
uint32 product = *number * space;
- std::string s = StringPrintf("%u", product);
+ std::string s = base::StringPrintf("%u", product);
int n = rand_(1, 12);
for (int i = 0; i < n; i++) {
int pos = rand_(0, s.length());
diff --git a/net/websockets/websocket_handshake_unittest.cc b/net/websockets/websocket_handshake_unittest.cc
index e392cfc..df3914e 100644
--- a/net/websockets/websocket_handshake_unittest.cc
+++ b/net/websockets/websocket_handshake_unittest.cc
@@ -8,9 +8,10 @@
#include "base/scoped_ptr.h"
#include "base/string_split.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/websockets/websocket_handshake.h"
-#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
namespace net {
@@ -86,9 +87,9 @@ class WebSocketHandshakeTest : public testing::Test {
std::string s;
for (int i = 0; i < len; i++) {
if (isprint(buf[i]))
- s += StringPrintf("%c", buf[i]);
+ s += base::StringPrintf("%c", buf[i]);
else
- s += StringPrintf("\\x%02x", buf[i]);
+ s += base::StringPrintf("\\x%02x", buf[i]);
}
return s;
}
diff --git a/net/websockets/websocket_net_log_params.h b/net/websockets/websocket_net_log_params.h
index b11cefd..a504186 100644
--- a/net/websockets/websocket_net_log_params.h
+++ b/net/websockets/websocket_net_log_params.h
@@ -13,6 +13,7 @@
#include "base/ref_counted.h"
#include "base/string_split.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "base/values.h"
#include "net/base/net_log.h"
@@ -37,7 +38,7 @@ class NetLogWebSocketHandshakeParameter : public NetLog::EventParameters {
i = i + 1;
for (; i < lines.size(); ++i) {
for (size_t j = 0; j < lines[i].length(); ++j) {
- key += StringPrintf("\\x%02x", lines[i][j] & 0xff);
+ key += base::StringPrintf("\\x%02x", lines[i][j] & 0xff);
}
key += "\\x0a";
}
diff --git a/net/websockets/websocket_throttle.cc b/net/websockets/websocket_throttle.cc
index 426fe79..614990e 100644
--- a/net/websockets/websocket_throttle.cc
+++ b/net/websockets/websocket_throttle.cc
@@ -12,6 +12,7 @@
#include "base/singleton.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/stringprintf.h"
#include "net/base/io_buffer.h"
#include "net/base/sys_addrinfo.h"
#include "net/socket_stream/socket_stream.h"
@@ -24,23 +25,24 @@ static std::string AddrinfoToHashkey(const struct addrinfo* addrinfo) {
case AF_INET: {
const struct sockaddr_in* const addr =
reinterpret_cast<const sockaddr_in*>(addrinfo->ai_addr);
- return StringPrintf("%d:%s",
- addrinfo->ai_family,
- base::HexEncode(&addr->sin_addr, 4).c_str());
+ return base::StringPrintf("%d:%s",
+ addrinfo->ai_family,
+ base::HexEncode(&addr->sin_addr, 4).c_str());
}
case AF_INET6: {
const struct sockaddr_in6* const addr6 =
reinterpret_cast<const sockaddr_in6*>(addrinfo->ai_addr);
- return StringPrintf("%d:%s",
- addrinfo->ai_family,
- base::HexEncode(&addr6->sin6_addr,
- sizeof(addr6->sin6_addr)).c_str());
+ return base::StringPrintf(
+ "%d:%s",
+ addrinfo->ai_family,
+ base::HexEncode(&addr6->sin6_addr,
+ sizeof(addr6->sin6_addr)).c_str());
}
default:
- return StringPrintf("%d:%s",
- addrinfo->ai_family,
- base::HexEncode(addrinfo->ai_addr,
- addrinfo->ai_addrlen).c_str());
+ return base::StringPrintf("%d:%s",
+ addrinfo->ai_family,
+ base::HexEncode(addrinfo->ai_addr,
+ addrinfo->ai_addrlen).c_str());
}
}