summaryrefslogtreecommitdiffstats
path: root/src/H5Spoint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-04-29 20:27:31 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-04-29 20:27:31 (GMT)
commita88d81f4ba6fdd08d7255a736b9e2954b0cef0ca (patch)
tree7a4afc2e68b372f3c16d65fe0da305eeb4f0f31d /src/H5Spoint.c
parent03a08823e78de11a77eaf99b97569fe9600c9a04 (diff)
downloadhdf5-a88d81f4ba6fdd08d7255a736b9e2954b0cef0ca.zip
hdf5-a88d81f4ba6fdd08d7255a736b9e2954b0cef0ca.tar.gz
hdf5-a88d81f4ba6fdd08d7255a736b9e2954b0cef0ca.tar.bz2
[svn-r5286] Purpose:
Bug Fix Description: Selection offsets were not being used correctly when iterating through all hyperslabs selections and point selections. Solution: Use the selection offset appropriately. Platforms tested: FreeBSD 4.5 (sleipnir)
Diffstat (limited to 'src/H5Spoint.c')
-rw-r--r--src/H5Spoint.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index efe6df0..5f56ebb 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -1258,14 +1258,13 @@ H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t
void *operator_data)
{
hsize_t mem_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */
- hsize_t acc; /* Size accumulator */
+ hssize_t mem_offset[H5O_LAYOUT_NDIMS]; /* Point offset */
hsize_t offset; /* Offset of region in buffer */
- hsize_t elmt_size; /* Size of datatype */
void *tmp_buf; /* Temporary location of the element in the buffer */
H5S_pnt_node_t *node; /* Point node */
unsigned rank; /* Dataspace rank */
H5T_t *dt; /* Datatype structure */
- int i; /* Index variable */
+ unsigned u; /* Local index variable */
herr_t ret_value=0; /* return value */
FUNC_ENTER (H5S_point_select_iterate, 0);
@@ -1284,21 +1283,24 @@ H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t
/* Set the size of the datatype */
if (NULL==(dt=H5I_object(type_id)))
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype");
- mem_size[rank]=elmt_size=H5T_get_size(dt);
+ mem_size[rank]=H5T_get_size(dt);
/* Iterate through the node, checking the bounds on each element */
node=space->select.sel_info.pnt_lst->head;
while(node!=NULL && ret_value==0) {
- /* Compute the offset of each selected point in the buffer */
- for(i=rank-1,acc=elmt_size,offset=0; i>=0; i--) {
- offset+=(node->pnt[i]+space->select.offset[i])*acc;
- acc*=mem_size[i];
- } /* end for */
+ /* Set up the location of the point */
+ HDmemcpy(mem_offset, node->pnt, rank*sizeof(hssize_t));
+ mem_offset[rank]=0;
+
+ /* Add in the selection offset */
+ for(u=0; u<rank; u++)
+ mem_offset[u]+=space->select.offset[u];
/* Get the offset in the memory buffer */
+ offset=H5V_array_offset(rank+1,mem_size,(const hssize_t *)mem_offset);
tmp_buf=((char *)buf+offset);
- ret_value=(*op)(tmp_buf,type_id,(hsize_t)rank,node->pnt,operator_data);
+ ret_value=(*op)(tmp_buf,type_id,(hsize_t)rank,mem_offset,operator_data);
node=node->next;
} /* end while */