summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-03-07 21:49:14 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-03-07 21:49:14 (GMT)
commit496af1be89de67fee06f23e4e6354a0d18c3be92 (patch)
tree542d2190ef4f1b7d7d3642f12d72c7bab6882a65 /src
parent5c4bab04f59bdb1821635e580bae3ce357cbd580 (diff)
downloadhdf5-496af1be89de67fee06f23e4e6354a0d18c3be92.zip
hdf5-496af1be89de67fee06f23e4e6354a0d18c3be92.tar.gz
hdf5-496af1be89de67fee06f23e4e6354a0d18c3be92.tar.bz2
Needs to sync with lib version and Sencode.
Diffstat (limited to 'src')
-rw-r--r--src/H5Abtree2.c4
-rw-r--r--src/H5Adense.c4
-rw-r--r--src/H5Aint.c55
-rw-r--r--src/H5Cimage.c5
-rw-r--r--src/H5Dint.c85
-rw-r--r--src/H5Dlayout.c43
-rw-r--r--src/H5Dpkg.h3
-rw-r--r--src/H5F.c30
-rw-r--r--src/H5Fdeprec.c62
-rw-r--r--src/H5Ffake.c21
-rw-r--r--src/H5Fint.c78
-rw-r--r--src/H5Fpkg.h3
-rw-r--r--src/H5Fprivate.h39
-rw-r--r--src/H5Fpublic.h14
-rw-r--r--src/H5Fquery.c109
-rw-r--r--src/H5Fsuper.c101
-rw-r--r--src/H5Gbtree2.c4
-rw-r--r--src/H5Gdense.c20
-rw-r--r--src/H5Gobj.c21
-rw-r--r--src/H5HFcache.c2
-rw-r--r--src/H5HFhdr.c8
-rw-r--r--src/H5O.c1
-rw-r--r--src/H5Oainfo.c5
-rw-r--r--src/H5Oattr.c24
-rw-r--r--src/H5Obogus.c5
-rw-r--r--src/H5Obtreek.c5
-rw-r--r--src/H5Ocache.c4
-rw-r--r--src/H5Ocache_image.c4
-rw-r--r--src/H5Ocont.c5
-rw-r--r--src/H5Ocopy.c30
-rw-r--r--src/H5Odrvinfo.c5
-rw-r--r--src/H5Odtype.c33
-rw-r--r--src/H5Oefl.c5
-rw-r--r--src/H5Ofill.c262
-rw-r--r--src/H5Ofsinfo.c6
-rw-r--r--src/H5Oginfo.c5
-rw-r--r--src/H5Oint.c62
-rw-r--r--src/H5Olinfo.c5
-rw-r--r--src/H5Olink.c5
-rw-r--r--src/H5Omessage.c4
-rw-r--r--src/H5Omtime.c10
-rw-r--r--src/H5Oname.c5
-rw-r--r--src/H5Opkg.h19
-rw-r--r--src/H5Opline.c144
-rw-r--r--src/H5Oprivate.h13
-rw-r--r--src/H5Orefcount.c5
-rw-r--r--src/H5Osdspace.c14
-rw-r--r--src/H5Oshared.c2
-rw-r--r--src/H5Oshared.h8
-rw-r--r--src/H5Oshmesg.c5
-rw-r--r--src/H5Ostab.c5
-rw-r--r--src/H5Pdcpl.c2
-rw-r--r--src/H5Pfapl.c355
-rw-r--r--src/H5S.c45
-rw-r--r--src/H5SM.c16
-rw-r--r--src/H5Spkg.h3
-rw-r--r--src/H5Sprivate.h2
-rw-r--r--src/H5T.c55
-rw-r--r--src/H5Tcommit.c29
-rw-r--r--src/H5Tpkg.h3
-rw-r--r--src/H5Tprivate.h4
-rw-r--r--src/H5trace.c1045
62 files changed, 1750 insertions, 1225 deletions
diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c
index ed67e0f..8b79aa5 100644
--- a/src/H5Abtree2.c
+++ b/src/H5Abtree2.c
@@ -158,7 +158,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
{
H5A_fh_ud_cmp_t *udata = (H5A_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
H5A_t *attr = NULL; /* Pointer to attribute created from heap object */
@@ -168,7 +168,7 @@ H5A__dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_ud
FUNC_ENTER_STATIC
/* Decode attribute information */
- if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj)))
+ if(NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute")
/* Compare the string values */
diff --git a/src/H5Adense.c b/src/H5Adense.c
index b1903a4..ba0578e 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -843,7 +843,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5A__dense_copy_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5A__dense_copy_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5A_fh_ud_cp_t *udata = (H5A_fh_ud_cp_t *)_udata; /* User data for fractal heap 'op' callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -857,7 +857,7 @@ H5A__dense_copy_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_uda
* HDF5 routine, it could attempt to re-protect that direct block for the
* heap, causing the HDF5 routine called to fail)
*/
- if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, (const unsigned char *)obj)))
+ if(NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute")
/* Set the creation order index for the attribute */
diff --git a/src/H5Aint.c b/src/H5Aint.c
index f1dd41e..55c46f6 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -102,6 +102,12 @@ static herr_t H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type
/* Package Variables */
/*********************/
+/* Format version bounds for attribute */
+const unsigned H5O_attr_ver_bounds[] = {
+ H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*****************************/
/* Library Private Variables */
@@ -209,18 +215,16 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
if(H5T_set_loc(attr->shared->dt, loc->oloc->file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
- /* Set the latest format for datatype, if requested */
- if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATATYPE))
- if(H5T_set_latest_version(attr->shared->dt) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of datatype")
+ /* Set the version for datatype */
+ if(H5T_set_version(loc->oloc->file, attr->shared->dt) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of datatype")
/* Copy the dataspace for the attribute */
attr->shared->ds = H5S_copy(space, FALSE, TRUE);
- /* Set the latest format for dataspace, if requested */
- if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATASPACE))
- if(H5S_set_latest_version(attr->shared->ds) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of dataspace")
+ /* Set the version for dataspace */
+ if(H5S_set_version(loc->oloc->file, attr->shared->ds) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace")
/* Copy the object header information */
if(H5O_loc_copy(&(attr->oloc), loc->oloc, H5_COPY_DEEP) < 0)
@@ -1843,11 +1847,11 @@ done:
* Function: H5A_set_version
*
* Purpose: Sets the correct version to encode attribute with.
- * Chooses the oldest version possible, unless the "use the
- * latest format" flag is set.
+ * 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
@@ -1859,8 +1863,8 @@ herr_t
H5A_set_version(const H5F_t *f, H5A_t *attr)
{
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
- hbool_t use_latest_format; /* Flag indicating the latest attribute version support is enabled */
- herr_t ret_value = SUCCEED; /* Return value */
+ uint8_t version; /* Message version */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1868,9 +1872,6 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
HDassert(f);
HDassert(attr);
- /* Get the file's 'use the latest attribute version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ATTRIBUTE);
-
/* Check whether datatype and dataspace are shared */
if(H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0)
type_shared = TRUE;
@@ -1883,14 +1884,22 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
space_shared = FALSE;
/* Check which version to encode attribute with */
- if(use_latest_format)
- attr->shared->version = H5O_ATTR_VERSION_LATEST; /* Write out latest attribute version */
- else if(attr->shared->encoding != H5T_CSET_ASCII)
- attr->shared->version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
+ if(attr->shared->encoding != H5T_CSET_ASCII)
+ version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
else if(type_shared || space_shared)
- attr->shared->version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
+ version = H5O_ATTR_VERSION_2; /* Write out version with flag for indicating shared datatype or dataspace */
else
- attr->shared->version = H5O_ATTR_VERSION_1; /* Write out basic version */
+ version = H5O_ATTR_VERSION_1; /* Write out basic version */
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(version, (uint8_t)H5O_attr_ver_bounds[H5F_LOW_BOUND(f)]);
+
+ /* Version bounds check */
+ if(version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_ATTR, H5E_BADRANGE, FAIL, "attribute version out of bounds")
+
+ /* Set the message version */
+ attr->shared->version = version;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index 53d1712..be2560f 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -1382,9 +1382,12 @@ H5C__prep_image_for_file_close(H5F_t *f, hid_t dxpl_id, hbool_t *image_generated
* Note that under some error conditions, the superblock will be
* undefined in this case as well -- if so, assume that the
* superblock does not support superblock extension messages.
+ * Also verify that the file's high_bound is at least release
+ * 1.10.x, otherwise cancel the request for a cache image
*/
if((NULL == f->shared->sblock) ||
- (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2)) {
+ (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) ||
+ (f->shared->high_bound < H5F_LIBVER_V110)) {
H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL;
cache_ptr->image_ctl = default_image_ctl;
diff --git a/src/H5Dint.c b/src/H5Dint.c
index e45b04d..17b989e 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -623,10 +623,10 @@ done:
static herr_t
H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
{
- htri_t relocatable; /* Flag whether the type is relocatable */
- htri_t immutable; /* Flag whether the type is immutable */
- hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */
- herr_t ret_value = SUCCEED; /* Return value */
+ htri_t relocatable; /* Flag whether the type is relocatable */
+ htri_t immutable; /* Flag whether the type is immutable */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -643,17 +643,17 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if((immutable = H5T_is_immutable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
- /* Get the file's 'use the latest datatype version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE);
+ /* To use at least v18 format versions or not */
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
/* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
- if(!immutable || relocatable || use_latest_format) {
+ if(!immutable || relocatable || use_at_least_v18) {
/* Copy datatype for dataset */
if((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype")
- /* Convert a datatype (if committed) to a transient type if the committed datatype's file
- location is different from the file location where the dataset will be created */
+ /* Convert a datatype (if committed) to a transient type if the committed datatype's file
+ location is different from the file location where the dataset will be created */
if(H5T_convert_committed_datatype(dset->shared->type, file) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info")
@@ -661,14 +661,13 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if(H5T_set_loc(dset->shared->type, file, H5T_LOC_DISK) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location")
- /* Set the latest format, if requested */
- if(use_latest_format)
- if(H5T_set_latest_version(dset->shared->type) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for datatype */
+ if(H5T_set_version(file, dset->shared->type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype")
/* Get a datatype ID for the dataset's datatype */
- if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
+ if((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type")
} /* end if */
/* Not a custom datatype, just use it directly */
else {
@@ -738,7 +737,6 @@ done:
static herr_t
H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
{
- hbool_t use_latest_format; /* Flag indicating the 'latest dataspace version support' is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -748,9 +746,6 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
HDassert(dset);
HDassert(space);
- /* Get the file's 'use the latest dataspace version support' flag */
- use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATASPACE);
-
/* Copy dataspace for dataset */
if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace")
@@ -759,10 +754,9 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
if(H5D__cache_dataspace_info(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info")
- /* Set the latest format, if requested */
- if(use_latest_format)
- if(H5S_set_latest_version(dset->shared->space) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for dataspace */
+ if(H5S_set_version(file, dset->shared->space) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
/* Set the dataset's dataspace to 'all' selection */
if(H5S_select_all(dset->shared->space, TRUE) < 0)
@@ -794,6 +788,7 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
H5D_fill_value_t fill_status; /* Fill value status */
hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -808,6 +803,9 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
type = dset->shared->type;
fill_prop = &dset->shared->dcpl_cache.fill;
+ /* To use at least v18 format versions or not */
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
+
/* Retrieve "defined" status of fill value */
if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
@@ -886,8 +884,8 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
/* If there is valid information for the old fill value struct, add it */
- /* (only if we aren't trying to write the 'latest fill message version support') */
- if(fill_prop->buf && !(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))) {
+ /* (only if we aren't using v18 format versions and above */
+ if(fill_prop->buf && !use_at_least_v18) {
H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
/* Shallow copy the fill value property */
@@ -922,27 +920,27 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
(H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) {
uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */
- unsigned bogus_id; /* "bogus" ID */
+ unsigned bogus_id; /* "bogus" ID */
- /* Retrieve "bogus" message ID */
+ /* Retrieve "bogus" message ID */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options")
/* Retrieve "bogus" message flags */
if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options")
/* Add a "bogus" message (for error testing). */
- if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
+ if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message")
} /* end if */
}
#endif /* H5O_ENABLE_BOGUS */
/* Add a modification time message, if using older format. */
- /* (If using the latest 'no modification time message' version support, the modification time is part of the object
+ /* (If using v18 format versions and above, the the modification time is part of the object
* header and doesn't use a separate message -QAK)
*/
- if(!(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_NO_MOD_TIME_MSG)))
+ if(!use_at_least_v18)
if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
@@ -1174,27 +1172,20 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation")
} /* end if */
- /* Set the latest version of the layout, pline & fill messages, if requested */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) {
- /* Set the latest version for the I/O pipeline message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG))
- if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
+ /* Set the version for the I/O pipeline message */
+ if(H5O_pline_set_version(file, &new_dset->shared->dcpl_cache.pline) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
- /* Set the latest version for the fill message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))
- /* Set the latest version for the fill value message */
- if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
+ /* Set the version for the fill message */
+ if(H5O_fill_set_version(file, &new_dset->shared->dcpl_cache.fill) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
- /* Set the latest version for the layout message */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG))
- /* Set the latest version for the layout message */
- if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
+ /* Set the latest version for the layout message */
+ if(H5D__layout_set_version(file, &new_dset->shared->layout) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
- } /* end if */
- else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
- /* Use latest indexing type for layout message version >= 4 */
+
+ if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
+ /* Use latest indexing type for layout message version >= 4 */
if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing")
} /* end if */
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index ec18e86..980b810 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -46,6 +46,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 */
@@ -57,6 +63,7 @@
/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5D__layout_set_io_ops
@@ -277,49 +284,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
*
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 45f2d3a..78705c7 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -562,6 +562,9 @@ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BT2[1];
H5_DLLVAR const H5B2_class_t H5D_BT2[1];
H5_DLLVAR const H5B2_class_t H5D_BT2_FILT[1];
+/* Array of versions for Layout */
+H5_DLLVAR const unsigned H5O_layout_ver_bounds[H5F_LIBVER_NBOUNDS];
+
/******************************/
/* Package Private Prototypes */
diff --git a/src/H5F.c b/src/H5F.c
index f435502..8e5f65a 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1477,7 +1477,8 @@ H5Fstart_swmr_write(hid_t file_id)
if(file->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version should be at least 3")
- HDassert((file->shared->latest_flags | H5F_LATEST_LAYOUT_MSG) > 0);
+
+ HDassert((file->shared->low_bound == H5F_LIBVER_V110) && (file->shared->high_bound == H5F_LIBVER_V110));
/* Should not be marked for SWMR writing mode already */
if(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)
@@ -1740,41 +1741,36 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5Fset_latest_format
+ * Function: H5Fset_libver_bounds
*
- * Purpose: Enable switching the "latest format" flag while a file is open.
+ * Purpose: Set to a different low and high bounds while a file is open.
+ * This public routine is introduced in place of
+ * H5Fset_latest_format() starting release 1.10.2.
+ * See explanation for H5Fset_latest_format() in H5Fdeprec.c.
*
* Return: Non-negative on success/Negative on failure
*-------------------------------------------------------------------------
*/
herr_t
-H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
+H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
H5F_t *f; /* File */
- unsigned latest_flags; /* Latest format flags for file */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE2("e", "ib", file_id, latest_format);
+ H5TRACE3("e", "iFvFv", file_id, low, high);
/* Check args */
if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
- /* Check if the value is changing */
- latest_flags = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ALL_FLAGS);
- if(latest_format != (H5F_LATEST_ALL_FLAGS == latest_flags)) {
- /* Call the flush routine, for this file */
- if(H5F__flush(f, H5AC_ind_read_dxpl_id, H5AC_rawdata_dxpl_id, FALSE) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
-
- /* Toggle the 'latest format' flag */
- H5F_SET_LATEST_FLAGS(f, latest_format ? H5F_LATEST_ALL_FLAGS : 0);
- } /* end if */
+ /* Call private set_libver_bounds function */
+ if(H5F_set_libver_bounds(f, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5Fset_latest_format() */
+} /* end H5Fset_libver_bounds() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index 03f5df8..a9ffa43 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -143,5 +143,67 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_info1() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fset_latest_format
+ *
+ * Purpose: Enable switching between latest or non-latest format while
+ * a file is open.
+ * This is deprecated starting release 1.10.2 and is modified
+ * to call the private H5F_set_libver_bounds() to set the
+ * bounds.
+ *
+ * Before release 1.10.2, the library supports only two
+ * combinations of low/high bounds:
+ * (earliest, latest)
+ * (latest, latest)
+ * Thus, this public routine does the job in switching
+ * between the two combinations listed above.
+ *
+ * Starting release 1.10.2, we add v18 to the enumerated
+ * define H5F_libver_t and the library supports five combinations
+ * as below:
+ * (earliest, v18)
+ * (earliest, v10)
+ * (v18, v18)
+ * (v18, v10)
+ * (v10, v10)
+ * So we introduce the new public routine H5Fset_libver_bounds()
+ * in place of H5Fset_latest_format().
+ * See also RFC: Setting Bounds for Object Creation in HDF5 1.10.0.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Vailin Choi; December 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
+{
+ H5F_t *f; /* File */
+ H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
+ H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", file_id, latest_format);
+
+ /* Check args */
+ if(NULL == (f = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* 'low' and 'high' are both initialized to LATEST.
+ If latest format is not expected, set 'low' to EARLIEST */
+ if(!latest_format)
+ low = H5F_LIBVER_EARLIEST;
+
+ /* Call private set_libver_bounds function to set the bounds */
+ if(H5F_set_libver_bounds(f, low, high) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fset_latest_format() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Ffake.c b/src/H5Ffake.c
index 86c4a3d..6072f2e 100644
--- a/src/H5Ffake.c
+++ b/src/H5Ffake.c
@@ -15,10 +15,9 @@
/* Packages needed by this file... */
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Fpkg.h" /* File access */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* File access */
/* PRIVATE PROTOTYPES */
@@ -41,11 +40,9 @@
*-------------------------------------------------------------------------
*/
H5F_t *
-H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id)
+H5F_fake_alloc(uint8_t sizeof_size)
{
H5F_t *f = NULL; /* Pointer to fake file struct */
- H5P_genplist_t *plist; /* Property list */
- hbool_t latest;
H5F_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -62,16 +59,6 @@ H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id)
else
f->shared->sizeof_size = sizeof_size;
- /* Activate latest version support according to the setting in fapl_id */
- /* See H5F_new() in H5Fint.c */
- if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list")
-
- if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag")
- if(latest)
- f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
-
/* Set return value */
ret_value = f;
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 4ef8e85..c41453a 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -161,10 +161,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size")
if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size")
- if(f->shared->latest_flags > 0)
- latest_format = TRUE;
- if(H5P_set(new_plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'latest format' flag")
+ if(H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'low' bound for library format versions")
+ if(H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'high' bound for library format versions")
if(H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'read attempts ' flag")
if(H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0)
@@ -902,13 +902,10 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference")
if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
- if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag")
- /* For latest format or SWMR_WRITE, activate all latest version support */
- if(latest_format)
- f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
- else if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- f->shared->latest_flags |= H5F_LATEST_LAYOUT_MSG;
+ if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &(f->shared->low_bound)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions")
+ if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &(f->shared->high_bound)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions")
if(H5P_get(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &(f->shared->use_mdc_logging)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'use mdc logging' flag")
if(H5P_get(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &(f->shared->start_mdc_log_on_access)) < 0)
@@ -2571,7 +2568,39 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5F_set_store_msg_crt_idx() */
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_libver_bounds()
+ *
+ * Purpose: Set the file's low and high bound to the input parameters
+ * 'low' and 'high' respectively.
+ * This is done only if the existing setting is different
+ * from the inputs.
+ *
+ * Return: SUCCEED on success, and FAIL on failure.
+ *
+ * Programmer: Vailin Choi; December 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_libver_bounds(H5F_t * f, H5F_libver_t low, H5F_libver_t high)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* Sanity checks */
+ HDassert(f);
+ HDassert(f->shared);
+
+ /* Set the bounds only if the existing setting is different from the inputs */
+ if(f->shared->low_bound != low || f->shared->high_bound != high) {
+ f->shared->low_bound = low;
+ f->shared->high_bound = high;
+ }
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_libver_bounds() */
+
+
/*-------------------------------------------------------------------------
* Function: H5F_get_file_image
*
@@ -2908,30 +2937,3 @@ H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr)
FUNC_LEAVE_NOAPI_VOID
} /* H5F_set_coll_md_read() */
#endif /* H5_HAVE_PARALLEL */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_set_latest_flags
- *
- * Purpose: Set the latest_flags field with a new value.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F_set_latest_flags(H5F_t *f, unsigned flags)
-{
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
- HDassert(0 == ((flags) & ~H5F_LATEST_ALL_FLAGS));
-
- f->shared->latest_flags = flags;
-
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5F_set_latest_flags() */
-
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index b50b4e5..c9aba56 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -300,7 +300,8 @@ struct H5F_file_t {
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Alignment */
unsigned gc_ref; /* Garbage-collect references? */
- unsigned latest_flags; /* The latest version support */
+ H5F_libver_t low_bound; /* The 'low' bound of library format versions */
+ H5F_libver_t high_bound; /* The 'high' bound of library format versions */
hbool_t store_msg_crt_idx; /* Store creation index for object header messages? */
unsigned ncwfs; /* Num entries on cwfs list */
struct H5HG_heap_t **cwfs; /* Global heap cache */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 2410a83..856e618 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -275,6 +275,8 @@ typedef struct H5F_t H5F_t;
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5F_MODULE
+#define H5F_LOW_BOUND(F) ((F)->shared->low_bound)
+#define H5F_HIGH_BOUND(F) ((F)->shared->high_bound)
#define H5F_INTENT(F) ((F)->shared->flags)
#define H5F_OPEN_NAME(F) ((F)->open_name)
#define H5F_ACTUAL_NAME(F) ((F)->actual_name)
@@ -311,15 +313,12 @@ typedef struct H5F_t H5F_t;
#define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0)
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
-#define H5F_USE_LATEST_FLAGS(F,FL) ((F)->shared->latest_flags & (FL))
-#define H5F_GET_LATEST_FLAGS(F) ((F)->shared->latest_flags)
#define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx)
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL)
#define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space)
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR)))
-#define H5F_SET_LATEST_FLAGS(F, FL) ((F)->shared->latest_flags = (FL))
#ifdef H5_HAVE_PARALLEL
#define H5F_COLL_MD_READ(F) ((F)->coll_md_read)
#endif /* H5_HAVE_PARALLEL */
@@ -333,6 +332,8 @@ typedef struct H5F_t H5F_t;
#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc)
#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc)
#else /* H5F_MODULE */
+#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
+#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
#define H5F_INTENT(F) (H5F_get_intent(F))
#define H5F_OPEN_NAME(F) (H5F_get_open_name(F))
#define H5F_ACTUAL_NAME(F) (H5F_get_actual_name(F))
@@ -369,15 +370,12 @@ typedef struct H5F_t H5F_t;
#define H5F_RDCC_W0(F) (H5F_rdcc_w0(F))
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
#define H5F_GC_REF(F) (H5F_gc_ref(F))
-#define H5F_USE_LATEST_FLAGS(F,FL) (H5F_use_latest_flags(F,FL))
-#define H5F_GET_LATEST_FLAGS(F) (H5F_get_latest_flags(F))
#define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL)))
#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
#define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC)))
#define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F))
#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR)))
-#define H5F_SET_LATEST_FLAGS(F, FL) (H5F_set_latest_flags((F), (FL)))
#ifdef H5_HAVE_PARALLEL
#define H5F_COLL_MD_READ(F) (H5F_coll_md_read(F))
#endif /* H5_HAVE_PARALLEL */
@@ -486,7 +484,8 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */
#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */
#define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */
-#define H5F_ACS_LATEST_FORMAT_NAME "latest_format" /* 'Use latest format version' flag */
+#define H5F_ACS_LIBVER_LOW_BOUND_NAME "libver_low_bound" /* 'low' bound of library format versions */
+#define H5F_ACS_LIBVER_HIGH_BOUND_NAME "libver_high_bound" /* 'high' bound of library format versions */
#define H5F_ACS_WANT_POSIX_FD_NAME "want_posix_fd" /* Internal: query the file descriptor from the core VFD, instead of the memory address */
#define H5F_ACS_METADATA_READ_ATTEMPTS_NAME "metadata_read_attempts" /* # of metadata read attempts */
#define H5F_ACS_OBJECT_FLUSH_CB_NAME "object_flush_cb" /* Object flush callback */
@@ -631,24 +630,6 @@ typedef struct H5F_t H5F_t;
#define H5SM_TABLE_MAGIC "SMTB" /* Shared Message Table */
#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
-
-/* Latest format will activate the following latest version support */
-/* "latest_flags" in H5F_file_t */
-#define H5F_LATEST_DATATYPE 0x0001
-#define H5F_LATEST_DATASPACE 0x0002
-#define H5F_LATEST_ATTRIBUTE 0x0004
-#define H5F_LATEST_FILL_MSG 0x0008
-#define H5F_LATEST_PLINE_MSG 0x0010
-#define H5F_LATEST_LAYOUT_MSG 0x0020
-#define H5F_LATEST_NO_MOD_TIME_MSG 0x0040
-#define H5F_LATEST_STYLE_GROUP 0x0080
-#define H5F_LATEST_OBJ_HEADER 0x0100
-#define H5F_LATEST_SUPERBLOCK 0x0200
-#define H5F_LATEST_DATASPACE_SELECTION 0x0400
-#define H5F_LATEST_ALL_FLAGS (H5F_LATEST_DATATYPE | H5F_LATEST_DATASPACE | H5F_LATEST_ATTRIBUTE | H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG | H5F_LATEST_NO_MOD_TIME_MSG | H5F_LATEST_STYLE_GROUP | H5F_LATEST_OBJ_HEADER | H5F_LATEST_SUPERBLOCK | H5F_LATEST_DATASPACE_SELECTION)
-
-#define H5F_LATEST_DSET_MSG_FLAGS (H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG)
-
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -739,7 +720,9 @@ H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, hid_t dxpl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed/*out*/);
-/* Functions than retrieve values from the file struct */
+/* Functions that retrieve values from the file struct */
+H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
+H5_DLL H5F_libver_t H5F_get_high_bound(const H5F_t *f);
H5_DLL unsigned H5F_get_intent(const H5F_t *f);
H5_DLL char *H5F_get_open_name(const H5F_t *f);
H5_DLL char *H5F_get_actual_name(const H5F_t *f);
@@ -786,11 +769,11 @@ H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
+H5_DLL herr_t H5F_set_libver_bounds(H5F_t * f, H5F_libver_t low, H5F_libver_t high);
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc);
H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f);
H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr);
-H5_DLL herr_t H5F_set_latest_flags(H5F_t *f, unsigned flags);
H5_DLL hsize_t H5F_get_alignment(const H5F_t *f);
H5_DLL hsize_t H5F_get_threshold(const H5F_t *f);
#ifdef H5_HAVE_PARALLEL
@@ -844,7 +827,7 @@ H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *ad
H5_DLL void H5F_sfile_assert_num(unsigned n);
/* Routines for creating & destroying "fake" file structures */
-H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size, hid_t fapl_id);
+H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size);
H5_DLL herr_t H5F_fake_free(H5F_t *f);
/* Superblock related routines */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 1594cb2..d333fa7 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -173,12 +173,17 @@ typedef struct H5F_sect_info_t {
hsize_t size; /* Size of free space section */
} H5F_sect_info_t;
-/* Library's file format versions */
+/* Library's format versions */
typedef enum H5F_libver_t {
- H5F_LIBVER_EARLIEST, /* Use the earliest possible format for storing objects */
- H5F_LIBVER_LATEST /* Use the latest possible format available for storing objects*/
+ H5F_LIBVER_ERROR = -1,
+ H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */
+ H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */
+ H5F_LIBVER_V110 = 2, /* Use the latest v10 format for storing objects */
+ H5F_LIBVER_NBOUNDS
} H5F_libver_t;
+#define H5F_LIBVER_LATEST H5F_LIBVER_V110
+
/* File space handling strategy */
typedef enum H5F_fspace_strategy_t {
H5F_FSPACE_STRATEGY_FSM_AGGR = 0, /* Mechanisms: free-space managers, aggregators, and virtual file drivers */
@@ -255,7 +260,7 @@ H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id);
H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type,
size_t nsects, H5F_sect_info_t *sect_info/*out*/);
H5_DLL herr_t H5Fclear_elink_file_cache(hid_t file_id);
-H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
+H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
H5_DLL herr_t H5Fstart_mdc_logging(hid_t file_id);
H5_DLL herr_t H5Fstop_mdc_logging(hid_t file_id);
H5_DLL herr_t H5Fget_mdc_logging_status(hid_t file_id,
@@ -295,6 +300,7 @@ typedef struct H5F_info1_t {
/* Function prototypes */
H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo);
+H5_DLL herr_t H5Fset_latest_format(hid_t file_id, hbool_t latest_format);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 235a26d..6f4febc 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -97,6 +97,56 @@ H5F_get_intent(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_low_bound
+ *
+ * Purpose: Quick and dirty routine to retrieve the file's low_bound.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
+ *
+ * Return: low_bound on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Vailin Choi; June 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_libver_t
+H5F_get_low_bound(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->shared->low_bound)
+} /* end H5F_get_low_bound() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5F_get_high_bound
+ *
+ * Purpose: Quick and dirty routine to retrieve the file's high_bound.
+ * (Mainly added to stop non-file routines from poking about in the
+ * H5F_t data structure)
+ *
+ * Return: high_bound on success/abort on failure (shouldn't fail)
+ *
+ * Programmer: Vailin Choi; June 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+H5F_libver_t
+H5F_get_high_bound(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->shared->high_bound)
+} /* end H5F_get_high_bound() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_open_name
*
* Purpose: Retrieve the name used to open a file.
@@ -667,9 +717,13 @@ H5F_sieve_buf_size(const H5F_t *f)
* references flag" now that the generic properties are being used
* to store the values.
*
- * Return: Success: The "garbage collect references flag"
- * is returned.
- * Failure: (should not happen)
+ * Return: Success: The "garbage collect references flag" is returned.
+ * Failure: (should not happen)
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Jul 8 2005
+ *
*-------------------------------------------------------------------------
*/
unsigned
@@ -686,55 +740,6 @@ H5F_gc_ref(const H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F_use_latest_flags
- *
- * Purpose: Retrieve the requested 'latest version support' for the file.
- *
- * Return: Success: Non-negative, the requested 'version support'
- * Failure: (can't happen)
- *-------------------------------------------------------------------------
- */
-unsigned
-H5F_use_latest_flags(const H5F_t *f, unsigned fl)
-{
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(f);
- HDassert(f->shared);
-
- FUNC_LEAVE_NOAPI(f->shared->latest_flags & (fl))
-} /* end H5F_use_latest_flags() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F_get_latest_flags
- *
- * Purpose: Retrieve the 'latest version support' setting for the file.
- *
- * Return: Success: Non-negative
- * Failure: (can't happen)
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Mar 5 2007
- *
- *-------------------------------------------------------------------------
- */
-unsigned
-H5F_get_latest_flags(const H5F_t *f)
-{
- /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
- FUNC_ENTER_NOAPI_NOINIT_NOERR
-
- HDassert(f);
- HDassert(f->shared);
-
- FUNC_LEAVE_NOAPI(f->shared->latest_flags)
-} /* end H5F_get_latest_flags() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_get_fc_degree
*
* Purpose: Retrieve the 'file close degree' for the file.
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 0c6f9cd..4250ff0 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -59,7 +59,6 @@ static herr_t H5F__update_super_ext_driver_msg(H5F_t *f, hid_t dxpl_id);
/* Package Variables */
/*********************/
-
/*****************************/
/* Library Private Variables */
/*****************************/
@@ -72,6 +71,12 @@ H5FL_DEFINE(H5F_super_t);
/* Local Variables */
/*******************/
+/* Format version bounds for superblock */
+static const unsigned HDF5_superblock_ver_bounds[] = {
+ HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */
+ HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */
+ HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*-------------------------------------------------------------------------
@@ -452,13 +457,46 @@ H5F__super_read(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t initial
if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, meta_dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags)))
HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock")
- if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
- HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "invalid superblock version for SWMR_WRITE")
+ /*
+ * When opening a file with SWMR-write access, the library will first
+ * check to ensure that superblock version 3 is used. Otherwise fail
+ * file open.
+ *
+ * Then the library will upgrade the file's low_bound depending on
+ * superblock version as follows:
+ * --version 0 or 1: no change to low_bound
+ * --version 2: upgrade low_bound to at least V18
+ * --version 3: upgrade low_bound to at least V110
+ *
+ * Upgrading low_bound will give the best format versions available for
+ * that superblock version. Due to the possible upgrade, the fapl returned
+ * from H5Fget_access_plist() might indicate a low_bound higher than what
+ * the user originally set.
+ *
+ * After upgrading low_bound, the library will check to ensure that the
+ * superblock version does not exceed the version allowed by high_bound.
+ * Otherise fail file open.
+ *
+ * For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0.
+ */
+
+ /* Check to ensure that superblock version 3 is used for SWMR-write access */
+ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) {
+ if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version for SWMR is less than 3")
+ }
- /* Enable all latest version support when file has v3 superblock */
+ /* Upgrade low_bound to at least V18 when encountering version 2 superblock */
+ if(sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2)
+ f->shared->low_bound = MAX(H5F_LIBVER_V18, f->shared->low_bound);
+
+ /* Upgrade low_bound to at least V110 when encountering version 3 superblock */
if(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3)
- f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
+ f->shared->low_bound = MAX(H5F_LIBVER_V110, f->shared->low_bound);
+
+ /* Version bounds check */
+ if(sblock->super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound])
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version exceeds high bound")
/* Pin the superblock in the cache */
if(H5AC_pin_protected_entry(sblock) < 0)
@@ -1018,14 +1056,42 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF))
non_default_fs_settings = TRUE;
- /* Bump superblock version if latest superblock version support is enabled */
- if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_SUPERBLOCK))
- super_vers = HDF5_SUPERBLOCK_VERSION_LATEST;
- /* Bump superblock version to use version 3 superblock for SWMR writing */
- else if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE))
+ /*
+ * When creating a file with write access, the library will:
+ * -- set superblock version to 0, 1 or 2 based on feature enabled
+ * -- no change to low_bound
+ * When creating a file with SWMR-write access, the library will:
+ * (See explanation (#) below.)
+ * -- set superblock version to 3
+ * -- upgrade low_bound to at least V110
+ *
+ * Then the library will finalize superblock version to that allowed by
+ * low_bound if that is higher.
+ * Lastly, the library will check to ensure the superblock version does not
+ * exceed the version allowed by high_bound. Otherwise fail file open.
+ *
+ * For details, please see RFC:Setting Bounds for Object Creation in HDF5 1.10.0.
+ *
+ * (#)
+ * Version 3 superblock is introduced in 1.10 for SWMR due to the problem of
+ * the status_flags field in the superblock. The problem is discussed in
+ * jira issue SWMR-79 and also in the RFC: File Format Changes in HDF5 1.10.0.
+ * The file's low_bound is upgraded for SWMR so that the library will
+ * use the best format versions available in 1.10.
+ * Due to the possible upgrade, the fapl returned from H5Fget_access_plist()
+ * might indicate a low_bound higher than what the user originally set.
+ */
+
+ /*
+ * Creating a file with SWMR-write access will
+ * upgrade superblock version and low_bound
+ */
+ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) {
super_vers = HDF5_SUPERBLOCK_VERSION_3;
+ f->shared->low_bound = MAX(H5F_LIBVER_V110, f->shared->low_bound);
+
/* Bump superblock version to create superblock extension for SOHM info */
- else if(f->shared->sohm_nindexes > 0)
+ } else if(f->shared->sohm_nindexes > 0)
super_vers = HDF5_SUPERBLOCK_VERSION_2;
/*
* Bump superblock version to create superblock extension for:
@@ -1043,6 +1109,13 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
else if(sblock->btree_k[H5B_CHUNK_ID] != HDF5_BTREE_CHUNK_IK_DEF)
super_vers = HDF5_SUPERBLOCK_VERSION_1;
+ /* Finalize superblock version to that allowed by the file's low bound if higher */
+ super_vers = MAX(super_vers, HDF5_superblock_ver_bounds[f->shared->low_bound]);
+
+ /* Version bounds check */
+ if(super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound])
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version out of bounds")
+
/* If a newer superblock version is required, set it here */
if(super_vers != HDF5_SUPERBLOCK_VERSION_DEF) {
H5P_genplist_t *c_plist; /* Property list */
@@ -1067,8 +1140,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
/* Sanity check the userblock size vs. the file's allocation alignment */
if(userblock_size > 0) {
- /* Set up the alignment to use for page or aggr fs */
- hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment;
+ /* Set up the alignment to use for page or aggr fs */
+ hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment;
if(userblock_size < alignment)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment")
diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c
index 71d15e5..4702c46 100644
--- a/src/H5Gbtree2.c
+++ b/src/H5Gbtree2.c
@@ -155,7 +155,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_cmp_t *udata = (H5G_fh_ud_cmp_t *)_udata; /* User data for 'op' callback */
H5O_link_t *lnk; /* Pointer to link created from heap object */
@@ -164,7 +164,7 @@ H5G_dense_fh_name_cmp(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_uda
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Compare the string values */
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 4ae6800..de11541 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -599,7 +599,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_lbi_t *udata = (H5G_fh_ud_lbi_t *)_udata; /* User data for fractal heap 'op' callback */
H5O_link_t *tmp_lnk = NULL; /* Temporary pointer to link */
@@ -608,7 +608,7 @@ H5G_dense_lookup_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, vo
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information & keep a copy */
- if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Copy link information */
@@ -889,7 +889,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_iterate_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_it_t *udata = (H5G_fh_ud_it_t *)_udata; /* User data for fractal heap 'op' callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -903,7 +903,7 @@ H5G_dense_iterate_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_u
* HDF5 routine, it could attempt to re-protect that direct block for the
* heap, causing the HDF5 routine called to fail - QAK)
*/
- if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
done:
@@ -1101,7 +1101,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_gnbi_t *udata = (H5G_fh_ud_gnbi_t *)_udata; /* User data for fractal heap 'op' callback */
H5O_link_t *lnk; /* Pointer to link created from heap object */
@@ -1110,7 +1110,7 @@ H5G_dense_get_name_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len,
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Get the length of the name */
@@ -1308,7 +1308,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_remove_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_rm_t *udata = (H5G_fh_ud_rm_t *)_udata; /* User data for fractal heap 'op' callback */
H5O_link_t *lnk = NULL; /* Pointer to link created from heap object */
@@ -1318,7 +1318,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_ud
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Check for removing the link from the creation order index */
@@ -1485,7 +1485,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, void *_udata)
+H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
{
H5G_fh_ud_rmbi_t *udata = (H5G_fh_ud_rmbi_t *)_udata; /* User data for fractal heap 'op' callback */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1493,7 +1493,7 @@ H5G_dense_remove_by_idx_fh_cb(const void *obj, size_t H5_ATTR_UNUSED obj_len, vo
FUNC_ENTER_NOAPI_NOINIT
/* Decode link information */
- if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, (const unsigned char *)obj)))
+ if(NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, udata->dxpl_id, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj)))
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link")
/* Can't operate on link here because the fractal heap block is locked */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index d2dc83b..5f9bdc8 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -185,7 +185,7 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc/*out*/)
{
size_t hdr_size; /* Size of object header to request */
- hbool_t use_latest_format; /* Flag indicating the new group format should be used */
+ hbool_t use_at_least_v18; /* Flag indicating the new group format should be used */
hid_t gcpl_id = gcrt_info->gcpl_id; /* Group creation property list ID */
herr_t ret_value = SUCCEED; /* Return value */
@@ -202,24 +202,23 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for invalid access request */
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
- /* Check for using the latest version of the group format */
+ /* Check for using the latest version of the group format which is introduced in v18 */
/* (add more checks for creating "new format" groups when needed) */
- if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_STYLE_GROUP) || linfo->track_corder
- || (pline && pline->nused))
- use_latest_format = TRUE;
+ if((H5F_LOW_BOUND(f) >= H5F_LIBVER_V18) || linfo->track_corder || (pline && pline->nused))
+ use_at_least_v18 = TRUE;
else
- use_latest_format = FALSE;
+ use_at_least_v18 = FALSE;
/* Make certain that the creation order is being tracked if an index is
* going to be built on it.
*/
if(linfo->index_corder && !linfo->track_corder)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it")
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it")
/* Check if we should be using the latest version of the group format */
- if(use_latest_format) {
+ if(use_at_least_v18) {
H5O_link_t lnk; /* Temporary link message info for computing message size */
char null_char = '\0'; /* Character for creating null string */
size_t ginfo_size; /* Size of the group info message */
@@ -262,10 +261,10 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
* incremented if the object is added to the group directed graph.
*/
if(H5O_create(f, dxpl_id, hdr_size, (size_t)1, gcpl_id, oloc/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header")
/* Check for format of group to create */
- if(use_latest_format) {
+ if(use_at_least_v18) {
/* Insert link info message */
/* (Casting away const OK - QAK) */
if(H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo, dxpl_id) < 0)
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 069bf17..c940161 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -572,7 +572,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata,
UINT32DECODE(image, hdr->pline_root_direct_filter_mask);
/* Decode I/O filter information */
- if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, udata->dxpl_id, NULL, H5O_PLINE_ID, image)))
+ if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, udata->dxpl_id, NULL, H5O_PLINE_ID, len, image)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
/* Advance past filter info to checksum */
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 2f01ce6..89b3b47 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -424,11 +424,9 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
if(NULL == H5O_msg_copy(H5O_PLINE_ID, &(cparam->pline), &(hdr->pline)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
- /* Pay attention to the latest version flag for the file */
- if(H5F_USE_LATEST_FLAGS(hdr->f, H5F_LATEST_PLINE_MSG))
- /* Set the latest version for the I/O pipeline message */
- if(H5O_pline_set_latest_version(&(hdr->pline)) < 0)
- HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline")
+ /* Set the version for the I/O pipeline message */
+ if(H5O_pline_set_version(hdr->f, &(hdr->pline)) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set version of I/O filter pipeline")
/* Compute the I/O filters' encoded size */
if(0 == (hdr->filter_len = (unsigned)H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline))))
diff --git a/src/H5O.c b/src/H5O.c
index cf84b47..109bf99 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -72,7 +72,6 @@
/* Local Variables */
/*******************/
-
/*-------------------------------------------------------------------------
* Function: H5Oopen
diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c
index d8298a4..b85337a 100644
--- a/src/H5Oainfo.c
+++ b/src/H5Oainfo.c
@@ -35,7 +35,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_ainfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_ainfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_ainfo_copy(const void *_mesg, void *_dest);
static size_t H5O_ainfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -105,7 +105,8 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t);
*/
static void *
H5O_ainfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_ainfo_t *ainfo = NULL; /* Attribute info */
unsigned char flags; /* Flags for encoding attribute info */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index cb802ea..79a0a52 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -26,7 +26,7 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static void *H5O_attr_copy(const void *_mesg, void *_dest);
static size_t H5O_attr_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_attr_free(void *mesg);
@@ -121,7 +121,7 @@ H5FL_EXTERN(H5S_extent_t);
--------------------------------------------------------------------------*/
static void *
H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned *ioflags, const uint8_t *p)
+ unsigned *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5A_t *attr = NULL;
H5S_extent_t *extent; /*extent dimensionality information */
@@ -185,7 +185,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Decode the attribute's datatype */
if(NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)))
+ ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->dt_size, p)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
if(attr->shared->version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(attr->shared->dt_size);
@@ -200,7 +200,7 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
/* Decode attribute's dataspace extent */
if((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)(f, dxpl_id, open_oh,
- ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, p)) == NULL)
+ ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->ds_size, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information to the dataspace */
@@ -622,14 +622,23 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED *native_src,
+H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src,
hbool_t *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
{
- FUNC_ENTER_NOAPI_NOINIT_NOERR
+ const H5A_t *attr_src = (const H5A_t *)native_src; /* Source attribute */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
/* check args */
HDassert(deleted);
HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds")
/* If we are not copying attributes into the destination file, indicate
* that this message should be deleted.
@@ -637,7 +646,8 @@ H5O_attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSED
if(cpy_info->copy_without_attr)
*deleted = TRUE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_pre_copy_file() */
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index a3531ed..02e0e6a 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -38,7 +38,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_bogus_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O_bogus_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream,
@@ -111,7 +111,8 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
*/
static void *
H5O_bogus_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_bogus_t *mesg = NULL;
void *ret_value; /* Return value */
diff --git a/src/H5Obtreek.c b/src/H5Obtreek.c
index 4fd0577..1d2b607 100644
--- a/src/H5Obtreek.c
+++ b/src/H5Obtreek.c
@@ -28,7 +28,7 @@
#include "H5MMprivate.h" /* Memory management */
static void *H5O_btreek_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_btreek_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_btreek_copy(const void *_mesg, void *_dest);
static size_t H5O_btreek_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -79,7 +79,8 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{
*/
static void *
H5O_btreek_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_btreek_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 8f4c155..94049ef 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -1515,7 +1515,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
H5O_cont_t *cont;
/* Decode continuation message */
- cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw);
+ cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw_size, mesg->raw);
H5_CHECKED_ASSIGN(cont->chunkno, unsigned, udata->cont_msg_info->nmsgs + 1, size_t); /* the next continuation message/chunk */
/* Save 'native' form of continuation message */
@@ -1531,7 +1531,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Decode ref. count message */
HDassert(oh->version > H5O_VERSION_1);
- refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw);
+ refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, udata->dxpl_id, NULL, 0, &ioflags, mesg->raw_size, mesg->raw);
/* Save 'native' form of ref. count message */
mesg->native = refcount;
diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c
index a427b49..d2b65bb 100644
--- a/src/H5Ocache_image.c
+++ b/src/H5Ocache_image.c
@@ -38,7 +38,7 @@
/* Callbacks for message class */
static void *H5O__mdci_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O__mdci_encode(H5F_t *f, hbool_t disable_shared,
uint8_t *p, const void *_mesg);
static void *H5O__mdci_copy(const void *_mesg, void *_dest);
@@ -99,7 +99,7 @@ H5FL_DEFINE(H5O_mdci_t);
static void *
H5O__mdci_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id,
H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_mdci_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ocont.c b/src/H5Ocont.c
index b002a32..f9a9768 100644
--- a/src/H5Ocont.c
+++ b/src/H5Ocont.c
@@ -37,7 +37,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_cont_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_cont_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O_cont_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static herr_t H5O_cont_free(void *mesg);
@@ -90,7 +90,8 @@ H5FL_DEFINE(H5O_cont_t);
*/
static void *
H5O_cont_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_cont_t *cont = NULL;
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index aa2a9e0..74c02f4 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -415,6 +415,11 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Initialize header information */
oh_dst->version = oh_src->version;
+
+ /* Version bounds check for destination object header */
+ if(oh_dst->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(oloc_dst->file)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "destination object header version out of bounds")
+
oh_dst->flags = oh_src->flags;
oh_dst->link_msgs_seen = oh_src->link_msgs_seen;
oh_dst->attr_msgs_seen = oh_src->attr_msgs_seen;
@@ -490,6 +495,12 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/,
/* Decode the message if necessary. */
H5O_LOAD_NATIVE(oloc_src->file, dxpl_id, 0, oh_src, mesg_src, FAIL)
+ /* Save destination file pointer in cpy_info so that it can be used
+ in the pre_copy_file callback to obtain the destination file's
+ high bound. The high bound is used to index into the corresponding
+ message's array of versions for doing version bounds check. */
+ cpy_info->file_dst = oloc_dst->file;
+
/* Perform "pre copy" operation on message */
if((copy_type->pre_copy_file)(oloc_src->file, mesg_src->native,
&(deleted[mesgno]), cpy_info, cpy_udata) < 0)
@@ -871,12 +882,19 @@ done:
HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
/* Free destination object header on failure */
- if(ret_value < 0 && oh_dst && !inserted) {
- if(H5O__free(oh_dst) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- if(H5O_loc_reset(oloc_dst) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
- } /* end if */
+ if(ret_value < 0) {
+ if(oh_dst && !inserted) {
+ if(H5O__free(oh_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+ if(H5O_loc_reset(oloc_dst) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
+ } /* end if */
+
+ if(addr_map == NULL && cpy_udata) {
+ if(obj_class && obj_class->free_copy_file_udata)
+ obj_class->free_copy_file_udata(cpy_udata);
+ } /* end if */
+ }
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5O_copy_header_real() */
diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c
index b9dea26..5921be3 100644
--- a/src/H5Odrvinfo.c
+++ b/src/H5Odrvinfo.c
@@ -28,7 +28,7 @@
#include "H5MMprivate.h" /* Memory management */
static void *H5O_drvinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_drvinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_drvinfo_copy(const void *_mesg, void *_dest);
static size_t H5O_drvinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -80,7 +80,8 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{
*/
static void *
H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_drvinfo_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index a1c24b6..c557b5c 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -15,22 +15,22 @@
#define H5T_FRIEND /*prevent warning from including H5Tpkg */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fprivate.h" /* Files */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Gprivate.h" /* Groups */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Tpkg.h" /* Datatypes */
-#include "H5VMprivate.h" /* Vectors and arrays */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Tpkg.h" /* Datatypes */
+#include "H5VMprivate.h" /* Vectors and arrays */
/* PRIVATE PROTOTYPES */
static herr_t H5O_dtype_encode(H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_dtype_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static void *H5O_dtype_copy(const void *_mesg, void *_dest);
static size_t H5O_dtype_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_dtype_reset(void *_mesg);
@@ -1094,7 +1094,7 @@ done:
--------------------------------------------------------------------------*/
static void *
H5O_dtype_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned *ioflags/*in,out*/, const uint8_t *p)
+ unsigned *ioflags/*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5T_t *dt = NULL;
void *ret_value = NULL; /* Return value */
@@ -1516,7 +1516,7 @@ done:
*/
static herr_t
H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info,
void *_udata)
{
const H5T_t *dt_src = (const H5T_t *)mesg_src; /* Source datatype */
@@ -1528,6 +1528,13 @@ H5O_dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src,
/* check args */
HDassert(file_src);
HDassert(dt_src);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version as indicated by the destination file's high bound */
+ if(dt_src->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "datatype message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset
* and check if we need to make a copy of the datatype for later in
diff --git a/src/H5Oefl.c b/src/H5Oefl.c
index ba7a6ee..f066964 100644
--- a/src/H5Oefl.c
+++ b/src/H5Oefl.c
@@ -28,7 +28,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_efl_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_efl_copy(const void *_mesg, void *_dest);
static size_t H5O_efl_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -88,7 +88,8 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{
*/
static void *
H5O_efl_decode(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_efl_t *mesg = NULL;
int version;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 5419762..849435c 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -21,28 +21,30 @@
#include "H5Omodule.h" /* This source code file is part of the H5O module */
-#include "H5private.h" /* Generic Functions */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5FLprivate.h" /* Free Lists */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* Memory management */
-#include "H5Opkg.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5Sprivate.h" /* Dataspaces */
+#include "H5private.h" /* Generic Functions */
+#include "H5Dprivate.h" /* Datasets */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Opkg.h" /* Object headers */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5Sprivate.h" /* Dataspaces */
static void *H5O_fill_old_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_fill_old_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static size_t H5O_fill_old_size(const H5F_t *f, const void *_mesg);
static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg);
static void *H5O_fill_copy(const void *_mesg, void *_dest);
static herr_t H5O_fill_reset(void *_mesg);
static herr_t H5O_fill_free(void *_mesg);
+static herr_t H5O_fill_pre_copy_file(H5F_t *file_src, const void *mesg_src,
+ hbool_t *deleted, const H5O_copy_t *cpy_info, void *udata);
static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
int indent, int fwidth);
@@ -105,52 +107,59 @@ static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *s
/* This message derives from H5O message class, for old fill value before version 1.5 */
const H5O_msg_class_t H5O_MSG_FILL[1] = {{
- H5O_FILL_ID, /*message id number */
- "fill", /*message name for debugging */
- sizeof(H5O_fill_t), /*native message size */
- H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
- H5O_fill_shared_decode, /*decode message */
- H5O_fill_shared_encode, /*encode message */
- H5O_fill_copy, /*copy the native value */
- H5O_fill_shared_size, /*raw message size */
- H5O_fill_reset, /*free internal memory */
- H5O_fill_free, /* free method */
- H5O_fill_shared_delete, /* file delete method */
- H5O_fill_shared_link, /* link method */
- NULL, /* set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O_fill_shared_copy_file, /* copy native value to file */
- H5O_fill_shared_post_copy_file, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_fill_shared_debug /*debug the message */
+ H5O_FILL_ID, /*message id number */
+ "fill", /*message name for debugging */
+ sizeof(H5O_fill_t), /*native message size */
+ H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
+ H5O_fill_shared_decode, /*decode message */
+ H5O_fill_shared_encode, /*encode message */
+ H5O_fill_copy, /*copy the native value */
+ H5O_fill_shared_size, /*raw message size */
+ H5O_fill_reset, /*free internal memory */
+ H5O_fill_free, /* free method */
+ H5O_fill_shared_delete, /* file delete method */
+ H5O_fill_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /*can share method */
+ H5O_fill_pre_copy_file, /* pre copy native value to file */
+ H5O_fill_shared_copy_file, /* copy native value to file */
+ H5O_fill_shared_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_fill_shared_debug /*debug the message */
}};
/* This message derives from H5O message class, for new fill value after version 1.4 */
const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
- H5O_FILL_NEW_ID, /*message id number */
- "fill_new", /*message name for debugging */
- sizeof(H5O_fill_t), /*native message size */
- H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
- H5O_fill_new_shared_decode, /*decode message */
- H5O_fill_new_shared_encode, /*encode message */
- H5O_fill_copy, /*copy the native value */
- H5O_fill_new_shared_size, /*raw message size */
- H5O_fill_reset, /*free internal memory */
- H5O_fill_free, /* free method */
- H5O_fill_new_shared_delete, /* file delete method */
- H5O_fill_new_shared_link, /* link method */
- NULL, /* set share method */
- NULL, /*can share method */
- NULL, /* pre copy native value to file */
- H5O_fill_new_shared_copy_file, /* copy native value to file */
- H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
- NULL, /* get creation index */
- NULL, /* set creation index */
- H5O_fill_new_shared_debug /*debug the message */
+ H5O_FILL_NEW_ID, /*message id number */
+ "fill_new", /*message name for debugging */
+ sizeof(H5O_fill_t), /*native message size */
+ H5O_SHARE_IS_SHARABLE|H5O_SHARE_IN_OHDR, /* messages are sharable? */
+ H5O_fill_new_shared_decode, /*decode message */
+ H5O_fill_new_shared_encode, /*encode message */
+ H5O_fill_copy, /*copy the native value */
+ H5O_fill_new_shared_size, /*raw message size */
+ H5O_fill_reset, /*free internal memory */
+ H5O_fill_free, /* free method */
+ H5O_fill_new_shared_delete, /* file delete method */
+ H5O_fill_new_shared_link, /* link method */
+ NULL, /* set share method */
+ NULL, /*can share method */
+ H5O_fill_pre_copy_file, /* pre copy native value to file */
+ H5O_fill_new_shared_copy_file, /* copy native value to file */
+ H5O_fill_new_shared_post_copy_file, /* post copy native value to file */
+ NULL, /* get creation index */
+ NULL, /* set creation index */
+ H5O_fill_new_shared_debug /*debug the message */
}};
+/* Format version bounds for fill value */
+const unsigned H5O_fill_ver_bounds[] = {
+ H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
+
/* Masks, shift values & flags for fill value message */
#define H5O_FILL_MASK_ALLOC_TIME 0x03
#define H5O_FILL_SHIFT_ALLOC_TIME 0
@@ -171,11 +180,11 @@ H5FL_BLK_EXTERN(type_conv);
* Function: H5O_fill_new_decode
*
* Purpose: Decode a new fill value message. The new fill value
- * message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
- * Return: Success: Ptr to new message in native struct.
- * Failure: NULL
+ * Return: Success: Ptr to new message in native struct.
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -184,7 +193,8 @@ H5FL_BLK_EXTERN(type_conv);
*/
static void *
H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_fill_t *fill = NULL;
void *ret_value = NULL; /* Return value */
@@ -195,7 +205,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t
HDassert(p);
if(NULL == (fill = H5FL_CALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
/* Version */
fill->version = *p++;
@@ -276,7 +286,7 @@ done:
if(!ret_value && fill) {
if(fill->buf)
H5MM_xfree(fill->buf);
- fill = H5FL_FREE(H5O_fill_t, fill);
+ fill = H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -298,7 +308,8 @@ done:
*/
static void *
H5O_fill_old_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_fill_t *fill = NULL; /* Decoded fill value message */
void *ret_value = NULL; /* Return value */
@@ -336,7 +347,7 @@ done:
if(!ret_value && fill) {
if(fill->buf)
H5MM_xfree(fill->buf);
- fill = H5FL_FREE(H5O_fill_t, fill);
+ fill = H5FL_FREE(H5O_fill_t, fill);
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
@@ -347,8 +358,8 @@ done:
* Function: H5O_fill_new_encode
*
* Purpose: Encode a new fill value message. The new fill value
- * message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
* Return: Non-negative on success/Negative on failure
*
@@ -481,7 +492,7 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
* whether fill value is defined.
*
* Return: Success: Ptr to _DEST
- * Failure: NULL
+ * Failure: NULL
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -491,16 +502,16 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill)
static void *
H5O_fill_copy(const void *_src, void *_dst)
{
- const H5O_fill_t *src = (const H5O_fill_t *)_src;
- H5O_fill_t *dst = (H5O_fill_t *)_dst;
- void *ret_value = NULL; /* Return value */
+ const H5O_fill_t *src = (const H5O_fill_t *)_src;
+ H5O_fill_t *dst = (H5O_fill_t *)_dst;
+ void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
HDassert(src);
if(!dst && NULL == (dst = H5FL_MALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
/* Shallow copy basic fields */
*dst = *src;
@@ -516,9 +527,9 @@ H5O_fill_copy(const void *_src, void *_dst)
/* Copy fill value and its size */
if(src->buf) {
H5_CHECK_OVERFLOW(src->size, ssize_t, size_t);
- if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
- HDmemcpy(dst->buf, src->buf, (size_t)src->size);
+ if(NULL == (dst->buf = H5MM_malloc((size_t)src->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
+ HDmemcpy(dst->buf, src->buf, (size_t)src->size);
/* Check for needing to convert/copy fill value */
if(src->type) {
@@ -579,9 +590,9 @@ done:
if(!ret_value && dst) {
if(dst->buf)
H5MM_xfree(dst->buf);
- if(dst->type)
+ if(dst->type)
H5T_close(dst->type);
- if(!_dst)
+ if(!_dst)
dst = H5FL_FREE(H5O_fill_t, dst);
} /* end if */
@@ -593,13 +604,13 @@ done:
* Function: H5O_fill_new_size
*
* Purpose: Returns the size of the raw message in bytes not counting the
- * message type or size fields, but only the data fields. This
- * function doesn't take into account alignment. The new fill
- * value message is fill value plus space allocation time and
- * fill value writing time and whether fill value is defined.
+ * message type or size fields, but only the data fields. This
+ * function doesn't take into account alignment. The new fill
+ * value message is fill value plus space allocation time and
+ * fill value writing time and whether fill value is defined.
*
* Return: Success: Message data size in bytes w/o alignment.
- * Failure: 0
+ * Failure: 0
*
* Programmer: Raymond Lu
* Feb 26, 2002
@@ -609,8 +620,8 @@ done:
static size_t
H5O_fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill)
{
- const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
- size_t ret_value = 0; /* Return value */
+ const H5O_fill_t *fill = (const H5O_fill_t *)_fill;
+ size_t ret_value = 0; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -721,8 +732,8 @@ H5O_fill_reset_dyn(H5O_fill_t *fill)
} /* end if */
fill->size = 0;
if(fill->type) {
- H5T_close(fill->type);
- fill->type = NULL;
+ H5T_close(fill->type);
+ fill->type = NULL;
} /* end if */
done:
@@ -792,6 +803,42 @@ H5O_fill_free(void *fill)
/*-------------------------------------------------------------------------
+ * Function: H5O_fill_pre_copy_file
+ *
+ * Purpose: Perform any necessary actions before copying message between
+ * files.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Vailin Choi; Dec 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5O_fill_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void H5_ATTR_UNUSED *udata)
+{
+ const H5O_fill_t *fill_src = (const H5O_fill_t *)mesg_src; /* Source fill value */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* check args */
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(fill_src->version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "fill value message version out of bounds")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_pre_copy_file() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_fill_debug
*
* Purpose: Prints debugging info for the message.
@@ -883,11 +930,11 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
"Size:", fill->size);
HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
if(fill->type) {
- H5T_debug(fill->type, stream);
- fprintf(stream, "\n");
+ H5T_debug(fill->type, stream);
+ HDfprintf(stream, "\n");
} /* end if */
else
- fprintf(stream, "<dataset type>\n");
+ HDfprintf(stream, "<dataset type>\n");
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_fill_debug() */
@@ -897,9 +944,9 @@ H5O_fill_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
* Function: H5O_fill_convert
*
* Purpose: Convert a fill value from whatever data type it currently has
- * to the specified dataset type. The `type' field of the fill
- * value struct will be set to NULL to indicate that it has the
- * same type as the dataset.
+ * to the specified dataset type. The `type' field of the fill
+ * value struct will be set to NULL to indicate that it has the
+ * same type as the dataset.
*
* Return: Non-negative on success/Negative on failure
*
@@ -925,21 +972,21 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed, hid_
/* No-op cases */
if(!fill->buf || !fill->type || 0 == H5T_cmp(fill->type, dset_type, FALSE)) {
/* Don't need datatype for fill value */
- if(fill->type)
+ if(fill->type)
H5T_close(fill->type);
- fill->type = NULL;
+ fill->type = NULL;
/* Note that the fill value info has changed */
*fill_changed = TRUE;
- HGOTO_DONE(SUCCEED);
+ HGOTO_DONE(SUCCEED);
} /* end if */
/*
* Can we convert between source and destination data types?
*/
if(NULL == (tpath = H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes")
/* Don't bother doing anything if there will be no actual conversion */
if(!H5T_path_noop(tpath)) {
@@ -997,28 +1044,39 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O_fill_set_latest_version
+ * Function: H5O_fill_set_version
*
- * Purpose: Set the encoding for a fill value to the latest version.
+ * Purpose: Set the version to encode a fill value 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
-H5O_fill_set_latest_version(H5O_fill_t *fill)
+H5O_fill_set_version(H5F_t *f, H5O_fill_t *fill)
{
- 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(fill);
- /* Set encoding of fill value to latest version */
- fill->version = H5O_FILL_VERSION_LATEST;
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(fill->version, H5O_fill_ver_bounds[H5F_LOW_BOUND(f)]);
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_fill_set_latest_version() */
+ /* Version bounds check */
+ if(version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds")
+
+ /* Set the message version */
+ fill->version = version;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_set_version() */
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index 4d62f49..8369ae1 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -32,7 +32,8 @@
#include "H5Opkg.h" /* Object headers */
/* PRIVATE PROTOTYPES */
-static void *H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+static void *H5O_fsinfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
+ unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_fsinfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_fsinfo_copy(const void *_mesg, void *_dest);
static size_t H5O_fsinfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -86,7 +87,8 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t);
*/
static void *
H5O_fsinfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_fsinfo_t *fsinfo = NULL; /* File space info message */
H5F_mem_page_t ptype; /* Memory type for iteration */
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 468e07a..e551f28 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -33,7 +33,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_ginfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_ginfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_ginfo_copy(const void *_mesg, void *_dest);
static size_t H5O_ginfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -95,7 +95,8 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t);
*/
static void *
H5O_ginfo_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */
unsigned char flags; /* Flags for encoding group info */
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 6ab5393..08eb28d 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -131,6 +131,13 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
#endif /* H5O_ENABLE_BOGUS */
};
+/* Format version bounds for object header */
+const unsigned H5O_obj_ver_bounds[] = {
+ H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_VERSION_2, /* H5F_LIBVER_V18 */
+ H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
+
/* Declare a free list to manage the H5O_t struct */
H5FL_DEFINE(H5O_t);
@@ -203,6 +210,53 @@ H5O__init_package(void)
/*-------------------------------------------------------------------------
+ * Function: H5O_set_version
+ *
+ * Purpose: Sets the correct version to encode the object header.
+ * Chooses the oldest version possible, unless the file's
+ * low bound indicates otherwise.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * 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)
+
+ /* check arguments */
+ HDassert(f);
+ HDassert(oh);
+
+ /* Set the correct version to encode object header with */
+ if(store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
+ version = H5O_VERSION_LATEST;
+ else
+ version = H5O_VERSION_1;
+
+ /* Upgrade to the version indicated by the file's low bound if higher */
+ version = MAX(version, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_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() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_create
*
* Purpose: Creates a new object header. Allocates space for it and
@@ -263,10 +317,10 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
/* Initialize file-specific information for object header */
store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
- if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
- oh->version = H5O_VERSION_LATEST;
- else
- oh->version = H5O_VERSION_1;
+
+ if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
+
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index cac4ed1..9917927 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -37,7 +37,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_linfo_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_linfo_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_linfo_copy(const void *_mesg, void *_dest);
static size_t H5O_linfo_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -114,7 +114,8 @@ H5FL_DEFINE_STATIC(H5O_linfo_t);
*/
static void *
H5O_linfo_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_linfo_t *linfo = NULL; /* Link info */
unsigned char index_flags; /* Flags for encoding link index info */
diff --git a/src/H5Olink.c b/src/H5Olink.c
index 77872ad..7e7885c 100644
--- a/src/H5Olink.c
+++ b/src/H5Olink.c
@@ -39,7 +39,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_link_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_link_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_link_copy(const void *_mesg, void *_dest);
static size_t H5O_link_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -118,7 +118,8 @@ H5FL_DEFINE_STATIC(H5O_link_t);
*/
static void *
H5O_link_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_link_t *lnk = NULL; /* Pointer to link message */
size_t len = 0; /* Length of a string in the message */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index 158701b..809c6e9 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1811,7 +1811,7 @@ done:
*/
void *
H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
- const unsigned char *buf)
+ size_t buf_size, const unsigned char *buf)
{
const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
unsigned ioflags = 0; /* Flags for decode routine */
@@ -1826,7 +1826,7 @@ H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned type_id,
HDassert(type);
/* decode */
- if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf)) == NULL)
+ if((ret_value = (type->decode)(f, dxpl_id, open_oh, 0, &ioflags, buf_size, buf)) == NULL)
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message")
done:
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 7e7baea..47bc0b1 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -28,12 +28,12 @@
static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_mtime_new_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static size_t H5O_mtime_new_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_mtime_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_mtime_copy(const void *_mesg, void *_dest);
static size_t H5O_mtime_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -119,7 +119,8 @@ H5FL_DEFINE(time_t);
*/
static void *
H5O_mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
time_t *mesg;
uint32_t tmp_time; /* Temporary copy of the time */
@@ -175,7 +176,8 @@ done:
*/
static void *
H5O_mtime_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
time_t *mesg, the_time;
struct tm tm;
diff --git a/src/H5Oname.c b/src/H5Oname.c
index 6292883..627a0f5 100644
--- a/src/H5Oname.c
+++ b/src/H5Oname.c
@@ -33,7 +33,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_name_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_name_copy(const void *_mesg, void *_dest);
static size_t H5O_name_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -84,7 +84,8 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{
*/
static void *
H5O_name_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_name_t *mesg;
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 109d273..e970406 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -63,8 +63,8 @@
)
#define H5O_ALIGN_OH(O, X) \
H5O_ALIGN_VERS((O)->version, X)
-#define H5O_ALIGN_F(F, X) \
- H5O_ALIGN_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
+#define H5O_ALIGN_F(F, X) \
+ H5O_ALIGN_VERS(MAX(H5O_VERSION_1, (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), X)
/* Size of checksum (on disk) */
#define H5O_SIZEOF_CHKSUM 4
@@ -136,7 +136,7 @@
#define H5O_SIZEOF_MSGHDR_OH(O) \
H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
#define H5O_SIZEOF_MSGHDR_F(F, C) \
- H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C))
+ H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C))
/*
* Size of chunk "header" for each chunk
@@ -186,7 +186,7 @@
\
/* Decode the message */ \
HDassert(msg_type->decode); \
- if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw))) \
+ if(NULL == ((MSG)->native = (msg_type->decode)((F), (DXPL), (OH), (MSG)->flags, &ioflags, (MSG)->raw_size, (MSG)->raw))) \
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \
\
/* Mark the message dirty if it was changed by decoding */ \
@@ -228,7 +228,7 @@ struct H5O_msg_class_t {
const char *name; /*for debugging */
size_t native_size; /*size of native message */
unsigned share_flags; /* Message sharing settings */
- void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *);
+ void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, size_t, const uint8_t *);
herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *);
void *(*copy)(const void *, void *); /*copy native value */
size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */
@@ -556,7 +556,6 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
/* Datatype Object. (H5O_TYPE_NAMED_DATATYPE - 2) */
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
-
/* Package-local function prototypes */
H5_DLL herr_t H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg);
H5_DLL herr_t H5O_flush_msgs(H5F_t *f, H5O_t *oh);
@@ -642,6 +641,14 @@ H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg
H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh,
hsize_t *nattrs);
+/* Arrays of versions for:
+ Object header, Attribute/Fill value/Filter pipeline messages */
+/* Layout/Datatype/Dataspace arrays of versions are in H5Dpkg.h, H5Tpkg.h and H5Spkg.h */
+H5_DLLVAR const unsigned H5O_obj_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_attr_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_fill_ver_bounds[H5F_LIBVER_NBOUNDS];
+H5_DLLVAR const unsigned H5O_pline_ver_bounds[H5F_LIBVER_NBOUNDS];
+
/* Testing functions */
#ifdef H5O_TESTING
H5_DLL htri_t H5O_is_attr_empty_test(hid_t oid);
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 2e52dbb..e59e192 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -34,7 +34,7 @@
/* PRIVATE PROTOTYPES */
static herr_t H5O_pline_encode(H5F_t *f, uint8_t *p, const void *mesg);
static void *H5O_pline_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static void *H5O_pline_copy(const void *_mesg, void *_dest);
static size_t H5O_pline_size(const H5F_t *f, const void *_mesg);
static herr_t H5O_pline_reset(void *_mesg);
@@ -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 */
+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);
@@ -109,12 +115,14 @@ H5FL_DEFINE(H5O_pline_t);
*/
static void *
H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t p_size, const uint8_t *p)
{
H5O_pline_t *pline = NULL; /* Pipeline message */
H5Z_filter_info_t *filter; /* Filter to decode */
size_t name_length; /* Length of filter name */
size_t i; /* Local index variable */
+ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */
void *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -124,17 +132,24 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
/* Allocate space for I/O pipeline message */
if(NULL == (pline = H5FL_CALLOC(H5O_pline_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Version */
pline->version = *p++;
if(pline->version < H5O_PLINE_VERSION_1 || pline->version > H5O_PLINE_VERSION_LATEST)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message")
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message")
/* Number of filters */
pline->nused = *p++;
- if(pline->nused > H5Z_MAX_NFILTERS)
- HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters")
+ if(pline->nused > H5Z_MAX_NFILTERS) {
+
+ /* Reset the number of filters used to avoid array traversal in error
+ * handling code.
+ */
+ pline->nused = 0;
+
+ HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters")
+ }
/* Reserved */
if(pline->version == H5O_PLINE_VERSION_1)
@@ -143,12 +158,12 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
/* Allocate array for filters */
pline->nalloc = pline->nused;
if(NULL == (pline->filter = (H5Z_filter_info_t *)H5MM_calloc(pline->nalloc * sizeof(pline->filter[0]))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Decode filters */
for(i = 0, filter = &pline->filter[0]; i < pline->nused; i++, filter++) {
/* Filter ID */
- UINT16DECODE(p, filter->id);
+ UINT16DECODE(p, filter->id);
/* Length of filter name */
if(pline->version > H5O_PLINE_VERSION_1 && filter->id < H5Z_FILTER_RESERVED)
@@ -160,18 +175,18 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
} /* end if */
/* Filter flags */
- UINT16DECODE(p, filter->flags);
+ UINT16DECODE(p, filter->flags);
/* Number of filter parameters ("client data elements") */
- UINT16DECODE(p, filter->cd_nelmts);
+ UINT16DECODE(p, filter->cd_nelmts);
/* Filter name, if there is one */
- if(name_length) {
+ if(name_length) {
size_t actual_name_length; /* Actual length of name */
/* Determine actual name length (without padding, but with null terminator) */
- actual_name_length = HDstrlen((const char *)p) + 1;
- HDassert(actual_name_length <= name_length);
+ actual_name_length = HDstrlen((const char *)p) + 1;
+ HDassert(actual_name_length <= name_length);
/* Allocate space for the filter name, or use the internal buffer */
if(actual_name_length > H5Z_COMMON_NAME_LEN) {
@@ -182,12 +197,12 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
else
filter->name = filter->_name;
- HDstrncpy(filter->name, (const char *)p, actual_name_length);
- p += name_length;
- } /* end if */
+ HDstrncpy(filter->name, (const char *)p, actual_name_length);
+ p += name_length;
+ } /* end if */
/* Filter parameters */
- if(filter->cd_nelmts) {
+ if(filter->cd_nelmts) {
size_t j; /* Local index variable */
/* Allocate space for the client data elements, or use the internal buffer */
@@ -199,15 +214,20 @@ H5O_pline_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5
else
filter->cd_values = filter->_cd_values;
- /*
- * Read the client data values and the padding
- */
- for(j = 0; j < filter->cd_nelmts; j++)
- UINT32DECODE(p, filter->cd_values[j]);
+ /*
+ * Read the client data values and the padding
+ */
+ for (j = 0; j < filter->cd_nelmts; j++) {
+ if (p + 4 - 1 <= p_end)
+ UINT32DECODE(p, filter->cd_values[j])
+ else
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "ran off the end of the buffer: current p = %p, p_size = %zu, p_end = %p", p, p_size, p_end)
+ }
+
if(pline->version == H5O_PLINE_VERSION_1)
if(filter->cd_nelmts % 2)
p += 4; /*padding*/
- } /* end if */
+ } /* end if */
} /* end for */
/* Set return value */
@@ -496,23 +516,30 @@ H5O_pline_reset(void *mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
+ /* NOTE: This function can be called during error processing from
+ * other API calls so DO NOT ASSUME THAT ANY VALUES ARE SANE.
+ */
+
HDassert(pline);
- /* Free information for each filter */
- for(i = 0; i < pline->nused; i++) {
- if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name)
- HDassert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
- if(pline->filter[i].name != pline->filter[i]._name)
- pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name);
- if(pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values)
- HDassert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES);
- if(pline->filter[i].cd_values != pline->filter[i]._cd_values)
- pline->filter[i].cd_values = (unsigned *)H5MM_xfree(pline->filter[i].cd_values);
- } /* end for */
+ /* Free the filter information and array */
+ if (pline->filter) {
+
+ /* Free information for each filter */
+ for(i = 0; i < pline->nused; i++) {
+ if(pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name)
+ HDassert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
+ if(pline->filter[i].name != pline->filter[i]._name)
+ pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name);
+ if(pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values)
+ HDassert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES);
+ if(pline->filter[i].cd_values != pline->filter[i]._cd_values)
+ pline->filter[i].cd_values = (unsigned *)H5MM_xfree(pline->filter[i].cd_values);
+ } /* end for */
- /* Free filter array */
- if(pline->filter)
+ /* Free filter array */
pline->filter = (H5Z_filter_info_t *)H5MM_xfree(pline->filter);
+ }
/* Reset # of filters */
pline->nused = pline->nalloc = 0;
@@ -566,16 +593,23 @@ H5O_pline_free(void *mesg)
*/
static herr_t
H5O_pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
{
- const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source datatype */
+ const H5O_pline_t *pline_src = (const H5O_pline_t *)mesg_src; /* Source pline */
H5O_copy_file_ud_common_t *udata = (H5O_copy_file_ud_common_t *)_udata; /* Object copying user data */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* check args */
HDassert(pline_src);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(pline_src->version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "pline message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset or group
* and make a copy of the filter pipeline for later in
@@ -664,28 +698,38 @@ 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
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
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
+ unsigned version; /* Message version */
+ 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 */
+ version = MAX(pline->version, H5O_pline_ver_bounds[H5F_LOW_BOUND(f)]);
- FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5O_pline_set_latest_version() */
+ /* Version bounds check */
+ if(version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_PLINE, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds")
+ /* Set the message version */
+ pline->version = version;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_pline_set_version() */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 4b74d8f..9f01a9a 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -177,7 +177,12 @@ typedef struct H5O_copy_t {
H5SL_t *dst_dt_list; /* Skip list to hold committed datatypes in dest file */
hbool_t dst_dt_list_complete; /* Whether the destination datatype list is complete (i.e. not only populated with "suggestions" from H5Padd_merge_committed_dtype_path) */
H5O_t *oh_dst; /* The destination object header */
- void *shared_fo; /* The shared pointer for the object */
+ H5F_t *file_dst; /* The destination file pointer */
+ /* This is used in the pre_copy_file callback to obtain
+ the destination file's high bound. The high bound
+ is used to index into the corresponding message's
+ array of versions for doing version bounds check. */
+ void *shared_fo; /* The shared pointer for the src object */
H5O_mcdt_search_cb_t mcdt_cb; /* The callback to invoke before searching the global list of committed datatypes at destination */
void *mcdt_ud; /* User data passed to callback */
} H5O_copy_t;
@@ -930,7 +935,7 @@ H5_DLL herr_t H5O_msg_get_crt_index(unsigned type_id, const void *mesg,
H5_DLL herr_t H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared,
unsigned char *buf, const void *obj);
H5_DLL void* H5O_msg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned type_id, const unsigned char *buf);
+ unsigned type_id, size_t buf_size, const unsigned char *buf);
H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
unsigned type_id, void *mesg);
H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id, uint8_t *flags);
@@ -967,14 +972,14 @@ H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl);
/* Fill value operators */
H5_DLL herr_t H5O_fill_reset_dyn(H5O_fill_t *fill);
H5_DLL herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type, hbool_t *fill_changed, hid_t dxpl_id);
-H5_DLL herr_t H5O_fill_set_latest_version(H5O_fill_t *fill);
+H5_DLL herr_t H5O_fill_set_version(H5F_t * f, H5O_fill_t *fill);
/* Link operators */
H5_DLL herr_t H5O_link_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
void *_mesg);
/* Filter pipeline operators */
-H5_DLL herr_t H5O_pline_set_latest_version(H5O_pline_t *pline);
+H5_DLL herr_t H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline);
/* Shared message operators */
H5_DLL herr_t H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src);
diff --git a/src/H5Orefcount.c b/src/H5Orefcount.c
index af68417..6f052ce 100644
--- a/src/H5Orefcount.c
+++ b/src/H5Orefcount.c
@@ -33,7 +33,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_refcount_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_refcount_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_refcount_copy(const void *_mesg, void *_dest);
static size_t H5O_refcount_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -90,7 +90,8 @@ H5FL_DEFINE_STATIC(H5O_refcount_t);
*/
static void *
H5O_refcount_decode(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_refcount_t *refcount = NULL; /* Reference count */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 3fe5652..f5d3c61 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -26,7 +26,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg);
static void *H5O_sdspace_copy(const void *_mesg, void *_dest);
static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg);
@@ -110,7 +110,8 @@ H5FL_ARR_EXTERN(hsize_t);
--------------------------------------------------------------------------*/
static void *
H5O_sdspace_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5S_extent_t *sdim = NULL;/* New extent dimensionality structure */
unsigned flags, version;
@@ -441,7 +442,7 @@ H5O_sdspace_free(void *mesg)
*/
static herr_t
H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
- hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t H5_ATTR_UNUSED *cpy_info, void *_udata)
+ hbool_t H5_ATTR_UNUSED *deleted, const H5O_copy_t *cpy_info, void *_udata)
{
const H5S_extent_t *src_space_extent = (const H5S_extent_t *)mesg_src; /* Source dataspace extent */
H5D_copy_file_ud_t *udata = (H5D_copy_file_ud_t *)_udata; /* Dataset copying user data */
@@ -452,6 +453,13 @@ H5O_sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src,
/* check args */
HDassert(file_src);
HDassert(src_space_extent);
+ HDassert(cpy_info);
+ HDassert(cpy_info->file_dst);
+
+ /* Check to ensure that the version of the message to be copied does not exceed
+ the message version allowed by the destination file's high bound */
+ if(src_space_extent->version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)])
+ HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "dataspace message version out of bounds")
/* If the user data is non-NULL, assume we are copying a dataset
* and make a copy of the dataspace extent for later in the object copying
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index db2d0cc..9217d3d 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -156,7 +156,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned *ioflags,
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.")
/* Decode the message */
- if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_ptr)))
+ if(NULL == (ret_value = (type->decode)(f, dxpl_id, open_oh, 0, ioflags, mesg_size, mesg_ptr)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.")
} /* end if */
else {
diff --git a/src/H5Oshared.h b/src/H5Oshared.h
index 2465e65..93cc11f 100644
--- a/src/H5Oshared.h
+++ b/src/H5Oshared.h
@@ -47,7 +47,7 @@
*/
static H5_INLINE void *
H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
- unsigned *ioflags, const uint8_t *p)
+ unsigned *ioflags, size_t p_size, const uint8_t *p)
{
void *ret_value = NULL; /* Return value */
@@ -67,7 +67,7 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
if(mesg_flags & H5O_MSG_FLAG_SHARED) {
/* Retrieve native message info indirectly through shared message */
if(NULL == (ret_value = H5O_shared_decode(f, dxpl_id, open_oh, ioflags, p, H5O_SHARED_TYPE)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
/* We currently do not support automatically fixing shared messages */
#ifdef H5_STRICT_FORMAT_CHECKS
@@ -79,8 +79,8 @@ H5O_SHARED_DECODE(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned mesg_flags,
} /* end if */
else {
/* Decode native message directly */
- if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message")
+ if(NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, dxpl_id, open_oh, mesg_flags, ioflags, p_size, p)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message")
} /* end else */
done:
diff --git a/src/H5Oshmesg.c b/src/H5Oshmesg.c
index 1cbfb05..f3fe9d1 100644
--- a/src/H5Oshmesg.c
+++ b/src/H5Oshmesg.c
@@ -28,7 +28,7 @@
#include "H5MMprivate.h" /* Memory management */
static void *H5O_shmesg_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_shmesg_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_shmesg_copy(const void *_mesg, void *_dest);
static size_t H5O_shmesg_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -76,7 +76,8 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{
*/
static void *
H5O_shmesg_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_shmesg_table_t *mesg; /* Native message */
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Ostab.c b/src/H5Ostab.c
index 5c840a6..6f02d72 100644
--- a/src/H5Ostab.c
+++ b/src/H5Ostab.c
@@ -36,7 +36,7 @@
/* PRIVATE PROTOTYPES */
static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
- unsigned mesg_flags, unsigned *ioflags, const uint8_t *p);
+ unsigned mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p);
static herr_t H5O_stab_encode(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mesg);
static void *H5O_stab_copy(const void *_mesg, void *_dest);
static size_t H5O_stab_size(const H5F_t *f, hbool_t disable_shared, const void *_mesg);
@@ -97,7 +97,8 @@ H5FL_DEFINE_STATIC(H5O_stab_t);
*/
static void *
H5O_stab_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh,
- unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags,
+ size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
{
H5O_stab_t *stab = NULL;
void *ret_value = NULL; /* Return value */
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index a000351..19ec00f 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1116,7 +1116,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value)
dt_size = (size_t)enc_value;
/* Decode type */
- if(NULL == (fill->type = H5T_decode(*pp)))
+ if(NULL == (fill->type = H5T_decode(dt_size, *pp)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode fill value datatype")
*pp += dt_size;
} /* end if */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index a1a7049..13409d2 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -140,11 +140,19 @@
#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT
#define H5F_ACS_MULTI_TYPE_ENC H5P__facc_multi_type_enc
#define H5F_ACS_MULTI_TYPE_DEC H5P__facc_multi_type_dec
-/* Definition for 'use latest format version' flag */
-#define H5F_ACS_LATEST_FORMAT_SIZE sizeof(hbool_t)
-#define H5F_ACS_LATEST_FORMAT_DEF FALSE
-#define H5F_ACS_LATEST_FORMAT_ENC H5P__encode_hbool_t
-#define H5F_ACS_LATEST_FORMAT_DEC H5P__decode_hbool_t
+
+/* Definition for "low" bound of library format versions */
+#define H5F_ACS_LIBVER_LOW_BOUND_SIZE sizeof(H5F_libver_t)
+#define H5F_ACS_LIBVER_LOW_BOUND_DEF H5F_LIBVER_EARLIEST
+#define H5F_ACS_LIBVER_LOW_BOUND_ENC H5P__facc_libver_type_enc
+#define H5F_ACS_LIBVER_LOW_BOUND_DEC H5P__facc_libver_type_dec
+
+/* Definition for "high" bound of library format versions */
+#define H5F_ACS_LIBVER_HIGH_BOUND_SIZE sizeof(H5F_libver_t)
+#define H5F_ACS_LIBVER_HIGH_BOUND_DEF H5F_LIBVER_LATEST
+#define H5F_ACS_LIBVER_HIGH_BOUND_ENC H5P__facc_libver_type_enc
+#define H5F_ACS_LIBVER_HIGH_BOUND_DEC H5P__facc_libver_type_dec
+
/* Definition for whether to query the file descriptor from the core VFD
* instead of the memory address. (Private to library)
*/
@@ -288,6 +296,8 @@ static herr_t H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t
static herr_t H5P__facc_fclose_degree_dec(const void **pp, void *value);
static herr_t H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void *udata);
static herr_t H5P__facc_multi_type_dec(const void **_pp, void *value);
+static herr_t H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size);
+static herr_t H5P__facc_libver_type_dec(const void **_pp, void *value);
/* Metadata cache log location property callbacks */
static herr_t H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void *udata);
@@ -352,7 +362,10 @@ static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF;
static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */
static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */
static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */
-static const hbool_t H5F_def_latest_format_g = H5F_ACS_LATEST_FORMAT_DEF; /* Default setting for "use the latest version of the format" flag */
+
+static const H5F_libver_t H5F_def_libver_low_bound_g = H5F_ACS_LIBVER_LOW_BOUND_DEF; /* Default setting for "low" bound of format version */
+static const H5F_libver_t H5F_def_libver_high_bound_g = H5F_ACS_LIBVER_HIGH_BOUND_DEF; /* Default setting for "high" bound of format version */
+
static const hbool_t H5F_def_want_posix_fd_g = H5F_ACS_WANT_POSIX_FD_DEF; /* Default setting for retrieving 'handle' from core VFD */
static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; /* Default external file cache size */
static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */
@@ -374,7 +387,7 @@ static const size_t H5F_def_page_buf_size_g = H5F_ACS_PAGE_BUFFER_SIZE_DEF;
static const unsigned H5F_def_page_buf_min_meta_perc_g = H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEF; /* Default page buffer minimum metadata size */
static const unsigned H5F_def_page_buf_min_raw_perc_g = H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEF; /* Default page buffer minumum raw data size */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_reg_prop
*
@@ -491,9 +504,15 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the 'use the latest version of the format' flag */
- if(H5P_register_real(pclass, H5F_ACS_LATEST_FORMAT_NAME, H5F_ACS_LATEST_FORMAT_SIZE, &H5F_def_latest_format_g,
- NULL, NULL, NULL, H5F_ACS_LATEST_FORMAT_ENC, H5F_ACS_LATEST_FORMAT_DEC,
+ /* Register the 'low' bound of library format versions */
+ if(H5P_register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g,
+ NULL, NULL, NULL, H5F_ACS_LIBVER_LOW_BOUND_ENC, H5F_ACS_LIBVER_LOW_BOUND_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
+ /* Register the 'high' bound of library format versions */
+ if(H5P_register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g,
+ NULL, NULL, NULL, H5F_ACS_LIBVER_HIGH_BOUND_ENC, H5F_ACS_LIBVER_HIGH_BOUND_DEC,
NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
@@ -608,7 +627,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_reg_prop() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_alignment
*
@@ -666,7 +685,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_alignment
*
@@ -707,7 +726,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_alignment() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_set_driver
*
@@ -755,7 +774,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_set_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_driver
*
@@ -798,7 +817,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_peek_driver
*
@@ -842,7 +861,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_peek_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_driver
*
@@ -883,7 +902,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_driver() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_peek_driver_info
*
@@ -925,7 +944,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_peek_driver_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_driver_info
*
@@ -965,7 +984,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_driver_info() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_driver_copy
*
@@ -1031,7 +1050,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_driver_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_driver_free
*
@@ -1083,7 +1102,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_driver_free() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_create
*
@@ -1112,7 +1131,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_create() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_set
*
@@ -1145,7 +1164,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_set() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_get
*
@@ -1178,7 +1197,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_get() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_del
*
@@ -1207,7 +1226,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_copy
*
@@ -1236,7 +1255,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_cmp
*
@@ -1295,7 +1314,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_driver_close
*
@@ -1324,7 +1343,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_driver_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_family_offset
*
@@ -1363,7 +1382,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_family_offset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_family_offset
*
@@ -1404,7 +1423,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_family_offset() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_multi_type
*
@@ -1443,7 +1462,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_multi_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_multi_type
*
@@ -1484,7 +1503,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_multi_type() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_cache
*
@@ -1538,7 +1557,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_cache() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_cache
*
@@ -1590,7 +1609,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_cache() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_image_config
*
@@ -1634,7 +1653,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_mdc_image_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_image_config
*
@@ -1685,7 +1704,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_mdc_image_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_config
*
@@ -1729,7 +1748,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_mdc_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_config
*
@@ -1780,7 +1799,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_mdc_config() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_gc_references
*
@@ -1833,7 +1852,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_gc_references
*
@@ -1876,7 +1895,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_fclose_degree
*
@@ -1912,7 +1931,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_fclose_degree() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_fclose_degree
*
@@ -1947,7 +1966,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fclose_degree() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_meta_block_size
*
@@ -1998,7 +2017,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_meta_block_size
*
@@ -2042,7 +2061,7 @@ done:
FUNC_LEAVE_API(ret_value)
}
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_sieve_buf_size
*
@@ -2093,7 +2112,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_sieve_buf_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_sieve_buf_size
*
@@ -2136,7 +2155,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_sieve_buf_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_small_data_block_size
*
@@ -2182,7 +2201,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_small_data_block_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_small_data_block_size
*
@@ -2221,7 +2240,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_small_data_block_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_libver_bounds
*
@@ -2301,6 +2320,24 @@ done:
* releases and then map down to the previous actual library release which
* had a format change.
*
+ * Note #3: The enumerated define for H5F_libver_t in 1.10 is:
+ * typedef enum H5F_libver_t {
+ * H5F_LIBVER_ERROR = -1,
+ * H5F_LIBVER_EARLIEST = 0,
+ * H5F_LIBVER_V18 = 1,
+ * H5F_LIBVER_V110 = 2,
+ * H5F_LIBVER_NBOUNDS
+ * } H5F_libver_t;
+ * #define H5F_LIBVER_LATEST H5F_LIBVER_V110
+ *
+ * The library supports five pairs of (low, high) combinations via H5Pset_libver_bounds():
+ * 1) H5F_LIBVER_EARLIEST, H5F_LIBVER_V18
+ * 2) H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST
+ * 4) H5F_LIBVER_V18, H5F_LIBVER_V18
+ * 4) H5F_LIBVER_V18, H5F_LIBVER_LATEST
+ * 5) H5F_LIBVER_LATEST, H5F_LIBVER_LATEST
+ * See detailed description in the RFC: Setting Bounds for Object Creation in HDF5 1.10.0.
+ *
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
@@ -2309,42 +2346,48 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low,
- H5F_libver_t high)
+H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high)
{
H5P_genplist_t *plist; /* Property list pointer */
- hbool_t latest; /* Whether to use the latest version or not */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFvFv", plist_id, low, high);
/* Check args */
- /* (Note that this is _really_ restricted right now, we'll want to loosen
- * this up more as we add features - QAK)
- */
- if(high != H5F_LIBVER_LATEST)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid high library version bound")
+ if(low < 0 || low > H5F_LIBVER_LATEST)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "low bound is not valid")
+
+ if(high < 0 || high > H5F_LIBVER_LATEST)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "high bound is not valid")
+
+ /* (earliest, earliest), (latest, earliest), (v18, earliest) are not valid combinations */
+ if(high == H5F_LIBVER_EARLIEST)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound")
+
+ /* (latest, v18) is not valid combination */
+ if(high < low)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound")
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
/* Set values */
- latest = (hbool_t)((low == H5F_LIBVER_LATEST) ? TRUE : FALSE);
- if(H5P_set(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set library version bounds")
-
+ if(H5P_set(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set low bound for library format versions")
+ if(H5P_set(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set high bound for library format versions")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_libver_bounds() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_libver_bounds
*
* Purpose: Returns the current settings for the library version format bounds
- * from a file access property list.
+ * from a file access property list.
*
* Return: Non-negative on success/Negative on failure
*
@@ -2358,7 +2401,6 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low/*out*/,
H5F_libver_t *high/*out*/)
{
H5P_genplist_t *plist; /* Property list pointer */
- hbool_t latest; /* Whether to use the latest version or not */
herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
@@ -2368,22 +2410,22 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low/*out*/,
if(NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
- /* Get value */
- if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get library version bounds")
+ /* Get values */
+ if(low) {
+ if(H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, low) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get low bound for library format versions")
+ }
- /* Check for setting values to return */
- /* (Again, this is restricted now, we'll need to open it up later -QAK) */
- if(low)
- *low = latest ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST;
- if(high)
- *high = H5F_LIBVER_LATEST;
+ if(high) {
+ if(H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get high bound for library format versions")
+ }
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_libver_bounds() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_elink_file_cache_size
*
@@ -2421,7 +2463,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_elink_file_cache_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_elink_file_cache_size
*
@@ -2460,7 +2502,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_elink_file_cache_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_image
*
@@ -2541,7 +2583,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_file_image() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_file_image
*
@@ -2630,7 +2672,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_file_image */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_file_image_callbacks
*
@@ -2707,7 +2749,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_file_image_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_file_image_callbacks
*
@@ -2763,7 +2805,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_file_image_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_image_info_copy
*
@@ -2841,7 +2883,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_image_info_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__file_image_info_free
*
@@ -2896,7 +2938,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__file_image_info_free() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_cmp
*
@@ -2939,7 +2981,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_image_config_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_enc
*
@@ -2985,7 +3027,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size, vo
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_cache_image_config_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_image_config_dec
*
@@ -3037,7 +3079,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_image_config_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_set
*
@@ -3070,7 +3112,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_set() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_get
*
@@ -3103,7 +3145,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_get() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_del
*
@@ -3134,7 +3176,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_copy
*
@@ -3164,7 +3206,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_cmp
*
@@ -3223,7 +3265,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_file_image_info_close
*
@@ -3253,7 +3295,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_file_image_info_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_cmp
*
@@ -3365,7 +3407,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_config_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_enc
*
@@ -3510,7 +3552,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size, void H5_
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_cache_config_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_cache_config_dec
*
@@ -3645,7 +3687,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__facc_cache_config_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_fclose_degree_enc
*
@@ -3683,7 +3725,7 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size, void H5
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_fclose_degree_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_fclose_degree_dec
*
@@ -3718,7 +3760,7 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_fclose_degree_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_multi_type_enc
*
@@ -3756,7 +3798,7 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size, void H5_AT
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_multi_type_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__facc_multi_type_dec
*
@@ -3791,7 +3833,78 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_multi_type_dec() */
-
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_libver_type_enc
+ *
+ * Purpose: Callback routine which is called whenever the 'low' or
+ * 'high' bound of library format versions property in the
+ * file access property list is encoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size)
+{
+ const H5F_libver_t *type = (const H5F_libver_t *)value; /* Create local alias for values */
+ uint8_t **pp = (uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity check */
+ HDassert(type);
+ HDassert(size);
+
+ /* Encode */
+ if(NULL != *pp)
+ *(*pp)++ = (uint8_t)*type;
+
+ /* Size */
+ (*size)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_libver_type_enc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5P__facc_libver_type_dec
+ *
+ * Purpose: Callback routine which is called whenever the 'low' or
+ * 'high' bound of library format versions property in the
+ * file access property list is decoded.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5P__facc_libver_type_dec(const void **_pp, void *_value)
+{
+ H5F_libver_t *type = (H5F_libver_t *)_value;
+ const uint8_t **pp = (const uint8_t **)_pp;
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(pp);
+ HDassert(*pp);
+ HDassert(type);
+
+ /* Decode */
+ *type = (H5F_libver_t)*(*pp)++;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5P__facc_libver_type_dec() */
+
+
/*-------------------------------------------------------------------------
* Function: H5Pset_core_write_tracking
*
@@ -3832,7 +3945,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_core_write_tracking() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_core_write_tracking
*
@@ -3874,7 +3987,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_core_write_tracking() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_metadata_read_attempts
*
@@ -3917,7 +4030,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_metadata_read_attempts() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_metadata_read_attempts
*
@@ -3958,7 +4071,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_metadata_read_attempts() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_obj_flush_cb
*
@@ -4002,7 +4115,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pset_obj_flush_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_obj_flush_cb
*
@@ -4043,7 +4156,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_obj_flush_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_mdc_log_options
*
@@ -4095,7 +4208,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_mdc_log_options() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mdc_log_options
*
@@ -4150,7 +4263,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mdc_log_options() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_enc
*
@@ -4203,7 +4316,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size, void
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_enc() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_dec
*
@@ -4257,7 +4370,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_facc_mdc_log_location_dec() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_del
*
@@ -4280,7 +4393,7 @@ H5P_facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_del() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_copy
*
@@ -4302,7 +4415,7 @@ H5P_facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_copy() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_cmp
*
@@ -4334,7 +4447,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_facc_mdc_log_location_cmp() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P_facc_mdc_log_location_close
*
@@ -4357,7 +4470,7 @@ H5P_facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P_facc_mdc_log_location_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_evict_on_close
*
@@ -4398,14 +4511,14 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t evict_on_close)
if(H5P_set(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property")
#else
- HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "evict on close is currently not supported in parallel HDF5")
+ HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "evict on close is currently not supported in parallel HDF5")
#endif /* H5_HAVE_PARALLEL */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_evict_on_close() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_evict_on_close
*
@@ -4449,7 +4562,7 @@ done:
} /* end H5Pget_evict_on_close() */
#ifdef H5_HAVE_PARALLEL
-
+
/*-------------------------------------------------------------------------
* Function: H5P__encode_coll_md_read_flag_t
*
@@ -4487,7 +4600,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size, voi
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__encode_coll_md_read_flag_t() */
-
+
/*-------------------------------------------------------------------------
* Function: H5P__decode_coll_md_read_flag_t
*
@@ -4521,7 +4634,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__decode_coll_md_read_flag_t() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_all_coll_metadata_ops
*
@@ -4580,7 +4693,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_all_coll_metadata_ops() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_all_coll_metadata_ops
*
@@ -4638,7 +4751,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Pget_all_coll_metadata_ops */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_coll_metadata_write
*
@@ -4677,7 +4790,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_coll_metadata_write() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_coll_metadata_write
*
@@ -4715,7 +4828,7 @@ done:
} /* end H5Pget_coll_metadata_write() */
#endif /* H5_HAVE_PARALLEL */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pset_page_buffer_size
*
@@ -4763,7 +4876,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pset_page_buffer_size() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Pget_page_buffer_size
*
diff --git a/src/H5S.c b/src/H5S.c
index 90c2674..1375695 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -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;
@@ -1723,8 +1730,8 @@ H5S_decode(const unsigned char **p)
/* Decode the extent part of dataspace */
/* (pass mostly bogus file pointer and bogus DXPL) */
- if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, pp))==NULL)
- HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
+ if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, extent_size, pp)) == NULL)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
pp += extent_size;
/* Copy the extent into dataspace structure */
@@ -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
diff --git a/src/H5SM.c b/src/H5SM.c
index d5ede7e..8e28529 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -70,7 +70,7 @@ static herr_t H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
static herr_t H5SM_decr_ref(void *record, void *op_data, hbool_t *changed);
static herr_t H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
H5SM_index_header_t *header, const H5O_shared_t * mesg,
- unsigned *cache_flags, void ** /*out*/ encoded_mesg);
+ unsigned *cache_flags, size_t * /*out*/ mesg_size, void ** /*out*/ encoded_mesg);
static herr_t H5SM_type_to_flag(unsigned type_id, unsigned *type_flag);
static herr_t H5SM_read_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequence,
unsigned *oh_modified, void *_udata);
@@ -1549,6 +1549,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
unsigned cache_flags = H5AC__NO_FLAGS_SET;
H5SM_table_cache_ud_t cache_udata; /* User-data for callback */
ssize_t index_num;
+ size_t mesg_size = 0;
void *mesg_buf = NULL;
void *native_mesg = NULL;
unsigned type_id; /* Message type ID to operate on */
@@ -1578,8 +1579,8 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
* zero and any file space it uses needs to be freed. mesg_buf holds the
* serialized form of the message.
*/
- if(H5SM_delete_from_index(f, dxpl_id, open_oh, &(table->indexes[index_num]), sh_mesg, &cache_flags, &mesg_buf) < 0)
- HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete mesage from SOHM index")
+ if(H5SM_delete_from_index(f, dxpl_id, open_oh, &(table->indexes[index_num]), sh_mesg, &cache_flags, &mesg_size, &mesg_buf) < 0)
+ HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete mesage from SOHM index")
/* Release the master SOHM table */
if(H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0)
@@ -1591,7 +1592,7 @@ H5SM_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, H5O_shared_t *sh_mesg)
* master table needs to be unprotected when we do this.
*/
if(mesg_buf) {
- if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, (const unsigned char *)mesg_buf)))
+ if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, open_oh, type_id, mesg_size, (const unsigned char *)mesg_buf)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTDECODE, FAIL, "can't decode shared message.")
if(H5O_msg_delete(f, dxpl_id, open_oh, type_id, native_mesg) < 0)
@@ -1778,7 +1779,7 @@ H5SM_decr_ref(void *record, void *op_data, hbool_t *changed)
static herr_t
H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
H5SM_index_header_t *header, const H5O_shared_t *mesg,
- unsigned *cache_flags, void ** /*out*/ encoded_mesg)
+ unsigned *cache_flags, size_t * /*out*/ mesg_size, void ** /*out*/ encoded_mesg)
{
H5SM_list_t *list = NULL;
H5SM_mesg_key_t key;
@@ -1910,6 +1911,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* Return the message's encoding so anything it references can be freed */
*encoded_mesg = encoding_buf;
+ *mesg_size = buf_size;
/* If there are no messages left in the index, delete it */
if(header->num_messages == 0) {
@@ -1951,8 +1953,10 @@ done:
/* Free the message encoding, if we're not returning it in encoded_mesg
* or if there's been an error.
*/
- if(encoding_buf && (NULL == *encoded_mesg || ret_value < 0))
+ if(encoding_buf && (NULL == *encoded_mesg || ret_value < 0)) {
encoding_buf = H5MM_xfree(encoding_buf);
+ *mesg_size = 0;
+ }
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5SM_delete_from_index() */
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index eb52c3d..984f56f 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -282,6 +282,9 @@ H5_DLLVAR const H5S_select_class_t H5S_sel_none[1];
*/
H5_DLLVAR const H5S_select_class_t H5S_sel_point[1];
+/* Array of versions for Dataspace */
+H5_DLLVAR const unsigned H5O_sdspace_ver_bounds[H5F_LIBVER_NBOUNDS];
+
/* Extent functions */
H5_DLL herr_t H5S_extent_release(H5S_extent_t *extent);
H5_DLL herr_t H5S_extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src,
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 009d877..e8a42e8 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -219,7 +219,7 @@ H5_DLL herr_t H5S_set_extent_simple(H5S_t *space, unsigned rank,
H5_DLL H5S_t *H5S_create(H5S_class_t type);
H5_DLL H5S_t *H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/],
const hsize_t maxdims[/*rank*/]);
-H5_DLL herr_t H5S_set_latest_version(H5S_t *ds);
+H5_DLL herr_t H5S_set_version(H5F_t *f, H5S_t *ds);
H5_DLL herr_t H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc, hid_t fapl_id);
H5_DLL H5S_t *H5S_decode(const unsigned char **p);
H5_DLL herr_t H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream,
diff --git a/src/H5T.c b/src/H5T.c
index 7fba30a..d85d20f 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -510,6 +510,12 @@ double H5T_NATIVE_DOUBLE_NEG_INF_g = (double)0.0f;
H5FL_DEFINE(H5T_t);
H5FL_DEFINE(H5T_shared_t);
+/* Format version bounds for datatype */
+const unsigned H5O_dtype_ver_bounds[] = {
+ H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
+ H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
+ H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
+};
/*******************/
/* Local Variables */
@@ -539,6 +545,7 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{
(H5I_free_t)H5T_close /* Callback routine for closing objects of this class */
}};
+
/* Flag indicating "top" of interface has been initialized */
static hbool_t H5T_top_package_initialize_s = FALSE;
@@ -2815,8 +2822,13 @@ H5Tdecode(const void *buf)
if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
- /* Create datatype by decoding buffer */
- if(NULL == (dt = H5T_decode((const unsigned char *)buf)))
+ /* Create datatype by decoding buffer
+ * There is no way to get the size of the buffer, so we pass in
+ * SIZE_MAX and assume the caller knows what they are doing.
+ * Really fixing this will require an H5Tdecode2() call that
+ * takes a size parameter.
+ */
+ if(NULL == (dt = H5T_decode(SIZE_MAX, (const unsigned char *)buf)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object")
/* Register the type and return the ID */
@@ -2905,7 +2917,7 @@ done:
*-------------------------------------------------------------------------
*/
H5T_t *
-H5T_decode(const unsigned char *buf)
+H5T_decode(size_t buf_size, const unsigned char *buf)
{
H5F_t *f = NULL; /* Fake file structure*/
H5T_t *ret_value = NULL; /* Return value */
@@ -2925,7 +2937,7 @@ H5T_decode(const unsigned char *buf)
HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype")
/* Decode the serialized datatype message */
- if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf)))
+ if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf_size, buf)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object")
/* Mark datatype as being in memory now */
@@ -5204,6 +5216,11 @@ H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc)
/* Check if the field changed size */
if(old_size != memb_type->shared->size) {
+
+ /* Fail if the old_size is zero */
+ if (0 == old_size)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "old_size of zero would cause division by zero");
+
/* Adjust the size of the member */
dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].size*memb_type->shared->size)/old_size;
@@ -5403,34 +5420,44 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5T_set_latest_version
+ * Function: H5T_set_version
*
- * Purpose: Set the encoding for a datatype to the latest version.
+ * Purpose: Set the encoding for a datatype to the version indicated by
+ * the file's low bound if that is higher than the datatype's
+ * version.
*
* Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * Thursday, July 19, 2007
+ * Programmer: Vailin Choi; December 2017
*
*-------------------------------------------------------------------------
*/
herr_t
-H5T_set_latest_version(H5T_t *dt)
+H5T_set_version(H5F_t *f, H5T_t *dt)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ unsigned vers; /* The version */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ HDassert(f);
HDassert(dt);
- /* Upgrade the format version for the datatype to the latest */
- if(H5T__upgrade_version(dt, H5O_DTYPE_VERSION_LATEST) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding")
+ vers = H5O_dtype_ver_bounds[H5F_LOW_BOUND(f)];
+ if(vers > dt->shared->version) {
+ /* Upgrade the format version for the datatype */
+ if(H5T__upgrade_version(dt, vers) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding")
+ }
+
+ /* Version bounds check */
+ if(dt->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(f)])
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "Datatype version out of bounds")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5T_set_latest_version() */
+} /* end H5T_set_version() */
/*-------------------------------------------------------------------------
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 30fbeeb..cd0597c 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -328,9 +328,9 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
* a named type should always succeed.
*/
if(H5T_STATE_NAMED == type->shared->state || H5T_STATE_OPEN == type->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed")
if(H5T_STATE_IMMUTABLE == type->shared->state)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable")
/* Check for a "sensible" datatype to store on disk */
if(H5T_is_sensible(type) <= 0)
@@ -344,15 +344,14 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
/* Reset datatype location and path */
if(H5O_loc_reset(&temp_oloc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location")
if(H5G_name_reset(&temp_path) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path")
loc_init = TRUE;
- /* Set the latest format, if requested */
- if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE))
- if(H5T_set_latest_version(type) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
+ /* Set the version for datatype */
+ if(H5T_set_version(file, type) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype")
/* Calculate message size infomation, for creating object header */
dtype_size = H5O_msg_size_f(file, tcpl_id, H5O_DTYPE_ID, type, (size_t)0);
@@ -363,15 +362,15 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
* type message and then give the object header a name.
*/
if(H5O_create(file, dxpl_id, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header")
if(H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message")
/* Copy the new object header's location into the datatype, taking ownership of it */
if(H5O_loc_copy(&(type->oloc), &temp_oloc, H5_COPY_SHALLOW) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
if(H5G_name_copy(&(type->path), &temp_path, H5_COPY_SHALLOW) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location")
loc_init = FALSE;
/* Set the shared info fields */
@@ -400,12 +399,12 @@ done:
if((type->shared->state == H5T_STATE_TRANSIENT || type->shared->state == H5T_STATE_RDONLY) && (type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED)) {
if(H5O_dec_rc_by_loc(&(type->oloc), dxpl_id) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
- if(H5O_close(&(type->oloc), NULL) < 0)
+ if(H5O_close(&(type->oloc), NULL) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header")
if(H5O_delete(file, dxpl_id, type->sh_loc.u.loc.oh_addr) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header")
- type->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
- } /* end if */
+ type->sh_loc.type = H5O_SHARE_TYPE_UNSHARED;
+ } /* end if */
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index d075127..f05c021 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -332,6 +332,9 @@ typedef struct {
/* Typedef for datatype iteration operations */
typedef herr_t (*H5T_operator_t)(H5T_t *dt, void *op_data/*in,out*/);
+/* Array of versions for Datatype */
+H5_DLLVAR const unsigned H5O_dtype_ver_bounds[H5F_LIBVER_NBOUNDS];
+
/*
* Alignment information for native types. A value of N indicates that the
* data must be aligned on an address ADDR such that 0 == ADDR mod N. When
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 9171e1e..61e7c79 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -114,7 +114,7 @@ H5_DLL htri_t H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_ap
H5_DLL size_t H5T_get_size(const H5T_t *dt);
H5_DLL int H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset);
H5_DLL herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc);
-H5_DLL H5T_t *H5T_decode(const unsigned char *buf);
+H5_DLL H5T_t *H5T_decode(size_t buf_size, const unsigned char *buf);
H5_DLL herr_t H5T_debug(const H5T_t *dt, FILE * stream);
H5_DLL struct H5O_loc_t *H5T_oloc(H5T_t *dt);
H5_DLL H5G_name_t *H5T_nameof(H5T_t *dt);
@@ -136,7 +136,7 @@ H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_
H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc);
H5_DLL htri_t H5T_is_sensible(const H5T_t *dt);
H5_DLL uint32_t H5T_hash(H5F_t * file, const H5T_t *dt);
-H5_DLL herr_t H5T_set_latest_version(H5T_t *dt);
+H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt);
H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f);
H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f);
H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
diff --git a/src/H5trace.c b/src/H5trace.c
index 7bc2724..32e05a7 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -174,26 +174,26 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
if(H5_debug_g.ttimes) {
char tmp[128];
- sprintf(tmp, "%.6f", event_time.etime-first_time.etime);
- fprintf(out, " %*s ", (int)HDstrlen(tmp), "");
+ HDsprintf(tmp, "%.6f", event_time.etime-first_time.etime);
+ HDfprintf(out, " %*s ", (int)HDstrlen(tmp), "");
} /* end if */
for(i = 0; i < current_depth; i++)
HDfputc('+', out);
- fprintf(out, "%*s%s = ", 2*current_depth, "", func);
+ HDfprintf(out, "%*s%s = ", 2*current_depth, "", func);
} /* end if */
else {
/* Continue current line with return value */
- fprintf(out, " = ");
+ HDfprintf(out, " = ");
} /* end else */
} /* end if */
else {
if(current_depth>last_call_depth)
HDfputs(" = <delayed>\n", out);
if(H5_debug_g.ttimes)
- fprintf(out, "@%.6f ", event_time.etime - first_time.etime);
+ HDfprintf(out, "@%.6f ", event_time.etime - first_time.etime);
for(i = 0; i < current_depth; i++)
HDfputc('+', out);
- fprintf(out, "%*s%s(", 2*current_depth, "", func);
+ HDfprintf(out, "%*s%s(", 2*current_depth, "", func);
} /* end else */
/* Clear array sizes */
@@ -235,7 +235,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
buf[MIN((int)sizeof(buf) - 1, n)] = '\0';
argname = buf;
} /* end if */
- fprintf(out, "%s%s=", argno?", ":"", argname);
+ HDfprintf(out, "%s%s=", argno?", ":"", argname);
} /* end if */
else
argname = "";
@@ -247,9 +247,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
haddr_t addr = va_arg(ap, haddr_t);
@@ -261,33 +261,33 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'b':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
/* Can't pass hbool_t to va_arg() */
hbool_t bool_var = (hbool_t)va_arg(ap, int);
if(TRUE == bool_var)
- fprintf(out, "TRUE");
+ HDfprintf(out, "TRUE");
else if(!bool_var)
- fprintf(out, "FALSE");
+ HDfprintf(out, "FALSE");
else
- fprintf(out, "TRUE(%u)", (unsigned)bool_var);
+ HDfprintf(out, "TRUE(%u)", (unsigned)bool_var);
}
break;
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
double dbl = va_arg(ap, double);
- fprintf(out, "%g", dbl);
+ HDfprintf(out, "%g", dbl);
} /* end else */
break;
@@ -296,36 +296,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if(ptr) {
if(vp)
- fprintf (out, "0x%lx", (unsigned long)vp);
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int);
switch(alloc_time) {
case H5D_ALLOC_TIME_ERROR:
- fprintf(out, "H5D_ALLOC_TIME_ERROR");
+ HDfprintf(out, "H5D_ALLOC_TIME_ERROR");
break;
case H5D_ALLOC_TIME_DEFAULT:
- fprintf(out, "H5D_ALLOC_TIME_DEFAULT");
+ HDfprintf(out, "H5D_ALLOC_TIME_DEFAULT");
break;
case H5D_ALLOC_TIME_EARLY:
- fprintf(out, "H5D_ALLOC_TIME_EARLY");
+ HDfprintf(out, "H5D_ALLOC_TIME_EARLY");
break;
case H5D_ALLOC_TIME_LATE:
- fprintf(out, "H5D_ALLOC_TIME_LATE");
+ HDfprintf(out, "H5D_ALLOC_TIME_LATE");
break;
case H5D_ALLOC_TIME_INCR:
- fprintf(out, "H5D_ALLOC_TIME_INCR");
+ HDfprintf(out, "H5D_ALLOC_TIME_INCR");
break;
default:
- fprintf(out, "%ld", (long)alloc_time);
+ HDfprintf(out, "%ld", (long)alloc_time);
break;
} /* end switch */
} /* end else */
@@ -334,24 +334,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int);
switch(opt) {
case H5FD_MPIO_COLLECTIVE_IO:
- fprintf(out, "H5FD_MPIO_COLLECTIVE_IO");
+ HDfprintf(out, "H5FD_MPIO_COLLECTIVE_IO");
break;
case H5FD_MPIO_INDIVIDUAL_IO:
- fprintf(out, "H5FD_MPIO_INDIVIDUAL_IO");
+ HDfprintf(out, "H5FD_MPIO_INDIVIDUAL_IO");
break;
default:
- fprintf(out, "%ld", (long)opt);
+ HDfprintf(out, "%ld", (long)opt);
break;
} /* end switch */
} /* end else */
@@ -360,32 +360,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int);
switch(fill_time) {
case H5D_FILL_TIME_ERROR:
- fprintf(out, "H5D_FILL_TIME_ERROR");
+ HDfprintf(out, "H5D_FILL_TIME_ERROR");
break;
case H5D_FILL_TIME_ALLOC:
- fprintf(out, "H5D_FILL_TIME_ALLOC");
+ HDfprintf(out, "H5D_FILL_TIME_ALLOC");
break;
case H5D_FILL_TIME_NEVER:
- fprintf(out, "H5D_FILL_TIME_NEVER");
+ HDfprintf(out, "H5D_FILL_TIME_NEVER");
break;
case H5D_FILL_TIME_IFSET:
- fprintf(out, "H5D_FILL_TIME_IFSET");
+ HDfprintf(out, "H5D_FILL_TIME_IFSET");
break;
default:
- fprintf(out, "%ld", (long)fill_time);
+ HDfprintf(out, "%ld", (long)fill_time);
break;
} /* end switch */
} /* end else */
@@ -394,32 +394,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'F':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int);
switch(fill_value) {
case H5D_FILL_VALUE_ERROR:
- fprintf(out, "H5D_FILL_VALUE_ERROR");
+ HDfprintf(out, "H5D_FILL_VALUE_ERROR");
break;
case H5D_FILL_VALUE_UNDEFINED:
- fprintf(out, "H5D_FILL_VALUE_UNDEFINED");
+ HDfprintf(out, "H5D_FILL_VALUE_UNDEFINED");
break;
case H5D_FILL_VALUE_DEFAULT:
- fprintf(out, "H5D_FILL_VALUE_DEFAULT");
+ HDfprintf(out, "H5D_FILL_VALUE_DEFAULT");
break;
case H5D_FILL_VALUE_USER_DEFINED:
- fprintf(out, "H5D_FILL_VALUE_USER_DEFINED");
+ HDfprintf(out, "H5D_FILL_VALUE_USER_DEFINED");
break;
default:
- fprintf(out, "%ld", (long)fill_value);
+ HDfprintf(out, "%ld", (long)fill_value);
break;
} /* end switch */
} /* end else */
@@ -428,28 +428,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'h':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int);
switch(opt) {
case H5FD_MPIO_CHUNK_DEFAULT:
- fprintf(out, "H5FD_MPIO_CHUNK_DEFAULT");
+ HDfprintf(out, "H5FD_MPIO_CHUNK_DEFAULT");
break;
case H5FD_MPIO_CHUNK_ONE_IO:
- fprintf(out, "H5FD_MPIO_CHUNK_ONE_IO");
+ HDfprintf(out, "H5FD_MPIO_CHUNK_ONE_IO");
break;
case H5FD_MPIO_CHUNK_MULTI_IO:
- fprintf(out, "H5FD_MPIO_CHUNK_MULTI_IO");
+ HDfprintf(out, "H5FD_MPIO_CHUNK_MULTI_IO");
break;
default:
- fprintf(out, "%ld", (long)opt);
+ HDfprintf(out, "%ld", (long)opt);
break;
} /* end switch */
} /* end else */
@@ -458,36 +458,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_mpio_actual_io_mode_t actual_io_mode = (H5D_mpio_actual_io_mode_t)va_arg(ap, int);
switch(actual_io_mode) {
case H5D_MPIO_NO_COLLECTIVE:
- fprintf(out, "H5D_MPIO_NO_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_NO_COLLECTIVE");
break;
case H5D_MPIO_CHUNK_INDEPENDENT:
- fprintf(out, "H5D_MPIO_CHUNK_INDEPENDENT");
+ HDfprintf(out, "H5D_MPIO_CHUNK_INDEPENDENT");
break;
case H5D_MPIO_CHUNK_COLLECTIVE:
- fprintf(out, "H5D_MPIO_CHUNK_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_CHUNK_COLLECTIVE");
break;
case H5D_MPIO_CHUNK_MIXED:
- fprintf(out, "H5D_MPIO_CHUNK_MIXED");
+ HDfprintf(out, "H5D_MPIO_CHUNK_MIXED");
break;
case H5D_MPIO_CONTIGUOUS_COLLECTIVE:
- fprintf(out, "H5D_MPIO_CONTIGUOUS_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_CONTIGUOUS_COLLECTIVE");
break;
default:
- fprintf(out, "%ld", (long)actual_io_mode);
+ HDfprintf(out, "%ld", (long)actual_io_mode);
break;
} /* end switch */
} /* end else */
@@ -496,44 +496,44 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'k':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_chunk_index_t idx = (H5D_chunk_index_t)va_arg(ap, int);
switch(idx) {
case H5D_CHUNK_IDX_BTREE:
- fprintf(out, "H5D_CHUNK_IDX_BTREE");
+ HDfprintf(out, "H5D_CHUNK_IDX_BTREE");
break;
case H5D_CHUNK_IDX_NONE:
- fprintf(out, "H5D_CHUNK_IDX_NONE");
+ HDfprintf(out, "H5D_CHUNK_IDX_NONE");
break;
case H5D_CHUNK_IDX_FARRAY:
- fprintf(out, "H5D_CHUNK_IDX_FARRAY");
+ HDfprintf(out, "H5D_CHUNK_IDX_FARRAY");
break;
case H5D_CHUNK_IDX_EARRAY:
- fprintf(out, "H5D_CHUNK_IDX_EARRAY");
+ HDfprintf(out, "H5D_CHUNK_IDX_EARRAY");
break;
case H5D_CHUNK_IDX_BT2:
- fprintf(out, "H5D_CHUNK_IDX_BT2");
+ HDfprintf(out, "H5D_CHUNK_IDX_BT2");
break;
case H5D_CHUNK_IDX_SINGLE:
- fprintf(out, "H5D_CHUNK_IDX_SINGLE");
+ HDfprintf(out, "H5D_CHUNK_IDX_SINGLE");
break;
case H5D_CHUNK_IDX_NTYPES:
- fprintf(out, "ERROR: H5D_CHUNK_IDX_NTYPES (invalid value)");
+ HDfprintf(out, "ERROR: H5D_CHUNK_IDX_NTYPES (invalid value)");
break;
default:
- fprintf(out, "UNKNOWN VALUE: %ld", (long)idx);
+ HDfprintf(out, "UNKNOWN VALUE: %ld", (long)idx);
break;
} /* end switch */
} /* end else */
@@ -542,40 +542,40 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_layout_t layout = (H5D_layout_t)va_arg(ap, int);
switch(layout) {
case H5D_LAYOUT_ERROR:
- fprintf(out, "H5D_LAYOUT_ERROR");
+ HDfprintf(out, "H5D_LAYOUT_ERROR");
break;
case H5D_COMPACT:
- fprintf(out, "H5D_COMPACT");
+ HDfprintf(out, "H5D_COMPACT");
break;
case H5D_CONTIGUOUS:
- fprintf(out, "H5D_CONTIGUOUS");
+ HDfprintf(out, "H5D_CONTIGUOUS");
break;
case H5D_CHUNKED:
- fprintf(out, "H5D_CHUNKED");
+ HDfprintf(out, "H5D_CHUNKED");
break;
case H5D_VIRTUAL:
- fprintf(out, "H5D_VIRTUAL");
+ HDfprintf(out, "H5D_VIRTUAL");
break;
case H5D_NLAYOUTS:
- fprintf(out, "H5D_NLAYOUTS");
+ HDfprintf(out, "H5D_NLAYOUTS");
break;
default:
- fprintf(out, "%ld", (long)layout);
+ HDfprintf(out, "%ld", (long)layout);
break;
} /* end switch */
} /* end else */
@@ -584,9 +584,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'n':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_mpio_no_collective_cause_t nocol_cause_mode = (H5D_mpio_no_collective_cause_t)va_arg(ap, int);
@@ -594,65 +594,65 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* Check for all bit-flags which might be set */
if(nocol_cause_mode & H5D_MPIO_COLLECTIVE) {
- fprintf(out, "H5D_MPIO_COLLECTIVE");
+ HDfprintf(out, "H5D_MPIO_COLLECTIVE");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_SET_INDEPENDENT) {
- fprintf(out, "%sH5D_MPIO_SET_INDEPENDENT", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_SET_INDEPENDENT", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_DATATYPE_CONVERSION) {
- fprintf(out, "%sH5D_MPIO_DATATYPE_CONVERSION", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_DATATYPE_CONVERSION", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_DATA_TRANSFORMS) {
- fprintf(out, "%sH5D_MPIO_DATA_TRANSFORMS", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_DATA_TRANSFORMS", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED) {
- fprintf(out, "%sH5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES) {
- fprintf(out, "%sH5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
if(nocol_cause_mode & H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET) {
- fprintf(out, "%sH5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET", flag_already_displayed ? " | " : "");
+ HDfprintf(out, "%sH5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET", flag_already_displayed ? " | " : "");
flag_already_displayed = TRUE;
} /* end if */
/* Display '<none>' if there's no flags set */
if(!flag_already_displayed)
- fprintf(out, "<none>");
+ HDfprintf(out, "<none>");
} /* end else */
break;
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_mpio_actual_chunk_opt_mode_t chunk_opt_mode = (H5D_mpio_actual_chunk_opt_mode_t)va_arg(ap, int);
switch(chunk_opt_mode) {
case H5D_MPIO_NO_CHUNK_OPTIMIZATION:
- fprintf(out, "H5D_MPIO_NO_CHUNK_OPTIMIZATION");
+ HDfprintf(out, "H5D_MPIO_NO_CHUNK_OPTIMIZATION");
break;
case H5D_MPIO_LINK_CHUNK:
- fprintf(out, "H5D_MPIO_LINK_CHUNK");
+ HDfprintf(out, "H5D_MPIO_LINK_CHUNK");
break;
case H5D_MPIO_MULTI_CHUNK:
- fprintf(out, "H5D_MPIO_MULTI_CHUNK");
+ HDfprintf(out, "H5D_MPIO_MULTI_CHUNK");
break;
default:
- fprintf(out, "%ld", (long)chunk_opt_mode);
+ HDfprintf(out, "%ld", (long)chunk_opt_mode);
break;
} /* end switch */
} /* end else */
@@ -661,32 +661,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_space_status_t space_status = (H5D_space_status_t)va_arg(ap, int);
switch(space_status) {
case H5D_SPACE_STATUS_NOT_ALLOCATED:
- fprintf(out, "H5D_SPACE_STATUS_NOT_ALLOCATED");
+ HDfprintf(out, "H5D_SPACE_STATUS_NOT_ALLOCATED");
break;
case H5D_SPACE_STATUS_PART_ALLOCATED:
- fprintf(out, "H5D_SPACE_STATUS_PART_ALLOCATED");
+ HDfprintf(out, "H5D_SPACE_STATUS_PART_ALLOCATED");
break;
case H5D_SPACE_STATUS_ALLOCATED:
- fprintf(out, "H5D_SPACE_STATUS_ALLOCATED");
+ HDfprintf(out, "H5D_SPACE_STATUS_ALLOCATED");
break;
case H5D_SPACE_STATUS_ERROR:
- fprintf(out, "H5D_SPACE_STATUS_ERROR");
+ HDfprintf(out, "H5D_SPACE_STATUS_ERROR");
break;
default:
- fprintf(out, "%ld", (long)space_status);
+ HDfprintf(out, "%ld", (long)space_status);
break;
} /* end switch */
} /* end else */
@@ -695,24 +695,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)va_arg(ap, int);
switch(transfer) {
case H5FD_MPIO_INDEPENDENT:
- fprintf(out, "H5FD_MPIO_INDEPENDENT");
+ HDfprintf(out, "H5FD_MPIO_INDEPENDENT");
break;
case H5FD_MPIO_COLLECTIVE:
- fprintf(out, "H5FD_MPIO_COLLECTIVE");
+ HDfprintf(out, "H5FD_MPIO_COLLECTIVE");
break;
default:
- fprintf(out, "%ld", (long)transfer);
+ HDfprintf(out, "%ld", (long)transfer);
break;
} /* end switch */
} /* end else */
@@ -721,35 +721,35 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'v':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5D_vds_view_t view = (H5D_vds_view_t)va_arg(ap, int);
switch(view) {
case H5D_VDS_ERROR:
- fprintf(out, "H5D_VDS_ERROR");
+ HDfprintf(out, "H5D_VDS_ERROR");
break;
case H5D_VDS_FIRST_MISSING:
- fprintf(out, "H5D_VDS_FIRST_MISSING");
+ HDfprintf(out, "H5D_VDS_FIRST_MISSING");
break;
case H5D_VDS_LAST_AVAILABLE:
- fprintf(out, "H5D_VDS_LAST_AVAILABLE");
+ HDfprintf(out, "H5D_VDS_LAST_AVAILABLE");
break;
default:
- fprintf(out, "%ld", (long)view);
+ HDfprintf(out, "%ld", (long)view);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(D%c)", type[1]);
+ HDfprintf (out, "BADTYPE(D%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -757,17 +757,17 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
herr_t status = va_arg(ap, herr_t);
if(status >= 0)
- fprintf(out, "SUCCEED");
+ HDfprintf(out, "SUCCEED");
else
- fprintf(out, "FAIL");
+ HDfprintf(out, "FAIL");
} /* end else */
break;
@@ -776,24 +776,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5E_direction_t direction = (H5E_direction_t)va_arg(ap, int);
switch(direction) {
case H5E_WALK_UPWARD:
- fprintf(out, "H5E_WALK_UPWARD");
+ HDfprintf(out, "H5E_WALK_UPWARD");
break;
case H5E_WALK_DOWNWARD:
- fprintf(out, "H5E_WALK_DOWNWARD");
+ HDfprintf(out, "H5E_WALK_DOWNWARD");
break;
default:
- fprintf(out, "%ld", (long)direction);
+ HDfprintf(out, "%ld", (long)direction);
break;
} /* end switch */
} /* end else */
@@ -802,45 +802,45 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5E_error2_t *error = va_arg(ap, H5E_error2_t *);
- fprintf(out, "0x%lx", (unsigned long)error);
+ HDfprintf(out, "0x%lx", (unsigned long)error);
} /* end else */
break;
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5E_type_t etype = (H5E_type_t)va_arg(ap, int);
switch(etype) {
case H5E_MAJOR:
- fprintf(out, "H5E_MAJOR");
+ HDfprintf(out, "H5E_MAJOR");
break;
case H5E_MINOR:
- fprintf(out, "H5E_MINOR");
+ HDfprintf(out, "H5E_MINOR");
break;
default:
- fprintf(out, "%ld", (long)etype);
+ HDfprintf(out, "%ld", (long)etype);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(E%c)", type[1]);
+ HDfprintf(out, "BADTYPE(E%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -850,32 +850,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_close_degree_t degree = (H5F_close_degree_t)va_arg(ap, int);
switch(degree) {
case H5F_CLOSE_DEFAULT:
- fprintf(out, "H5F_CLOSE_DEFAULT");
+ HDfprintf(out, "H5F_CLOSE_DEFAULT");
break;
case H5F_CLOSE_WEAK:
- fprintf(out, "H5F_CLOSE_WEAK");
+ HDfprintf(out, "H5F_CLOSE_WEAK");
break;
case H5F_CLOSE_SEMI:
- fprintf(out, "H5F_CLOSE_SEMI");
+ HDfprintf(out, "H5F_CLOSE_SEMI");
break;
case H5F_CLOSE_STRONG:
- fprintf(out, "H5F_CLOSE_STRONG");
+ HDfprintf(out, "H5F_CLOSE_STRONG");
break;
default:
- fprintf(out, "%ld", (long)degree);
+ HDfprintf(out, "%ld", (long)degree);
break;
} /* end switch */
} /* end else */
@@ -884,33 +884,33 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'f':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_fspace_strategy_t fs_strategy = (H5F_fspace_strategy_t)va_arg(ap, int);
switch(fs_strategy) {
case H5F_FSPACE_STRATEGY_FSM_AGGR:
- fprintf(out, "H5F_FSPACE_STRATEGY_FSM_AGGR");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_FSM_AGGR");
break;
case H5F_FSPACE_STRATEGY_PAGE:
- fprintf(out, "H5F_FSPACE_STRATEGY_PAGE");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_PAGE");
break;
case H5F_FSPACE_STRATEGY_AGGR:
- fprintf(out, "H5F_FSPACE_STRATEGY_AGGR");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_AGGR");
break;
case H5F_FSPACE_STRATEGY_NONE:
- fprintf(out, "H5F_FSPACE_STRATEGY_NONE");
+ HDfprintf(out, "H5F_FSPACE_STRATEGY_NONE");
break;
case H5F_FSPACE_STRATEGY_NTYPES:
default:
- fprintf(out, "%ld", (long)fs_strategy);
+ HDfprintf(out, "%ld", (long)fs_strategy);
break;
} /* end switch */
} /* end else */
@@ -919,49 +919,49 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'm':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_mem_t mem_type = (H5F_mem_t)va_arg(ap, int);
switch(mem_type) {
case H5FD_MEM_NOLIST:
- fprintf(out, "H5FD_MEM_NOLIST");
+ HDfprintf(out, "H5FD_MEM_NOLIST");
break;
case H5FD_MEM_DEFAULT:
- fprintf(out, "H5FD_MEM_DEFAULT");
+ HDfprintf(out, "H5FD_MEM_DEFAULT");
break;
case H5FD_MEM_SUPER:
- fprintf(out, "H5FD_MEM_SUPER");
+ HDfprintf(out, "H5FD_MEM_SUPER");
break;
case H5FD_MEM_BTREE:
- fprintf(out, "H5FD_MEM_BTREE");
+ HDfprintf(out, "H5FD_MEM_BTREE");
break;
case H5FD_MEM_DRAW:
- fprintf(out, "H5FD_MEM_DRAW");
+ HDfprintf(out, "H5FD_MEM_DRAW");
break;
case H5FD_MEM_GHEAP:
- fprintf(out, "H5FD_MEM_GHEAP");
+ HDfprintf(out, "H5FD_MEM_GHEAP");
break;
case H5FD_MEM_LHEAP:
- fprintf(out, "H5FD_MEM_LHEAP");
+ HDfprintf(out, "H5FD_MEM_LHEAP");
break;
case H5FD_MEM_OHDR:
- fprintf(out, "H5FD_MEM_OHDR");
+ HDfprintf(out, "H5FD_MEM_OHDR");
break;
case H5FD_MEM_NTYPES:
default:
- fprintf(out, "%ld", (long)mem_type);
+ HDfprintf(out, "%ld", (long)mem_type);
break;
} /* end switch */
} /* end else */
@@ -970,24 +970,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_scope_t scope = (H5F_scope_t)va_arg(ap, int);
switch(scope) {
case H5F_SCOPE_LOCAL:
- fprintf(out, "H5F_SCOPE_LOCAL");
+ HDfprintf(out, "H5F_SCOPE_LOCAL");
break;
case H5F_SCOPE_GLOBAL:
- fprintf(out, "H5F_SCOPE_GLOBAL");
+ HDfprintf(out, "H5F_SCOPE_GLOBAL");
break;
default:
- fprintf(out, "%ld", (long)scope);
+ HDfprintf(out, "%ld", (long)scope);
break;
} /* end switch */
} /* end else */
@@ -996,40 +996,47 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
break;
case 'v':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5F_libver_t libver_vers = (H5F_libver_t)va_arg(ap, int);
switch(libver_vers) {
case H5F_LIBVER_EARLIEST:
- fprintf(out, "H5F_LIBVER_EARLIEST");
+ HDfprintf(out, "H5F_LIBVER_EARLIEST");
break;
- case H5F_LIBVER_LATEST:
- fprintf(out, "H5F_LIBVER_LATEST");
+ case H5F_LIBVER_V18:
+ HDfprintf(out, "H5F_LIBVER_V18");
break;
+ case H5F_LIBVER_V110:
+ HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
+ HDfprintf(out, "H5F_LIBVER_LATEST");
+ break;
+
+ case H5F_LIBVER_ERROR:
+ case H5F_LIBVER_NBOUNDS:
default:
- fprintf(out, "%ld", (long)libver_vers);
+ HDfprintf(out, "%ld", (long)libver_vers);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(F%c)", type[1]);
+ HDfprintf(out, "BADTYPE(F%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1040,46 +1047,46 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5G_obj_t obj_type = (H5G_obj_t)va_arg(ap, int);
switch(obj_type) {
case H5G_UNKNOWN:
- fprintf(out, "H5G_UNKNOWN");
+ HDfprintf(out, "H5G_UNKNOWN");
break;
case H5G_GROUP:
- fprintf(out, "H5G_GROUP");
+ HDfprintf(out, "H5G_GROUP");
break;
case H5G_DATASET:
- fprintf(out, "H5G_DATASET");
+ HDfprintf(out, "H5G_DATASET");
break;
case H5G_TYPE:
- fprintf(out, "H5G_TYPE");
+ HDfprintf(out, "H5G_TYPE");
break;
case H5G_LINK:
- fprintf(out, "H5G_LINK");
+ HDfprintf(out, "H5G_LINK");
break;
case H5G_UDLINK:
- fprintf(out, "H5G_UDLINK");
+ HDfprintf(out, "H5G_UDLINK");
break;
case H5G_RESERVED_5:
case H5G_RESERVED_6:
case H5G_RESERVED_7:
- fprintf(out, "H5G_RESERVED(%ld)", (long)obj_type);
+ HDfprintf(out, "H5G_RESERVED(%ld)", (long)obj_type);
break;
default:
- fprintf(out, "%ld", (long)obj_type);
+ HDfprintf(out, "%ld", (long)obj_type);
break;
} /* end switch */
} /* end else */
@@ -1088,20 +1095,20 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf (out, "0x%lx", (unsigned long)vp);
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t*);
- fprintf(out, "0x%lx", (unsigned long)statbuf);
+ HDfprintf(out, "0x%lx", (unsigned long)statbuf);
}
break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
default:
- fprintf(out, "BADTYPE(G%c)", type[1]);
+ HDfprintf(out, "BADTYPE(G%c)", type[1]);
goto error;
}
break;
@@ -1109,22 +1116,22 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'h':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
hsize_t *p = (hsize_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++) {
if(H5S_UNLIMITED == p[i])
HDfprintf(out, "%sH5S_UNLIMITED", (i ? ", " : ""));
else
HDfprintf(out, "%s%Hu", (i ? ", " : ""), p[i]);
} /* end for */
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hsize_t hsize = va_arg(ap, hsize_t);
@@ -1143,18 +1150,18 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
hssize_t *p = (hssize_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%Hd", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hssize_t hssize = va_arg(ap, hssize_t);
@@ -1165,7 +1172,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
default:
- fprintf (out, "BADTYPE(H%c)", type[1]);
+ HDfprintf (out, "BADTYPE(H%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1173,130 +1180,130 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hid_t obj = va_arg(ap, hid_t);
if(H5P_DEFAULT == obj)
- fprintf(out, "H5P_DEFAULT");
+ HDfprintf(out, "H5P_DEFAULT");
else if(obj < 0)
- fprintf(out, "FAIL");
+ HDfprintf(out, "FAIL");
else {
switch(H5I_TYPE(obj)) { /* Use internal H5I macro instead of function call */
case H5I_UNINIT:
- fprintf(out, "%ld (uninit - error)", (long)obj);
+ HDfprintf(out, "%ld (uninit - error)", (long)obj);
break;
case H5I_BADID:
- fprintf(out, "%ld (error)", (long)obj);
+ HDfprintf(out, "%ld (error)", (long)obj);
break;
case H5I_FILE:
- fprintf(out, "%ld (file)", (long)obj);
+ HDfprintf(out, "%ld (file)", (long)obj);
break;
case H5I_GROUP:
- fprintf(out, "%ld (group)", (long)obj);
+ HDfprintf(out, "%ld (group)", (long)obj);
break;
case H5I_DATATYPE:
if(obj == H5T_NATIVE_SCHAR_g)
- fprintf(out, "H5T_NATIVE_SCHAR");
+ HDfprintf(out, "H5T_NATIVE_SCHAR");
else if(obj == H5T_NATIVE_UCHAR_g)
- fprintf(out, "H5T_NATIVE_UCHAR");
+ HDfprintf(out, "H5T_NATIVE_UCHAR");
else if(obj == H5T_NATIVE_SHORT_g)
- fprintf(out, "H5T_NATIVE_SHORT");
+ HDfprintf(out, "H5T_NATIVE_SHORT");
else if(obj == H5T_NATIVE_USHORT_g)
- fprintf(out, "H5T_NATIVE_USHORT");
+ HDfprintf(out, "H5T_NATIVE_USHORT");
else if(obj == H5T_NATIVE_INT_g)
- fprintf(out, "H5T_NATIVE_INT");
+ HDfprintf(out, "H5T_NATIVE_INT");
else if(obj == H5T_NATIVE_UINT_g)
- fprintf(out, "H5T_NATIVE_UINT");
+ HDfprintf(out, "H5T_NATIVE_UINT");
else if(obj == H5T_NATIVE_LONG_g)
- fprintf(out, "H5T_NATIVE_LONG");
+ HDfprintf(out, "H5T_NATIVE_LONG");
else if(obj == H5T_NATIVE_ULONG_g)
- fprintf(out, "H5T_NATIVE_ULONG");
+ HDfprintf(out, "H5T_NATIVE_ULONG");
else if(obj == H5T_NATIVE_LLONG_g)
- fprintf(out, "H5T_NATIVE_LLONG");
+ HDfprintf(out, "H5T_NATIVE_LLONG");
else if(obj == H5T_NATIVE_ULLONG_g)
- fprintf(out, "H5T_NATIVE_ULLONG");
+ HDfprintf(out, "H5T_NATIVE_ULLONG");
else if(obj == H5T_NATIVE_FLOAT_g)
- fprintf(out, "H5T_NATIVE_FLOAT");
+ HDfprintf(out, "H5T_NATIVE_FLOAT");
else if(obj == H5T_NATIVE_DOUBLE_g)
- fprintf(out, "H5T_NATIVE_DOUBLE");
+ HDfprintf(out, "H5T_NATIVE_DOUBLE");
#if H5_SIZEOF_LONG_DOUBLE !=0
else if(obj == H5T_NATIVE_LDOUBLE_g)
- fprintf(out, "H5T_NATIVE_LDOUBLE");
+ HDfprintf(out, "H5T_NATIVE_LDOUBLE");
#endif
else if(obj == H5T_IEEE_F32BE_g)
- fprintf(out, "H5T_IEEE_F32BE");
+ HDfprintf(out, "H5T_IEEE_F32BE");
else if(obj == H5T_IEEE_F32LE_g)
- fprintf(out, "H5T_IEEE_F32LE");
+ HDfprintf(out, "H5T_IEEE_F32LE");
else if(obj == H5T_IEEE_F64BE_g)
- fprintf(out, "H5T_IEEE_F64BE");
+ HDfprintf(out, "H5T_IEEE_F64BE");
else if(obj == H5T_IEEE_F64LE_g)
- fprintf(out, "H5T_IEEE_F64LE");
+ HDfprintf(out, "H5T_IEEE_F64LE");
else if(obj == H5T_STD_I8BE_g)
- fprintf(out, "H5T_STD_I8BE");
+ HDfprintf(out, "H5T_STD_I8BE");
else if(obj == H5T_STD_I8LE_g)
- fprintf(out, "H5T_STD_I8LE");
+ HDfprintf(out, "H5T_STD_I8LE");
else if(obj == H5T_STD_I16BE_g)
- fprintf(out, "H5T_STD_I16BE");
+ HDfprintf(out, "H5T_STD_I16BE");
else if(obj == H5T_STD_I16LE_g)
- fprintf(out, "H5T_STD_I16LE");
+ HDfprintf(out, "H5T_STD_I16LE");
else if(obj == H5T_STD_I32BE_g)
- fprintf(out, "H5T_STD_I32BE");
+ HDfprintf(out, "H5T_STD_I32BE");
else if(obj == H5T_STD_I32LE_g)
- fprintf(out, "H5T_STD_I32LE");
+ HDfprintf(out, "H5T_STD_I32LE");
else if(obj == H5T_STD_I64BE_g)
- fprintf(out, "H5T_STD_I64BE");
+ HDfprintf(out, "H5T_STD_I64BE");
else if(obj == H5T_STD_I64LE_g)
- fprintf(out, "H5T_STD_I64LE");
+ HDfprintf(out, "H5T_STD_I64LE");
else if(obj == H5T_STD_U8BE_g)
- fprintf(out, "H5T_STD_U8BE");
+ HDfprintf(out, "H5T_STD_U8BE");
else if(obj == H5T_STD_U8LE_g)
- fprintf(out, "H5T_STD_U8LE");
+ HDfprintf(out, "H5T_STD_U8LE");
else if(obj == H5T_STD_U16BE_g)
- fprintf(out, "H5T_STD_U16BE");
+ HDfprintf(out, "H5T_STD_U16BE");
else if(obj == H5T_STD_U16LE_g)
- fprintf(out, "H5T_STD_U16LE");
+ HDfprintf(out, "H5T_STD_U16LE");
else if(obj == H5T_STD_U32BE_g)
- fprintf(out, "H5T_STD_U32BE");
+ HDfprintf(out, "H5T_STD_U32BE");
else if(obj == H5T_STD_U32LE_g)
- fprintf(out, "H5T_STD_U32LE");
+ HDfprintf(out, "H5T_STD_U32LE");
else if(obj == H5T_STD_U64BE_g)
- fprintf(out, "H5T_STD_U64BE");
+ HDfprintf(out, "H5T_STD_U64BE");
else if(obj == H5T_STD_U64LE_g)
- fprintf(out, "H5T_STD_U64LE");
+ HDfprintf(out, "H5T_STD_U64LE");
else if(obj == H5T_STD_B8BE_g)
- fprintf(out, "H5T_STD_B8BE");
+ HDfprintf(out, "H5T_STD_B8BE");
else if(obj == H5T_STD_B8LE_g)
- fprintf(out, "H5T_STD_B8LE");
+ HDfprintf(out, "H5T_STD_B8LE");
else if(obj == H5T_STD_B16BE_g)
- fprintf(out, "H5T_STD_B16BE");
+ HDfprintf(out, "H5T_STD_B16BE");
else if(obj == H5T_STD_B16LE_g)
- fprintf(out, "H5T_STD_B16LE");
+ HDfprintf(out, "H5T_STD_B16LE");
else if(obj == H5T_STD_B32BE_g)
- fprintf(out, "H5T_STD_B32BE");
+ HDfprintf(out, "H5T_STD_B32BE");
else if(obj == H5T_STD_B32LE_g)
- fprintf(out, "H5T_STD_B32LE");
+ HDfprintf(out, "H5T_STD_B32LE");
else if(obj == H5T_STD_B64BE_g)
- fprintf(out, "H5T_STD_B64BE");
+ HDfprintf(out, "H5T_STD_B64BE");
else if(obj == H5T_STD_B64LE_g)
- fprintf(out, "H5T_STD_B64LE");
+ HDfprintf(out, "H5T_STD_B64LE");
else if(obj == H5T_C_S1_g)
- fprintf(out, "H5T_C_S1");
+ HDfprintf(out, "H5T_C_S1");
else if(obj == H5T_FORTRAN_S1_g)
- fprintf(out, "H5T_FORTRAN_S1");
+ HDfprintf(out, "H5T_FORTRAN_S1");
else
- fprintf(out, "%ld (dtype)", (long)obj);
+ HDfprintf(out, "%ld (dtype)", (long)obj);
break;
case H5I_DATASPACE:
- fprintf(out, "%ld (dspace)", (long)obj);
+ HDfprintf(out, "%ld (dspace)", (long)obj);
/* Save the rank of simple data spaces for arrays */
/* This may generate recursive call to the library... -QAK */
{
@@ -1309,47 +1316,47 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
case H5I_DATASET:
- fprintf(out, "%ld (dset)", (long)obj);
+ HDfprintf(out, "%ld (dset)", (long)obj);
break;
case H5I_ATTR:
- fprintf(out, "%ld (attr)", (long)obj);
+ HDfprintf(out, "%ld (attr)", (long)obj);
break;
case H5I_REFERENCE:
- fprintf(out, "%ld (reference)", (long)obj);
+ HDfprintf(out, "%ld (reference)", (long)obj);
break;
case H5I_VFL:
- fprintf(out, "%ld (file driver)", (long)obj);
+ HDfprintf(out, "%ld (file driver)", (long)obj);
break;
case H5I_GENPROP_CLS:
- fprintf(out, "%ld (genprop class)", (long)obj);
+ HDfprintf(out, "%ld (genprop class)", (long)obj);
break;
case H5I_GENPROP_LST:
- fprintf(out, "%ld (genprop list)", (long)obj);
+ HDfprintf(out, "%ld (genprop list)", (long)obj);
break;
case H5I_ERROR_CLASS:
- fprintf(out, "%ld (err class)", (long)obj);
+ HDfprintf(out, "%ld (err class)", (long)obj);
break;
case H5I_ERROR_MSG:
- fprintf(out, "%ld (err msg)", (long)obj);
+ HDfprintf(out, "%ld (err msg)", (long)obj);
break;
case H5I_ERROR_STACK:
- fprintf(out, "%ld (err stack)", (long)obj);
+ HDfprintf(out, "%ld (err stack)", (long)obj);
break;
case H5I_NTYPES:
- fprintf (out, "%ld (ntypes - error)", (long)obj);
+ HDfprintf (out, "%ld (ntypes - error)", (long)obj);
break;
default:
- fprintf(out, "%ld (unknown class)", (long)obj);
+ HDfprintf(out, "%ld (unknown class)", (long)obj);
break;
} /* end switch */
} /* end else */
@@ -1361,32 +1368,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5_index_t idx_type = (H5_index_t)va_arg(ap, int);
switch(idx_type) {
case H5_INDEX_UNKNOWN:
- fprintf(out, "H5_INDEX_UNKNOWN");
+ HDfprintf(out, "H5_INDEX_UNKNOWN");
break;
case H5_INDEX_NAME:
- fprintf(out, "H5_INDEX_NAME");
+ HDfprintf(out, "H5_INDEX_NAME");
break;
case H5_INDEX_CRT_ORDER:
- fprintf(out, "H5_INDEX_CRT_ORDER");
+ HDfprintf(out, "H5_INDEX_CRT_ORDER");
break;
case H5_INDEX_N:
- fprintf(out, "H5_INDEX_N");
+ HDfprintf(out, "H5_INDEX_N");
break;
default:
- fprintf(out, "%ld", (long)idx_type);
+ HDfprintf(out, "%ld", (long)idx_type);
break;
} /* end switch */
} /* end else */
@@ -1395,36 +1402,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5_iter_order_t order = (H5_iter_order_t)va_arg(ap, int);
switch(order) {
case H5_ITER_UNKNOWN:
- fprintf(out, "H5_ITER_UNKNOWN");
+ HDfprintf(out, "H5_ITER_UNKNOWN");
break;
case H5_ITER_INC:
- fprintf(out, "H5_ITER_INC");
+ HDfprintf(out, "H5_ITER_INC");
break;
case H5_ITER_DEC:
- fprintf(out, "H5_ITER_DEC");
+ HDfprintf(out, "H5_ITER_DEC");
break;
case H5_ITER_NATIVE:
- fprintf(out, "H5_ITER_NATIVE");
+ HDfprintf(out, "H5_ITER_NATIVE");
break;
case H5_ITER_N:
- fprintf(out, "H5_ITER_N");
+ HDfprintf(out, "H5_ITER_N");
break;
default:
- fprintf(out, "%ld", (long)order);
+ HDfprintf(out, "%ld", (long)order);
break;
} /* end switch */
} /* end else */
@@ -1433,23 +1440,23 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
int *p = (int*)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
- fprintf(out, "%s%d", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "%s%d", (i ? ", " : ""), p[i]);
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
int is = va_arg(ap, int);
- fprintf (out, "%d", is);
+ HDfprintf (out, "%d", is);
asize[argno] = is;
} /* end else */
break;
@@ -1457,80 +1464,80 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5I_type_t id_type = (H5I_type_t)va_arg(ap, int);
switch (id_type) {
case H5I_UNINIT:
- fprintf(out, "H5I_UNINIT");
+ HDfprintf(out, "H5I_UNINIT");
break;
case H5I_BADID:
- fprintf(out, "H5I_BADID");
+ HDfprintf(out, "H5I_BADID");
break;
case H5I_FILE:
- fprintf(out, "H5I_FILE");
+ HDfprintf(out, "H5I_FILE");
break;
case H5I_GROUP:
- fprintf(out, "H5I_GROUP");
+ HDfprintf(out, "H5I_GROUP");
break;
case H5I_DATATYPE:
- fprintf(out, "H5I_DATATYPE");
+ HDfprintf(out, "H5I_DATATYPE");
break;
case H5I_DATASPACE:
- fprintf(out, "H5I_DATASPACE");
+ HDfprintf(out, "H5I_DATASPACE");
break;
case H5I_DATASET:
- fprintf(out, "H5I_DATASET");
+ HDfprintf(out, "H5I_DATASET");
break;
case H5I_ATTR:
- fprintf(out, "H5I_ATTR");
+ HDfprintf(out, "H5I_ATTR");
break;
case H5I_REFERENCE:
- fprintf(out, "H5I_REFERENCE");
+ HDfprintf(out, "H5I_REFERENCE");
break;
case H5I_VFL:
- fprintf(out, "H5I_VFL");
+ HDfprintf(out, "H5I_VFL");
break;
case H5I_GENPROP_CLS:
- fprintf(out, "H5I_GENPROP_CLS");
+ HDfprintf(out, "H5I_GENPROP_CLS");
break;
case H5I_GENPROP_LST:
- fprintf(out, "H5I_GENPROP_LST");
+ HDfprintf(out, "H5I_GENPROP_LST");
break;
case H5I_ERROR_CLASS:
- fprintf(out, "H5I_ERROR_CLASS");
+ HDfprintf(out, "H5I_ERROR_CLASS");
break;
case H5I_ERROR_MSG:
- fprintf(out, "H5I_ERROR_MSG");
+ HDfprintf(out, "H5I_ERROR_MSG");
break;
case H5I_ERROR_STACK:
- fprintf(out, "H5I_ERROR_STACK");
+ HDfprintf(out, "H5I_ERROR_STACK");
break;
case H5I_NTYPES:
- fprintf(out, "H5I_NTYPES");
+ HDfprintf(out, "H5I_NTYPES");
break;
default:
- fprintf(out, "%ld", (long)id_type);
+ HDfprintf(out, "%ld", (long)id_type);
break;
} /* end switch */
} /* end else */
@@ -1539,29 +1546,29 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'u':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned *p = (unsigned*)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%u", i?", ":"", p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
unsigned iu = va_arg(ap, unsigned);
- fprintf(out, "%u", iu);
+ HDfprintf(out, "%u", iu);
asize[argno] = iu;
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(I%c)", type[1]);
+ HDfprintf (out, "BADTYPE(I%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1571,43 +1578,43 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if(ptr) {
if(vp)
- fprintf (out, "0x%lx", (unsigned long)vp);
+ HDfprintf (out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5L_type_t link_type = (H5L_type_t)va_arg(ap, int);
switch(link_type) {
case H5L_TYPE_ERROR:
- fprintf(out, "H5L_TYPE_ERROR");
+ HDfprintf(out, "H5L_TYPE_ERROR");
break;
case H5L_TYPE_HARD:
- fprintf(out, "H5L_TYPE_HARD");
+ HDfprintf(out, "H5L_TYPE_HARD");
break;
case H5L_TYPE_SOFT:
- fprintf(out, "H5L_TYPE_SOFT");
+ HDfprintf(out, "H5L_TYPE_SOFT");
break;
case H5L_TYPE_EXTERNAL:
- fprintf(out, "H5L_TYPE_EXTERNAL");
+ HDfprintf(out, "H5L_TYPE_EXTERNAL");
break;
case H5L_TYPE_MAX:
- fprintf(out, "H5L_TYPE_MAX");
+ HDfprintf(out, "H5L_TYPE_MAX");
break;
default:
- fprintf(out, "%ld", (long)link_type);
+ HDfprintf(out, "%ld", (long)link_type);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(G%c)", type[1]);
+ HDfprintf(out, "BADTYPE(G%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1617,15 +1624,15 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
MPI_Comm comm = va_arg(ap, MPI_Comm);
- fprintf(out, "%ld", (long)comm);
+ HDfprintf(out, "%ld", (long)comm);
} /* end else */
#endif /* H5_HAVE_PARALLEL */
break;
@@ -1633,15 +1640,15 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'i':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
MPI_Info info = va_arg(ap, MPI_Info);
- fprintf(out, "%ld", (long)info);
+ HDfprintf(out, "%ld", (long)info);
} /* end else */
#endif /* H5_HAVE_PARALLEL */
break;
@@ -1649,52 +1656,52 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5FD_mem_t mt = (H5FD_mem_t)va_arg(ap, int);
switch(mt) {
case H5FD_MEM_NOLIST:
- fprintf(out, "H5FD_MEM_NOLIST");
+ HDfprintf(out, "H5FD_MEM_NOLIST");
break;
case H5FD_MEM_DEFAULT:
- fprintf(out, "H5FD_MEM_DEFAULT");
+ HDfprintf(out, "H5FD_MEM_DEFAULT");
break;
case H5FD_MEM_SUPER:
- fprintf(out, "H5FD_MEM_SUPER");
+ HDfprintf(out, "H5FD_MEM_SUPER");
break;
case H5FD_MEM_BTREE:
- fprintf(out, "H5FD_MEM_BTREE");
+ HDfprintf(out, "H5FD_MEM_BTREE");
break;
case H5FD_MEM_DRAW:
- fprintf(out, "H5FD_MEM_DRAW");
+ HDfprintf(out, "H5FD_MEM_DRAW");
break;
case H5FD_MEM_GHEAP:
- fprintf(out, "H5FD_MEM_GHEAP");
+ HDfprintf(out, "H5FD_MEM_GHEAP");
break;
case H5FD_MEM_LHEAP:
- fprintf(out, "H5FD_MEM_LHEAP");
+ HDfprintf(out, "H5FD_MEM_LHEAP");
break;
case H5FD_MEM_OHDR:
- fprintf(out, "H5FD_MEM_OHDR");
+ HDfprintf(out, "H5FD_MEM_OHDR");
break;
case H5FD_MEM_NTYPES:
- fprintf(out, "H5FD_MEM_NTYPES");
+ HDfprintf(out, "H5FD_MEM_NTYPES");
break;
default:
- fprintf(out, "%ld", (long)mt);
+ HDfprintf(out, "%ld", (long)mt);
break;
} /* end switch */
} /* end else */
@@ -1708,14 +1715,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
off_t offset = va_arg(ap, off_t);
- fprintf (out, "%ld", (long)offset);
+ HDfprintf (out, "%ld", (long)offset);
} /* end else */
break;
@@ -1724,43 +1731,43 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5O_type_t objtype = (H5O_type_t)va_arg(ap, int);
switch(objtype) {
case H5O_TYPE_UNKNOWN:
- fprintf(out, "H5O_TYPE_UNKNOWN");
+ HDfprintf(out, "H5O_TYPE_UNKNOWN");
break;
case H5O_TYPE_GROUP:
- fprintf(out, "H5O_TYPE_GROUP");
+ HDfprintf(out, "H5O_TYPE_GROUP");
break;
case H5O_TYPE_DATASET:
- fprintf(out, "H5O_TYPE_DATASET");
+ HDfprintf(out, "H5O_TYPE_DATASET");
break;
case H5O_TYPE_NAMED_DATATYPE:
- fprintf(out, "H5O_TYPE_NAMED_DATATYPE");
+ HDfprintf(out, "H5O_TYPE_NAMED_DATATYPE");
break;
case H5O_TYPE_NTYPES:
- fprintf(out, "H5O_TYPE_TYPES");
+ HDfprintf(out, "H5O_TYPE_TYPES");
break;
default:
- fprintf(out, "BADTYPE(%ld)", (long)objtype);
+ HDfprintf(out, "BADTYPE(%ld)", (long)objtype);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(S%c)", type[1]);
+ HDfprintf(out, "BADTYPE(S%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1768,9 +1775,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'p':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hid_t pclass_id = va_arg(ap, hid_t);
@@ -1781,20 +1788,20 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
/* (This may generate recursive call to the library... -QAK) */
if(NULL != (pclass = (H5P_genclass_t *)H5I_object(pclass_id)) &&
NULL != (class_name = H5P_get_class_name(pclass))) {
- fprintf(out, "%s", class_name);
+ HDfprintf(out, "%s", class_name);
H5MM_xfree(class_name);
} /* end if */
else
- fprintf(out, "%ld", (long)pclass_id);
+ HDfprintf(out, "%ld", (long)pclass_id);
} /* end else */
break;
case 'r':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
hobj_ref_t ref = va_arg(ap, hobj_ref_t);
@@ -1808,39 +1815,39 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5R_type_t reftype = (H5R_type_t)va_arg(ap, int);
switch(reftype) {
case H5R_BADTYPE:
- fprintf(out, "H5R_BADTYPE");
+ HDfprintf(out, "H5R_BADTYPE");
break;
case H5R_OBJECT:
- fprintf(out, "H5R_OBJECT");
+ HDfprintf(out, "H5R_OBJECT");
break;
case H5R_DATASET_REGION:
- fprintf(out, "H5R_DATASET_REGION");
+ HDfprintf(out, "H5R_DATASET_REGION");
break;
case H5R_MAXTYPE:
- fprintf(out, "H5R_MAXTYPE");
+ HDfprintf(out, "H5R_MAXTYPE");
break;
default:
- fprintf(out, "BADTYPE(%ld)", (long)reftype);
+ HDfprintf(out, "BADTYPE(%ld)", (long)reftype);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(S%c)", type[1]);
+ HDfprintf(out, "BADTYPE(S%c)", type[1]);
goto error;
}
break;
@@ -1850,32 +1857,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5S_class_t cls = (H5S_class_t)va_arg(ap, int);
switch(cls) {
case H5S_NO_CLASS:
- fprintf(out, "H5S_NO_CLASS");
+ HDfprintf(out, "H5S_NO_CLASS");
break;
case H5S_SCALAR:
- fprintf(out, "H5S_SCALAR");
+ HDfprintf(out, "H5S_SCALAR");
break;
case H5S_SIMPLE:
- fprintf(out, "H5S_SIMPLE");
+ HDfprintf(out, "H5S_SIMPLE");
break;
case H5S_NULL:
- fprintf(out, "H5S_NULL");
+ HDfprintf(out, "H5S_NULL");
break;
default:
- fprintf(out, "%ld", (long)cls);
+ HDfprintf(out, "%ld", (long)cls);
break;
} /* end switch */
} /* end else */
@@ -1884,56 +1891,56 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5S_seloper_t so = (H5S_seloper_t)va_arg(ap, int);
switch(so) {
case H5S_SELECT_NOOP:
- fprintf(out, "H5S_NOOP");
+ HDfprintf(out, "H5S_NOOP");
break;
case H5S_SELECT_SET:
- fprintf(out, "H5S_SELECT_SET");
+ HDfprintf(out, "H5S_SELECT_SET");
break;
case H5S_SELECT_OR:
- fprintf(out, "H5S_SELECT_OR");
+ HDfprintf(out, "H5S_SELECT_OR");
break;
case H5S_SELECT_AND:
- fprintf(out, "H5S_SELECT_AND");
+ HDfprintf(out, "H5S_SELECT_AND");
break;
case H5S_SELECT_XOR:
- fprintf(out, "H5S_SELECT_XOR");
+ HDfprintf(out, "H5S_SELECT_XOR");
break;
case H5S_SELECT_NOTB:
- fprintf(out, "H5S_SELECT_NOTB");
+ HDfprintf(out, "H5S_SELECT_NOTB");
break;
case H5S_SELECT_NOTA:
- fprintf(out, "H5S_SELECT_NOTA");
+ HDfprintf(out, "H5S_SELECT_NOTA");
break;
case H5S_SELECT_APPEND:
- fprintf(out, "H5S_SELECT_APPEND");
+ HDfprintf(out, "H5S_SELECT_APPEND");
break;
case H5S_SELECT_PREPEND:
- fprintf(out, "H5S_SELECT_PREPEND");
+ HDfprintf(out, "H5S_SELECT_PREPEND");
break;
case H5S_SELECT_INVALID:
- fprintf(out, "H5S_SELECT_INVALID");
+ HDfprintf(out, "H5S_SELECT_INVALID");
break;
default:
- fprintf(out, "%ld", (long)so);
+ HDfprintf(out, "%ld", (long)so);
break;
} /* end switch */
} /* end else */
@@ -1942,47 +1949,47 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5S_sel_type st = (H5S_sel_type)va_arg(ap, int);
switch(st) {
case H5S_SEL_ERROR:
- fprintf(out, "H5S_SEL_ERROR");
+ HDfprintf(out, "H5S_SEL_ERROR");
break;
case H5S_SEL_NONE:
- fprintf(out, "H5S_SEL_NONE");
+ HDfprintf(out, "H5S_SEL_NONE");
break;
case H5S_SEL_POINTS:
- fprintf(out, "H5S_SEL_POINTS");
+ HDfprintf(out, "H5S_SEL_POINTS");
break;
case H5S_SEL_HYPERSLABS:
- fprintf(out, "H5S_SEL_HYPERSLABS");
+ HDfprintf(out, "H5S_SEL_HYPERSLABS");
break;
case H5S_SEL_ALL:
- fprintf(out, "H5S_SEL_ALL");
+ HDfprintf(out, "H5S_SEL_ALL");
break;
case H5S_SEL_N:
- fprintf(out, "H5S_SEL_N");
+ HDfprintf(out, "H5S_SEL_N");
break;
default:
- fprintf(out, "%ld", (long)st);
+ HDfprintf(out, "%ld", (long)st);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf(out, "BADTYPE(S%c)", type[1]);
+ HDfprintf(out, "BADTYPE(S%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -1990,14 +1997,14 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
const char *str = va_arg(ap, const char *);
- fprintf(out, "\"%s\"", str);
+ HDfprintf(out, "\"%s\"", str);
} /* end else */
break;
@@ -2006,24 +2013,24 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_cset_t cset = (H5T_cset_t)va_arg(ap, int);
switch(cset) {
case H5T_CSET_ERROR:
- fprintf(out, "H5T_CSET_ERROR");
+ HDfprintf(out, "H5T_CSET_ERROR");
break;
case H5T_CSET_ASCII:
- fprintf(out, "H5T_CSET_ASCII");
+ HDfprintf(out, "H5T_CSET_ASCII");
break;
case H5T_CSET_UTF8:
- fprintf(out, "H5T_CSET_UTF8");
+ HDfprintf(out, "H5T_CSET_UTF8");
break;
case H5T_CSET_RESERVED_2:
@@ -2040,11 +2047,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5T_CSET_RESERVED_13:
case H5T_CSET_RESERVED_14:
case H5T_CSET_RESERVED_15:
- fprintf(out, "H5T_CSET_RESERVED_%ld", (long)cset);
+ HDfprintf(out, "H5T_CSET_RESERVED_%ld", (long)cset);
break;
default:
- fprintf(out, "%ld", (long)cset);
+ HDfprintf(out, "%ld", (long)cset);
break;
} /* end switch */
} /* end else */
@@ -2053,28 +2060,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'd':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_direction_t direct = (H5T_direction_t)va_arg(ap, int);
switch(direct) {
case H5T_DIR_DEFAULT:
- fprintf(out, "H5T_DIR_DEFAULT");
+ HDfprintf(out, "H5T_DIR_DEFAULT");
break;
case H5T_DIR_ASCEND:
- fprintf(out, "H5T_DIR_ASCEND");
+ HDfprintf(out, "H5T_DIR_ASCEND");
break;
case H5T_DIR_DESCEND:
- fprintf(out, "H5T_DIR_DESCEND");
+ HDfprintf(out, "H5T_DIR_DESCEND");
break;
default:
- fprintf(out, "%ld", (long)direct);
+ HDfprintf(out, "%ld", (long)direct);
break;
} /* end switch */
} /* end else */
@@ -2083,28 +2090,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_pers_t pers = (H5T_pers_t)va_arg(ap, int);
switch(pers) {
case H5T_PERS_DONTCARE:
- fprintf(out, "H5T_PERS_DONTCARE");
+ HDfprintf(out, "H5T_PERS_DONTCARE");
break;
case H5T_PERS_SOFT:
- fprintf(out, "H5T_PERS_SOFT");
+ HDfprintf(out, "H5T_PERS_SOFT");
break;
case H5T_PERS_HARD:
- fprintf(out, "H5T_PERS_HARD");
+ HDfprintf(out, "H5T_PERS_HARD");
break;
default:
- fprintf(out, "%ld", (long)pers);
+ HDfprintf(out, "%ld", (long)pers);
break;
} /* end switch */
} /* end else */
@@ -2113,32 +2120,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'n':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_norm_t norm = (H5T_norm_t)va_arg(ap, int);
switch(norm) {
case H5T_NORM_ERROR:
- fprintf(out, "H5T_NORM_ERROR");
+ HDfprintf(out, "H5T_NORM_ERROR");
break;
case H5T_NORM_IMPLIED:
- fprintf(out, "H5T_NORM_IMPLIED");
+ HDfprintf(out, "H5T_NORM_IMPLIED");
break;
case H5T_NORM_MSBSET:
- fprintf(out, "H5T_NORM_MSBSET");
+ HDfprintf(out, "H5T_NORM_MSBSET");
break;
case H5T_NORM_NONE:
- fprintf(out, "H5T_NORM_NONE");
+ HDfprintf(out, "H5T_NORM_NONE");
break;
default:
- fprintf(out, "%ld", (long)norm);
+ HDfprintf(out, "%ld", (long)norm);
break;
} /* end switch */
} /* end else */
@@ -2147,40 +2154,40 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'o':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_order_t order = (H5T_order_t)va_arg(ap, int);
switch(order) {
case H5T_ORDER_ERROR:
- fprintf(out, "H5T_ORDER_ERROR");
+ HDfprintf(out, "H5T_ORDER_ERROR");
break;
case H5T_ORDER_LE:
- fprintf(out, "H5T_ORDER_LE");
+ HDfprintf(out, "H5T_ORDER_LE");
break;
case H5T_ORDER_BE:
- fprintf(out, "H5T_ORDER_BE");
+ HDfprintf(out, "H5T_ORDER_BE");
break;
case H5T_ORDER_VAX:
- fprintf(out, "H5T_ORDER_VAX");
+ HDfprintf(out, "H5T_ORDER_VAX");
break;
case H5T_ORDER_MIXED:
- fprintf(out, "H5T_ORDER_MIXED");
+ HDfprintf(out, "H5T_ORDER_MIXED");
break;
case H5T_ORDER_NONE:
- fprintf(out, "H5T_ORDER_NONE");
+ HDfprintf(out, "H5T_ORDER_NONE");
break;
default:
- fprintf(out, "%ld", (long)order);
+ HDfprintf(out, "%ld", (long)order);
break;
} /* end switch */
} /* end else */
@@ -2189,36 +2196,36 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'p':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_pad_t pad = (H5T_pad_t)va_arg(ap, int);
switch(pad) {
case H5T_PAD_ERROR:
- fprintf(out, "H5T_PAD_ERROR");
+ HDfprintf(out, "H5T_PAD_ERROR");
break;
case H5T_PAD_ZERO:
- fprintf(out, "H5T_PAD_ZERO");
+ HDfprintf(out, "H5T_PAD_ZERO");
break;
case H5T_PAD_ONE:
- fprintf(out, "H5T_PAD_ONE");
+ HDfprintf(out, "H5T_PAD_ONE");
break;
case H5T_PAD_BACKGROUND:
- fprintf(out, "H5T_PAD_BACKGROUND");
+ HDfprintf(out, "H5T_PAD_BACKGROUND");
break;
case H5T_NPAD:
- fprintf(out, "H5T_NPAD");
+ HDfprintf(out, "H5T_NPAD");
break;
default:
- fprintf(out, "%ld", (long)pad);
+ HDfprintf(out, "%ld", (long)pad);
break;
} /* end switch */
} /* end else */
@@ -2227,32 +2234,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 's':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_sign_t sign = (H5T_sign_t)va_arg(ap, int);
switch(sign) {
case H5T_SGN_ERROR:
- fprintf(out, "H5T_SGN_ERROR");
+ HDfprintf(out, "H5T_SGN_ERROR");
break;
case H5T_SGN_NONE:
- fprintf(out, "H5T_SGN_NONE");
+ HDfprintf(out, "H5T_SGN_NONE");
break;
case H5T_SGN_2:
- fprintf(out, "H5T_SGN_2");
+ HDfprintf(out, "H5T_SGN_2");
break;
case H5T_NSGN:
- fprintf(out, "H5T_NSGN");
+ HDfprintf(out, "H5T_NSGN");
break;
default:
- fprintf(out, "%ld", (long)sign);
+ HDfprintf(out, "%ld", (long)sign);
break;
} /* end switch */
} /* end else */
@@ -2261,68 +2268,68 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_class_t type_class = (H5T_class_t)va_arg(ap, int);
switch(type_class) {
case H5T_NO_CLASS:
- fprintf(out, "H5T_NO_CLASS");
+ HDfprintf(out, "H5T_NO_CLASS");
break;
case H5T_INTEGER:
- fprintf(out, "H5T_INTEGER");
+ HDfprintf(out, "H5T_INTEGER");
break;
case H5T_FLOAT:
- fprintf(out, "H5T_FLOAT");
+ HDfprintf(out, "H5T_FLOAT");
break;
case H5T_TIME:
- fprintf(out, "H5T_TIME");
+ HDfprintf(out, "H5T_TIME");
break;
case H5T_STRING:
- fprintf(out, "H5T_STRING");
+ HDfprintf(out, "H5T_STRING");
break;
case H5T_BITFIELD:
- fprintf(out, "H5T_BITFIELD");
+ HDfprintf(out, "H5T_BITFIELD");
break;
case H5T_OPAQUE:
- fprintf(out, "H5T_OPAQUE");
+ HDfprintf(out, "H5T_OPAQUE");
break;
case H5T_COMPOUND:
- fprintf(out, "H5T_COMPOUND");
+ HDfprintf(out, "H5T_COMPOUND");
break;
case H5T_REFERENCE:
- fprintf(out, "H5T_REFERENCE");
+ HDfprintf(out, "H5T_REFERENCE");
break;
case H5T_ENUM:
- fprintf(out, "H5T_ENUM");
+ HDfprintf(out, "H5T_ENUM");
break;
case H5T_VLEN:
- fprintf(out, "H5T_VLEN");
+ HDfprintf(out, "H5T_VLEN");
break;
case H5T_ARRAY:
- fprintf(out, "H5T_ARRAY");
+ HDfprintf(out, "H5T_ARRAY");
break;
case H5T_NCLASSES:
- fprintf(out, "H5T_NCLASSES");
+ HDfprintf(out, "H5T_NCLASSES");
break;
default:
- fprintf(out, "%ld", (long)type_class);
+ HDfprintf(out, "%ld", (long)type_class);
break;
} /* end switch */
} /* end else */
@@ -2331,28 +2338,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'z':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5T_str_t str = (H5T_str_t)va_arg(ap, int);
switch(str) {
case H5T_STR_ERROR:
- fprintf(out, "H5T_STR_ERROR");
+ HDfprintf(out, "H5T_STR_ERROR");
break;
case H5T_STR_NULLTERM:
- fprintf(out, "H5T_STR_NULLTERM");
+ HDfprintf(out, "H5T_STR_NULLTERM");
break;
case H5T_STR_NULLPAD:
- fprintf(out, "H5T_STR_NULLPAD");
+ HDfprintf(out, "H5T_STR_NULLPAD");
break;
case H5T_STR_SPACEPAD:
- fprintf(out, "H5T_STR_SPACEPAD");
+ HDfprintf(out, "H5T_STR_SPACEPAD");
break;
case H5T_STR_RESERVED_3:
@@ -2368,18 +2375,18 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case H5T_STR_RESERVED_13:
case H5T_STR_RESERVED_14:
case H5T_STR_RESERVED_15:
- fprintf(out, "H5T_STR_RESERVED(%ld)",(long)str);
+ HDfprintf(out, "H5T_STR_RESERVED(%ld)",(long)str);
break;
default:
- fprintf(out, "%ld", (long)str);
+ HDfprintf(out, "%ld", (long)str);
break;
} /* end switch */
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(T%c)", type[1]);
+ HDfprintf (out, "BADTYPE(T%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -2387,19 +2394,19 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 't':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
htri_t tri_var = va_arg (ap, htri_t);
if(tri_var>0)
- fprintf (out, "TRUE");
+ HDfprintf (out, "TRUE");
else if(!tri_var)
- fprintf (out, "FALSE");
+ HDfprintf (out, "FALSE");
else
- fprintf(out, "FAIL(%d)", (int)tri_var);
+ HDfprintf(out, "FAIL(%d)", (int)tri_var);
} /* end else */
break;
@@ -2408,23 +2415,23 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'l':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned long *p = (unsigned long *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%lu", i?", ":"", p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
unsigned long iul = va_arg(ap, unsigned long);
- fprintf(out, "%lu", iul);
+ HDfprintf(out, "%lu", iul);
asize[argno] = (hssize_t)iul;
} /* end else */
break;
@@ -2432,29 +2439,29 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'L':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
unsigned long long *p = (unsigned long long *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%llu", i?", ":"", p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
unsigned long long iull = va_arg(ap, unsigned long long);
- fprintf(out, "%llu", iull);
+ HDfprintf(out, "%llu", iull);
asize[argno] = (hssize_t)iull;
} /* end else */
break;
default:
- fprintf (out, "BADTYPE(U%c)", type[1]);
+ HDfprintf (out, "BADTYPE(U%c)", type[1]);
goto error;
} /* end switch */
break;
@@ -2462,48 +2469,48 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'x':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
void **p = (void**)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++) {
if(p[i])
- fprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i]));
+ HDfprintf(out, "%s0x%lx", (i ? ", " : ""), (unsigned long)(p[i]));
else
- fprintf(out, "%sNULL", (i ? ", " : ""));
+ HDfprintf(out, "%sNULL", (i ? ", " : ""));
} /* end for */
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
vp = va_arg (ap, void *);
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end else */
break;
case 'z':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
size_t *p = (size_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%Zu", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
size_t size = va_arg(ap, size_t);
@@ -2518,28 +2525,28 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'a':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)va_arg(ap, int);
switch(scale_type) {
case H5Z_SO_FLOAT_DSCALE:
- fprintf(out, "H5Z_SO_FLOAT_DSCALE");
+ HDfprintf(out, "H5Z_SO_FLOAT_DSCALE");
break;
case H5Z_SO_FLOAT_ESCALE:
- fprintf(out, "H5Z_SO_FLOAT_ESCALE");
+ HDfprintf(out, "H5Z_SO_FLOAT_ESCALE");
break;
case H5Z_SO_INT:
- fprintf(out, "H5Z_SO_INT");
+ HDfprintf(out, "H5Z_SO_INT");
break;
default:
- fprintf(out, "%ld", (long)scale_type);
+ HDfprintf(out, "%ld", (long)scale_type);
break;
} /* end switch */
} /* end else */
@@ -2548,68 +2555,68 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
case 'c':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t*);
- fprintf(out, "0x%lx", (unsigned long)filter);
+ HDfprintf(out, "0x%lx", (unsigned long)filter);
} /* end else */
break;
case 'e':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_EDC_t edc = (H5Z_EDC_t)va_arg(ap, int);
if(H5Z_DISABLE_EDC == edc)
- fprintf(out, "H5Z_DISABLE_EDC");
+ HDfprintf(out, "H5Z_DISABLE_EDC");
else if (H5Z_ENABLE_EDC == edc)
- fprintf(out, "H5Z_ENABLE_EDC");
+ HDfprintf(out, "H5Z_ENABLE_EDC");
else
- fprintf(out, "%ld", (long)edc);
+ HDfprintf(out, "%ld", (long)edc);
} /* end else */
break;
case 'f':
if(ptr) {
if(vp)
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
H5Z_filter_t id = va_arg(ap, H5Z_filter_t);
if(H5Z_FILTER_DEFLATE == id)
- fprintf(out, "H5Z_FILTER_DEFLATE");
+ HDfprintf(out, "H5Z_FILTER_DEFLATE");
else
- fprintf(out, "%ld", (long)id);
+ HDfprintf(out, "%ld", (long)id);
} /* end else */
break;
case 's':
if(ptr) {
if(vp) {
- fprintf(out, "0x%lx", (unsigned long)vp);
+ HDfprintf(out, "0x%lx", (unsigned long)vp);
if(asize_idx >= 0 && asize[asize_idx] >= 0) {
ssize_t *p = (ssize_t *)vp;
- fprintf(out, " {");
+ HDfprintf(out, " {");
for(i = 0; i < asize[asize_idx]; i++)
HDfprintf(out, "%s%Zd", (i ? ", " : ""), p[i]);
- fprintf(out, "}");
+ HDfprintf(out, "}");
} /* end if */
} /* end if */
else
- fprintf(out, "NULL");
+ HDfprintf(out, "NULL");
} /* end if */
else {
ssize_t ssize = va_arg(ap, ssize_t);
@@ -2620,32 +2627,32 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
break;
default:
- fprintf(out, "BADTYPE(Z%c)", type[1]);
+ HDfprintf(out, "BADTYPE(Z%c)", type[1]);
goto error;
} /* end switch */
break;
default:
if(HDisupper(type[0]))
- fprintf(out, "BADTYPE(%c%c)", type[0], type[1]);
+ HDfprintf(out, "BADTYPE(%c%c)", type[0], type[1]);
else
- fprintf(out, "BADTYPE(%c)", type[0]);
+ HDfprintf(out, "BADTYPE(%c)", type[0]);
goto error;
} /* end switch */
} /* end for */
/* Display event time for return */
if(returning && H5_debug_g.ttimes)
- fprintf(out, " @%.6f [dt=%.6f]", (event_time.etime - first_time.etime),
+ HDfprintf(out, " @%.6f [dt=%.6f]", (event_time.etime - first_time.etime),
(event_time.etime - *returning));
error:
va_end(ap);
if(returning)
- fprintf(out, ";\n");
+ HDfprintf(out, ";\n");
else {
last_call_depth = current_depth++;
- fprintf (out, ")");
+ HDfprintf (out, ")");
} /* end else */
HDfflush(out);