Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_elf/blacklist/blacklist.h" | 5 #include "chrome_elf/blacklist/blacklist.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 int size = -1; | 223 int size = -1; |
| 224 while (blacklist::g_troublesome_dlls[++size] != NULL) {} | 224 while (blacklist::g_troublesome_dlls[++size] != NULL) {} |
| 225 | 225 |
| 226 return size; | 226 return size; |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool IsBlacklistInitialized() { | 229 bool IsBlacklistInitialized() { |
| 230 return g_blacklist_initialized; | 230 return g_blacklist_initialized; |
| 231 } | 231 } |
| 232 | 232 |
| 233 int GetBlacklistIndex(const wchar_t* dll_name) { | |
| 234 for (int i = 0; i < kTroublesomeDllsMaxCount, g_troublesome_dlls[i]; ++i) { | |
|
Nico
2014/10/28 02:55:47
you mean &&, not ,
robertshield
2014/10/28 03:27:29
indeed! fixed with https://codereview.chromium.org
| |
| 235 if (_wcsicmp(dll_name, g_troublesome_dlls[i]) == 0) | |
| 236 return i; | |
| 237 } | |
| 238 return -1; | |
| 239 } | |
| 240 | |
| 233 bool AddDllToBlacklist(const wchar_t* dll_name) { | 241 bool AddDllToBlacklist(const wchar_t* dll_name) { |
| 234 int blacklist_size = BlacklistSize(); | 242 int blacklist_size = BlacklistSize(); |
| 235 // We need to leave one space at the end for the null pointer. | 243 // We need to leave one space at the end for the null pointer. |
| 236 if (blacklist_size + 1 >= kTroublesomeDllsMaxCount) | 244 if (blacklist_size + 1 >= kTroublesomeDllsMaxCount) |
| 237 return false; | 245 return false; |
| 238 for (int i = 0; i < blacklist_size; ++i) { | 246 for (int i = 0; i < blacklist_size; ++i) { |
| 239 if (!_wcsicmp(g_troublesome_dlls[i], dll_name)) | 247 if (!_wcsicmp(g_troublesome_dlls[i], dll_name)) |
| 240 return true; | 248 return true; |
| 241 } | 249 } |
| 242 | 250 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 break; | 435 break; |
| 428 value_buffer[value_len - 1] = L'\0'; | 436 value_buffer[value_len - 1] = L'\0'; |
| 429 AddDllToBlacklist(&value_buffer[0]); | 437 AddDllToBlacklist(&value_buffer[0]); |
| 430 } | 438 } |
| 431 | 439 |
| 432 ::RegCloseKey(key); | 440 ::RegCloseKey(key); |
| 433 return; | 441 return; |
| 434 } | 442 } |
| 435 | 443 |
| 436 } // namespace blacklist | 444 } // namespace blacklist |
| OLD | NEW |