diff options
Diffstat (limited to 'Swiften/Network/GConfProxyProvider.cpp')
| -rw-r--r-- | Swiften/Network/GConfProxyProvider.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Swiften/Network/GConfProxyProvider.cpp b/Swiften/Network/GConfProxyProvider.cpp index eade450..7c31868 100644 --- a/Swiften/Network/GConfProxyProvider.cpp +++ b/Swiften/Network/GConfProxyProvider.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (c) 2016-2017 Isode Limited. | 8 | * Copyright (c) 2016-2018 Isode Limited. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * See the COPYING file for more information. | 10 | * See the COPYING file for more information. |
| 11 | */ | 11 | */ |
| @@ -21,6 +21,8 @@ extern "C" { | |||
| 21 | #include <gconf/gconf-client.h> | 21 | #include <gconf/gconf-client.h> |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | #include <boost/numeric/conversion/cast.hpp> | ||
| 25 | |||
| 24 | #include <Swiften/Base/Log.h> | 26 | #include <Swiften/Base/Log.h> |
| 25 | 27 | ||
| 26 | namespace Swift { | 28 | namespace Swift { |
| @@ -50,13 +52,17 @@ HostAddressPort GConfProxyProvider::getSOCKS5Proxy() const { | |||
| 50 | 52 | ||
| 51 | HostAddressPort GConfProxyProvider::getFromGConf(const char* gcHost, const char* gcPort) { | 53 | HostAddressPort GConfProxyProvider::getFromGConf(const char* gcHost, const char* gcPort) { |
| 52 | std::string address; | 54 | std::string address; |
| 53 | int port = 0; | 55 | unsigned short port = 0; |
| 54 | gchar* str; | 56 | gchar* str; |
| 55 | 57 | ||
| 56 | GConfClient* client = gconf_client_get_default(); | 58 | GConfClient* client = gconf_client_get_default(); |
| 57 | 59 | ||
| 58 | str = gconf_client_get_string(client, gcHost, NULL); | 60 | str = gconf_client_get_string(client, gcHost, NULL); |
| 59 | port = static_cast<int> (gconf_client_get_int(client, gcPort, NULL)); | 61 | try { |
| 62 | port = boost::numeric_cast<unsigned short>(gconf_client_get_int(client, gcPort, NULL)); | ||
| 63 | } | ||
| 64 | catch (const boost::numeric::bad_numeric_cast&) { | ||
| 65 | } | ||
| 60 | 66 | ||
| 61 | if(str) { | 67 | if(str) { |
| 62 | address = static_cast<char*> (str); | 68 | address = static_cast<char*> (str); |
Swift