summaryrefslogtreecommitdiffstats
path: root/src/H5Sselect.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-15 17:32:01 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-15 17:32:01 (GMT)
commit1f8f6f019c85df6c031a32f6bf703fa18e225973 (patch)
tree29e642ec8de803f102bb0a593c86368e786b1a4b /src/H5Sselect.c
parentd14b96e95976967c03c7623f6800506b89292656 (diff)
downloadhdf5-1f8f6f019c85df6c031a32f6bf703fa18e225973.zip
hdf5-1f8f6f019c85df6c031a32f6bf703fa18e225973.tar.gz
hdf5-1f8f6f019c85df6c031a32f6bf703fa18e225973.tar.bz2
Fixed stack and frame size warnings. Not complete, but fixes most of
the easier cases.
Diffstat (limited to 'src/H5Sselect.c')
-rw-r--r--src/H5Sselect.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 9814e38..13233ce 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -2601,9 +2601,9 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
{
H5S_t *new_space = NULL; /* New dataspace constructed */
H5S_t *tmp_src_intersect_space = NULL; /* Temporary SIS converted from points->hyperslabs */
- H5S_sel_iter_t ss_iter; /* Selection iterator for src_space */
+ H5S_sel_iter_t *ss_iter = NULL; /* Selection iterator for src_space */
hbool_t ss_iter_init = FALSE; /* Whether ss_iter has been initialized */
- H5S_sel_iter_t ds_iter; /* Selection iterator for dst_space */
+ H5S_sel_iter_t *ds_iter = NULL; /* Selection iterator for dst_space */
hbool_t ds_iter_init = FALSE; /* Whether ds_iter has been initialized */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2617,6 +2617,11 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space));
HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space));
+ if(NULL == (ss_iter = H5FL_CALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+ if(NULL == (ds_iter = H5FL_CALLOC(H5S_sel_iter_t)))
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator")
+
/* Create new space, using dst extent. Start with "all" selection. */
if(NULL == (new_space = H5S_create(H5S_SIMPLE)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace")
@@ -2717,20 +2722,20 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
/* Initialize iterators */
- if(H5S_select_iter_init(&ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ if(H5S_select_iter_init(ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize source space selection iterator")
ss_iter_init = TRUE;
- if(H5S_select_iter_init(&ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
+ if(H5S_select_iter_init(ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't initialize destination space selection iterator")
ds_iter_init = TRUE;
/* Iterate over points */
do {
- HDassert(ss_iter.elmt_left > 0);
- HDassert(ss_iter.elmt_left > 0);
+ HDassert(ss_iter->elmt_left > 0);
+ HDassert(ss_iter->elmt_left > 0);
/* Get SS coords */
- if(H5S_SELECT_ITER_COORDS(&ss_iter, coords) < 0)
+ if(H5S_SELECT_ITER_COORDS(ss_iter, coords) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source selection coordinates")
/* Check for intersection */
@@ -2740,7 +2745,7 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Add point if it intersects */
if(intersect) {
/* Get DS coords */
- if(H5S_SELECT_ITER_COORDS(&ds_iter, coords) < 0)
+ if(H5S_SELECT_ITER_COORDS(ds_iter, coords) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get destination selection coordinates")
/* Add point to new_space */
@@ -2749,14 +2754,14 @@ H5S_select_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
} /* end if */
/* Advance iterators */
- if(H5S_SELECT_ITER_NEXT(&ss_iter, 1) < 0)
+ if(H5S_SELECT_ITER_NEXT(ss_iter, 1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne source selection iterator")
- ss_iter.elmt_left--;
- if(H5S_SELECT_ITER_NEXT(&ds_iter, 1) < 0)
+ ss_iter->elmt_left--;
+ if(H5S_SELECT_ITER_NEXT(ds_iter, 1) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "can't advacne destination selection iterator")
- ds_iter.elmt_left--;
- } while(ss_iter.elmt_left > 0);
- HDassert(H5S_SELECT_ITER_NELMTS(&ds_iter) == 0);
+ ds_iter->elmt_left--;
+ } while(ss_iter->elmt_left > 0);
+ HDassert(H5S_SELECT_ITER_NELMTS(ds_iter) == 0);
} /* end if */
else {
HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE);
@@ -2783,11 +2788,14 @@ done:
/* General cleanup */
if(tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace")
- if(ss_iter_init && H5S_SELECT_ITER_RELEASE(&ss_iter) < 0)
+ if(ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator")
- if(ds_iter_init && H5S_SELECT_ITER_RELEASE(&ds_iter) < 0)
+ if(ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0)
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator")
+ ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter);
+ ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_select_project_intersection() */