summaryrefslogtreecommitdiffstats
path: root/src/H5Sall.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1999-04-23 21:11:27 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1999-04-23 21:11:27 (GMT)
commitacbad9533eb3bba58a9c33c27a7435ae33c72e36 (patch)
tree221d4eabf44876a065c406f7355936452164656d /src/H5Sall.c
parentdaf4ab55869c71b69a4764bd5947ba230d5da0da (diff)
downloadhdf5-acbad9533eb3bba58a9c33c27a7435ae33c72e36.zip
hdf5-acbad9533eb3bba58a9c33c27a7435ae33c72e36.tar.gz
hdf5-acbad9533eb3bba58a9c33c27a7435ae33c72e36.tar.bz2
[svn-r1210] Changed parameters for function calls which figure out the buffer size for
H5Dread/H5Dwrite to use to allow the I/O calls to break up a user's buffer into pieces that are at least as large as the sequence of bytes being written in the fastest changing dimension. Also fixed a hard-to-find bug in the hyperslab I/O routines which could cause data to be corrupted when writing out fields to compound datatype data with background preservation turned on and hyperslabs which were large enough to require two I/O passes on a hyperslab block. A pretty obscure situation, but it would be worthwhile for users to upgrade to this code in order to be certain that correct data is being written.
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r--src/H5Sall.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 6ebd241..4deb877 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -19,7 +19,7 @@
static intn interface_initialize_g = 0;
static herr_t H5S_all_init (const struct H5O_layout_t *layout,
- const H5S_t *space, H5S_sel_iter_t *iter);
+ const H5S_t *space, H5S_sel_iter_t *iter, size_t *min_elem_out);
static size_t H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *iter,
size_t max);
static size_t H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout,
@@ -76,8 +76,13 @@ const H5S_mconv_t H5S_ALL_MCONV[1] = {{
*/
static herr_t
H5S_all_init (const struct H5O_layout_t UNUSED *layout,
- const H5S_t *space, H5S_sel_iter_t *sel_iter)
+ const H5S_t *space, H5S_sel_iter_t *sel_iter, size_t *min_elem_out)
{
+ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */
+ intn space_ndims; /*dimensionality of space*/
+ hsize_t acc; /*accumulator */
+ intn i; /*counters */
+
FUNC_ENTER (H5S_all_init, FAIL);
/* Check args */
@@ -90,6 +95,19 @@ H5S_all_init (const struct H5O_layout_t UNUSED *layout,
/* Start at the upper left location */
sel_iter->all.offset=0;
+
+ /* Get the dimensions of the space, to set the min. # of elements */
+ if ((space_ndims=H5S_get_simple_extent_dims (space, hsize, NULL))<0) {
+ HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL,
+ "unable to retrieve hyperslab parameters");
+ }
+
+ /* Adjust the slowest varying dimension to account for strip mining */
+ for (i=1, acc=1; i<space_ndims; i++)
+ acc *= hsize[i];
+
+ /* Set the minimum # of elements to output */
+ *min_elem_out=acc;
FUNC_LEAVE (SUCCEED);
}
@@ -471,8 +489,9 @@ H5S_all_mscat (const void *_tconv_buf, size_t elmt_size,
}
/* Adjust the slowest varying dimension to take care of strip mining */
- for (i=1, acc=1; i<space_ndims; i++)
+ for (i=1, acc=1; i<space_ndims; i++) {
acc *= hsize[i];
+ }
assert (0==mem_iter->all.offset % acc);
assert (0==nelmts % acc);
mem_offset[0] += mem_iter->all.offset / acc;