From 1272867d0c5f5a924cba78d1053fbb1f19f1bb02 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Mon, 17 Mar 2008 23:25:30 +0000 Subject: [PATCH] correct computing of size of buffer subset --- libblock/block_read.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libblock/block_read.c b/libblock/block_read.c index 59cc51f..4da2a23 100644 --- a/libblock/block_read.c +++ b/libblock/block_read.c @@ -4,7 +4,6 @@ * */ -#include #include #include "libblock.h" @@ -24,7 +23,6 @@ size_t block_read(block_FILE *file, void *ptr, size_t size) file->offset / blocksize) / file->buffer_size; block_offset = (file->base - block_nb * file->buffer_size) * blocksize + file->offset; - if (block_nb != file->current) { ret = file->device->read_sector(file->device->data, @@ -36,7 +34,7 @@ size_t block_read(block_FILE *file, void *ptr, size_t size) file->current = block_nb; } - part = file->buffer_size - block_offset; + part = file->buffer_size * blocksize - block_offset; if (part > size) part = size; memcpy(ptr, file->buffer + block_offset, part);