From be3ccfa47de5d0e80cc64421d6b4b9ed3df8bbcc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 15 Nov 2007 11:03:37 -0500 Subject: [svn-r14262] Description: Correct "off by one" error in computing the size of block to allocate when the I/O size is less than the memory block size. Tested on: Customer machines, by local developer... --- src/H5FDdirect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 23ff0fe..b078511 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -976,7 +976,7 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha * copy buffer size. Make a bigger buffer for aligned I/O if size is * smaller than maximal copy buffer. */ if(size < _cbsize) - alloc_size = (size / _fbsize + 1) * _fbsize + _fbsize; + alloc_size = ((size / _fbsize) * _fbsize) + _fbsize; else alloc_size = _cbsize; if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) @@ -1141,7 +1141,7 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h * smaller than maximal copy buffer. */ if(size < _cbsize) - alloc_size = (size / _fbsize + 1) * _fbsize + _fbsize; + alloc_size = ((size / _fbsize) * _fbsize) + _fbsize; else alloc_size = _cbsize; -- cgit v0.12