diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 07:28:46 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-19 07:28:46 +0000 |
commit | e06f4d5c6bd7bad162c45784e39cd0114635eb42 (patch) | |
tree | e53d6b4188af6e49393babc92a797ed5734a1026 /chrome/installer/util/shell_util.cc | |
parent | 2b107a348f2b27934fe38680ec8010d743f61765 (diff) | |
download | chromium_src-e06f4d5c6bd7bad162c45784e39cd0114635eb42.zip chromium_src-e06f4d5c6bd7bad162c45784e39cd0114635eb42.tar.gz chromium_src-e06f4d5c6bd7bad162c45784e39cd0114635eb42.tar.bz2 |
Regkey functions return error code instead of bool
Change the Regkey helper to consistently use and return LONG
instead of bool. Fix RegKey usage all over the code base and
get rid of workarounds due to lack of return value.
Reviewers:
brettw: everything (skip parts for other reviewers if you wish)
robertshield,grt: chrome_frame, installer
siggi: ceee
BUG=none
TEST=covered by existing tests
Review URL: http://codereview.chromium.org/6090006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/shell_util.cc')
-rw-r--r-- | chrome/installer/util/shell_util.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 8d4e643..d143ffb 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -200,14 +200,14 @@ class RegistryEntry { bool found = false; if (_is_string) { std::wstring read_value; - found = (key.ReadValue(_name.c_str(), &read_value)) && + found = (key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS) && (read_value.size() == _value.size()) && (std::equal(_value.begin(), _value.end(), read_value.begin(), base::CaseInsensitiveCompare<wchar_t>())); } else { DWORD read_value; - found = key.ReadValueDW(_name.c_str(), &read_value) && - read_value == _int_value; + found = (key.ReadValueDW(_name.c_str(), &read_value) == ERROR_SUCCESS) && + (read_value == _int_value); } key.Close(); return found; @@ -220,10 +220,10 @@ class RegistryEntry { bool found = false; if (_is_string) { std::wstring read_value; - found = key.ReadValue(_name.c_str(), &read_value); + found = key.ReadValue(_name.c_str(), &read_value) == ERROR_SUCCESS; } else { DWORD read_value; - found = key.ReadValueDW(_name.c_str(), &read_value); + found = key.ReadValueDW(_name.c_str(), &read_value) == ERROR_SUCCESS; } key.Close(); return found; @@ -356,7 +356,7 @@ bool AnotherUserHasDefaultBrowser(BrowserDistribution* dist, reg_key.append(L"\\" + dist->GetApplicationName() + ShellUtil::kRegShellOpen); RegKey key(HKEY_LOCAL_MACHINE, reg_key.c_str(), KEY_READ); std::wstring registry_chrome_exe; - if (!key.ReadValue(L"", ®istry_chrome_exe) || + if ((key.ReadValue(L"", ®istry_chrome_exe) != ERROR_SUCCESS) || registry_chrome_exe.length() < 2) return false; @@ -583,15 +583,16 @@ void ShellUtil::GetRegisteredBrowsers(BrowserDistribution* dist, RegKey capabilities(root, (key + L"\\Capabilities").c_str(), KEY_READ); std::wstring name; if (!capabilities.Valid() || - !capabilities.ReadValue(L"ApplicationName", &name)) { + capabilities.ReadValue(L"ApplicationName", &name) != ERROR_SUCCESS) { RegKey base_key(root, key.c_str(), KEY_READ); - if (!base_key.ReadValue(L"", &name)) + if (base_key.ReadValue(L"", &name) != ERROR_SUCCESS) continue; } RegKey install_info(root, (key + L"\\InstallInfo").c_str(), KEY_READ); std::wstring command; if (!install_info.Valid() || - !install_info.ReadValue(L"ReinstallCommand", &command)) + (install_info.ReadValue(L"ReinstallCommand", + &command) != ERROR_SUCCESS)) continue; if (!name.empty() && !command.empty() && name.find(dist->GetApplicationName()) == std::wstring::npos) |