summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5S.c12
-rw-r--r--src/H5Shyper.c6
2 files changed, 14 insertions, 4 deletions
diff --git a/src/H5S.c b/src/H5S.c
index a548f13..4d6ef76 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -511,10 +511,20 @@ H5S_extent_copy(H5S_t *dst, const H5S_t *src)
HDassert(dst);
HDassert(src);
- /* Copy */
+ /* Copy extent */
if(H5S_extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent")
+ /* If the selection is 'all', update the number of elements selected in the
+ * destination space */
+ if(H5S_SEL_ALL == H5S_GET_SELECT_TYPE(dst))
+ if(H5S_select_all(dst, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection")
+
+ /* Mark the destination space as no longer shared if it was before */
+ if(H5O_msg_reset_share(H5O_SDSPACE_ID, dst) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRESET, FAIL, "can't stop sharing dataspace")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5S_extent_copy() */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 1fd19fe..51460da 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -9085,11 +9085,11 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
int_sel_off = sis_off[sis_i] - ss_off[ss_i] + ss_sel_off;
if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) <= (sis_off[sis_i]
+ (hsize_t)sis_len[sis_i])) {
- int_len = (size_t)(ss_off[ss_i] + (hsize_t)ss_len[ss_i] - int_sel_off);
+ int_len = (size_t)((hsize_t)ss_len[ss_i] + ss_sel_off - int_sel_off);
advance_ss = TRUE;
} /* end if */
else
- int_len = (size_t)(sis_off[sis_i] + (hsize_t)sis_len[sis_i] - int_sel_off);
+ int_len = (size_t)(sis_off[sis_i] + (hsize_t)sis_len[sis_i] - ss_off[ss_i] + ss_sel_off - int_sel_off);
if((ss_off[ss_i] + (hsize_t)ss_len[ss_i]) >= (sis_off[sis_i]
+ (hsize_t)sis_len[sis_i]))
advance_sis = TRUE;
@@ -9102,7 +9102,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
ds_sel_off += (hsize_t)ds_len[ds_i];
if(++ds_i == ds_nseq) {
HDassert(0 && "Checking code coverage..."); //VDSINC
- HDassert(sis_nelem > 0);
+ HDassert(ds_nelem > 0);
/* Try to grab more sequences from dst_space */
if(H5S_SELECT_GET_SEQ_LIST(dst_space, 0u, &ds_iter, H5S_PROJECT_INTERSECT_NSEQS, ds_nelem, &ds_nseq, &nelem, ds_off, ds_len) < 0)