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

Side by Side Diff: sandbox/win/src/win_utils.cc

Issue 2121513002: Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos Created 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "sandbox/win/src/win_utils.h" 5 #include "sandbox/win/src/win_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 for (size_t i = 0; i < arraysize(kKnownKey); ++i) { 125 for (size_t i = 0; i < arraysize(kKnownKey); ++i) {
126 if (name == kKnownKey[i].name) 126 if (name == kKnownKey[i].name)
127 return kKnownKey[i].key; 127 return kKnownKey[i].key;
128 } 128 }
129 129
130 return NULL; 130 return NULL;
131 } 131 }
132 132
133 bool ResolveRegistryName(base::string16 name, base::string16* resolved_name) { 133 bool ResolveRegistryName(base::string16 name, base::string16* resolved_name) {
134 for (size_t i = 0; i < arraysize(kKnownKey); ++i) { 134 for (size_t i = 0; i < arraysize(kKnownKey); ++i) {
135 if (name.find(kKnownKey[i].name) == 0) { 135 if (base::StartsWith(name, kKnownKey[i].name,
136 base::CompareCase::SENSITIVE)) {
136 HKEY key; 137 HKEY key;
137 DWORD disposition; 138 DWORD disposition;
138 if (ERROR_SUCCESS != ::RegCreateKeyEx(kKnownKey[i].key, L"", 0, NULL, 0, 139 if (ERROR_SUCCESS != ::RegCreateKeyEx(kKnownKey[i].key, L"", 0, NULL, 0,
139 MAXIMUM_ALLOWED, NULL, &key, 140 MAXIMUM_ALLOWED, NULL, &key,
140 &disposition)) 141 &disposition))
141 return false; 142 return false;
142 143
143 bool result = GetPathFromHandle(key, resolved_name); 144 bool result = GetPathFromHandle(key, resolved_name);
144 ::RegCloseKey(key); 145 ::RegCloseKey(key);
145 146
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 ::InterlockedCompareExchangePointer( 425 ::InterlockedCompareExchangePointer(
425 reinterpret_cast<PVOID volatile*>(&ntdll), ntdll_local, NULL); 426 reinterpret_cast<PVOID volatile*>(&ntdll), ntdll_local, NULL);
426 427
427 } 428 }
428 429
429 CHECK_NT(ntdll); 430 CHECK_NT(ntdll);
430 FARPROC* function_ptr = reinterpret_cast<FARPROC*>(ptr); 431 FARPROC* function_ptr = reinterpret_cast<FARPROC*>(ptr);
431 *function_ptr = ::GetProcAddress(ntdll, name); 432 *function_ptr = ::GetProcAddress(ntdll, name);
432 CHECK_NT(*function_ptr); 433 CHECK_NT(*function_ptr);
433 } 434 }
OLDNEW
« media/blink/resource_multibuffer_data_provider.cc ('K') | « ppapi/shared_impl/test_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698