diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-01-08 17:27:15 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-01-08 17:27:15 (GMT) |
commit | 634c7c5a93abb49a56336eec9e842a0bd694f828 (patch) | |
tree | d30f170a49ca3186bc8beddac7bf3523dfdb1ad3 /src/H5Spoint.c | |
parent | 9b1f93283c32f81658cf40d0caeb5333c4db6ae9 (diff) | |
download | hdf5-634c7c5a93abb49a56336eec9e842a0bd694f828.zip hdf5-634c7c5a93abb49a56336eec9e842a0bd694f828.tar.gz hdf5-634c7c5a93abb49a56336eec9e842a0bd694f828.tar.bz2 |
[svn-r16279] Description:
Bring revision 16278 back from revise_chunks branch:
Update layout information in DCPL to unify all information in one
underlying property and switch to using H5O_layout_t for storing it, which
simplifies things considerably.
Also, fix many compiler warnings.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
(Original patch tested on many machines)
Diffstat (limited to 'src/H5Spoint.c')
-rw-r--r-- | src/H5Spoint.c | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 74d72d9..84b427e 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -655,18 +655,18 @@ H5S_point_is_valid (const H5S_t *space) assert(space); /* Check each point to determine whether selection+offset is within extent */ - curr=space->select.sel_info.pnt_lst->head; - while(curr!=NULL) { + curr = space->select.sel_info.pnt_lst->head; + while(curr != NULL) { /* Check each dimension */ - for(u=0; u<space->extent.rank; u++) { + for(u = 0; u < space->extent.rank; u++) { /* Check if an offset has been defined */ /* Bounds check the selected point + offset against the extent */ - if(((curr->pnt[u]+space->select.offset[u])>space->extent.size[u]) - || (((hssize_t)curr->pnt[u]+space->select.offset[u])<0)) + if(((curr->pnt[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u]) + || (((hssize_t)curr->pnt[u] + space->select.offset[u]) < 0)) HGOTO_DONE(FALSE) } /* end for */ - curr=curr->next; + curr = curr->next; } /* end while */ done: @@ -706,7 +706,7 @@ H5Sget_select_elem_npoints(hid_t spaceid) if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection") - ret_value = H5S_GET_SELECT_NPOINTS(space); + ret_value = (hssize_t)H5S_GET_SELECT_NPOINTS(space); done: FUNC_LEAVE_API(ret_value) @@ -923,34 +923,34 @@ static herr_t H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoints, hsize_t *buf) { H5S_pnt_node_t *node; /* Point node */ - int rank; /* Dataspace rank */ + unsigned rank; /* Dataspace rank */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_get_select_elem_pointlist); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_get_select_elem_pointlist) - assert(space); - assert(buf); + HDassert(space); + HDassert(buf); /* Get the dataspace extent rank */ - rank=space->extent.rank; + rank = space->extent.rank; /* Get the head of the point list */ - node=space->select.sel_info.pnt_lst->head; + node = space->select.sel_info.pnt_lst->head; /* Iterate to the first point to return */ - while(node!=NULL && startpoint>0) { + while(node != NULL && startpoint > 0) { startpoint--; - node=node->next; + node = node->next; } /* end while */ /* Iterate through the node, copying each hyperslab's information */ - while(node!=NULL && numpoints>0) { - HDmemcpy(buf,node->pnt,sizeof(hsize_t)*rank); - buf+=rank; + while(node != NULL && numpoints > 0) { + HDmemcpy(buf, node->pnt, sizeof(hsize_t) * rank); + buf += rank; numpoints--; - node=node->next; + node = node->next; } /* end while */ - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_get_select_elem_pointlist() */ @@ -1105,7 +1105,6 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset) const hssize_t *sel_offset; /* Pointer to the selection's offset */ const hsize_t *dim_size; /* Pointer to a dataspace's extent */ hsize_t accum; /* Accumulator for dimension sizes */ - int rank; /* Dataspace rank */ int i; /* index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1123,9 +1122,8 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset) dim_size = space->extent.size; /* Loop through coordinates, calculating the linear offset */ - rank = space->extent.rank; accum = 1; - for(i = (rank - 1); i >= 0; i--) { + for(i = (int)space->extent.rank - 1; i >= 0; i--) { hssize_t pnt_offset = (hssize_t)pnt[i] + sel_offset[i]; /* Point's offset in this dimension */ /* Check for offset moving selection out of the dataspace */ @@ -1133,7 +1131,7 @@ H5S_point_offset(const H5S_t *space, hsize_t *offset) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") /* Add the point's offset in this dimension to the total linear offset */ - *offset += pnt_offset * accum; + *offset += (hsize_t)pnt_offset * accum; /* Increase the accumulator */ accum *= dim_size[i]; @@ -1448,9 +1446,9 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, curr_seq=0; while(node!=NULL) { /* Compute the offset of each selected point in the buffer */ - for(i=ndims-1,acc=iter->elmt_size,loc=0; i>=0; i--) { - loc+=(node->pnt[i]+space->select.offset[i])*acc; - acc*=dims[i]; + for(i = ndims - 1, acc = iter->elmt_size, loc = 0; i >= 0; i--) { + loc += (node->pnt[i] + space->select.offset[i]) * acc; + acc *= dims[i]; } /* end for */ /* Check if this is a later point in the selection */ |