From 8cfac795c6f52539863ddd26f2741b50b8fe6454 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 13 Sep 2020 12:22:31 +0800 Subject: [PATCH] Avoid using libtorrent internal functions `char const* socket_type_name(socket_type_t);` is decided to be not exported and thus it is internal: https://github.com/arvidn/libtorrent/pull/4859/files#r452925563 --- src/base/bittorrent/session.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index a6316504b..afbd0b102 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -202,26 +202,37 @@ namespace QString toString(const lt::socket_type_t socketType) { -#if (LIBTORRENT_VERSION_NUM >= 20000) - return QString::fromLatin1(lt::socket_type_name(socketType)); -#else switch (socketType) { +#if (LIBTORRENT_VERSION_NUM >= 20000) + case lt::socket_type_t::http: + return QLatin1String("HTTP"); + case lt::socket_type_t::http_ssl: + return QLatin1String("HTTP_SSL"); +#endif case lt::socket_type_t::i2p: return QLatin1String("I2P"); case lt::socket_type_t::socks5: return QLatin1String("SOCKS5"); +#if (LIBTORRENT_VERSION_NUM >= 20000) + case lt::socket_type_t::socks5_ssl: + return QLatin1String("SOCKS5_SSL"); +#endif case lt::socket_type_t::tcp: return QLatin1String("TCP"); case lt::socket_type_t::tcp_ssl: return QLatin1String("TCP_SSL"); +#if (LIBTORRENT_VERSION_NUM >= 20000) + case lt::socket_type_t::utp: + return QLatin1String("UTP"); +#else case lt::socket_type_t::udp: return QLatin1String("UDP"); +#endif case lt::socket_type_t::utp_ssl: return QLatin1String("UTP_SSL"); } return QLatin1String("INVALID"); -#endif } QString toString(const lt::address &address)