diff options
author | James Laird <jlaird@hdfgroup.org> | 2004-07-27 16:55:19 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2004-07-27 16:55:19 (GMT) |
commit | 5a19f181b35a0928d23c7c12fd7a0698b465855b (patch) | |
tree | 3516b75287980167182a4185e167a0ddff9bbf91 /test/tvltypes.c | |
parent | 7a07c6cc133e62f5f00e6a4baf214c9011657800 (diff) | |
download | hdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.zip hdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.tar.gz hdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.tar.bz2 |
[svn-r8953]
Purpose:
Bug fix
Description:
When a simple dataspace is created, its extent should be set before using it,
or it will silently function as a NULL dataspace.
Solution:
Added checks on user-supplied dataspaces. Now dataspaces without extents set
will throw errors; users must explicitly set a dataspace to be NULL.
Platforms tested:
sleipnir, windows
Diffstat (limited to 'test/tvltypes.c')
-rw-r--r-- | test/tvltypes.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/tvltypes.c b/test/tvltypes.c index bf22e24..af56eef 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -178,6 +178,7 @@ test_vltypes_vlen_atomic(void) hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1; /* Dataspace ID */ + hid_t sid2; /* ID of bad dataspace (no extent set) */ hid_t tid1; /* Datatype ID */ hid_t dcpl_pid; /* Dataset creation property list ID */ hid_t xfer_pid; /* Dataset transfer property list ID */ @@ -395,6 +396,10 @@ test_vltypes_vlen_atomic(void) tid1 = H5Dget_type(dataset); CHECK(tid1, FAIL, "H5Dget_type"); + /* Create a "bad" dataspace with no extent set */ + sid2 = H5Screate(H5S_SIMPLE); + CHECK(sid2, FAIL, "H5Screate"); + /* Change to the custom memory allocation routines for reading VL data */ xfer_pid=H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); @@ -406,6 +411,12 @@ test_vltypes_vlen_atomic(void) ret=H5Dvlen_get_buf_size(dataset,tid1,sid1,&size); CHECK(ret, FAIL, "H5Dvlen_get_buf_size"); + /* Try to call H5Dvlen_get_buf with bad dataspace */ + H5E_BEGIN_TRY { + ret=H5Dvlen_get_buf_size(dataset,tid1,sid2,&size); + } H5E_END_TRY + VERIFY(ret, FAIL, "H5Dvlen_get_buf_size"); + /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */ VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size"); @@ -431,6 +442,13 @@ test_vltypes_vlen_atomic(void) } /* end for */ } /* end for */ + /* Try to reclaim read data using "bad" dataspace with no extent + * Should fail */ + H5E_BEGIN_TRY { + ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata); + } H5E_END_TRY + VERIFY(ret, FAIL, "H5Dvlen_reclaim"); + /* Reclaim the read VL data */ ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata); CHECK(ret, FAIL, "H5Dvlen_reclaim"); |