summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5R.c2
-rw-r--r--src/H5S.c6
-rw-r--r--src/H5Sall.c2
-rw-r--r--src/H5Shyper.c108
-rw-r--r--src/H5Snone.c2
-rw-r--r--src/H5Spoint.c2
-rw-r--r--src/H5Spublic.h3
-rw-r--r--src/H5Sselect.c1
-rw-r--r--src/Makefile.in4
10 files changed, 124 insertions, 10 deletions
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 3be5b82..5e47ad1 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -308,7 +308,7 @@ H5O_sdspace_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(mesg);
- if(!dest && NULL == (dest = H5FL_MALLOC(H5S_extent_t)))
+ if(!dest && NULL == (dest = H5FL_CALLOC(H5S_extent_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy extent information */
@@ -463,7 +463,7 @@ H5O_sdspace_pre_copy_file(H5F_t UNUSED *file_src, const void *mesg_src,
*/
if(udata) {
/* Allocate copy of dataspace extent */
- if(NULL == (udata->src_space_extent = H5FL_MALLOC(H5S_extent_t)))
+ if(NULL == (udata->src_space_extent = H5FL_CALLOC(H5S_extent_t)))
HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed")
/* Create a copy of the dataspace extent */
diff --git a/src/H5R.c b/src/H5R.c
index f44b21f..26f4b9d 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -659,7 +659,7 @@ H5R_get_region(H5F_t *file, hid_t dxpl_id, const void *_ref)
HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, NULL, "not found")
/* Unserialize the selection */
- if(H5S_select_deserialize(&ret_value, &p) < 0)
+ if(H5S_SELECT_DESERIALIZE(&ret_value, &p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, NULL, "can't deserialize selection")
done:
diff --git a/src/H5S.c b/src/H5S.c
index 106d75a..a548f13 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -542,6 +542,10 @@ H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_ma
FUNC_ENTER_NOAPI(FAIL)
+ /* Release destination extent before we copy over it */
+ if(H5S_extent_release(dst) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent")
+
/* Copy the regular fields */
dst->type = src->type;
dst->version = src->version;
@@ -616,7 +620,7 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max)
FUNC_ENTER_NOAPI(NULL)
- if(NULL == (dst = H5FL_MALLOC(H5S_t)))
+ if(NULL == (dst = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Copy the source dataspace's extent */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 6ac00d2..1105915 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -553,7 +553,7 @@ H5S_all_serialize (const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_all_deserialize(H5S_t *space, const uint8_t **p)
+H5S_all_deserialize(H5S_t *space, const uint8_t UNUSED **p)
{
herr_t ret_value = SUCCEED; /* return value */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 91f31d2..9b1562f 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -2260,7 +2260,7 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t **p)
HDassert(*p);
/* Deserialize slabs to select */
- /* The header and rank have already beed decoded */
+ /* (The header and rank have already beed decoded) */
rank = space->extent.rank; /* Retrieve rank from space */
UINT32DECODE(*p,num_elem); /* decode the number of points */
@@ -8860,3 +8860,109 @@ H5S_hyper_get_seq_list(const H5S_t *space, unsigned UNUSED flags, H5S_sel_iter_t
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_get_seq_list() */
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Sis_regular_hyperslab
+ PURPOSE
+ Determine if a hyperslab selection is regular
+ USAGE
+ htri_t H5Sis_regular_hyperslab(dsid)
+ hid_t dsid; IN: Dataspace ID of hyperslab selection to query
+ RETURNS
+ TRUE/FALSE for hyperslab selection, FAIL on error or when querying other
+ selection types.
+ DESCRIPTION
+ If a hyperslab can be represented as a single call to H5Sselect_hyperslab,
+ with the H5S_SELECT_SET option, it is regular. If the hyperslab selection
+ would require multiple calls to H5Sselect_hyperslab, it is irregular.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5Sis_regular_hyperslab(hid_t spaceid)
+{
+ H5S_t *space; /* Dataspace to query */
+ htri_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE1("t", "i", spaceid);
+
+ /* Check args */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
+
+ ret_value = H5S_hyper_is_regular(space);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Sis_regular_hyperslab() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5Sgetregular_hyperslab
+ PURPOSE
+ Retrieve a regular hyperslab selection
+ USAGE
+ herr_t H5Sget_regular_hyperslab(dsid, start, stride, block, count)
+ hid_t dsid; IN: Dataspace ID of hyperslab selection to query
+ hsize_t start[]; OUT: Offset of start of hyperslab
+ hsize_t stride[]; OUT: Hyperslab stride
+ hsize_t count[]; OUT: Number of blocks included in hyperslab
+ hsize_t block[]; OUT: Size of block in hyperslab
+ RETURNS
+ Non-negative on success/Negative on failure. (It is an error to query
+ the regular hyperslab selections for non-regular hyperslab selections)
+ DESCRIPTION
+ Retrieve the start/stride/count/block for a regular hyperslab selection.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ Note that if a hyperslab is originally regular, then becomes irregular
+ through selection operations, and then becomes regular again, the new
+ final regular selection may be equivalent but not identical to the
+ original regular selection.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[], hsize_t stride[],
+ hsize_t count[], hsize_t block[])
+{
+ H5S_t *space; /* Dataspace to query */
+ unsigned u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "i*h*h*h*h", spaceid, start, stride, count, block);
+
+ /* Check args */
+ if(NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
+ if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection")
+ if(TRUE != H5S_hyper_is_regular(space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a regular hyperslab selection")
+
+ /* Retrieve hyperslab parameters */
+ if(start)
+ for(u = 0; u < space->extent.rank; u++)
+ start[u] = space->select.sel_info.hslab->app_diminfo[u].start;
+ if(stride)
+ for(u = 0; u < space->extent.rank; u++)
+ stride[u] = space->select.sel_info.hslab->app_diminfo[u].stride;
+ if(count)
+ for(u = 0; u < space->extent.rank; u++)
+ count[u] = space->select.sel_info.hslab->app_diminfo[u].count;
+ if(block)
+ for(u = 0; u < space->extent.rank; u++)
+ block[u] = space->select.sel_info.hslab->app_diminfo[u].block;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Sget_regular_hyperslab() */
+
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 94d41a9..c5ec2de 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -519,7 +519,7 @@ H5S_none_serialize(const H5S_t *space, uint8_t **p)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_none_deserialize(H5S_t *space, const uint8_t **p)
+H5S_none_deserialize(H5S_t *space, const uint8_t UNUSED **p)
{
herr_t ret_value = SUCCEED; /* return value */
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index e6a4a39..44e0510 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -906,7 +906,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t **p)
HDassert(*p);
/* Deserialize points to select */
- /* The header and rank have already beed decoded */
+ /* (The header and rank have already beed decoded) */
rank = space->extent.rank; /* Retrieve rank from space */
UINT32DECODE(*p, num_elem); /* decode the number of points */
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 0a39ce1..37d3866 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -137,6 +137,9 @@ H5_DLL herr_t H5Sselect_all(hid_t spaceid);
H5_DLL herr_t H5Sselect_none(hid_t spaceid);
H5_DLL herr_t H5Soffset_simple(hid_t space_id, const hssize_t *offset);
H5_DLL htri_t H5Sselect_valid(hid_t spaceid);
+H5_DLL htri_t H5Sis_regular_hyperslab(hid_t spaceid);
+H5_DLL htri_t H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[],
+ hsize_t stride[], hsize_t count[], hsize_t block[]);
H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid);
H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid);
H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock,
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 34e9473..a4f13d7 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -518,6 +518,7 @@ H5S_select_deserialize (H5S_t **space, const uint8_t **p)
/* Return space to the caller if allocated */
if(!*space)
*space = tmp_space;
+
done:
/* Free temporary space if not passed to caller (only happens on error) */
if(!*space && tmp_space)
diff --git a/src/Makefile.in b/src/Makefile.in
index aa0fc7a..5396842 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -726,8 +726,8 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chkexe files are used to mark tests that have run successfully.
# .chklog files are output from those tests.
-# *.clog are from the MPE option.
-CHECK_CLEANFILES = *.chkexe *.chklog *.clog
+# *.clog and *.clog2 are from the MPE option.
+CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
# Add libtool shared library version numbers to the HDF5 library
# See libtool versioning documentation online.