Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/sync/engine/syncer_proto_util.cc

Issue 340055: String cleanup in sync code (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/engine/syncer.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/engine/syncer_proto_util.h" 5 #include "chrome/browser/sync/engine/syncer_proto_util.h"
6 6
7 #include "chrome/browser/sync/engine/net/server_connection_manager.h" 7 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
8 #include "chrome/browser/sync/engine/syncer.h" 8 #include "chrome/browser/sync/engine/syncer.h"
9 #include "chrome/browser/sync/engine/syncer_util.h" 9 #include "chrome/browser/sync/engine/syncer_util.h"
10 #include "chrome/browser/sync/protocol/service_constants.h" 10 #include "chrome/browser/sync/protocol/service_constants.h"
11 #include "chrome/browser/sync/syncable/directory_manager.h" 11 #include "chrome/browser/sync/syncable/directory_manager.h"
12 #include "chrome/browser/sync/syncable/syncable-inl.h" 12 #include "chrome/browser/sync/syncable/syncable-inl.h"
13 #include "chrome/browser/sync/syncable/syncable.h" 13 #include "chrome/browser/sync/syncable/syncable.h"
14 #include "chrome/browser/sync/util/character_set_converters.h"
15 14
16 using std::string; 15 using std::string;
17 using std::stringstream; 16 using std::stringstream;
18 using syncable::BASE_VERSION; 17 using syncable::BASE_VERSION;
19 using syncable::CTIME; 18 using syncable::CTIME;
20 using syncable::ID; 19 using syncable::ID;
21 using syncable::IS_DEL; 20 using syncable::IS_DEL;
22 using syncable::IS_DIR; 21 using syncable::IS_DIR;
23 using syncable::IS_UNSYNCED; 22 using syncable::IS_UNSYNCED;
24 using syncable::MTIME; 23 using syncable::MTIME;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // static 238 // static
240 void SyncerProtoUtil::CopyBlobIntoProtoBytes(const syncable::Blob& blob, 239 void SyncerProtoUtil::CopyBlobIntoProtoBytes(const syncable::Blob& blob,
241 std::string* proto_bytes) { 240 std::string* proto_bytes) {
242 std::string blob_string(blob.begin(), blob.end()); 241 std::string blob_string(blob.begin(), blob.end());
243 proto_bytes->swap(blob_string); 242 proto_bytes->swap(blob_string);
244 } 243 }
245 244
246 // static 245 // static
247 syncable::SyncName SyncerProtoUtil::NameFromSyncEntity( 246 syncable::SyncName SyncerProtoUtil::NameFromSyncEntity(
248 const SyncEntity& entry) { 247 const SyncEntity& entry) {
249 SyncName result(PSTR("")); 248 SyncName result(entry.name());
250
251 AppendUTF8ToPathString(entry.name(), &result.value());
252 if (entry.has_non_unique_name()) { 249 if (entry.has_non_unique_name()) {
253 AppendUTF8ToPathString(entry.non_unique_name(), 250 result.set_non_unique_value(entry.non_unique_name());
254 &result.non_unique_value());
255 } else {
256 result.non_unique_value() = result.value();
257 } 251 }
258 return result; 252 return result;
259 } 253 }
260 254
261 // static 255 // static
262 syncable::SyncName SyncerProtoUtil::NameFromCommitEntryResponse( 256 syncable::SyncName SyncerProtoUtil::NameFromCommitEntryResponse(
263 const CommitResponse_EntryResponse& entry) { 257 const CommitResponse_EntryResponse& entry) {
264 SyncName result(PSTR("")); 258 SyncName result(entry.name());
265
266 AppendUTF8ToPathString(entry.name(), &result.value());
267 if (entry.has_non_unique_name()) { 259 if (entry.has_non_unique_name()) {
268 AppendUTF8ToPathString(entry.non_unique_name(), 260 result.set_non_unique_value(entry.non_unique_name());
269 &result.non_unique_value());
270 } else {
271 result.non_unique_value() = result.value();
272 } 261 }
273 return result; 262 return result;
274 } 263 }
275 264
276 } // namespace browser_sync 265 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer.cc ('k') | chrome/browser/sync/engine/syncer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698