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

Unified Diff: chrome_frame/chrome_tab.cc

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome_frame/chrome_tab.cc
===================================================================
--- chrome_frame/chrome_tab.cc (revision 71345)
+++ chrome_frame/chrome_tab.cc (working copy)
@@ -324,16 +324,16 @@
}
RegKey run_once;
- if (run_once.Create(hive, kRunOnce, KEY_READ | KEY_WRITE)) {
+ LONG ret = run_once.Create(hive, kRunOnce, KEY_READ | KEY_WRITE);
+ if (ret == ERROR_SUCCESS) {
CommandLine run_once_cmd(chrome_launcher::GetChromeExecutablePath());
run_once_cmd.AppendSwitchASCII(switches::kAutomationClientChannelID,
"0");
run_once_cmd.AppendSwitch(switches::kChromeFrame);
- if (run_once.WriteValue(L"A",
- run_once_cmd.command_line_string().c_str())) {
- result = S_OK;
- }
+ ret = run_once.WriteValue(L"A",
+ run_once_cmd.command_line_string().c_str());
}
grt (UTC plus 2) 2011/01/14 15:53:43 Looks like you're missing "if (ret == ERROR_SUCCES
amit 2011/01/15 01:28:11 Next HRESULT_FROM_WIN32 should translate ERROR_SUC
grt (UTC plus 2) 2011/01/16 04:19:48 Oh yeah. Sweet.
+ result = HRESULT_FROM_WIN32(ret);
} else {
result = S_FALSE;
}
@@ -434,7 +434,8 @@
HKEY parent_hive = is_system ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
RegKey ua_key;
- if (ua_key.Create(parent_hive, kPostPlatformUAKey, KEY_WRITE)) {
+ if (ua_key.Create(parent_hive, kPostPlatformUAKey,
+ KEY_WRITE) == ERROR_SUCCESS) {
std::wstring chrome_frame_ua_value_name = kChromeFramePrefix;
chrome_frame_ua_value_name += GetCurrentModuleVersion();
if (value) {
@@ -632,7 +633,7 @@
RegKey backup_key(HKEY_LOCAL_MACHINE, backup_key_name_.c_str(),
KEY_READ | KEY_WRITE);
if (backup_key.Valid()) {
- return backup_key.WriteValue(NULL, str.GetString());
+ return backup_key.WriteValue(NULL, str.GetString()) == ERROR_SUCCESS;
}
return false;
@@ -674,15 +675,15 @@
DWORD len = 0;
DWORD reg_type = REG_NONE;
- if (!backup_key.ReadValue(NULL, NULL, &len, &reg_type))
+ if (backup_key.ReadValue(NULL, NULL, &len, &reg_type) != ERROR_SUCCESS)
return false;
if (reg_type != REG_SZ)
return false;
size_t wchar_count = 1 + len / sizeof(wchar_t);
- if (!backup_key.ReadValue(NULL, WriteInto(sddl, wchar_count), &len,
- &reg_type)) {
+ if (backup_key.ReadValue(NULL, WriteInto(sddl, wchar_count), &len,
+ &reg_type) != ERROR_SUCCESS) {
return false;
}
@@ -738,16 +739,17 @@
if (!key.Valid())
return false;
- bool result;
+ LONG result1 = ERROR_SUCCESS;
+ LONG result2 = ERROR_SUCCESS;
if (set) {
- result = key.WriteValue(L"ChromeTab.ChromeActiveDocument", 1);
- result = key.WriteValue(L"ChromeTab.ChromeActiveDocument.1", 1) && result;
+ result1 = key.WriteValue(L"ChromeTab.ChromeActiveDocument", 1);
+ result2 = key.WriteValue(L"ChromeTab.ChromeActiveDocument.1", 1);
} else {
- result = key.DeleteValue(L"ChromeTab.ChromeActiveDocument");
- result = key.DeleteValue(L"ChromeTab.ChromeActiveDocument.1") && result;
+ result1 = key.DeleteValue(L"ChromeTab.ChromeActiveDocument");
+ result2 = key.DeleteValue(L"ChromeTab.ChromeActiveDocument.1");
}
- return result;
+ return (result2 == ERROR_SUCCESS) && (result2 == ERROR_SUCCESS);
}
bool RegisterSecuredMimeHandler(bool enable, bool is_system) {

Powered by Google App Engine
This is Rietveld 408576698