diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 19:28:44 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-30 19:28:44 +0000 |
commit | 528c56de01bbbd38788ed6cf8d2eea4c56cbe19e (patch) | |
tree | ac4f7a001affd772c4ab89701d3d46109b5f9e19 /chrome/browser/sync | |
parent | 5c86ada8d84f6e67d17b027d347052ef451241c4 (diff) | |
download | chromium_src-528c56de01bbbd38788ed6cf8d2eea4c56cbe19e.zip chromium_src-528c56de01bbbd38788ed6cf8d2eea4c56cbe19e.tar.gz chromium_src-528c56de01bbbd38788ed6cf8d2eea4c56cbe19e.tar.bz2 |
Move the number conversions from string_util to a new file.
Use the base namespace in the new file. Update callers.
I removed all wstring variants and also the string->number ones that ignore the return value. That encourages people to write code and forget about error handling.
TEST=included unit tests
BUG=none
Review URL: http://codereview.chromium.org/3056029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync')
-rw-r--r-- | chrome/browser/sync/engine/syncer_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/sync/glue/http_bridge.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc | 7 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/directory_backing_store.cc | 3 | ||||
-rw-r--r-- | chrome/browser/sync/syncable/syncable.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/util/fast_dump.h | 6 |
6 files changed, 15 insertions, 12 deletions
diff --git a/chrome/browser/sync/engine/syncer_unittest.cc b/chrome/browser/sync/engine/syncer_unittest.cc index ae6e597..9db596a 100644 --- a/chrome/browser/sync/engine/syncer_unittest.cc +++ b/chrome/browser/sync/engine/syncer_unittest.cc @@ -14,6 +14,7 @@ #include "base/callback.h" #include "base/scoped_ptr.h" +#include "base/string_number_conversions.h" #include "build/build_config.h" #include "chrome/browser/sync/engine/conflict_resolver.h" #include "chrome/browser/sync/engine/get_commit_ids_command.h" @@ -4982,7 +4983,7 @@ class SyncerPositionUpdateTest : public SyncerTest { } void AddRootItemWithPosition(int64 position) { - string id = string("ServerId") + Int64ToString(next_update_id_++); + string id = string("ServerId") + base::Int64ToString(next_update_id_++); string name = "my name is my id -- " + id; int revision = next_revision_++; mock_server_->AddUpdateDirectory(id, kRootId, name, revision, revision); diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc index a442953..e39e6ff 100644 --- a/chrome/browser/sync/glue/http_bridge.cc +++ b/chrome/browser/sync/glue/http_bridge.cc @@ -6,7 +6,7 @@ #include "base/message_loop.h" #include "base/message_loop_proxy.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/profile.h" #include "chrome/browser/chrome_thread.h" @@ -143,7 +143,7 @@ void HttpBridge::SetURL(const char* url, int port) { << "HttpBridge::SetURL called more than once?!"; GURL temp(url); GURL::Replacements replacements; - std::string port_str = IntToString(port); + std::string port_str = base::IntToString(port); replacements.SetPort(port_str.c_str(), url_parse::Component(0, port_str.length())); url_for_request_ = temp.ReplaceComponents(replacements); diff --git a/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc b/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc index 7edfc73..a4c36dd 100644 --- a/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc +++ b/chrome/browser/sync/notifier/cache_invalidation_packet_handler.cc @@ -10,7 +10,8 @@ #include "base/callback.h" #include "base/logging.h" #include "base/rand_util.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" +//#include "base/string_util.h" #include "chrome/browser/sync/sync_constants.h" #include "google/cacheinvalidation/invalidation-client.h" #include "jingle/notifier/listener/xml_element_util.h" @@ -170,7 +171,7 @@ class CacheInvalidationSendMessageTask : public buzz::XmppTask { buzz::XmlElement* cache_invalidation_iq_packet = new buzz::XmlElement(kQnData, true); iq->AddElement(cache_invalidation_iq_packet); - cache_invalidation_iq_packet->SetAttr(kQnSeq, IntToString(seq)); + cache_invalidation_iq_packet->SetAttr(kQnSeq, base::IntToString(seq)); cache_invalidation_iq_packet->SetAttr(kQnSid, sid); cache_invalidation_iq_packet->SetAttr(kQnServiceUrl, browser_sync::kSyncServiceUrl); @@ -188,7 +189,7 @@ class CacheInvalidationSendMessageTask : public buzz::XmppTask { std::string MakeSid() { uint64 sid = base::RandUint64(); - return std::string("chrome-sync-") + Uint64ToString(sid); + return std::string("chrome-sync-") + base::Uint64ToString(sid); } } // namespace diff --git a/chrome/browser/sync/syncable/directory_backing_store.cc b/chrome/browser/sync/syncable/directory_backing_store.cc index c5bfdb0..8cec2a9 100644 --- a/chrome/browser/sync/syncable/directory_backing_store.cc +++ b/chrome/browser/sync/syncable/directory_backing_store.cc @@ -16,6 +16,7 @@ #include "base/hash_tables.h" #include "base/logging.h" #include "base/stl_util-inl.h" +#include "base/string_number_conversions.h" #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" #include "chrome/browser/sync/protocol/service_constants.h" #include "chrome/browser/sync/protocol/sync.pb.h" @@ -286,7 +287,7 @@ bool DirectoryBackingStore::DeleteEntries(const MetahandleSet& handles) { ++it) { if (it != handles.begin()) query.append(","); - query.append(Int64ToString(*it)); + query.append(base::Int64ToString(*it)); } query.append(")"); SQLStatement statement; diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc index cf19379..807abf6 100644 --- a/chrome/browser/sync/syncable/syncable.cc +++ b/chrome/browser/sync/syncable/syncable.cc @@ -31,7 +31,7 @@ #include "base/logging.h" #include "base/perftimer.h" #include "base/scoped_ptr.h" -#include "base/string_util.h" +#include "base/string_number_conversions.h" #include "base/stl_util-inl.h" #include "base/time.h" #include "chrome/browser/sync/engine/syncer.h" @@ -1441,7 +1441,7 @@ Id Directory::NextId() { kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; } DCHECK_LT(result, 0); - return Id::CreateFromClientString(Int64ToString(result)); + return Id::CreateFromClientString(base::Int64ToString(result)); } Id Directory::GetChildWithNullIdField(IdField field, diff --git a/chrome/browser/sync/util/fast_dump.h b/chrome/browser/sync/util/fast_dump.h index a9eff24..28d1484 100644 --- a/chrome/browser/sync/util/fast_dump.h +++ b/chrome/browser/sync/util/fast_dump.h @@ -10,7 +10,7 @@ #include <streambuf> #include <string> -#include "base/string_util.h" +#include "base/string_number_conversions.h" using std::ostream; using std::streambuf; @@ -32,7 +32,7 @@ class FastDump { inline browser_sync::FastDump& operator << (browser_sync::FastDump& dump, int64 n) { - string numbuf(Int64ToString(n)); + string numbuf(base::Int64ToString(n)); const char* number = numbuf.c_str(); dump.out_->sputn(number, numbuf.length()); return dump; @@ -40,7 +40,7 @@ inline browser_sync::FastDump& operator << inline browser_sync::FastDump& operator << (browser_sync::FastDump& dump, int32 n) { - string numbuf(IntToString(n)); + string numbuf(base::IntToString(n)); const char* number = numbuf.c_str(); dump.out_->sputn(number, numbuf.length()); return dump; |