summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-06-12 17:01:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-06-12 17:01:01 (GMT)
commitbdefbb5cba63402c819819545c3d45e862540ee6 (patch)
treebce893e3521d102b0b428a937a0944da8a7b34e9 /src
parent3bbc9285cf7bda368f18cc724f14edcf2828a0ea (diff)
downloadhdf5-bdefbb5cba63402c819819545c3d45e862540ee6.zip
hdf5-bdefbb5cba63402c819819545c3d45e862540ee6.tar.gz
hdf5-bdefbb5cba63402c819819545c3d45e862540ee6.tar.bz2
[svn-r5603] Purpose:
Bug fix Description: I/O on "Regular" hyperslab selections could fail to transfer correctly if the number of elements in the selection's row did now fit "evenly" into the buffer being used for the transfer. Solution: Correct the calculation of the block & count offsets within the optimized "regular" hyperslab routines. Platforms tested: FreeBSD 4.5 (sleipnir)
Diffstat (limited to 'src')
-rw-r--r--src/H5Shyper.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 1d14592..bf035b4 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -968,8 +968,14 @@ H5S_hyper_fread_opt (H5F_t *f, const struct H5O_layout_t *layout,
/* Compute the current "counts" for this location */
for(i=0; i<ndims; i++) {
- tmp_count[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)%file_space->select.sel_info.hslab.diminfo[i].stride;
- tmp_block[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)/file_space->select.sel_info.hslab.diminfo[i].stride;
+ if(file_space->select.sel_info.hslab.diminfo[i].stride==1) {
+ tmp_count[i] = 0;
+ tmp_block[i] = file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start;
+ } /* end if */
+ else {
+ tmp_count[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)/file_space->select.sel_info.hslab.diminfo[i].stride;
+ tmp_block[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)%file_space->select.sel_info.hslab.diminfo[i].stride;
+ } /* end else */
} /* end for */
/* Compute the initial buffer offset */
@@ -1993,8 +1999,14 @@ H5S_hyper_fwrite_opt (H5F_t *f, const struct H5O_layout_t *layout,
/* Compute the current "counts" for this location */
for(i=0; i<ndims; i++) {
- tmp_count[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)%file_space->select.sel_info.hslab.diminfo[i].stride;
- tmp_block[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)/file_space->select.sel_info.hslab.diminfo[i].stride;
+ if(file_space->select.sel_info.hslab.diminfo[i].stride==1) {
+ tmp_count[i] = 0;
+ tmp_block[i] = file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start;
+ } /* end if */
+ else {
+ tmp_count[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)/file_space->select.sel_info.hslab.diminfo[i].stride;
+ tmp_block[i] = (file_iter->hyp.off[i]-file_space->select.sel_info.hslab.diminfo[i].start)%file_space->select.sel_info.hslab.diminfo[i].stride;
+ } /* end else */
} /* end for */
/* Compute the initial buffer offset */
@@ -2923,8 +2935,14 @@ H5S_hyper_mread_opt (const void *_buf, size_t elmt_size,
/* Compute the current "counts" for this location */
for(i=0; i<ndims; i++) {
- tmp_count[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)%mem_space->select.sel_info.hslab.diminfo[i].stride;
- tmp_block[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)/mem_space->select.sel_info.hslab.diminfo[i].stride;
+ if(mem_space->select.sel_info.hslab.diminfo[i].stride==1) {
+ tmp_count[i] = 0;
+ tmp_block[i] = mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start;
+ } /* end if */
+ else {
+ tmp_count[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)/mem_space->select.sel_info.hslab.diminfo[i].stride;
+ tmp_block[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)%mem_space->select.sel_info.hslab.diminfo[i].stride;
+ } /* end else */
} /* end for */
/* Compute the initial buffer offset */
@@ -3752,8 +3770,14 @@ H5S_hyper_mwrite_opt (const void *_tconv_buf, size_t elmt_size,
/* Compute the current "counts" for this location */
for(i=0; i<ndims; i++) {
- tmp_count[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)%mem_space->select.sel_info.hslab.diminfo[i].stride;
- tmp_block[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)/mem_space->select.sel_info.hslab.diminfo[i].stride;
+ if(mem_space->select.sel_info.hslab.diminfo[i].stride==1) {
+ tmp_count[i] = 0;
+ tmp_block[i] = mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start;
+ } /* end if */
+ else {
+ tmp_count[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)/mem_space->select.sel_info.hslab.diminfo[i].stride;
+ tmp_block[i] = (mem_iter->hyp.off[i]-mem_space->select.sel_info.hslab.diminfo[i].start)%mem_space->select.sel_info.hslab.diminfo[i].stride;
+ } /* end else */
} /* end for */
/* Compute the initial buffer offset */