From b1b1b74b383d84e024e3c76ddb79ea2abdf4eebe Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 4 Aug 2000 15:49:59 -0500 Subject: [PATCH] [svn-r2465] Changed nbytes to an hsize_t type since that's what it holds. Also, moved it into the if-then statement to limit it's scope. --- src/H5FDcore.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 888dabeb66..56860032a4 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -573,8 +573,7 @@ static herr_t H5FD_core_read(H5FD_t *_file, hid_t UNUSED dxpl_id, haddr_t addr, hsize_t size, void *buf/*out*/) { - H5FD_core_t *file = (H5FD_core_t*)_file; - ssize_t nbytes; + H5FD_core_t *file = (H5FD_core_t*)_file; FUNC_ENTER(H5FD_core_read, FAIL); @@ -582,24 +581,25 @@ H5FD_core_read(H5FD_t *_file, hid_t UNUSED dxpl_id, haddr_t addr, assert(buf); /* Check for overflow conditions */ - if (HADDR_UNDEF==addr) + if (HADDR_UNDEF == addr) HRETURN_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed"); if (REGION_OVERFLOW(addr, size)) HRETURN_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed"); - if (addr+size>file->eoa) + if (addr + size > file->eoa) HRETURN_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed"); /* Read the part which is before the EOF marker */ - if (addreof) { - nbytes = MIN(size, file->eof-addr); - memcpy(buf, file->mem+addr, nbytes); + if (addr < file->eof) { + hsize_t nbytes = MIN(size, file->eof-addr); + + memcpy(buf, file->mem + addr, nbytes); size -= nbytes; addr += nbytes; - buf = (char*)buf + nbytes; + buf = (char *)buf + nbytes; } /* Read zeros for the part which is after the EOF markers */ - if (size>0) + if (size > 0) memset(buf, 0, size); FUNC_LEAVE(SUCCEED);