From ad2974940ab1bea414ecb5e3a0edc5c046c582d1 Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Date: Tue, 1 Jan 2008 20:25:07 +0100 Subject: [PATCH] Correctly manage image size and written progress. --- src/ecma119.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ecma119.c b/src/ecma119.c index 5f3a1ff..cf3283b 100644 --- a/src/ecma119.c +++ b/src/ecma119.c @@ -827,8 +827,8 @@ int ecma119_image_new(IsoImage *src, Ecma119WriteOpts *opts, Ecma119Image **img) * The volume space size is just the size of the last session, in * case of ms images. */ - target->total_size = (target->curblock - target->ms_block) * BLOCK_SIZE; target->vol_space_size = target->curblock - target->ms_block; + target->total_size = (off_t) target->vol_space_size * BLOCK_SIZE; /* 4. Create and start writting thread */ @@ -972,9 +972,9 @@ int iso_write(Ecma119Image *target, void *buf, size_t count) unsigned int kbw, kbt; int percent; - target->bytes_written += count; - kbw = (unsigned int) target->bytes_written >> 10; - kbt = (unsigned int) target->total_size >> 10; + target->bytes_written += (off_t) count; + kbw = (unsigned int) (target->bytes_written >> 10); + kbt = (unsigned int) (target->total_size >> 10); percent = (kbw * 100) / kbt; /* only report in 5% chunks */