]> git.sesse.net Git - vlc/blobdiff - src/darwin/netconf.c
clock: use msg_Err()
[vlc] / src / darwin / netconf.c
index 0d9ca432bdcc89da6a920c895df8b0565422805c..d5f66664a49eda91640cdf2c829739bd493e8d83 100644 (file)
 #include <vlc_common.h>
 #include <vlc_network.h>
 
-#import <TargetConditionals.h>
 #include <CoreFoundation/CoreFoundation.h>
+
+#import <TargetConditionals.h>
 #if TARGET_OS_IPHONE
 #include <CFNetwork/CFProxySupport.h>
 #else
-#include <SystemConfiguration/SystemConfiguration.h>
+#include <CoreServices/CoreServices.h>
 #endif
 
 /**
@@ -44,7 +45,6 @@
 char *vlc_getProxyUrl(const char *url)
 {
     VLC_UNUSED(url);
-#if TARGET_OS_IPHONE
     char *proxy_url = NULL;
     CFDictionaryRef dicRef = CFNetworkCopySystemProxySettings();
     if (NULL != dicRef) {
@@ -64,7 +64,6 @@ char *vlc_getProxyUrl(const char *url)
             if (CFStringGetCString(proxyCFstr, host_buffer, sizeof(host_buffer)
                                    - 1, kCFStringEncodingUTF8)) {
                 char buffer[4096];
-                memset(host_buffer, 0, sizeof(host_buffer));
                 sprintf(buffer, "%s:%d", host_buffer, port);
                 proxy_url = strdup(buffer);
             }
@@ -74,58 +73,4 @@ char *vlc_getProxyUrl(const char *url)
     }
 
     return proxy_url;
-#else
-    CFDictionaryRef proxies = SCDynamicStoreCopyProxies(NULL);
-    char *proxy_url = NULL;
-
-    if (proxies) {
-        CFNumberRef cfn_httpProxyOn =
-            (CFNumberRef)CFDictionaryGetValue(proxies,
-                                              kSCPropNetProxiesHTTPEnable);
-        if (cfn_httpProxyOn) {
-            int i_httpProxyOn;
-            CFNumberGetValue(cfn_httpProxyOn, kCFNumberIntType, &i_httpProxyOn);
-            CFRelease(cfn_httpProxyOn);
-
-            if (i_httpProxyOn == 1) // http proxy is on
-            {
-                CFStringRef httpProxy =
-                    (CFStringRef)CFDictionaryGetValue(proxies,
-                                                      kSCPropNetProxiesHTTPProxy);
-
-                if (httpProxy) {
-                    CFNumberRef cfn_httpProxyPort =
-                        (CFNumberRef)CFDictionaryGetValue(proxies,
-                                                        kSCPropNetProxiesHTTPPort);
-                    int i_httpProxyPort;
-                    CFNumberGetValue(cfn_httpProxyPort,
-                                     kCFNumberIntType,
-                                     &i_httpProxyPort);
-                    CFRelease(cfn_httpProxyPort);
-
-                    CFMutableStringRef outputURL =
-                        CFStringCreateMutableCopy(kCFAllocatorDefault,
-                                                  0,
-                                                  httpProxy);
-                    if (i_httpProxyPort > 0)
-                        CFStringAppendFormat(outputURL,
-                                             NULL,
-                                             CFSTR(":%i"),
-                                             i_httpProxyPort);
-
-                    char buffer[4096];
-                    if (CFStringGetCString(outputURL, buffer, sizeof(buffer),
-                        kCFStringEncodingUTF8))
-                        proxy_url = strdup(buffer);
-
-                    CFRelease(outputURL);
-                }
-                CFRelease(httpProxy);
-            }
-        }
-        CFRelease(proxies);
-    }
-
-    return proxy_url;
-#endif
 }