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

Side by Side Diff: components/sync/engine/engine_util.cc

Issue 2427803002: [Sync] Replacing NULL with nullptr in code and null in comments for components/sync/ (Closed)
Patch Set: Fixing start of sentence capitlization. Created 4 years, 2 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/sync/engine/engine_util.h" 5 #include "components/sync/engine/engine_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/sync/base/cryptographer.h" 12 #include "components/sync/base/cryptographer.h"
13 #include "components/sync/protocol/attachments.pb.h" 13 #include "components/sync/protocol/attachments.pb.h"
14 #include "components/sync/protocol/password_specifics.pb.h" 14 #include "components/sync/protocol/password_specifics.pb.h"
15 #include "components/sync/protocol/sync.pb.h" 15 #include "components/sync/protocol/sync.pb.h"
16 16
17 namespace syncer { 17 namespace syncer {
18 18
19 namespace { 19 namespace {
20 20
21 bool EndsWithSpace(const std::string& string) { 21 bool EndsWithSpace(const std::string& string) {
22 return !string.empty() && *string.rbegin() == ' '; 22 return !string.empty() && *string.rbegin() == ' ';
23 } 23 }
24 } 24 }
25 25
26 sync_pb::PasswordSpecificsData* DecryptPasswordSpecifics( 26 sync_pb::PasswordSpecificsData* DecryptPasswordSpecifics(
27 const sync_pb::EntitySpecifics& specifics, 27 const sync_pb::EntitySpecifics& specifics,
28 Cryptographer* crypto) { 28 Cryptographer* crypto) {
29 if (!specifics.has_password()) 29 if (!specifics.has_password())
30 return NULL; 30 return nullptr;
31 const sync_pb::PasswordSpecifics& password_specifics = specifics.password(); 31 const sync_pb::PasswordSpecifics& password_specifics = specifics.password();
32 if (!password_specifics.has_encrypted()) 32 if (!password_specifics.has_encrypted())
33 return NULL; 33 return nullptr;
34 const sync_pb::EncryptedData& encrypted = password_specifics.encrypted(); 34 const sync_pb::EncryptedData& encrypted = password_specifics.encrypted();
35 std::unique_ptr<sync_pb::PasswordSpecificsData> data( 35 std::unique_ptr<sync_pb::PasswordSpecificsData> data(
36 new sync_pb::PasswordSpecificsData); 36 new sync_pb::PasswordSpecificsData);
37 if (!crypto->CanDecrypt(encrypted)) 37 if (!crypto->CanDecrypt(encrypted))
38 return NULL; 38 return nullptr;
39 if (!crypto->Decrypt(encrypted, data.get())) 39 if (!crypto->Decrypt(encrypted, data.get()))
40 return NULL; 40 return nullptr;
41 return data.release(); 41 return data.release();
42 } 42 }
43 43
44 // The list of names which are reserved for use by the server. 44 // The list of names which are reserved for use by the server.
45 static const char* kForbiddenServerNames[] = {"", ".", ".."}; 45 static const char* kForbiddenServerNames[] = {"", ".", ".."};
46 46
47 // When taking a name from the syncapi, append a space if it matches the 47 // When taking a name from the syncapi, append a space if it matches the
48 // pattern of a server-illegal name followed by zero or more spaces. 48 // pattern of a server-illegal name followed by zero or more spaces.
49 void SyncAPINameToServerName(const std::string& syncer_name, std::string* out) { 49 void SyncAPINameToServerName(const std::string& syncer_name, std::string* out) {
50 *out = syncer_name; 50 *out = syncer_name;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 bool AreAttachmentMetadataEqual(const sync_pb::AttachmentMetadata& left, 112 bool AreAttachmentMetadataEqual(const sync_pb::AttachmentMetadata& left,
113 const sync_pb::AttachmentMetadata& right) { 113 const sync_pb::AttachmentMetadata& right) {
114 if (left.SerializeAsString() == right.SerializeAsString()) { 114 if (left.SerializeAsString() == right.SerializeAsString()) {
115 return true; 115 return true;
116 } 116 }
117 return false; 117 return false;
118 } 118 }
119 119
120 } // namespace syncer 120 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine/attachments/attachment_store_frontend_unittest.cc ('k') | components/sync/engine/model_safe_worker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698