mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
[svn-r7950] Purpose:
Bug fix Description: Attributes which were created with scalar dataspaces were reporting their dataspace as a simple dataspace when queried later. Solution: Fix the dataspace handling code when reading in the attribute message from the file to set the extent type correctly. Platforms tested: FreeBSD 4.9 (sleipnir) too minor to require h5committest
This commit is contained in:
parent
4feb66edc9
commit
8dc49da486
@ -93,9 +93,11 @@ Bug Fixes since HDF5-1.6.0 release
|
||||
|
||||
Library
|
||||
-------
|
||||
- Fixed bug where scalar dataspaces for attributes were reporting as
|
||||
simple dataspaces. QAK - 2003/12/13
|
||||
- Fixed problem with selection offsets of hyperslab selections in
|
||||
chunked datasets causing the library to go into an infinite loop.
|
||||
QAK - 2003/12/06
|
||||
QAK - 2003/12/13
|
||||
- Fixed H5Giterate to avoid re-using index parameter after iteration
|
||||
callback has been called (allows iteration callback to modify the
|
||||
index parameter itself). QAK - 2003/12/06
|
||||
|
@ -180,8 +180,16 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t UNUSED *
|
||||
hsize_t nelem; /* Number of elements in extent */
|
||||
unsigned u; /* Local index variable */
|
||||
|
||||
attr->ds->extent.type = H5S_SIMPLE;
|
||||
/* Set the dataspace type to be simple or scalar as appropriate */
|
||||
if(simple->rank>0)
|
||||
attr->ds->extent.type = H5S_SIMPLE;
|
||||
else
|
||||
attr->ds->extent.type = H5S_SCALAR;
|
||||
|
||||
/* Copy the extent information */
|
||||
HDmemcpy(&(attr->ds->extent.u.simple),simple, sizeof(H5S_simple_t));
|
||||
|
||||
/* Release temporary extent information */
|
||||
H5FL_FREE(H5S_simple_t,simple);
|
||||
|
||||
/* Compute the number of elements in the extent */
|
||||
|
16
test/tattr.c
16
test/tattr.c
@ -721,7 +721,9 @@ test_attr_scalar_read(void)
|
||||
{
|
||||
hid_t fid1; /* HDF5 File IDs */
|
||||
hid_t dataset; /* Dataset ID */
|
||||
hid_t attr; /* Attribute ID */
|
||||
hid_t sid; /* Dataspace ID */
|
||||
hid_t attr; /* Attribute ID */
|
||||
H5S_class_t stype; /* Dataspace class */
|
||||
float rdata=0.0; /* Buffer for reading 1st attribute */
|
||||
herr_t ret; /* Generic return value */
|
||||
|
||||
@ -749,6 +751,18 @@ test_attr_scalar_read(void)
|
||||
CHECK(ret, FAIL, "H5Aread");
|
||||
VERIFY(rdata, attr_data5, "H5Aread");
|
||||
|
||||
/* Get the attribute's dataspace */
|
||||
sid = H5Aget_space(attr);
|
||||
CHECK(sid, FAIL, "H5Aget_space");
|
||||
|
||||
/* Make certain the dataspace is scalar */
|
||||
stype = H5Sget_simple_extent_type (sid);
|
||||
VERIFY(stype, H5S_SCALAR, "H5Sget_simple_extent_type");
|
||||
|
||||
/* Close dataspace */
|
||||
ret = H5Sclose(sid);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
|
||||
/* Close attribute */
|
||||
ret=H5Aclose(attr);
|
||||
CHECK(ret, FAIL, "H5Aclose");
|
||||
|
Loading…
Reference in New Issue
Block a user