summaryrefslogtreecommitdiffstats
path: root/src/H5Shyper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r--src/H5Shyper.c422
1 files changed, 252 insertions, 170 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 5a01f6a..fac113c 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -41,7 +41,7 @@ static H5S_hyper_span_info_t *H5S_hyper_copy_span (H5S_hyper_span_info_t *spans)
static herr_t H5S_hyper_span_scratch (H5S_hyper_span_info_t *spans, void *scr_value);
static herr_t H5S_hyper_span_precompute (H5S_hyper_span_info_t *spans, size_t elmt_size);
static herr_t H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]);
+ const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]);
static herr_t H5S_hyper_generate_spans(H5S_t *space);
/* Needed for use in hyperslab code (H5Shyper.c) */
#ifdef NEW_HYPERSLAB_API
@@ -58,15 +58,15 @@ static htri_t H5S_hyper_is_valid(const H5S_t *space);
static hssize_t H5S_hyper_serial_size(const H5S_t *space);
static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t *buf);
static herr_t H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf);
-static herr_t H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end);
+static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end);
static htri_t H5S_hyper_is_contiguous(const H5S_t *space);
static htri_t H5S_hyper_is_single(const H5S_t *space);
static htri_t H5S_hyper_is_regular(const H5S_t *space);
static herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Selection iteration callbacks */
-static herr_t H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords);
-static herr_t H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end);
+static herr_t H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords);
+static herr_t H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end);
static hsize_t H5S_hyper_iter_nelmts(const H5S_sel_iter_t *iter);
static htri_t H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *sel_iter);
static herr_t H5S_hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem);
@@ -415,7 +415,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
+H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_coords);
@@ -435,17 +435,16 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
flat_dim=iter->u.hyp.iter_rank-1;
/* Copy the coordinates up to where things got flattened */
- HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*flat_dim);
+ HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*flat_dim);
/* Compute the coordinates for the flattened dimensions */
- H5_CHECK_OVERFLOW(iter->u.hyp.off[flat_dim],hssize_t,hsize_t);
- H5V_array_calc((hsize_t)iter->u.hyp.off[flat_dim],iter->rank-flat_dim,&(iter->dims[flat_dim]),&(coords[flat_dim]));
+ H5V_array_calc(iter->u.hyp.off[flat_dim],iter->rank-flat_dim,&(iter->dims[flat_dim]),&(coords[flat_dim]));
} /* end if */
else
- HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*iter->rank);
+ HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*iter->rank);
} /* end if */
else
- HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*iter->rank);
+ HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*iter->rank);
FUNC_LEAVE_NOAPI(SUCCEED);
} /* H5S_hyper_iter_coords() */
@@ -470,7 +469,7 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords)
*-------------------------------------------------------------------------
*/
static herr_t
-H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end)
+H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end)
{
unsigned u; /* Local index variable */
@@ -562,7 +561,7 @@ H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
/* Check for a single "regular" hyperslab */
if(iter->u.hyp.diminfo_valid) {
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- const hssize_t *toff; /* Temporary offset in selection */
+ const hsize_t *toff; /* Temporary offset in selection */
/* Check if the offset of the iterator is at the last location in all dimensions */
tdiminfo=iter->u.hyp.diminfo;
@@ -571,8 +570,7 @@ H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *iter)
/* If there is only one block, continue */
if(tdiminfo[u].count==1)
continue;
- H5_CHECK_OVERFLOW(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride),hsize_t,hssize_t);
- if(toff[u]!=(hssize_t)(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride)))
+ if(toff[u]!=(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride)))
HGOTO_DONE(TRUE);
} /* end for */
} /* end if */
@@ -705,7 +703,7 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem)
else {
H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hssize_t *abs_arr; /* Absolute hyperslab span position */
+ hsize_t *abs_arr; /* Absolute hyperslab span position */
int curr_dim; /* Temporary rank holder */
/* Set the rank of the fastest changing dimension */
@@ -905,7 +903,7 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter)
else {
H5S_hyper_span_t *curr_span; /* Current hyperslab span node */
H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */
- hssize_t *abs_arr; /* Absolute hyperslab span position */
+ hsize_t *abs_arr; /* Absolute hyperslab span position */
int curr_dim; /* Temporary rank holder */
/* Set the rank of the fastest changing dimension */
@@ -1031,7 +1029,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter)
Make a new hyperslab span node
USAGE
H5S_hyper_span_t *H5S_hyper_new_span(low, high, down, next)
- hssize_t low, high; IN: Low and high bounds for new span node
+ hsize_t low, high; IN: Low and high bounds for new span node
H5S_hyper_span_info_t *down; IN: Down span tree for new node
H5S_hyper_span_t *next; IN: Next span for new node
RETURNS
@@ -1046,7 +1044,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter)
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_t *
-H5S_hyper_new_span (hssize_t low, hssize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+H5S_hyper_new_span (hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
{
H5S_hyper_span_t *ret_value;
@@ -1665,10 +1663,10 @@ H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *o
while(curr!=NULL && ret_value==TRUE) {
/* Check if an offset has been defined */
/* Bounds check the selected point + offset against the extent */
- if(((curr->low+offset[rank])>=(hssize_t)size[rank])
- || ((curr->low+offset[rank])<0)
- || ((curr->high+offset[rank])>=(hssize_t)size[rank])
- || ((curr->high+offset[rank])<0)) {
+ if((((hssize_t)curr->low+offset[rank])>=(hssize_t)size[rank])
+ || (((hssize_t)curr->low+offset[rank])<0)
+ || (((hssize_t)curr->high+offset[rank])>=(hssize_t)size[rank])
+ || (((hssize_t)curr->high+offset[rank])<0)) {
ret_value=FALSE;
break;
} /* end if */
@@ -1730,12 +1728,12 @@ H5S_hyper_is_valid (const H5S_t *space)
/* no data point is chosen */
if (diminfo[u].count && diminfo[u].block) {
/* Bounds check the start point in this dimension */
- if((diminfo[u].start+space->select.offset[u])<0 ||
- (diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u])
+ if(((hssize_t)diminfo[u].start+space->select.offset[u])<0 ||
+ ((hssize_t)diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u])
HGOTO_DONE(FALSE)
/* Compute the largest location in this dimension */
- end=diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1)+space->select.offset[u];
+ end=(hssize_t)(diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1))+space->select.offset[u];
/* Bounds check the end point in this dimension */
if(end<0 || end>=(hssize_t)space->extent.size[u])
@@ -1956,7 +1954,7 @@ H5S_hyper_serial_size (const H5S_t *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hssize_t *start, hssize_t *end, hsize_t rank, uint8_t **buf)
+H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **buf)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
hsize_t u; /* Index variable */
@@ -2035,10 +2033,10 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf)
{
const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
- hssize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hssize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
- hssize_t temp_off; /* Offset in a given dimension */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t temp_off; /* Offset in a given dimension */
uint8_t *lenp; /* pointer to length location for later storage */
uint32_t len=0; /* number of bytes used */
int i; /* local counting variable */
@@ -2194,13 +2192,13 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf)
{
uint32_t rank; /* rank of points */
size_t num_elem=0; /* number of elements in selection */
- hssize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */
- hssize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */
hsize_t stride[H5O_LAYOUT_NDIMS]; /* hyperslab stride information */
hsize_t count[H5O_LAYOUT_NDIMS]; /* hyperslab count information */
hsize_t block[H5O_LAYOUT_NDIMS]; /* hyperslab block information */
- hssize_t *tstart=NULL; /* temporary hyperslab pointers */
- hssize_t *tend=NULL; /* temporary hyperslab pointers */
+ hsize_t *tstart=NULL; /* temporary hyperslab pointers */
+ hsize_t *tend=NULL; /* temporary hyperslab pointers */
hsize_t *tstride=NULL; /* temporary hyperslab pointers */
hsize_t *tcount=NULL; /* temporary hyperslab pointers */
hsize_t *tblock=NULL; /* temporary hyperslab pointers */
@@ -2258,8 +2256,8 @@ done:
USAGE
herr_t H5S_hyper_span_blocklist(spans, start, end, rank, startblock, numblocks, buf)
H5S_hyper_span_info_t *spans; IN: Dataspace pointer of selection to query
- hssize_t start[]; IN/OUT: Accumulated start points
- hssize_t end[]; IN/OUT: Accumulated end points
+ hsize_t start[]; IN/OUT: Accumulated start points
+ hsize_t end[]; IN/OUT: Accumulated end points
hsize_t rank; IN: Rank of dataspace
hsize_t *startblock; IN/OUT: Hyperslab block to start with
hsize_t *numblocks; IN/OUT: Number of hyperslab blocks to get
@@ -2284,7 +2282,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hssize_t start[], hssize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf)
+H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hsize_t start[], hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf)
{
H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */
hsize_t u; /* Index variable */
@@ -2389,10 +2387,10 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startbloc
{
H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
- hssize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
- hssize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
- hssize_t temp_off; /* Offset in a given dimension */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */
+ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */
+ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */
+ hsize_t temp_off; /* Offset in a given dimension */
int i; /* Counter */
int fast_dim; /* Rank of the fastest changing dimension for the dataspace */
int temp_dim; /* Temporary rank holder */
@@ -2592,12 +2590,12 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hssize_t *start, hssize_t *end)
+H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hsize_t *start, hsize_t *end)
{
H5S_hyper_span_t *curr; /* Hyperslab information nodes */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_bounds_helper);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_bounds_helper)
assert(spans);
assert(offset);
@@ -2608,6 +2606,10 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off
/* Check each point to determine whether selection+offset is within extent */
curr=spans->head;
while(curr!=NULL) {
+ /* Check for offset moving selection negative */
+ if(((hssize_t)curr->low+offset[rank])<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
/* Check if the current span extends the bounding box */
if((curr->low+offset[rank])<start[rank])
start[rank]=curr->low+offset[rank];
@@ -2617,7 +2619,7 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off
/* Recurse if this node has down spans */
if(curr->down!=NULL) {
if(H5S_hyper_bounds_helper(curr->down,offset,rank+1,start,end)<0)
- HGOTO_DONE(FAIL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "failure in lower dimension")
} /* end if */
/* Advance to next node */
@@ -2625,7 +2627,7 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off
} /* end while */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_hyper_bounds_helper() */
@@ -2656,13 +2658,13 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
+H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end)
{
int rank; /* Dataspace rank */
int i; /* index variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_bounds);
+ FUNC_ENTER_NOAPI(H5S_hyper_bounds,FAIL)
assert(space);
assert(start);
@@ -2671,8 +2673,8 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
/* Set the start and end arrays up */
rank=space->extent.rank;
for(i=0; i<rank; i++) {
- start[i]=HSSIZET_MAX;
- end[i]=HSSIZET_MIN;
+ start[i]=HSIZET_MAX;
+ end[i]=0;
} /* end for */
/* Check for a "regular" hyperslab selection */
@@ -2681,6 +2683,10 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
/* Check each dimension */
for(i=0; i<rank; i++) {
+ /* Check for offset moving selection negative */
+ if((space->select.offset[i]+(hssize_t)diminfo[i].start)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds")
+
/* Compute the smallest location in this dimension */
start[i]=diminfo[i].start+space->select.offset[i];
@@ -2693,7 +2699,8 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end)
ret_value=H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst,space->select.offset,(hsize_t)0,start,end);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5S_hyper_bounds() */
@@ -2819,7 +2826,7 @@ H5S_hyper_is_contiguous(const H5S_t *space)
} /* end if */
else {
/* If this span doesn't cover the entire dimension, then this selection isn't contiguous */
- if(((span->high-span->low)+1)!=(hssize_t)space->extent.size[u]) {
+ if(((span->high-span->low)+1)!=space->extent.size[u]) {
large_contiguous=FALSE;
break;
} /* end if */
@@ -3088,7 +3095,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp
USAGE
H5S_hyper_span_t *H5S_hyper_coord_to_span(rank, coords)
unsigned rank; IN: Number of dimensions of coordinate
- hssize_t *coords; IN: Location of element
+ hsize_t *coords; IN: Location of element
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -3099,7 +3106,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_t *
-H5S_hyper_coord_to_span(unsigned rank, hssize_t *coords)
+H5S_hyper_coord_to_span(unsigned rank, hsize_t *coords)
{
H5S_hyper_span_t *new_span; /* Pointer to new span tree for coordinate */
H5S_hyper_span_info_t *down=NULL; /* Pointer to new span tree for next level down */
@@ -3153,7 +3160,7 @@ done:
herr_t H5S_hyper_add_span_element_helper(prev_span, span_tree, rank, coords)
H5S_hyper_span_info_t *span_tree; IN/OUT: Pointer to span tree to append to
unsigned rank; IN: Number of dimensions of coordinates
- hssize_t *coords; IN: Location of element to add to span tree
+ hsize_t *coords; IN: Location of element to add to span tree
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -3165,7 +3172,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned rank, hssize_t *coords)
+H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned rank, hsize_t *coords)
{
H5S_hyper_span_info_t *tspan_info; /* Temporary pointer to span info */
H5S_hyper_span_info_t *prev_span_info; /* Pointer to span info for level above current position */
@@ -3355,7 +3362,7 @@ done:
herr_t H5S_hyper_add_span_element(space, span_tree, rank, coords)
H5S_t *space; IN/OUT: Pointer to dataspace to add coordinate to
unsigned rank; IN: Number of dimensions of coordinates
- hssize_t *coords; IN: Location of element to add to span tree
+ hsize_t *coords; IN: Location of element to add to span tree
RETURNS
Non-negative on success, negative on failure
DESCRIPTION
@@ -3367,7 +3374,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hssize_t *coords)
+H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords)
{
herr_t ret_value=SUCCEED; /* Return value */
@@ -3496,7 +3503,7 @@ H5S_hyper_convert(H5S_t *space)
case H5S_SEL_ALL: /* All elements selected in dataspace */
/* Convert current "all" selection to "real" hyperslab selection */
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -3658,9 +3665,9 @@ done:
htri_t H5S_hyper_intersect_block_helper(spans, start, end)
H5S_hyper_span_info_t *spans; IN: First span tree to operate with
hssize_t *offset; IN: Selection offset coordinate
- hssize_t *start; IN: Starting coordinate for block
- hssize_t *end; IN: Ending coordinate for block
- RETURNS
+ hsize_t *start; IN: Starting coordinate for block
+ hsize_t *end; IN: Ending coordinate for block
+ RETURN
Non-negative on success, negative on failure
DESCRIPTION
Quickly detect intersections between span tree and block
@@ -3670,7 +3677,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static htri_t
-H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *offset, hssize_t *start, hssize_t *end)
+H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *offset, hsize_t *start, hsize_t *end)
{
H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */
htri_t status; /* Status from recursive call */
@@ -3690,11 +3697,11 @@ H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *
/* Iterate over the spans in the tree */
while(curr!=NULL) {
/* Check for span entirely before block */
- if((curr->high+*offset)<*start)
+ if(((hssize_t)curr->high+*offset)<(hssize_t)*start)
/* Advance to next span in this dimension */
curr=curr->next;
/* If this span is past the end of the block, then we're done in this dimension */
- else if((curr->low+*offset)>*end)
+ else if(((hssize_t)curr->low+*offset)>(hssize_t)*end)
HGOTO_DONE(FALSE)
/* block & span overlap */
else {
@@ -3740,7 +3747,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
htri_t
-H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end)
+H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end)
{
htri_t ret_value=FAIL; /* Return value */
@@ -3756,7 +3763,7 @@ H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end)
if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL)
HGOTO_DONE(TRUE);
- /* Check that the space selections both have span trees */
+ /* Check that the space selection has a span tree */
if(space->select.sel_info.hslab->span_lst==NULL)
if(H5S_hyper_generate_spans(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree");
@@ -3772,11 +3779,120 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust_helper
+ H5S_hyper_adjust_helper_u
PURPOSE
Helper routine to adjust offsets in span trees
USAGE
- herr_t H5S_hyper_adjust_helper(spans, offset)
+ herr_t H5S_hyper_adjust_helper_u(spans, offset)
+ H5S_hyper_span_info_t *spans; IN: Span tree to operate with
+ const hsize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Adjust the location of the spans in a span tree by subtracting an offset
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+static herr_t
+H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset)
+{
+ H5S_hyper_span_t *span; /* Pointer to current span in span tree */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_u);
+
+ /* Sanity check */
+ assert(spans);
+ assert(offset);
+
+ /* Check if we've already set this down span tree */
+ if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) {
+ /* Set the tree's scratch pointer */
+ spans->scratch=(H5S_hyper_span_info_t *)~((size_t)NULL);
+
+ /* Get the span lists for each span in this tree */
+ span=spans->head;
+
+ /* Iterate over the spans in tree */
+ while(span!=NULL) {
+ /* Adjust span offset */
+ assert(span->low>=*offset);
+ span->low-=*offset;
+ span->high-=*offset;
+
+ /* Recursively adjust spans in next dimension down */
+ if(span->down!=NULL)
+ H5S_hyper_adjust_helper_u(span->down,offset+1);
+
+ /* Advance to next span in this dimension */
+ span=span->next;
+ } /* end while */
+ } /* end if */
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5S_hyper_adjust_helper_u() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_adjust_u
+ PURPOSE
+ Adjust a hyperslab selection by subtracting an offset
+ USAGE
+ herr_t H5S_hyper_adjust_u(space,offset)
+ H5S_t *space; IN/OUT: Pointer to dataspace to adjust
+ const hsize_t *offset; IN: Offset to subtract
+ RETURNS
+ Non-negative on success, negative on failure
+ DESCRIPTION
+ Moves a hyperslab selection by subtracting an offset from it.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset)
+{
+ unsigned u; /* Local index variable */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_u);
+
+ assert(space);
+ assert(offset);
+
+ /* Subtract the offset from the "regular" coordinates, if they exist */
+ if(space->select.sel_info.hslab->diminfo_valid) {
+ for(u=0; u<space->extent.rank; u++) {
+ assert(space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
+ space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
+ } /* end for */
+ } /* end if */
+
+ /* Subtract the offset from the span tree coordinates, if they exist */
+ if(space->select.sel_info.hslab->span_lst) {
+ if(H5S_hyper_adjust_helper_u(space->select.sel_info.hslab->span_lst,offset)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment");
+
+ /* Reset the scratch pointers for the next routine which needs them */
+ if(H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst,NULL)==FAIL)
+ HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't reset hyperslab scratch pointer");
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5S_hyper_adjust_u() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_hyper_adjust_helper_s
+ PURPOSE
+ Helper routine to adjust offsets in span trees
+ USAGE
+ herr_t H5S_hyper_adjust_helper_s(spans, offset)
H5S_hyper_span_info_t *spans; IN: Span tree to operate with
const hssize_t *offset; IN: Offset to subtract
RETURNS
@@ -3789,11 +3905,11 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
+H5S_hyper_adjust_helper_s (H5S_hyper_span_info_t *spans, const hssize_t *offset)
{
H5S_hyper_span_t *span; /* Pointer to current span in span tree */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_s);
/* Sanity check */
assert(spans);
@@ -3810,14 +3926,13 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
/* Iterate over the spans in tree */
while(span!=NULL) {
/* Adjust span offset */
+ assert((hssize_t)span->low>=*offset);
span->low-=*offset;
- assert(span->low>=0);
span->high-=*offset;
- assert(span->high>=0);
/* Recursively adjust spans in next dimension down */
if(span->down!=NULL)
- H5S_hyper_adjust_helper(span->down,offset+1);
+ H5S_hyper_adjust_helper_s(span->down,offset+1);
/* Advance to next span in this dimension */
span=span->next;
@@ -3825,16 +3940,16 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
} /* end if */
FUNC_LEAVE_NOAPI(SUCCEED);
-} /* H5S_hyper_adjust_helper() */
+} /* H5S_hyper_adjust_helper_s() */
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_adjust
+ H5S_hyper_adjust_s
PURPOSE
Adjust a hyperslab selection by subtracting an offset
USAGE
- herr_t H5S_hyper_adjust(space,offset)
+ herr_t H5S_hyper_adjust_s(space,offset)
H5S_t *space; IN/OUT: Pointer to dataspace to adjust
const hssize_t *offset; IN: Offset to subtract
RETURNS
@@ -3847,12 +3962,12 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5S_hyper_adjust(H5S_t *space, const hssize_t *offset)
+H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset)
{
unsigned u; /* Local index variable */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust);
+ FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_s);
assert(space);
assert(offset);
@@ -3860,14 +3975,14 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset)
/* Subtract the offset from the "regular" coordinates, if they exist */
if(space->select.sel_info.hslab->diminfo_valid) {
for(u=0; u<space->extent.rank; u++) {
+ assert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]);
space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u];
- assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0);
} /* end for */
} /* end if */
/* Subtract the offset from the span tree coordinates, if they exist */
if(space->select.sel_info.hslab->span_lst) {
- if(H5S_hyper_adjust_helper(space->select.sel_info.hslab->span_lst,offset)<0)
+ if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst,offset)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment");
/* Reset the scratch pointers for the next routine which needs them */
@@ -3877,7 +3992,7 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_hyper_adjust() */
+} /* H5S_hyper_adjust_s() */
/*--------------------------------------------------------------------------
@@ -3921,10 +4036,9 @@ H5S_hyper_move_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset)
/* Iterate over the spans in tree */
while(span!=NULL) {
/* Adjust span location */
+ assert(*offset>=0);
span->high=*offset+(span->high-span->low);
- assert(span->high>=0);
span->low=*offset;
- assert(span->low>=0);
/* Recursively move spans in next dimension down */
if(span->down!=NULL)
@@ -3971,8 +4085,8 @@ H5S_hyper_move(H5S_t *space, const hssize_t *offset)
/* Move to the offset with the "regular" coordinates, if they exist */
if(space->select.sel_info.hslab->diminfo_valid) {
for(u=0; u<space->extent.rank; u++) {
+ assert(offset[u]>=0);
space->select.sel_info.hslab->opt_diminfo[u].start=offset[u];
- assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0);
} /* end for */
} /* end if */
@@ -4028,7 +4142,7 @@ H5S_hyper_normalize_offset(H5S_t *space)
space->select.offset[u] =- space->select.offset[u];
/* Call the existing 'adjust' routine */
- if(H5S_hyper_adjust(space, space->select.offset)<0)
+ if(H5S_hyper_adjust_s(space, space->select.offset)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab normalization");
/* Zero out the selection offset */
@@ -4050,7 +4164,7 @@ done:
herr_t H5S_hyper_append_span(prev_span, span_tree, low, high, down, next)
H5S_hyper_span_t **prev_span; IN/OUT: Pointer to previous span in list
H5S_hyper_span_info_t **span_tree; IN/OUT: Pointer to span tree to append to
- hssize_t low, high; IN: Low and high bounds for new span node
+ hsize_t low, high; IN: Low and high bounds for new span node
H5S_hyper_span_info_t *down; IN: Down span tree for new node
H5S_hyper_span_t *next; IN: Next span for new node
RETURNS
@@ -4064,7 +4178,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hssize_t low, hssize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
+H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next)
{
H5S_hyper_span_t *new_span;
herr_t ret_value=SUCCEED; /* Return value */
@@ -5022,7 +5136,7 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
PURPOSE
Count the number of elements in a span tree
USAGE
- hssize_t H5S_hyper_spans_nelem(spans)
+ hsize_t H5S_hyper_spans_nelem(spans)
const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of
RETURNS
Number of elements in span tree on success; negative on failure
@@ -5033,11 +5147,11 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-static hssize_t
+static hsize_t
H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
{
H5S_hyper_span_t *span; /* Hyperslab span */
- hssize_t ret_value;
+ hsize_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_spans_nelem);
@@ -5072,7 +5186,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
USAGE
H5S_hyper_span_t *H5S_hyper_make_spans(rank, start, stride, count, block)
unsigned rank; IN: # of dimensions of the space
- const hssize_t *start; IN: Starting location of the hyperslabs
+ const hsize_t *start; IN: Starting location of the hyperslabs
const hsize_t *stride; IN: Stride from the beginning of one block to
the next
const hsize_t *count; IN: Number of blocks
@@ -5090,7 +5204,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans)
REVISION LOG
--------------------------------------------------------------------------*/
static H5S_hyper_span_info_t *
-H5S_hyper_make_spans (unsigned rank, const hssize_t *start, const hsize_t *stride,
+H5S_hyper_make_spans (unsigned rank, const hsize_t *start, const hsize_t *stride,
const hsize_t *count, const hsize_t *block)
{
H5S_hyper_span_info_t *down;/* Pointer to spans in next dimension down */
@@ -5320,7 +5434,7 @@ H5S_hyper_rebuild (H5S_t *space)
static herr_t
H5S_hyper_generate_spans(H5S_t *space)
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -5366,7 +5480,7 @@ done:
*/
static herr_t
H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t stride[],
const hsize_t count[],
const hsize_t block[])
@@ -5375,7 +5489,6 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- hssize_t nelem; /* Number of elements in hyperslab span tree */
htri_t status; /* Status from internal calls */
herr_t ret_value=SUCCEED; /* Return value */
@@ -5400,9 +5513,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Set the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(new_spans))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(new_spans);
/* Indicate that the new_spans are owned */
new_spans=NULL;
@@ -5420,9 +5531,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem+=nelem;
+ space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5441,9 +5550,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_and_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
/* Indicate that the a_and_b spans are owned */
a_and_b=NULL;
@@ -5465,18 +5572,14 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
} /* end if */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(space,b_not_a,FALSE)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem+=nelem;
+ space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5495,9 +5598,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
/* Indicate that the a_not_b are owned */
a_not_b=NULL;
@@ -5519,9 +5620,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- space->select.num_elem=nelem;
+ space->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
/* Indicate that the b_not_a are owned */
b_not_a=NULL;
@@ -5602,7 +5701,7 @@ done:
*/
herr_t
H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t *stride,
const hsize_t count[],
const hsize_t *block)
@@ -5701,7 +5800,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Convert current "all" selection to "real" hyperslab selection */
/* Then allow operation to proceed */
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -5810,10 +5909,10 @@ done:
herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block)
hid_t dsid; IN: Dataspace ID of selection to modify
H5S_seloper_t op; IN: Operation to perform on current selection
- const hssize_t *start; IN: Offset of start of hyperslab
- const hssize_t *stride; IN: Hyperslab stride
- const hssize_t *count; IN: Number of blocks included in hyperslab
- const hssize_t *block; IN: Size of block in hyperslab
+ const hsize_t *start; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t *count; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -5828,7 +5927,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
+H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
@@ -5836,7 +5935,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Sselect_hyperslab, FAIL);
- H5TRACE6("e","iSs*Hs*h*h*h",space_id,op,start,stride,count,block);
+ H5TRACE6("e","iSs*h*h*h*h",space_id,op,start,stride,count,block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -5887,7 +5986,6 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */
H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */
H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */
- hssize_t nelem; /* Number of elements in hyperslab span tree */
htri_t status; /* Status from internal calls */
herr_t ret_value=SUCCEED; /* Return value */
@@ -5905,9 +6003,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(spans2))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(spans2);
/* Indicate that we took ownership of span2, if allowed */
if(can_own_span2)
@@ -5929,9 +6025,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(spans1))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(spans1);
} /* end if */
/* Add any new spans from spans2 to current selection */
@@ -5940,9 +6034,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem+=nelem;
+ result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5953,9 +6045,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_and_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(a_and_b);
/* Indicate that the result owns the a_and_b spans */
a_and_b=NULL;
@@ -5969,18 +6059,14 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
} /* end if */
if(b_not_a!=NULL) {
if(H5S_hyper_merge_spans(result,b_not_a,FALSE)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem+=nelem;
+ result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a);
} /* end if */
break;
@@ -5991,9 +6077,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(a_not_b))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(a_not_b);
/* Indicate that the result owns the a_not_b spans */
a_not_b=NULL;
@@ -6007,9 +6091,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs");
/* Update the number of elements in current selection */
- if((nelem=H5S_hyper_spans_nelem(b_not_a))<0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements");
- result->select.num_elem=nelem;
+ result->select.num_elem=H5S_hyper_spans_nelem(b_not_a);
/* Indicate that the result owns the b_not_a spans */
b_not_a=NULL;
@@ -6085,7 +6167,7 @@ done:
*/
static herr_t
H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t stride[],
const hsize_t count[],
const hsize_t block[])
@@ -6158,7 +6240,7 @@ done:
*/
herr_t
H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
- const hssize_t start[],
+ const hsize_t start[],
const hsize_t *stride,
const hsize_t count[],
const hsize_t *block)
@@ -6257,7 +6339,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Convert current "all" selection to "real" hyperslab selection */
/* Then allow operation to proceed */
{
- hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
+ hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */
hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */
hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */
@@ -6368,10 +6450,10 @@ done:
herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block)
hid_t dsid; IN: Dataspace ID of selection to modify
H5S_seloper_t op; IN: Operation to perform on current selection
- const hssize_t *start; IN: Offset of start of hyperslab
- const hssize_t *stride; IN: Hyperslab stride
- const hssize_t *count; IN: Number of blocks included in hyperslab
- const hssize_t *block; IN: Size of block in hyperslab
+ const hsize_t *start; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t *count; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
RETURNS
Non-negative on success/Negative on failure
DESCRIPTION
@@ -6386,14 +6468,14 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
herr_t
-H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
+H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Sselect_hyperslab, FAIL);
- H5TRACE6("e","iSs*Hs*h*h*h",space_id,op,start,stride,count,block);
+ H5TRACE6("e","iSs*h*h*h*h",space_id,op,start,stride,count,block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -6435,10 +6517,10 @@ done:
hid_t H5Srefine_hyperslab(dsid, op, start, stride, count, block)
hid_t dsid; IN: Dataspace ID of selection to use
H5S_seloper_t op; IN: Operation to perform on current selection
- const hssize_t *start; IN: Offset of start of hyperslab
- const hssize_t *stride; IN: Hyperslab stride
- const hssize_t *count; IN: Number of blocks included in hyperslab
- const hssize_t *block; IN: Size of block in hyperslab
+ const hsize_t *start; IN: Offset of start of hyperslab
+ const hsize_t *stride; IN: Hyperslab stride
+ const hsize_t *count; IN: Number of blocks included in hyperslab
+ const hsize_t *block; IN: Size of block in hyperslab
RETURNS
Dataspace ID on success/Negative on failure
DESCRIPTION
@@ -6454,7 +6536,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
hid_t
-H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
+H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
H5S_t *space = NULL; /* Dataspace to modify selection of */
@@ -6462,7 +6544,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
hid_t ret_value;
FUNC_ENTER_API(H5Scombine_hyperslab, FAIL);
- H5TRACE6("i","iSs*Hs*h*h*h",space_id,op,start,stride,count,block);
+ H5TRACE6("i","iSs*h*h*h*h",space_id,op,start,stride,count,block);
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
@@ -6781,7 +6863,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter,
hsize_t acc; /* Accumulator for computing cumulative sizes */
hsize_t loc_off; /* Element offset in the dataspace */
hsize_t last_span_end=0; /* The offset of the end of the last span */
- hssize_t *abs_arr; /* Absolute hyperslab span position */
+ hsize_t *abs_arr; /* Absolute hyperslab span position */
const hssize_t *off_arr; /* Offset within the dataspace extent */
size_t span_size=0; /* Number of bytes in current span to actually process */
size_t io_left; /* Number of elements left to process */
@@ -7210,16 +7292,16 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter,
hsize_t *mem_size; /* Size of the source buffer */
hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */
const hssize_t *sel_off; /* Selection offset in dataspace */
- hssize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
+ hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */
hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */
hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */
- hssize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
+ hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */
hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */
const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */
- hssize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */
+ fast_dim_stride,
+ fast_dim_block,
fast_dim_offset;
- hsize_t fast_dim_stride, /* Local copies of fastest changing dimension info */
- fast_dim_block;
size_t fast_dim_buf_off; /* Local copy of amount to move fastest dimension buffer offset */
size_t fast_dim_count; /* Number of blocks left in fastest changing dimension */
size_t tot_blk_count; /* Total number of blocks left to output */