Fixed overflow in the calculation of progress percentage for file

allocation and hash check when off_t is 32bit.
pull/1/head
Tatsuhiro Tsujikawa 2011-01-30 23:28:10 +09:00
parent be1e168082
commit 27974108f0
1 changed files with 8 additions and 4 deletions

View File

@ -311,7 +311,7 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e)
<< "B"
<< "(";
if(entry->getTotalLength() > 0) {
o << 100*entry->getCurrentLength()/entry->getTotalLength();
o << 100LL*entry->getCurrentLength()/entry->getTotalLength();
} else {
o << "--";
}
@ -337,9 +337,13 @@ ConsoleStatCalc::calculateStat(const DownloadEngine* e)
<< "/"
<< sizeFormatter(entry->getTotalLength())
<< "B"
<< "("
<< 100*entry->getCurrentLength()/entry->getTotalLength()
<< "%)"
<< "(";
if(entry->getTotalLength() > 0) {
o << 100LL*entry->getCurrentLength()/entry->getTotalLength();
} else {
o << "--";
}
o << "%)"
<< "]";
if(e->getCheckIntegrityMan()->hasNext()) {
o << "("