summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5Dint.c2
-rw-r--r--src/H5Dio.c4
-rw-r--r--src/H5Spoint.c147
-rw-r--r--src/H5Sprivate.h4
-rw-r--r--src/H5Spublic.h3
5 files changed, 78 insertions, 82 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 4ee6c19..a5ea398 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2177,7 +2177,7 @@ H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, co
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't resize tbuf")
/* Select point to read in */
- if(H5Sselect_elements(vlen_bufsize->fspace_id, H5S_SELECT_SET, (size_t)1, (const hsize_t **)point) < 0)
+ if(H5Sselect_elements(vlen_bufsize->fspace_id, H5S_SELECT_SET, (size_t)1, point) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't select point")
/* Read in the point (with the custom VL memory allocator) */
diff --git a/src/H5Dio.c b/src/H5Dio.c
index bcb90a0..8576464 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -3196,7 +3196,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
coords_in_chunk[u]=coords[u]%fm->layout->u.chunk.dim[u];
/* Add point to file selection for chunk */
- if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, (const hsize_t **)coords_in_chunk) < 0)
+ if(H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
/* Increment the number of elemented selected in chunk */
@@ -3269,7 +3269,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const
/* Add point to memory selection for chunk */
if(fm->msel_type==H5S_SEL_POINTS) {
- if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, (const hsize_t **)coords_in_mem) < 0)
+ if(H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element")
} /* end if */
else {
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() */
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index aa8a418..bd27f09 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -258,8 +258,8 @@ H5_DLL herr_t H5S_select_all(H5S_t *space, hbool_t rel_prev);
H5_DLL herr_t H5S_select_none(H5S_t *space);
/* Operations on point selections */
-H5_DLL herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op,
- size_t num_elem, const hsize_t **coord);
+H5_DLL herr_t H5S_select_elements(H5S_t *space, H5S_seloper_t op,
+ size_t num_elem, const hsize_t *coord);
/* Operations on hyperslab selections */
H5_DLL herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hsize_t start[],
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 4a49da2..4b26cc8 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -126,8 +126,7 @@ H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
hid_t space2_id);
#endif /* NEW_HYPERSLAB_API */
H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
- size_t num_elemn,
- const hsize_t **coord);
+ size_t num_elem, const hsize_t *coord);
H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id);
H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id);