forked from premiere/premiere-libtorrent
fix iconv cast warnings
This commit is contained in:
parent
afe1f685a4
commit
1ea760ae93
|
@ -199,7 +199,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// FreeBSD has a reasonable iconv signature
|
// FreeBSD has a reasonable iconv signature
|
||||||
// unless we're on glibc
|
// unless we're on glibc
|
||||||
#ifndef __GLIBC__
|
#ifndef __GLIBC__
|
||||||
# define TORRENT_ICONV_ARG (const char**)
|
# define TORRENT_ICONV_ARG(x) (x)
|
||||||
#endif
|
#endif
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define TORRENT_USE_IFCONF 1
|
#define TORRENT_USE_IFCONF 1
|
||||||
#define TORRENT_USE_SYSCTL 1
|
#define TORRENT_USE_SYSCTL 1
|
||||||
#define TORRENT_USE_IPV6 0
|
#define TORRENT_USE_IPV6 0
|
||||||
#define TORRENT_ICONV_ARG (const char**)
|
#define TORRENT_ICONV_ARG(x) (x)
|
||||||
#define TORRENT_USE_WRITEV 0
|
#define TORRENT_USE_WRITEV 0
|
||||||
#define TORRENT_USE_READV 0
|
#define TORRENT_USE_READV 0
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ int snprintf(char* buf, int len, char const* fmt, ...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef TORRENT_ICONV_ARG
|
#ifndef TORRENT_ICONV_ARG
|
||||||
#define TORRENT_ICONV_ARG (char**)
|
#define TORRENT_ICONV_ARG(x) const_cast<char**>(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __GNUC__ || defined __clang__
|
#if defined __GNUC__ || defined __clang__
|
||||||
|
|
|
@ -514,6 +514,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TORRENT_USE_ICONV
|
#if TORRENT_USE_ICONV
|
||||||
|
namespace {
|
||||||
std::string iconv_convert_impl(std::string const& s, iconv_t h)
|
std::string iconv_convert_impl(std::string const& s, iconv_t h)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
@ -525,9 +526,9 @@ namespace libtorrent
|
||||||
// posix has a weird iconv signature. implementations
|
// posix has a weird iconv signature. implementations
|
||||||
// differ on what this signature should be, so we use
|
// differ on what this signature should be, so we use
|
||||||
// a macro to let config.hpp determine it
|
// a macro to let config.hpp determine it
|
||||||
size_t retval = iconv(h, TORRENT_ICONV_ARG &in, &insize,
|
size_t retval = iconv(h, TORRENT_ICONV_ARG(&in), &insize,
|
||||||
&out, &outsize);
|
&out, &outsize);
|
||||||
if (retval == (size_t)-1) return s;
|
if (retval == size_t(-1)) return s;
|
||||||
// if this string has an invalid utf-8 sequence in it, don't touch it
|
// if this string has an invalid utf-8 sequence in it, don't touch it
|
||||||
if (insize != 0) return s;
|
if (insize != 0) return s;
|
||||||
// not sure why this would happen, but it seems to be possible
|
// not sure why this would happen, but it seems to be possible
|
||||||
|
@ -537,6 +538,7 @@ namespace libtorrent
|
||||||
ret.resize(ret.size() - outsize);
|
ret.resize(ret.size() - outsize);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
std::string convert_to_native(std::string const& s)
|
std::string convert_to_native(std::string const& s)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue