summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2004-07-27 16:55:19 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2004-07-27 16:55:19 (GMT)
commit5a19f181b35a0928d23c7c12fd7a0698b465855b (patch)
tree3516b75287980167182a4185e167a0ddff9bbf91 /src/H5S.c
parent7a07c6cc133e62f5f00e6a4baf214c9011657800 (diff)
downloadhdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.zip
hdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.tar.gz
hdf5-5a19f181b35a0928d23c7c12fd7a0698b465855b.tar.bz2
[svn-r8953]
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 86ac23a..1993966 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -2167,6 +2167,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 && ds->extent.type != H5S_NULL)
+ ret_value = FALSE;
+ else
+ ret_value = TRUE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
/*-------------------------------------------------------------------------
* Function: H5S_set_extent_real