Fix bug in progress info, count last written bytes in percent.

This commit is contained in:
Vreixo Formoso 2007-12-30 18:05:35 +01:00
parent 48e243d5da
commit c786fc70b6

View File

@ -963,13 +963,15 @@ int iso_write(Ecma119Image *target, void *buf, size_t count)
/* reader cancelled */
return ISO_WRITE_ERROR;
}
if (ret > 0){
unsigned int kbw = (unsigned int) target->bytes_written >> 10;
unsigned int kbt = (unsigned int) target->total_size >> 10;
int percent = (kbw * 100) / kbt;
if (ret > 0){
unsigned int kbw, kbt;
int percent;
target->bytes_written += count;
kbw = (unsigned int) target->bytes_written >> 10;
kbt = (unsigned int) target->total_size >> 10;
percent = (kbw * 100) / kbt;
/* only report in 5% chunks */
if (percent >= target->percent_written + 5) {