summaryrefslogtreecommitdiffstats
path: root/src/H5Opline.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-10-03 19:57:36 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-10-03 19:57:36 (GMT)
commitfe70476a225d2e0576149e0f1bdf95689f922c77 (patch)
treeca07b675475ec83f9c8588c0256d585e69688578 /src/H5Opline.c
parent9d6ba29a01079e0f81ffa530605d8cd830378f9c (diff)
downloadhdf5-fe70476a225d2e0576149e0f1bdf95689f922c77.zip
hdf5-fe70476a225d2e0576149e0f1bdf95689f922c77.tar.gz
hdf5-fe70476a225d2e0576149e0f1bdf95689f922c77.tar.bz2
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/H5Opline.c')
-rw-r--r--src/H5Opline.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 2e52dbb..c1ff183 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -89,6 +89,12 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
H5O_pline_shared_debug /* debug the message */
}};
+/* Format version bounds for filter pipleline */
+static const unsigned H5O_pline_ver_bounds[] = {
+ H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/* Declare a free list to manage the H5O_pline_t struct */
H5FL_DEFINE(H5O_pline_t);
@@ -664,11 +670,11 @@ H5O_pline_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const voi
/*-------------------------------------------------------------------------
- * Function: H5O_pline_set_latest_version
+ * Function: H5O_pline_set_version
*
- * Purpose: Set the encoding for a I/O filter pipeline to the latest version.
+ * Purpose: Set the version to encode an I/O filter pipeline with.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, July 24, 2007
@@ -676,16 +682,23 @@ H5O_pline_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const voi
*-------------------------------------------------------------------------
*/
herr_t
-H5O_pline_set_latest_version(H5O_pline_t *pline)
+H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(f);
HDassert(pline);
- /* Set encoding of I/O pipeline to latest version */
- pline->version = H5O_PLINE_VERSION_LATEST;
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ pline->version = MAX(pline->version, H5O_pline_ver_bounds[H5F_LOW_BOUND(f)]);
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_pline_set_latest_version() */
+ /* File bound check */
+ if(pline->version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_PLINE, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds")
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_pline_set_version() */