summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 07:28:46 +0000
committeramit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 07:28:46 +0000
commite06f4d5c6bd7bad162c45784e39cd0114635eb42 (patch)
treee53d6b4188af6e49393babc92a797ed5734a1026 /net
parent2b107a348f2b27934fe38680ec8010d743f61765 (diff)
downloadchromium_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 'net')
-rw-r--r--net/base/platform_mime_util_win.cc4
-rw-r--r--net/base/ssl_config_service_win.cc20
-rw-r--r--net/proxy/proxy_config_service_win.cc4
3 files changed, 13 insertions, 15 deletions
diff --git a/net/base/platform_mime_util_win.cc b/net/base/platform_mime_util_win.cc
index b93008b..f9a9391 100644
--- a/net/base/platform_mime_util_win.cc
+++ b/net/base/platform_mime_util_win.cc
@@ -28,8 +28,8 @@ bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
bool PlatformMimeUtil::GetPreferredExtensionForMimeType(
const std::string& mime_type, FilePath::StringType* ext) const {
std::wstring key(L"MIME\\Database\\Content Type\\" + UTF8ToWide(mime_type));
- if (!base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue(
- L"Extension", ext)) {
+ if (base::win::RegKey(HKEY_CLASSES_ROOT, key.c_str(), KEY_READ).ReadValue(
+ L"Extension", ext) != ERROR_SUCCESS) {
return false;
}
// Strip off the leading dot, this should always be the case.
diff --git a/net/base/ssl_config_service_win.cc b/net/base/ssl_config_service_win.cc
index ca20e79..dbdedb4 100644
--- a/net/base/ssl_config_service_win.cc
+++ b/net/base/ssl_config_service_win.cc
@@ -63,17 +63,15 @@ bool SSLConfigServiceWin::GetSSLConfigNow(SSLConfig* config) {
// http://crbug.com/61455
base::ThreadRestrictions::ScopedAllowIO allow_io;
RegKey internet_settings;
- if (!internet_settings.Open(HKEY_CURRENT_USER, kInternetSettingsSubKeyName,
- KEY_READ))
+ if (internet_settings.Open(HKEY_CURRENT_USER, kInternetSettingsSubKeyName,
+ KEY_READ) != ERROR_SUCCESS)
return false;
- DWORD revocation;
- if (!internet_settings.ReadValueDW(kRevocationValueName, &revocation))
- revocation = REVOCATION_DEFAULT;
+ DWORD revocation = REVOCATION_DEFAULT;
+ internet_settings.ReadValueDW(kRevocationValueName, &revocation);
- DWORD protocols;
- if (!internet_settings.ReadValueDW(kProtocolsValueName, &protocols))
- protocols = PROTOCOLS_DEFAULT;
+ DWORD protocols = PROTOCOLS_DEFAULT;
+ internet_settings.ReadValueDW(kProtocolsValueName, &protocols);
config->rev_checking_enabled = (revocation != 0);
config->ssl3_enabled = ((protocols & SSL3) != 0);
@@ -120,9 +118,9 @@ void SSLConfigServiceWin::SetSSLVersionEnabled(int version, bool enabled) {
base::ThreadRestrictions::ScopedAllowIO allow_io;
RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName,
KEY_READ | KEY_WRITE);
- DWORD value;
- if (!internet_settings.ReadValueDW(kProtocolsValueName, &value))
- value = PROTOCOLS_DEFAULT;
+ DWORD value = PROTOCOLS_DEFAULT;
+ internet_settings.ReadValueDW(kProtocolsValueName, &value);
+
if (enabled)
value |= version;
else
diff --git a/net/proxy/proxy_config_service_win.cc b/net/proxy/proxy_config_service_win.cc
index 849fc24..3c2fbff 100644
--- a/net/proxy/proxy_config_service_win.cc
+++ b/net/proxy/proxy_config_service_win.cc
@@ -42,7 +42,7 @@ class ProxyConfigServiceWin::KeyEntry {
bool StartWatching(base::win::ObjectWatcher::Delegate* delegate) {
// Try to create a watch event for the registry key (which watches the
// sibling tree as well).
- if (!key_.StartWatching())
+ if (key_.StartWatching() != ERROR_SUCCESS)
return false;
// Now setup an ObjectWatcher for this event, so we get OnObjectSignaled()
@@ -54,7 +54,7 @@ class ProxyConfigServiceWin::KeyEntry {
}
bool CreateRegKey(HKEY rootkey, const wchar_t* subkey) {
- return key_.Create(rootkey, subkey, KEY_NOTIFY);
+ return key_.Create(rootkey, subkey, KEY_NOTIFY) == ERROR_SUCCESS;
}
HANDLE watch_event() const {