diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-01-15 21:10:42 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-01-15 21:10:42 (GMT) |
commit | e622f3351553cb867566a59b5c8e0d5cf0a74c5a (patch) | |
tree | 639deb8e2e350a16b0712f544e26f64bd91827d4 /src/H5Spoint.c | |
parent | e4b251d90df06d1dcd1a1cdda5ff47c3535a98a1 (diff) | |
download | hdf5-e622f3351553cb867566a59b5c8e0d5cf0a74c5a.zip hdf5-e622f3351553cb867566a59b5c8e0d5cf0a74c5a.tar.gz hdf5-e622f3351553cb867566a59b5c8e0d5cf0a74c5a.tar.bz2 |
[svn-r14420] Description:
Correct the prototype for H5Sselect_elements() to take an 'hsize_t *' for
the coordinates, instead of 'hsize_t **'.
Tested on:
Mac OS X/32 10.5.1 (amazon)
Diffstat (limited to 'src/H5Spoint.c')
-rw-r--r-- | src/H5Spoint.c | 147 |
1 files changed, 72 insertions, 75 deletions
diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 78c401c..6a3c122 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -382,71 +382,70 @@ H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t **_coord) +H5S_point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *coord) { H5S_pnt_node_t *top, *curr, *new_node; /* Point selection nodes */ - const hsize_t *coord=(const hsize_t *)_coord; /* Pointer to the actual coordinates */ - unsigned i; /* Counter */ - herr_t ret_value=SUCCEED; /* Return value */ + unsigned i; /* Counter */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_point_add); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_add) - assert(space); - assert(num_elem>0); - assert(coord); - assert(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND); + HDassert(space); + HDassert(num_elem > 0); + HDassert(coord); + HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND); - top=curr=NULL; - for(i=0; i<num_elem; i++) { + top = curr = NULL; + for(i = 0; i < num_elem; i++) { /* Allocate space for the new node */ - if((new_node = H5FL_MALLOC(H5S_pnt_node_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); + if(NULL == (new_node = H5FL_MALLOC(H5S_pnt_node_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node") - if((new_node->pnt = H5MM_malloc(space->extent.rank*sizeof(hsize_t)))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); + if(NULL == (new_node->pnt = H5MM_malloc(space->extent.rank * sizeof(hsize_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") /* Copy over the coordinates */ - HDmemcpy(new_node->pnt,coord+(i*space->extent.rank),(space->extent.rank*sizeof(hsize_t))); + HDmemcpy(new_node->pnt, coord + (i * space->extent.rank), (space->extent.rank * sizeof(hsize_t))); /* Link into list */ - new_node->next=NULL; - if(top==NULL) - top=new_node; + new_node->next = NULL; + if(top == NULL) + top = new_node; else - curr->next=new_node; - curr=new_node; + curr->next = new_node; + curr = new_node; } /* end for */ /* Insert the list of points selected in the proper place */ - if(op==H5S_SELECT_SET || op==H5S_SELECT_PREPEND) { + if(op == H5S_SELECT_SET || op == H5S_SELECT_PREPEND) { /* Append current list, if there is one */ - if(space->select.sel_info.pnt_lst->head!=NULL) - curr->next=space->select.sel_info.pnt_lst->head; + if(space->select.sel_info.pnt_lst->head != NULL) + curr->next = space->select.sel_info.pnt_lst->head; /* Put new list in point selection */ - space->select.sel_info.pnt_lst->head=top; + space->select.sel_info.pnt_lst->head = top; } /* end if */ else { /* op==H5S_SELECT_APPEND */ - new_node=space->select.sel_info.pnt_lst->head; - if(new_node!=NULL) { - while(new_node->next!=NULL) - new_node=new_node->next; + new_node = space->select.sel_info.pnt_lst->head; + if(new_node != NULL) { + while(new_node->next != NULL) + new_node = new_node->next; /* Append new list to point selection */ - new_node->next=top; + new_node->next = top; } /* end if */ else - space->select.sel_info.pnt_lst->head=top; + space->select.sel_info.pnt_lst->head = top; } /* end else */ /* Set the number of elements in the new selection */ - if(op==H5S_SELECT_SET) - space->select.num_elem=num_elem; + if(op == H5S_SELECT_SET) + space->select.num_elem = num_elem; else - space->select.num_elem+=num_elem; + space->select.num_elem += num_elem; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_point_add() */ @@ -507,7 +506,7 @@ H5S_point_release (H5S_t *space) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection size_t num_elem; IN: Number of elements in COORD array. - const hsize_t **coord; IN: The location of each element selected + const hsize_t *coord; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -528,40 +527,38 @@ H5S_point_release (H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem, - const hsize_t **coord) +H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, + const hsize_t *coord) { - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_select_elements); + FUNC_ENTER_NOAPI_NOINIT(H5S_select_elements) /* Check args */ - assert(space); - assert(num_elem); - assert(coord); - assert(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND); + HDassert(space); + HDassert(num_elem); + HDassert(coord); + HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND); /* If we are setting a new selection, remove current selection first */ - if(op==H5S_SELECT_SET || H5S_GET_SELECT_TYPE(space)!=H5S_SEL_POINTS) { - if(H5S_SELECT_RELEASE(space)<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection"); - } /* end if */ + if(op == H5S_SELECT_SET || H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) + if(H5S_SELECT_RELEASE(space) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection") /* Allocate space for the point selection information if necessary */ - if(H5S_GET_SELECT_TYPE(space)!=H5S_SEL_POINTS || space->select.sel_info.pnt_lst==NULL) { - if((space->select.sel_info.pnt_lst = H5FL_CALLOC(H5S_pnt_list_t))==NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information"); - } /* end if */ + if(H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL) + if(NULL == (space->select.sel_info.pnt_lst = H5FL_CALLOC(H5S_pnt_list_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information") /* Add points to selection */ - if(H5S_point_add(space,op,num_elem,coord)<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements"); + if(H5S_point_add(space, op, num_elem, coord) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements") /* Set selection type */ - space->select.type=H5S_sel_point; + space->select.type = H5S_sel_point; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_select_elements() */ @@ -1326,7 +1323,7 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection size_t num_elem; IN: Number of elements in COORD array. - const hsize_t **coord; IN: The location of each element selected + const hsize_t *coord; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -1348,32 +1345,32 @@ H5S_point_adjust_u(H5S_t *space, const hsize_t *offset) --------------------------------------------------------------------------*/ herr_t H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, - const hsize_t **coord) + const hsize_t *coord) { - H5S_t *space = NULL; /* Dataspace to modify selection of */ - herr_t ret_value; /* return value */ + H5S_t *space = NULL; /* Dataspace to modify selection of */ + herr_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Sselect_elements, FAIL); - H5TRACE4("e", "iSsz**h", spaceid, op, num_elem, coord); + FUNC_ENTER_API(H5Sselect_elements, FAIL) + H5TRACE4("e", "iSsz*h", spaceid, op, num_elem, coord); /* Check args */ - if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); - if (H5S_SCALAR==H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_SCALAR space"); - if (H5S_NULL==H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_NULL space"); - if(coord==NULL || num_elem==0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "elements not specified"); - if(!(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted"); + if(NULL == (space = H5I_object_verify(spaceid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + if(H5S_SCALAR == H5S_GET_EXTENT_TYPE(space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_SCALAR space") + if(H5S_NULL == H5S_GET_EXTENT_TYPE(space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_NULL space") + if(coord == NULL || num_elem == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "elements not specified") + if(!(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND)) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted") /* Call the real element selection routine */ - if((ret_value=H5S_select_elements(space,op,num_elem,coord))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't select elements"); + if((ret_value = H5S_select_elements(space, op, num_elem, coord)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't select elements") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Sselect_elements() */ |