fix iconv use on mingw
This commit is contained in:
parent
1b353ce5af
commit
ff6da81c4c
|
@ -167,6 +167,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_USE_ICONV 0
|
||||
#define TORRENT_USE_LOCALE 1
|
||||
#endif
|
||||
#define TORRENT_ICONV_ARG (const char**)
|
||||
#define TORRENT_USE_RLIMIT 0
|
||||
#define TORRENT_USE_NETLINK 0
|
||||
#define TORRENT_USE_GETADAPTERSADDRESSES 1
|
||||
|
@ -276,6 +277,10 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#define TORRENT_UPNP_LOGGING
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_ICONV_ARG
|
||||
#define TORRENT_ICONV_ARG (char**)
|
||||
#endif
|
||||
|
||||
// libiconv presence, not implemented yet
|
||||
#ifndef TORRENT_USE_ICONV
|
||||
#define TORRENT_USE_ICONV 1
|
||||
|
|
|
@ -621,8 +621,10 @@ namespace libtorrent
|
|||
ret.resize(outsize);
|
||||
char const* in = s.c_str();
|
||||
char* out = &ret[0];
|
||||
// posix has a weird iconv signature
|
||||
size_t retval = iconv(h, (char**)&in, &insize,
|
||||
// posix has a weird iconv signature. implementations
|
||||
// differ on what this signature should be, so we use
|
||||
// a macro to let config.hpp determine it
|
||||
size_t retval = iconv(h, TORRENT_ICONV_ARG &in, &insize,
|
||||
&out, &outsize);
|
||||
if (retval == (size_t)-1) return s;
|
||||
// if this string has an invalid utf-8 sequence in it, don't touch it
|
||||
|
|
Loading…
Reference in New Issue