summaryrefslogtreecommitdiffstats
path: root/src/H5Dvirtual.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-08-07 20:06:56 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-08-07 20:06:56 (GMT)
commit0c4ec00cba82a900d22c3ba9bb0403a6b4cf8208 (patch)
tree8bcff59908f166b3a138ea6ae56ae841c28bcdec /src/H5Dvirtual.c
parent98f947ceaedbae472efbebad505680d2ca62b403 (diff)
downloadhdf5-0c4ec00cba82a900d22c3ba9bb0403a6b4cf8208.zip
hdf5-0c4ec00cba82a900d22c3ba9bb0403a6b4cf8208.tar.gz
hdf5-0c4ec00cba82a900d22c3ba9bb0403a6b4cf8208.tar.bz2
[svn-r27481] Add support for offset selections passed to H5Pset_virtual.
Add test for this. Tested: ummon
Diffstat (limited to 'src/H5Dvirtual.c')
-rw-r--r--src/H5Dvirtual.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index db45ceb..04f42c9 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -1552,6 +1552,7 @@ H5D__virtual_init(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, const H5D_t *dset,
{
H5O_storage_virtual_t *storage; /* Convenience pointer */
H5P_genplist_t *dapl; /* Data access property list object pointer */
+ hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset (unused) */
size_t i; /* Local index variables */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1566,12 +1567,23 @@ H5D__virtual_init(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, const H5D_t *dset,
* status because this layout could be from an old version held in the
* object header message code. We cannot update that held message because
* the layout message is constant, so just overwrite the values here (and
- * invalidate other fields by setting storage->init to FALSE below). */
+ * invalidate other fields by setting storage->init to FALSE below). Also
+ * remove offset from selections. We only have to update
+ * source_space_status and virtual_space_status because others will be based
+ * on these and should therefore already have been normalized. */
for(i = 0; i < storage->list_nused; i++) {
+ HDassert(storage->list[i].sub_dset_nalloc == 0);
+
+ /* Patch extent */
if(H5S_extent_copy(storage->list[i].source_dset.virtual_select, dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy virtual dataspace extent")
storage->list[i].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT;
- HDassert(storage->list[i].sub_dset_nalloc == 0);
+
+ /* Normalize offsets, toss out old offset values */
+ if(H5S_hyper_normalize_offset(storage->list[i].source_dset.virtual_select, old_offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
+ if(H5S_hyper_normalize_offset(storage->list[i].source_select, old_offset) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset")
} /* end for */
/* Get dataset access property list */