summaryrefslogtreecommitdiffstats
path: root/src/H5Dio.c
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2015-05-11 19:11:04 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2015-05-11 19:11:04 (GMT)
commit5520ff138ca79bb5aa46146908773c910f767554 (patch)
treec9ea17f4530c1eade235ea077f179d3557042233 /src/H5Dio.c
parentc3218d9f39ec281506251c2c6ba0b395adfa9013 (diff)
parent67ba6cb57d84dd34c69930d469ae445697b49731 (diff)
downloadhdf5-5520ff138ca79bb5aa46146908773c910f767554.zip
hdf5-5520ff138ca79bb5aa46146908773c910f767554.tar.gz
hdf5-5520ff138ca79bb5aa46146908773c910f767554.tar.bz2
[svn-r27050] merge from trunk.
Diffstat (limited to 'src/H5Dio.c')
-rw-r--r--src/H5Dio.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c
index ade7351..e5d8009 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -294,10 +294,8 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
uint32_t direct_filters;
hsize_t *direct_offset;
uint32_t direct_datasize;
- int ndims = 0;
- hsize_t dims[H5O_LAYOUT_NDIMS];
hsize_t internal_offset[H5O_LAYOUT_NDIMS];
- unsigned u;
+ unsigned u; /* Local index variable */
/* Get the dataset transfer property list */
if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id)))
@@ -316,12 +314,9 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
/* The library's chunking code requires the offset terminates with a zero. So transfer the
* offset array to an internal offset array */
- if((ndims = H5S_get_simple_extent_dims(dset->shared->space, dims, NULL)) < 0)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve dataspace extent dims")
-
- for(u = 0; u < ndims; u++) {
+ for(u = 0; u < dset->shared->ndims; u++) {
/* Make sure the offset doesn't exceed the dataset's dimensions */
- if(direct_offset[u] > dims[u])
+ if(direct_offset[u] > dset->shared->curr_dims[u])
HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
/* Make sure the offset fall right on a chunk's boundary */
@@ -332,7 +327,7 @@ H5D__pre_write(H5D_t *dset, hbool_t direct_write, hid_t mem_type_id,
} /* end for */
/* Terminate the offset with a zero */
- internal_offset[ndims] = 0;
+ internal_offset[dset->shared->ndims] = 0;
/* write raw data */
if(H5D__chunk_direct_write(dset, dxpl_id, direct_filters, internal_offset, direct_datasize, buf) < 0)
@@ -406,7 +401,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
mem_space = file_space;
if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dst dataspace has invalid selection")
- H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
+ H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
/* Fill the DXPL cache values for later use */
if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0)
@@ -676,7 +671,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
- H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, hsize_t);
+ H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t);
/* Make certain that the number of elements in each selection is the same */
if(nelmts != (hsize_t)H5S_GET_SELECT_NPOINTS(file_space))