summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorElena Pourmal <epourmal@hdfgroup.org>2002-06-04 16:22:19 (GMT)
committerElena Pourmal <epourmal@hdfgroup.org>2002-06-04 16:22:19 (GMT)
commita7f08bc1bb584afff9e208bc038cdc441daeaf26 (patch)
tree7af01c8b2b1e1779881dde5552b806414006dbfa /src
parentba26e8f2ad29dbefd3078b2f97b7a731ba39db1e (diff)
downloadhdf5-a7f08bc1bb584afff9e208bc038cdc441daeaf26.zip
hdf5-a7f08bc1bb584afff9e208bc038cdc441daeaf26.tar.gz
hdf5-a7f08bc1bb584afff9e208bc038cdc441daeaf26.tar.bz2
[svn-r5524]
Purpose: Bug fix (#699), fix provided by a user, approved by Quincey Description: When a scalar dataspace was written to the file and then subsequently queried with the H5Sget_simple_extent_type function, type was reported H5S_SIMPLE instead of H5S_SCALAR. Solution: Applied a fix (see bug report 699) Platforms tested: Solaris 2.7 and Linux 2.2.18
Diffstat (limited to 'src')
-rw-r--r--src/H5S.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 5b5ce2e..3db039c 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1153,11 +1153,16 @@ H5S_read(H5G_entry_t *ent)
HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
-
- if (H5O_read(ent, H5O_SDSPACE, 0, &(ds->extent.u.simple))) {
- ds->extent.type = H5S_SIMPLE;
- } else {
- ds->extent.type = H5S_SCALAR;
+
+ if (H5O_read(ent, H5O_SDSPACE, 0, &(ds->extent.u.simple)) == NULL) {
+ HRETURN_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL,
+ "unable to load dataspace info from dataset header");
+ }
+
+ if(ds->extent.u.simple.rank != 0) {
+ ds->extent.type = H5S_SIMPLE;
+ } else {
+ ds->extent.type = H5S_SCALAR;
}
/* Default to entire dataspace being selected */
@@ -1267,7 +1272,8 @@ H5S_is_simple(const H5S_t *sdim)
/* Check args and all the boring stuff. */
assert(sdim);
- ret_value = sdim->extent.type == H5S_SIMPLE ? TRUE : FALSE;
+ ret_value = (sdim->extent.type == H5S_SIMPLE ||
+ sdim->extent.type == H5S_SCALAR) ? TRUE : FALSE;
FUNC_LEAVE(ret_value);
}
@@ -1506,7 +1512,7 @@ H5S_find (const H5S_t *mem_space, const H5S_t *file_space, unsigned flags)
assert (mem_space && (H5S_SIMPLE==mem_space->extent.type ||
H5S_SCALAR==mem_space->extent.type));
assert (file_space && (H5S_SIMPLE==file_space->extent.type ||
- H5S_SCALAR==mem_space->extent.type));
+ H5S_SCALAR==file_space->extent.type));
/*
* We can't do conversion if the source and destination select a