generalized string conversion for libc
This commit is contained in:
parent
97a40a45cd
commit
118a75ebe7
|
@ -142,6 +142,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#if defined __APPLE__
|
||||
#ifndef TORRENT_USE_ICONV
|
||||
#define TORRENT_USE_ICONV 0
|
||||
#define TORRENT_USE_LOCALE 0
|
||||
#endif
|
||||
#endif
|
||||
#define TORRENT_HAS_FALLOCATE 0
|
||||
|
@ -157,7 +158,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#define TORRENT_MINGW
|
||||
#define TORRENT_WINDOWS
|
||||
#ifndef TORRENT_USE_ICONV
|
||||
#define TORRENT_USE_ICONV 1
|
||||
#define TORRENT_USE_ICONV 0
|
||||
#define TORRENT_USE_LOCALE 1
|
||||
#endif
|
||||
#define TORRENT_USE_RLIMIT 0
|
||||
|
||||
|
@ -169,6 +171,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
// is necessary
|
||||
#ifndef TORRENT_USE_ICONV
|
||||
#define TORRENT_USE_ICONV 0
|
||||
#define TORRENT_USE_LOCALE 1
|
||||
#endif
|
||||
#define TORRENT_USE_RLIMIT 0
|
||||
#define TORRENT_HAS_FALLOCATE 0
|
||||
|
@ -257,6 +260,10 @@ inline int snprintf(char* buf, int len, char const* fmt, ...)
|
|||
#define TORRENT_USE_ICONV 1
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_USE_LOCALE
|
||||
#define TORRENT_USE_LOCALE 0
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_BROKEN_UNIONS
|
||||
#define TORRENT_BROKEN_UNIONS 0
|
||||
#endif
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace libtorrent
|
|||
TORRENT_EXPORT std::string convert_from_wstring(std::wstring const& s);
|
||||
#endif
|
||||
|
||||
#if defined TORRENT_WINDOWS || TORRENT_USE_ICONV
|
||||
#if TORRENT_USE_ICONV || TORRENT_USE_LOCALE
|
||||
TORRENT_EXPORT std::string convert_to_native(std::string const& s);
|
||||
TORRENT_EXPORT std::string convert_from_native(std::string const& s);
|
||||
#else
|
||||
|
|
|
@ -657,7 +657,9 @@ namespace libtorrent
|
|||
if (iconv_handle == iconv_t(-1)) return s;
|
||||
return iconv_convert_impl(s, iconv_handle);
|
||||
}
|
||||
#elif defined TORRENT_WINDOWS
|
||||
|
||||
#elif TORRENT_USE_LOCALE
|
||||
|
||||
std::string convert_to_native(std::string const& s)
|
||||
{
|
||||
std::wstring ws;
|
||||
|
@ -682,6 +684,7 @@ namespace libtorrent
|
|||
libtorrent::wchar_utf8(ws, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue