From 21be57d06f310e641ced34df361c00ec36c3de00 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 4 May 2007 14:35:39 +0000 Subject: [PATCH] - Fixed compiling with libtorrent v0.12 stable - Fixed EffectiveSize() function so that the file size really reflects only unfiltered files in the torrent --- src/GUI.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/GUI.cpp b/src/GUI.cpp index e2da27e83..a5c86470a 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -1044,9 +1044,26 @@ size_type GUI::torrentEffectiveSize(QString hash) const{ torrent_info t = h.get_torrent_info(); unsigned short nbFiles = t.num_files(); size_type effective_size = 0; +#ifndef V_0_13 + QList filteredFiles; + QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".pieces"); + if(pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QByteArray pieces_selection = pieces_file.readAll(); + pieces_file.close(); + filteredFiles = pieces_selection.split('\n'); + } + bool corrupted_pieces_file = false; + if(nbFiles != filteredFiles.size() - 1) + corrupted_pieces_file = true; +#endif for(unsigned int i=0; i