[vlc-commits] src: fix crashes on proxy lookups by deleting the Mac specific and using the iOS code which works just fine on 10.6+ (close #9561)

Felix Paul Kühne git at videolan.org
Mon Oct 7 12:22:41 CEST 2013


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Oct  7 12:21:29 2013 +0200| [b062c14b11a1f2dc7df560fd77f4310995d20a6c] | committer: Felix Paul Kühne

src: fix crashes on proxy lookups by deleting the Mac specific and using the iOS code which works just fine on 10.6+ (close #9561)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b062c14b11a1f2dc7df560fd77f4310995d20a6c
---

 configure.ac         |    2 +-
 src/darwin/netconf.c |   61 --------------------------------------------------
 2 files changed, 1 insertion(+), 62 deletions(-)

diff --git a/configure.ac b/configure.ac
index a273d18..a526996 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,7 +155,7 @@ case "${host_os}" in
     LDFLAGS="${LDFLAGS} -Wl,-headerpad_max_install_names ${ARCH_flag}"
     VLC_ADD_LIBS([libvlc vlc],[-Wl,-undefined,dynamic_lookup,-framework,AppKit])
     VLC_ADD_LIBS([avcodec access_avio swscale postproc i420_rgb_mmx x262 x264 x26410b],[-Wl,-read_only_relocs,suppress])
-    VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,SystemConfiguration])
+    VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreFoundation,-framework,CFNetwork])
 
     dnl Allow binaries created on Lion to run on earlier releases
     AC_EGREP_CPP(yes,
diff --git a/src/darwin/netconf.c b/src/darwin/netconf.c
index 0d9ca43..c36201c 100644
--- a/src/darwin/netconf.c
+++ b/src/darwin/netconf.c
@@ -28,13 +28,8 @@
 #include <vlc_common.h>
 #include <vlc_network.h>
 
-#import <TargetConditionals.h>
 #include <CoreFoundation/CoreFoundation.h>
-#if TARGET_OS_IPHONE
 #include <CFNetwork/CFProxySupport.h>
-#else
-#include <SystemConfiguration/SystemConfiguration.h>
-#endif
 
 /**
  * Determines the network proxy server to use (if any).
@@ -44,7 +39,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 +58,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 +67,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
 }



More information about the vlc-commits mailing list