From e06f4d5c6bd7bad162c45784e39cd0114635eb42 Mon Sep 17 00:00:00 2001 From: "amit@chromium.org" Date: Wed, 19 Jan 2011 07:28:46 +0000 Subject: 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 --- net/base/platform_mime_util_win.cc | 4 ++-- net/base/ssl_config_service_win.cc | 20 +++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'net/base') 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 -- cgit v1.1