From d66c88d59e62f3449f5b4bfccc72dc7c5ad0603f Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 18 Dec 2010 19:09:47 +0000 Subject: [PATCH] Fix possible encoding problem --- src/qtlibtorrent/qbtsession.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index f68e7f0f9..671c2ac17 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -1364,7 +1364,7 @@ void QBtSession::loadSessionState() { } #if LIBTORRENT_VERSION_MINOR > 14 std::vector in; - if (load_file(state_path.toLocal8Bit().constData(), in) == 0) + if (load_file(state_path.toUtf8().constData(), in) == 0) { lazy_entry e; #if LIBTORRENT_VERSION_MINOR > 15 @@ -1378,7 +1378,7 @@ void QBtSession::loadSessionState() { #endif } #else - boost::filesystem::ifstream ses_state_file(state_path.toLocal8Bit().constData() + boost::filesystem::ifstream ses_state_file(state_path.toUtf8().constData() , std::ios_base::binary); ses_state_file.unsetf(std::ios_base::skipws); s->load_state(bdecode( @@ -1397,13 +1397,13 @@ void QBtSession::saveSessionState() { bencode(std::back_inserter(out), session_state); file f; error_code ec; - if (!f.open(state_path.toLocal8Bit().constData(), file::write_only, ec)) return; + if (!f.open(state_path.toUtf8().constData(), file::write_only, ec)) return; if (ec) return; file::iovec_t b = {&out[0], out.size()}; f.writev(0, &b, 1, ec); #else entry session_state = s->state(); - boost::filesystem::ofstream out(state_path.toLocal8Bit().constData() + boost::filesystem::ofstream out(state_path.toUtf8().constData() , std::ios_base::binary); out.unsetf(std::ios_base::skipws); bencode(std::ostream_iterator(out), session_state); @@ -1418,7 +1418,7 @@ bool QBtSession::enableDHT(bool b) { entry dht_state; const QString dht_state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("dht_state"); if(QFile::exists(dht_state_path)) { - boost::filesystem::ifstream dht_state_file(dht_state_path.toLocal8Bit().constData(), std::ios_base::binary); + boost::filesystem::ifstream dht_state_file(dht_state_path.toUtf8().constData(), std::ios_base::binary); dht_state_file.unsetf(std::ios_base::skipws); try{ dht_state = bdecode(std::istream_iterator(dht_state_file), std::istream_iterator());