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

Unified Diff: net/proxy/proxy_config_service_mac.cc

Issue 8528013: Convert plain C-style casts to use CFCastStrict and GetValueFromDictionary template (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Line alignment + Switching strict cases to normal. Created 9 years, 1 month 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
« no previous file with comments | « no previous file | net/proxy/proxy_resolver_mac.cc » ('j') | net/proxy/proxy_resolver_mac.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_config_service_mac.cc
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc
index 2fd6ee00af687e0272de16f65bb4b31c5e5c5a82..d462188bc96fc4c57690b879dbacaeb78a2194b0 100644
--- a/net/proxy/proxy_config_service_mac.cc
+++ b/net/proxy/proxy_config_service_mac.cc
@@ -8,6 +8,7 @@
#include <SystemConfiguration/SystemConfiguration.h>
#include "base/logging.h"
+#include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
wtc 2011/11/16 06:23:33 Can you see if we can remove this #include line no
#include "base/mac/scoped_cftyperef.h"
#include "base/message_loop.h"
@@ -28,8 +29,8 @@ const int kPollIntervalSec = 5;
bool GetBoolFromDictionary(CFDictionaryRef dict,
CFStringRef key,
bool default_value) {
- CFNumberRef number = (CFNumberRef)base::mac::GetValueFromDictionary(
- dict, key, CFNumberGetTypeID());
+ CFNumberRef number = base::mac::CFCastStrict<CFNumberRef>(
+ base::mac::GetValueFromDictionary(dict, key, CFNumberGetTypeID()));
Mark Mentovai 2011/11/11 17:31:50 I would only consider this a temporary measure. Ge
if (!number)
return default_value;
@@ -60,10 +61,11 @@ void GetCurrentProxyConfig(ProxyConfig* config) {
if (GetBoolFromDictionary(config_dict.get(),
kSCPropNetProxiesProxyAutoConfigEnable,
false)) {
- CFStringRef pac_url_ref = (CFStringRef)base::mac::GetValueFromDictionary(
- config_dict.get(),
- kSCPropNetProxiesProxyAutoConfigURLString,
- CFStringGetTypeID());
+ CFStringRef pac_url_ref = base::mac::CFCastStrict<CFStringRef>(
+ base::mac::GetValueFromDictionary(
+ config_dict.get(),
+ kSCPropNetProxiesProxyAutoConfigURLString,
+ CFStringGetTypeID()));
if (pac_url_ref)
config->set_pac_url(GURL(base::SysCFStringRefToUTF8(pac_url_ref)));
}
@@ -129,16 +131,16 @@ void GetCurrentProxyConfig(ProxyConfig* config) {
// proxy bypass list
- CFArrayRef bypass_array_ref =
- (CFArrayRef)base::mac::GetValueFromDictionary(
+ CFArrayRef bypass_array_ref = base::mac::CFCastStrict<CFArrayRef>(
+ base::mac::GetValueFromDictionary(
config_dict.get(),
kSCPropNetProxiesExceptionsList,
- CFArrayGetTypeID());
+ CFArrayGetTypeID()));
if (bypass_array_ref) {
CFIndex bypass_array_count = CFArrayGetCount(bypass_array_ref);
for (CFIndex i = 0; i < bypass_array_count; ++i) {
- CFStringRef bypass_item_ref =
- (CFStringRef)CFArrayGetValueAtIndex(bypass_array_ref, i);
+ CFStringRef bypass_item_ref = base::mac::CFCast<CFStringRef>(
+ CFArrayGetValueAtIndex(bypass_array_ref, i));
if (CFGetTypeID(bypass_item_ref) != CFStringGetTypeID()) {
Mark Mentovai 2011/11/11 17:31:50 This is wrong now. bypass_item_ref will either be
LOG(WARNING) << "Expected value for item " << i
<< " in the kSCPropNetProxiesExceptionsList"
« no previous file with comments | « no previous file | net/proxy/proxy_resolver_mac.cc » ('j') | net/proxy/proxy_resolver_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698