diff options
author | Elena Pourmal <epourmal@hdfgroup.org> | 2002-06-04 16:17:58 (GMT) |
---|---|---|
committer | Elena Pourmal <epourmal@hdfgroup.org> | 2002-06-04 16:17:58 (GMT) |
commit | 282c92e588d606d6bf6ac618337c4e08702ef6fb (patch) | |
tree | a4d30c16168eb8bf72b6da816fec9fff1e9f1300 | |
parent | c4d217ae934fbeef083cf80d593a2327109950c3 (diff) | |
download | hdf5-282c92e588d606d6bf6ac618337c4e08702ef6fb.zip hdf5-282c92e588d606d6bf6ac618337c4e08702ef6fb.tar.gz hdf5-282c92e588d606d6bf6ac618337c4e08702ef6fb.tar.bz2 |
[svn-r5522]
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 H5S_SCALAR.
Solution:
Applied a fix
Platforms tested:
Solaris 2.7 and Linux 2.2.18
-rw-r--r-- | release_docs/RELEASE.txt | 4 | ||||
-rw-r--r-- | src/H5S.c | 19 |
2 files changed, 17 insertions, 6 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 9dc0198..7a8a71b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -91,6 +91,10 @@ New Features Bug Fixes since HDF5-1.4.3 Release ================================== + * Fixed bug (#699, fix provided by a user) where 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. EIP - 2002/06/04 * Clear symbol table node "dirty" flag when flushing symbol tables to disk, to reduce I/O calls made & improve performance. QAK - 2002/06/03 * Fixed bug where an object's header could get corrupted in certain @@ -1160,10 +1160,15 @@ H5S_read(H5G_entry_t *ent) "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 */ @@ -1273,7 +1278,9 @@ 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); } @@ -1512,7 +1519,7 @@ H5S_find (const H5S_t *mem_space, const H5S_t *file_space) 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 |