diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2018-03-18 23:36:49 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2018-03-18 23:36:49 (GMT) |
commit | f38864920d4e0bc8adaf9a23fd3f775ad90cb3f7 (patch) | |
tree | b5f709e5415db2f1a9287b43565fea826b3018f5 /src/H5Dlayout.c | |
parent | 4a17aff4085ad6ee265b95730aca3f493056dec8 (diff) | |
parent | 7aa4eb1b04014f1ad7e1c857ca6509aeeb6c0ae7 (diff) | |
download | hdf5-f38864920d4e0bc8adaf9a23fd3f775ad90cb3f7.zip hdf5-f38864920d4e0bc8adaf9a23fd3f775ad90cb3f7.tar.gz hdf5-f38864920d4e0bc8adaf9a23fd3f775ad90cb3f7.tar.bz2 |
Merge branch 'develop' of https://bitbucket.hdfgroup.org/scm/hdffv/hdf5 into merge_func_enter_vol
Plus initial steps toward merging API context push into FUNC_ENTER_API* macros
Diffstat (limited to 'src/H5Dlayout.c')
-rw-r--r-- | src/H5Dlayout.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index a591957..c8afb8e 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -47,6 +47,12 @@ /* Package Variables */ /*********************/ +/* Format version bounds for layout */ +const unsigned H5O_layout_ver_bounds[] = { + H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */ + H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */ + H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */ +}; /*****************************/ /* Library Private Variables */ @@ -58,6 +64,7 @@ /*******************/ + /*------------------------------------------------------------------------- * Function: H5D__layout_set_io_ops @@ -278,49 +285,47 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__layout_set_latest_version + * Function: H5D__layout_set_version * - * Purpose: Set the encoding for a layout to the latest version. - * Part of the coding in this routine is moved to - * H5D__layout_set_latest_indexing(). + * Purpose: Set the version to encode a layout with. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 + * Programmer: Vailin Choi; December 2017 * *------------------------------------------------------------------------- */ herr_t -H5D__layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space, - const H5D_dcpl_cache_t *dcpl_cache) +H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout) { - herr_t ret_value = SUCCEED; /* Return value */ + unsigned version; /* Message version */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(layout); - HDassert(space); - HDassert(dcpl_cache); + HDassert(f); + + /* Upgrade to the version indicated by the file's low bound if higher */ + version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]); - /* Set encoding of layout to latest version */ - layout->version = H5O_LAYOUT_VERSION_LATEST; + /* Version bounds check */ + if(version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds") - /* Set the latest indexing type for the layout message */ - if(H5D__layout_set_latest_indexing(layout, space, dcpl_cache) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest indexing type") + /* Set the message version */ + layout->version = version; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__layout_set_latest_version() */ +} /* end H5D__layout_set_version() */ /*------------------------------------------------------------------------- * Function: H5D__layout_set_latest_indexing * * Purpose: Set the latest indexing type for a layout message - * This is moved from H5D_layout_set_latest_version(). * * Return: Non-negative on success/Negative on failure * @@ -689,7 +694,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D__layout_oh_write(H5D_t *dataset, H5O_t *oh, unsigned update_flags) +H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned update_flags) { htri_t msg_exists; /* Whether the layout message exists */ herr_t ret_value = SUCCEED; /* Return value */ |