diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2018-02-14 01:15:40 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2018-02-14 01:15:40 (GMT) |
commit | 66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b (patch) | |
tree | 380fd687260c0d0aff9c3dc04be70afa63b9e296 /src/H5S.c | |
parent | 20332fac0ead66b7fc90858b209b33fbd6a75d57 (diff) | |
parent | b4294d8d3e5937527e9814f23d04df412ebbe770 (diff) | |
download | hdf5-66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b.zip hdf5-66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b.tar.gz hdf5-66ea3b8fb9fdff0a0ffa6ffd318ad5fc2c9a8f4b.tar.bz2 |
Merge pull request #876 in HDFFV/hdf5 from ~VCHOI/my_hdf5_fork:bugfix/version_bounds to develop
* commit 'b4294d8d3e5937527e9814f23d04df412ebbe770':
Added comment for clarification about latest as 1.10. Platforms tested: Linux/64 (jelly) Linux/32 (jam)
Fixed typos Platforms tested: Linux/32 (jam)
Additional tests Description: - Revised and add more variety to version bound tests per review - Revised gen_bounds.c per review Platforms tested: Linux/64 (jelly) Linux/32 (jam) Darwin (osx1010test)
Added gen_bounds
Cleaned up per comments in PR# 876
Modifications made based on comments from pull request.
Added gen_bounds.c
Added gen_bounds.c
Fix bounds check for the generation of cache image.
Modify usage description for -j and -k options so that it is more informative.
Modify h5repack usage so that it is more descriptive.
Changes made based on code reviews.
Further improvement
Fixed comment.
Adding data file generator Description: Added gen_bounds.c to generate the following files: - bounds_earliest_latest.h5 - bounds_earliest_v18.h5 - bounds_latest_latest.h5 - bounds_v18_latest.h5 - bounds_v18_v18.h5 for testing the version bounds fix in 1.8 and 1.6.
Initial checkin for library version bounds Code changes to provide versioning support when adding to the enumerated defines for H5F_libver_t.
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 41 |
1 files changed, 30 insertions, 11 deletions
@@ -57,6 +57,12 @@ static htri_t H5S_is_simple(const H5S_t *sdim); /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; +/* Format version bounds for dataspace */ +const unsigned H5O_sdspace_ver_bounds[] = { + H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */ + H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */ + H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */ +}; /*****************************/ /* Library Private Variables */ @@ -84,6 +90,7 @@ static const H5I_class_t H5I_DATASPACE_CLS[1] = {{ (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */ }}; + /* Flag indicating "top" of interface has been initialized */ static hbool_t H5S_top_package_initialize_s = FALSE; @@ -2167,30 +2174,42 @@ H5S_extent_nelem(const H5S_extent_t *ext) /*------------------------------------------------------------------------- - * Function: H5S_set_latest_version + * Function: H5S_set_version * - * Purpose: Set the encoding for a dataspace to the latest version. + * Purpose: Set the version to encode a dataspace with. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, July 24, 2007 + * Programmer: Vailin Choi; December 2017 * *------------------------------------------------------------------------- */ herr_t -H5S_set_latest_version(H5S_t *ds) +H5S_set_version(H5F_t *f, H5S_t *ds) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + unsigned version; /* Message version */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ + HDassert(f); HDassert(ds); - /* Set encoding of extent to latest version */ - ds->extent.version = H5O_SDSPACE_VERSION_LATEST; + /* Upgrade to the version indicated by the file's low bound if higher */ + version = MAX(ds->extent.version, H5O_sdspace_ver_bounds[H5F_LOW_BOUND(f)]); + + /* Version bounds check */ + if(version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "Dataspace version out of bounds") + + /* Set the message version */ + ds->extent.version = version; + +done: + FUNC_LEAVE_NOAPI(ret_value) - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5S_set_latest_version() */ +} /* end H5S_set_version() */ #ifndef H5_NO_DEPRECATED_SYMBOLS |