summaryrefslogtreecommitdiffstats
path: root/src/H5Oefl.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-03-05 21:27:38 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-03-05 21:27:38 (GMT)
commit79158424981ffc6cf5ce69a64cd096e4c928d842 (patch)
tree3e0dc2fb04966ef49cbe10ee820a770d1c5a1215 /src/H5Oefl.c
parent4badc161ae7cd13a01e17b8c920759e47631951a (diff)
downloadhdf5-79158424981ffc6cf5ce69a64cd096e4c928d842.zip
hdf5-79158424981ffc6cf5ce69a64cd096e4c928d842.tar.gz
hdf5-79158424981ffc6cf5ce69a64cd096e4c928d842.tar.bz2
[svn-r306] Changes since 19980305
---------------------- ./src/H5D.c ./test/external.c A contiguous dataset can now be stored in external files in such a way that the slowest varying dimension can be increased after the dataset is created and even written. The user must have reserved enough space in the external file and the data space must allow an increase the the slowest varying dimension. See test_3() of ./test/external.c ./src/H5Oefl.c ./configure.in ./src/H5Fprivate.h Fixed an overflow bug with unlimited external storage. ./src/H5V.c Fixed a cast warning. ./test/dsets.c Make better use of automatic error reporting.
Diffstat (limited to 'src/H5Oefl.c')
-rw-r--r--src/H5Oefl.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index ac65101..1b3fa6a 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -386,7 +386,8 @@ H5O_efl_read (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
/* Find the first efl member from which to read */
for (i=0, cur=0; i<efl->nused; i++) {
- if (addr->offset < cur+efl->slot[i].size) {
+ if (H5O_EFL_UNLIMITED==efl->slot[i].size ||
+ addr->offset < cur+efl->slot[i].size) {
skip = addr->offset - cur;
break;
}
@@ -399,11 +400,15 @@ H5O_efl_read (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL,
"read past logical end of file");
}
+ if (H5F_OVERFLOW_SIZET2OFFT (efl->slot[i].offset+skip)) {
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL,
+ "external file address overflowed");
+ }
if ((fd=open (efl->slot[i].name, O_RDONLY))<0) {
HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL,
"unable to open external raw data file");
}
- if (lseek (fd, efl->slot[i].offset+skip, SEEK_SET)<0) {
+ if (lseek (fd, (off_t)(efl->slot[i].offset+skip), SEEK_SET)<0) {
HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL,
"unable to seek in external raw data file");
}
@@ -454,7 +459,6 @@ H5O_efl_write (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
{
int i, fd=-1;
size_t to_write, cur, skip;
- ssize_t n;
herr_t ret_value = FAIL;
FUNC_ENTER (H5O_efl_write, FAIL);
@@ -466,7 +470,8 @@ H5O_efl_write (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
/* Find the first efl member in which to write */
for (i=0, cur=0; i<efl->nused; i++) {
- if (addr->offset < cur+efl->slot[i].size) {
+ if (H5O_EFL_UNLIMITED==efl->slot[i].size ||
+ addr->offset < cur+efl->slot[i].size) {
skip = addr->offset - cur;
break;
}
@@ -479,6 +484,10 @@ H5O_efl_write (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL,
"write past logical end of file");
}
+ if (H5F_OVERFLOW_SIZET2OFFT (efl->slot[i].offset+skip)) {
+ HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL,
+ "external file address overflowed");
+ }
if ((fd=open (efl->slot[i].name, O_RDWR))<0) {
if (access (efl->slot[i].name, F_OK)<0) {
HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL,
@@ -488,12 +497,12 @@ H5O_efl_write (H5F_t *f, const H5O_efl_t *efl, haddr_t *addr, size_t size,
"unable to open external raw data file");
}
}
- if (lseek (fd, efl->slot[i].offset+skip, SEEK_SET)<0) {
+ if (lseek (fd, (off_t)(efl->slot[i].offset+skip), SEEK_SET)<0) {
HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL,
"unable to seek in external raw data file");
}
to_write = MIN(efl->slot[i].size-skip, size);
- if ((n=write (fd, buf, to_write))!=to_write) {
+ if (write (fd, buf, to_write)!=to_write) {
HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL,
"write error in external raw data file");
}