summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--release_docs/RELEASE.txt4
-rw-r--r--src/H5Oattr.c10
-rw-r--r--test/tattr.c16
3 files changed, 27 insertions, 3 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 9338a31..69f8596 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -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
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index fdf24a6..8714fdb 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -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 */
diff --git a/test/tattr.c b/test/tattr.c
index 653269c..a8e604b 100644
--- a/test/tattr.c
+++ b/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");