diff options
Diffstat (limited to 'Swiften/Network/MacOSXProxyProvider.cpp')
-rw-r--r-- | Swiften/Network/MacOSXProxyProvider.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Swiften/Network/MacOSXProxyProvider.cpp b/Swiften/Network/MacOSXProxyProvider.cpp index eaadd28..3456c73 100644 --- a/Swiften/Network/MacOSXProxyProvider.cpp +++ b/Swiften/Network/MacOSXProxyProvider.cpp @@ -5,4 +5,10 @@ */ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + #include <Swiften/Base/Platform.h> #include <Swiften/Network/MacOSXProxyProvider.h> @@ -11,4 +17,5 @@ #include <stdlib.h> #include <iostream> +#include <boost/numeric/conversion/cast.hpp> #include <utility> @@ -17,4 +24,6 @@ #endif +#pragma clang diagnostic ignored "-Wdisabled-macro-expansion" + using namespace Swift; @@ -28,5 +37,5 @@ static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabl CFNumberRef zero = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &i); CFComparisonResult result = CFNumberCompare(numberValue, zero, NULL); - CFRelease(numberValue); + CFRelease(zero); if(result != kCFCompareEqualTo) { @@ -38,5 +47,4 @@ static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabl if(numberValue != NULL) { CFNumberGetValue(numberValue, kCFNumberIntType, &port); - CFRelease(numberValue); } @@ -47,5 +55,5 @@ static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabl // if the string is toby the length must be at least 5. CFIndex length = CFStringGetLength(stringValue) + 1; - buffer.resize(length); + buffer.resize(boost::numeric_cast<size_t>(length)); if(CFStringGetCString(stringValue, &buffer[0], length, kCFStringEncodingMacRoman)) { for(std::vector<char>::iterator iter = buffer.begin(); iter != buffer.end(); ++iter) { @@ -53,5 +61,4 @@ static HostAddressPort getFromDictionary(CFDictionaryRef dict, CFStringRef enabl } } - CFRelease(stringValue); } } @@ -79,4 +86,5 @@ HostAddressPort MacOSXProxyProvider::getHTTPConnectProxy() const { if(proxies != NULL) { result = getFromDictionary(proxies, kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort); + CFRelease(proxies); } #endif @@ -90,4 +98,5 @@ HostAddressPort MacOSXProxyProvider::getSOCKS5Proxy() const { if(proxies != NULL) { result = getFromDictionary(proxies, kSCPropNetProxiesSOCKSEnable, kSCPropNetProxiesSOCKSProxy, kSCPropNetProxiesSOCKSPort); + CFRelease(proxies); } #endif |