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

Side by Side Diff: rlz/win/lib/rlz_value_store_registry.cc

Issue 1547683004: Switch to standard integer types in rlz/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « rlz/win/lib/rlz_value_store_registry.h ('k') | no next file » | 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) 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 "rlz/win/lib/rlz_value_store_registry.h" 5 #include "rlz/win/lib/rlz_value_store_registry.h"
6 6
7 #include "base/macros.h"
7 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
9 #include "base/win/registry.h" 10 #include "base/win/registry.h"
10 #include "rlz/lib/assert.h" 11 #include "rlz/lib/assert.h"
11 #include "rlz/lib/lib_values.h" 12 #include "rlz/lib/lib_values.h"
12 #include "rlz/lib/rlz_lib.h" 13 #include "rlz/lib/rlz_lib.h"
13 #include "rlz/lib/string_utils.h" 14 #include "rlz/lib/string_utils.h"
14 #include "rlz/win/lib/registry_util.h" 15 #include "rlz/win/lib/registry_util.h"
15 16
16 using base::ASCIIToUTF16; 17 using base::ASCIIToUTF16;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 155
155 // static 156 // static
156 std::wstring RlzValueStoreRegistry::GetWideLibKeyName() { 157 std::wstring RlzValueStoreRegistry::GetWideLibKeyName() {
157 return ASCIIToUTF16(kLibKeyName); 158 return ASCIIToUTF16(kLibKeyName);
158 } 159 }
159 160
160 bool RlzValueStoreRegistry::HasAccess(AccessType type) { 161 bool RlzValueStoreRegistry::HasAccess(AccessType type) {
161 return HasUserKeyAccess(type == kWriteAccess); 162 return HasUserKeyAccess(type == kWriteAccess);
162 } 163 }
163 164
164 bool RlzValueStoreRegistry::WritePingTime(Product product, int64 time) { 165 bool RlzValueStoreRegistry::WritePingTime(Product product, int64_t time) {
165 base::win::RegKey key; 166 base::win::RegKey key;
166 std::wstring product_name = GetWideProductName(product); 167 std::wstring product_name = GetWideProductName(product);
167 return GetPingTimesRegKey(KEY_WRITE, &key) && 168 return GetPingTimesRegKey(KEY_WRITE, &key) &&
168 key.WriteValue(product_name.c_str(), &time, sizeof(time), 169 key.WriteValue(product_name.c_str(), &time, sizeof(time),
169 REG_QWORD) == ERROR_SUCCESS; 170 REG_QWORD) == ERROR_SUCCESS;
170 } 171 }
171 172
172 bool RlzValueStoreRegistry::ReadPingTime(Product product, int64* time) { 173 bool RlzValueStoreRegistry::ReadPingTime(Product product, int64_t* time) {
173 base::win::RegKey key; 174 base::win::RegKey key;
174 std::wstring product_name = GetWideProductName(product); 175 std::wstring product_name = GetWideProductName(product);
175 return GetPingTimesRegKey(KEY_READ, &key) && 176 return GetPingTimesRegKey(KEY_READ, &key) &&
176 key.ReadInt64(product_name.c_str(), time) == ERROR_SUCCESS; 177 key.ReadInt64(product_name.c_str(), time) == ERROR_SUCCESS;
177 } 178 }
178 179
179 bool RlzValueStoreRegistry::ClearPingTime(Product product) { 180 bool RlzValueStoreRegistry::ClearPingTime(Product product) {
180 base::win::RegKey key; 181 base::win::RegKey key;
181 GetPingTimesRegKey(KEY_WRITE, &key); 182 GetPingTimesRegKey(KEY_WRITE, &key);
182 183
183 std::wstring product_name = GetWideProductName(product); 184 std::wstring product_name = GetWideProductName(product);
184 key.DeleteValue(product_name.c_str()); 185 key.DeleteValue(product_name.c_str());
185 186
186 // Verify deletion. 187 // Verify deletion.
187 uint64 value; 188 uint64_t value;
188 DWORD size = sizeof(value); 189 DWORD size = sizeof(value);
189 if (key.ReadValue( 190 if (key.ReadValue(
190 product_name.c_str(), &value, &size, NULL) == ERROR_SUCCESS) { 191 product_name.c_str(), &value, &size, NULL) == ERROR_SUCCESS) {
191 ASSERT_STRING("RlzValueStoreRegistry::ClearPingTime: Failed to delete."); 192 ASSERT_STRING("RlzValueStoreRegistry::ClearPingTime: Failed to delete.");
192 return false; 193 return false;
193 } 194 }
194 195
195 return true; 196 return true;
196 } 197 }
197 198
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 } 371 }
371 372
372 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() { 373 ScopedRlzValueStoreLock::~ScopedRlzValueStoreLock() {
373 } 374 }
374 375
375 RlzValueStore* ScopedRlzValueStoreLock::GetStore() { 376 RlzValueStore* ScopedRlzValueStoreLock::GetStore() {
376 return store_.get(); 377 return store_.get();
377 } 378 }
378 379
379 } // namespace rlz_lib 380 } // namespace rlz_lib
OLDNEW
« no previous file with comments | « rlz/win/lib/rlz_value_store_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698