summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-07-27 16:56:19 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-07-27 16:56:19 (GMT)
commit52563e6fa8c56bc68051c50e9e847293da30a008 (patch)
treed6c2acb4013c54be48da0449c5ae3695cf6e421c /src/H5S.c
parent6dae05b645086f67a45d4a3d3ab91f303a3362c0 (diff)
downloadhdf5-52563e6fa8c56bc68051c50e9e847293da30a008.zip
hdf5-52563e6fa8c56bc68051c50e9e847293da30a008.tar.gz
hdf5-52563e6fa8c56bc68051c50e9e847293da30a008.tar.bz2
[svn-r8954]
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 'src/H5S.c')
-rw-r--r--src/H5S.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 4c5227c..5c42787 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1912,6 +1912,38 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
}
+/*-------------------------------------------------------------------------
+ * Function: H5S_has_extent
+ *
+ * Purpose: Determines if a simple dataspace's extent has been set (e.g.,
+ * by H5Sset_extent_simple() ). Helps avoid write errors.
+ *
+ * Return: TRUE if dataspace has extent set
+ * FALSE if dataspace's extent is uninitialized
+ *
+ * Programmer: James Laird
+ *
+ * Date: July 23, 2004
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5S_has_extent(const H5S_t *ds)
+{
+ htri_t ret_value;
+ FUNC_ENTER_NOAPI(H5S_has_extent, FAIL)
+
+ assert(ds);
+
+ if(ds->extent.rank==0 && ds->extent.nelem == 0)
+ ret_value = FALSE;
+ else
+ ret_value = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
/*-------------------------------------------------------------------------
* Function: H5S_set_extent_real