Merge pull request #146 from arvidn/convert-from-native

correctly convert error messages from native to utf8
This commit is contained in:
Arvid Norberg 2015-09-10 00:09:37 -04:00
commit 7114648f33
1 changed files with 6 additions and 3 deletions

View File

@ -154,7 +154,8 @@ namespace libtorrent {
if (ec) if (ec)
{ {
snprintf(msg, sizeof(msg), "%s: read_piece %u failed: %s" snprintf(msg, sizeof(msg), "%s: read_piece %u failed: %s"
, torrent_alert::message().c_str() , piece, ec.message().c_str()); , torrent_alert::message().c_str() , piece
, convert_from_native(ec.message()).c_str());
} }
else else
{ {
@ -298,7 +299,8 @@ namespace libtorrent {
char ret[400]; char ret[400];
snprintf(ret, sizeof(ret), "%s (%d) %s \"%s\" (%d)" snprintf(ret, sizeof(ret), "%s (%d) %s \"%s\" (%d)"
, tracker_alert::message().c_str(), status_code , tracker_alert::message().c_str(), status_code
, error.message().c_str(), error_message(), times_in_row); , convert_from_native(error.message()).c_str(), error_message()
, times_in_row);
return ret; return ret;
} }
@ -1291,7 +1293,8 @@ namespace libtorrent {
std::string mmap_cache_alert::message() const std::string mmap_cache_alert::message() const
{ {
char msg[600]; char msg[600];
snprintf(msg, sizeof(msg), "mmap cache failed: (%d) %s", error.value(), error.message().c_str()); snprintf(msg, sizeof(msg), "mmap cache failed: (%d) %s", error.value()
, convert_from_native(error.message()).c_str());
return msg; return msg;
} }