summaryrefslogtreecommitdiffstats
path: root/src/H5Oint.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2018-01-12 20:36:03 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2018-01-12 20:36:03 (GMT)
commit37318f109a294bb47e5040be5888963967c1badc (patch)
tree183f86084fec7afa0ce48787db692c567dc812ab /src/H5Oint.c
parent7af4786a9b29184596cb31afa80b69a68f00349b (diff)
downloadhdf5-37318f109a294bb47e5040be5888963967c1badc.zip
hdf5-37318f109a294bb47e5040be5888963967c1badc.tar.gz
hdf5-37318f109a294bb47e5040be5888963967c1badc.tar.bz2
Changes made based on code reviews.
Diffstat (limited to 'src/H5Oint.c')
-rw-r--r--src/H5Oint.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 0df7467..08eb28d 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -216,18 +216,17 @@ H5O__init_package(void)
* Chooses the oldest version possible, unless the file's
* low bound indicates otherwise.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Jul 17 2007
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx)
{
+ uint8_t version; /* Message version */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -238,17 +237,20 @@ H5O_set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_idx
/* Set the correct version to encode object header with */
if(store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
- oh->version = H5O_VERSION_2;
+ version = H5O_VERSION_LATEST;
else
- oh->version = H5O_VERSION_1;
+ version = H5O_VERSION_1;
/* Upgrade to the version indicated by the file's low bound if higher */
- oh->version = MAX(oh->version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
+ version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(f)]);
- /* File bound check */
- if(oh->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)])
+ /* Version bounds check */
+ if(version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)])
HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "object header version out of bounds")
+ /* Set the message version */
+ oh->version = version;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_set_version() */