From e7abeb9bd42d56bbf5d4041bd615ad253f0a9d75 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 10 Mar 2011 17:42:17 +0000 Subject: [PATCH] Code clean up --- src/torrentcreator/torrentcreatorthread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/torrentcreator/torrentcreatorthread.cpp b/src/torrentcreator/torrentcreatorthread.cpp index 800a2e513..aa6a9da63 100644 --- a/src/torrentcreator/torrentcreatorthread.cpp +++ b/src/torrentcreator/torrentcreatorthread.cpp @@ -89,16 +89,16 @@ void TorrentCreatorThread::run() { try { file_storage fs; // Adding files to the torrent - add_files(fs, input_path.toUtf8().constData(), file_filter); + libtorrent::add_files(fs, input_path.toUtf8().constData(), file_filter); if(abort) return; create_torrent t(fs, piece_size); // Add url seeds foreach(const QString &seed, url_seeds){ - t.add_url_seed(seed.trimmed().toLocal8Bit().data()); + t.add_url_seed(seed.trimmed().toStdString()); } foreach(const QString &tracker, trackers) { - t.add_tracker(tracker.trimmed().toLocal8Bit().data()); + t.add_tracker(tracker.trimmed().toStdString()); } if(abort) return; // calculate the hash for all pieces @@ -116,7 +116,7 @@ void TorrentCreatorThread::run() { std::vector torrent; bencode(back_inserter(torrent), t.generate()); QFile outfile(save_path); - if(outfile.open(QIODevice::WriteOnly)) { + if(!torrent.empty() && outfile.open(QIODevice::WriteOnly)) { outfile.write(&torrent[0], torrent.size()); outfile.close(); emit updateProgress(100);