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

Side by Side Diff: sync/internal_api/public/base/invalidation.cc

Issue 382673002: Fixes for re-enabling more MSVC level 4 warnings: misc edition #2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « sql/recovery.cc ('k') | sync/internal_api/sync_manager_impl_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "sync/internal_api/public/base/invalidation.h" 5 #include "sync/internal_api/public/base/invalidation.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 DLOG(WARNING) << "Failed to parse is_unknown_version flag"; 66 DLOG(WARNING) << "Failed to parse is_unknown_version flag";
67 return scoped_ptr<Invalidation>(); 67 return scoped_ptr<Invalidation>();
68 } 68 }
69 if (is_unknown_version) { 69 if (is_unknown_version) {
70 return scoped_ptr<Invalidation>(new Invalidation( 70 return scoped_ptr<Invalidation>(new Invalidation(
71 id, 71 id,
72 true, 72 true,
73 kInvalidVersion, 73 kInvalidVersion,
74 std::string(), 74 std::string(),
75 AckHandle::CreateUnique())); 75 AckHandle::CreateUnique()));
76 } else {
77 int64 version;
78 std::string version_as_string;
79 if (!value.GetString(kVersionKey, &version_as_string)
80 || !base::StringToInt64(version_as_string, &version)) {
81 DLOG(WARNING) << "Failed to parse version";
82 return scoped_ptr<Invalidation>();
83 }
84 std::string payload;
85 if (!value.GetString(kPayloadKey, &payload)) {
86 DLOG(WARNING) << "Failed to parse payload";
87 return scoped_ptr<Invalidation>();
88 }
89 return scoped_ptr<Invalidation>(new Invalidation(
90 id,
91 false,
92 version,
93 payload,
94 AckHandle::CreateUnique()));
95 } 76 }
77 int64 version = 0;
78 std::string version_as_string;
79 if (!value.GetString(kVersionKey, &version_as_string)
80 || !base::StringToInt64(version_as_string, &version)) {
81 DLOG(WARNING) << "Failed to parse version";
82 return scoped_ptr<Invalidation>();
83 }
84 std::string payload;
85 if (!value.GetString(kPayloadKey, &payload)) {
86 DLOG(WARNING) << "Failed to parse payload";
87 return scoped_ptr<Invalidation>();
88 }
89 return scoped_ptr<Invalidation>(new Invalidation(
90 id,
91 false,
92 version,
93 payload,
94 AckHandle::CreateUnique()));
96 } 95 }
97 96
98 Invalidation::~Invalidation() {} 97 Invalidation::~Invalidation() {}
99 98
100 Invalidation& Invalidation::operator=(const Invalidation& other) { 99 Invalidation& Invalidation::operator=(const Invalidation& other) {
101 id_ = other.id_; 100 id_ = other.id_;
102 is_unknown_version_ = other.is_unknown_version_; 101 is_unknown_version_ = other.is_unknown_version_;
103 version_ = other.version_; 102 version_ = other.version_;
104 payload_ = other.payload_; 103 payload_ = other.payload_;
105 ack_handle_ = other.ack_handle_; 104 ack_handle_ = other.ack_handle_;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int64 version, 188 int64 version,
190 const std::string& payload, 189 const std::string& payload,
191 AckHandle ack_handle) 190 AckHandle ack_handle)
192 : id_(id), 191 : id_(id),
193 is_unknown_version_(is_unknown_version), 192 is_unknown_version_(is_unknown_version),
194 version_(version), 193 version_(version),
195 payload_(payload), 194 payload_(payload),
196 ack_handle_(ack_handle) {} 195 ack_handle_(ack_handle) {}
197 196
198 } // namespace syncer 197 } // namespace syncer
OLDNEW
« no previous file with comments | « sql/recovery.cc ('k') | sync/internal_api/sync_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698