merged string encoding fix from RC_0_16
This commit is contained in:
parent
cad9bbebd2
commit
850834b48f
|
@ -23,6 +23,7 @@
|
|||
* fix uTP edge case where udp socket buffer fills up
|
||||
* fix nagle implementation in uTP
|
||||
|
||||
* fix string encoding issue in alert messages
|
||||
* fix SSL authentication issue
|
||||
* deprecate std::wstring overloads. long live utf-8
|
||||
* improve time-critical pieces feature (streaming)
|
||||
|
|
|
@ -589,7 +589,7 @@ namespace libtorrent
|
|||
std::wstring ws;
|
||||
libtorrent::utf8_wchar(s, ws);
|
||||
std::string ret;
|
||||
ret.resize(ws.size() * 4);
|
||||
ret.resize(ws.size() * 4 + 1);
|
||||
std::size_t size = WideCharToMultiByte(CP_ACP, 0, ws.c_str(), -1, &ret[0], ret.size(), NULL, NULL);
|
||||
if (size == std::size_t(-1)) return s;
|
||||
ret.resize(size);
|
||||
|
@ -599,7 +599,7 @@ namespace libtorrent
|
|||
std::string convert_from_native(std::string const& s)
|
||||
{
|
||||
std::wstring ws;
|
||||
ws.resize(s.size());
|
||||
ws.resize(s.size() + 1);
|
||||
std::size_t size = MultiByteToWideChar(CP_ACP, 0, s.c_str(), -1, &ws[0], ws.size());
|
||||
if (size == std::size_t(-1)) return s;
|
||||
ws.resize(size);
|
||||
|
|
Loading…
Reference in New Issue