From 3c2e39acd1cbf4b92bc52afaf96ff57222c2fdbc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 4 Oct 2000 17:43:11 -0500 Subject: [svn-r2633] Purpose: Bug Fix Description: Use H5FD_get_eoa instead of H5FD_get_eof to check for reading off the end of the allocated file space. Using H5FD_get_eof was causing the Stream VFD to fail. Solution: Switched from using H5FD_get_eof to H5FD_get_eoa Platforms tested: FreeBSD 4.1.1 (hawkwind) --- src/H5Dcontig.c | 20 ++++++++++---------- src/H5Fcontig.c | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index a051b12..d4430c0 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -44,7 +44,7 @@ H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, hid_t dxpl_id, void *_buf/*out*/) { uint8_t *buf = (uint8_t*)_buf; /*cast for arithmetic */ - haddr_t eof; /*end of file address */ + haddr_t eoa; /*end of file address */ FUNC_ENTER(H5F_contig_read, FAIL); @@ -107,11 +107,11 @@ H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, hid_t dxpl_id, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { @@ -147,11 +147,11 @@ H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, hid_t dxpl_id, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { @@ -198,7 +198,7 @@ herr_t H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxpl_id, const void *buf) { - haddr_t eof; /*end of file address */ + haddr_t eoa; /*end of file address */ FUNC_ENTER(H5F_block_write, FAIL); @@ -268,11 +268,11 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { @@ -309,11 +309,11 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { diff --git a/src/H5Fcontig.c b/src/H5Fcontig.c index a051b12..d4430c0 100644 --- a/src/H5Fcontig.c +++ b/src/H5Fcontig.c @@ -44,7 +44,7 @@ H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, hid_t dxpl_id, void *_buf/*out*/) { uint8_t *buf = (uint8_t*)_buf; /*cast for arithmetic */ - haddr_t eof; /*end of file address */ + haddr_t eoa; /*end of file address */ FUNC_ENTER(H5F_contig_read, FAIL); @@ -107,11 +107,11 @@ H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, hid_t dxpl_id, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { @@ -147,11 +147,11 @@ H5F_contig_read(H5F_t *f, haddr_t addr, hsize_t size, hid_t dxpl_id, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { @@ -198,7 +198,7 @@ herr_t H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hid_t dxpl_id, const void *buf) { - haddr_t eof; /*end of file address */ + haddr_t eoa; /*end of file address */ FUNC_ENTER(H5F_block_write, FAIL); @@ -268,11 +268,11 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { @@ -309,11 +309,11 @@ H5F_contig_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, f->shared->sieve_loc=addr; /* Make certain we don't read off the end of the file */ - if (HADDR_UNDEF==(eof=H5FD_get_eof(f->shared->lf))) { + if (HADDR_UNDEF==(eoa=H5FD_get_eoa(f->shared->lf))) { HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to determine file size"); } - f->shared->sieve_size=MIN(eof-addr,f->shared->sieve_buf_size); + f->shared->sieve_size=MIN(eoa-addr,f->shared->sieve_buf_size); /* Read the new sieve buffer */ if (H5F_block_read(f, f->shared->sieve_loc, f->shared->sieve_size, dxpl_id, f->shared->sieve_buf)<0) { -- cgit v0.12