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

Side by Side Diff: chrome/browser/policy/policy_loader_win.cc

Issue 10830022: Fixed check return warnings from Coverity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
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 "chrome/browser/policy/policy_loader_win.h" 5 #include "chrome/browser/policy/policy_loader_win.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 { kRegistryRecommendedSubKey, POLICY_LEVEL_RECOMMENDED }, 81 { kRegistryRecommendedSubKey, POLICY_LEVEL_RECOMMENDED },
82 }; 82 };
83 83
84 // Lookup at the mandatory path for both user and machine policies first, and 84 // Lookup at the mandatory path for both user and machine policies first, and
85 // then at the recommended path. 85 // then at the recommended path.
86 for (size_t k = 0; k < arraysize(kKeyPaths); ++k) { 86 for (size_t k = 0; k < arraysize(kKeyPaths); ++k) {
87 for (size_t h = 0; h < arraysize(kHives); ++h) { 87 for (size_t h = 0; h < arraysize(kHives); ++h) {
88 string16 path(kKeyPaths[k].path); 88 string16 path(kKeyPaths[k].path);
89 if (!key_path.empty()) 89 if (!key_path.empty())
90 path += kPathSep + key_path; 90 path += kPathSep + key_path;
91 key->Open(kHives[h].hive, path.c_str(), KEY_READ); 91 LONG rc = key->Open(kHives[h].hive, path.c_str(), KEY_READ);
92 DCHECK_EQ(rc, ERROR_SUCCESS);
Mattias Nissler (ping if slow) 2012/07/26 09:37:06 I think this is also wrong. Keys may not exist, so
Joao da Silva 2012/07/26 10:04:33 Yep. Rewrite as: if (key->Open(...) != ERROR_SUCC
Danh Nguyen 2012/07/26 15:46:27 Fixed per Joao's advice. Thanks.
92 if (!key->Valid()) 93 if (!key->Valid())
93 continue; 94 continue;
94 if (value_name.empty() || key->HasValue(value_name.c_str())) { 95 if (value_name.empty() || key->HasValue(value_name.c_str())) {
95 *level = kKeyPaths[k].level; 96 *level = kKeyPaths[k].level;
96 *scope = kHives[h].scope; 97 *scope = kHives[h].scope;
97 return true; 98 return true;
98 } 99 }
99 } 100 }
100 } 101 }
101 return false; 102 return false;
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 681
681 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { 682 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) {
682 DCHECK(object == user_policy_changed_event_.handle() || 683 DCHECK(object == user_policy_changed_event_.handle() ||
683 object == machine_policy_changed_event_.handle()) 684 object == machine_policy_changed_event_.handle())
684 << "unexpected object signaled policy reload, obj = " 685 << "unexpected object signaled policy reload, obj = "
685 << std::showbase << std::hex << object; 686 << std::showbase << std::hex << object;
686 Reload(false); 687 Reload(false);
687 } 688 }
688 689
689 } // namespace policy 690 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698