mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 16:37:21 -06:00
- BUGFIX: Fixed possible overflow in progress calculation in arborescence.
h
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
* Unknown - Christophe DUMEZ <chris@qbittorrent.org> - 1.3.5
|
* Unknown - Christophe DUMEZ <chris@qbittorrent.org> - 1.3.5
|
||||||
- BUGFIX: Made IP filter parser more robust
|
- BUGFIX: Made IP filter parser more robust
|
||||||
- BUGFIX: Fixed torrent creation tool
|
- BUGFIX: Fixed torrent creation tool
|
||||||
|
- BUGFIX: Fixed possible overflow in progress calculation in arborescence.h
|
||||||
|
|
||||||
* Sun Jul 12 2009 - Christophe DUMEZ <chris@qbittorrent.org> - v1.3.4
|
* Sun Jul 12 2009 - Christophe DUMEZ <chris@qbittorrent.org> - v1.3.4
|
||||||
- BUGFIX: Fixed IP filter file parsing on 64bits
|
- BUGFIX: Fixed IP filter file parsing on 64bits
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ class torrent_file {
|
|||||||
torrent_file(torrent_file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){
|
torrent_file(torrent_file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){
|
||||||
qDebug("created a file with index %d", index);
|
qDebug("created a file with index %d", index);
|
||||||
rel_path = QDir::cleanPath(path);
|
rel_path = QDir::cleanPath(path);
|
||||||
|
Q_ASSERT(progress >= 0.);
|
||||||
|
Q_ASSERT(progress <= 1.);
|
||||||
if(parent) {
|
if(parent) {
|
||||||
parent->updateProgress();
|
parent->updateProgress();
|
||||||
parent->updatePriority(priority);
|
parent->updatePriority(priority);
|
||||||
@@ -75,8 +77,8 @@ class torrent_file {
|
|||||||
progress = 0.;
|
progress = 0.;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float wanted = 0.;
|
double wanted = 0.;
|
||||||
float done = 0.;
|
double done = 0.;
|
||||||
foreach(const torrent_file *child, children) {
|
foreach(const torrent_file *child, children) {
|
||||||
wanted += child->getSize();
|
wanted += child->getSize();
|
||||||
done += child->getSize()*child->getProgress();
|
done += child->getSize()*child->getProgress();
|
||||||
@@ -205,13 +207,13 @@ class arborescence {
|
|||||||
} else {
|
} else {
|
||||||
// XXX: Will crash if there is no file in torrent
|
// XXX: Will crash if there is no file in torrent
|
||||||
qDebug("one file in the torrent, setting it as root with index 0");
|
qDebug("one file in the torrent, setting it as root with index 0");
|
||||||
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, ((float)fp[0])/t.file_at(0).size, prioritiesTab[0]);
|
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, ((double)fp[0])/t.file_at(0).size, prioritiesTab[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(fi != t.end_files()) {
|
while(fi != t.end_files()) {
|
||||||
QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
|
QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
|
||||||
addFile(path, fi->size, i, ((float)fp[i])/t.file_at(i).size, prioritiesTab[i]);
|
addFile(path, fi->size, i, ((double)fp[i])/t.file_at(i).size, prioritiesTab[i]);
|
||||||
fi++;
|
fi++;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user