summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-10 20:36:33 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-10 20:36:33 (GMT)
commitc0c896e724c77226e3a73379f3571b323893335d (patch)
tree6ad76b3f1d04661b3353664d7a743bb7fea98362
parent65d30cc9c36b782c704daeb4b3f75cdbc7bff680 (diff)
downloadhdf5-c0c896e724c77226e3a73379f3571b323893335d.zip
hdf5-c0c896e724c77226e3a73379f3571b323893335d.tar.gz
hdf5-c0c896e724c77226e3a73379f3571b323893335d.tar.bz2
[svn-r12740] Description:
Update datasets and the layout, attributes and fill-value object header messages to use the latest version of the file format flag. Tested on: FreeBSD 4.11 (sleipnir) Linux/64 2.4 (mir) Linux/32 2.4 (heping)
-rw-r--r--src/H5A.c16
-rw-r--r--src/H5D.c7
-rw-r--r--src/H5Oattr.c252
-rw-r--r--src/H5Odtype.c10
-rw-r--r--src/H5Ofill.c334
-rw-r--r--src/H5Oginfo.c20
-rw-r--r--src/H5Olayout.c100
-rw-r--r--src/H5Olinfo.c20
-rw-r--r--src/H5Osdspace.c6
-rw-r--r--test/fillval.c117
-rw-r--r--test/links.c1
-rw-r--r--test/tattr.c143
-rw-r--r--test/unlink.c3
13 files changed, 540 insertions, 489 deletions
diff --git a/src/H5A.c b/src/H5A.c
index e8540cf..f9db2b6 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -268,18 +268,16 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
/* If the creation property list is H5P_DEFAULT, use the default character encoding */
if(acpl_id == H5P_DEFAULT)
- {
- attr->encoding = H5P_CHAR_ENCODING_DEF;
- }
+ attr->encoding = H5P_CHAR_ENCODING_DEF;
else
{
- /* Get a local copy of the attribute creation property list */
- if (NULL == (ac_plist = H5I_object(acpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+ /* Get a local copy of the attribute creation property list */
+ if (NULL == (ac_plist = H5I_object(acpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
- if(H5P_get(ac_plist, H5P_CHAR_ENCODING_NAME, &(attr->encoding)) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get character encoding flag")
- }
+ if(H5P_get(ac_plist, H5P_CHAR_ENCODING_NAME, &(attr->encoding)) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get character encoding flag")
+ } /* end else */
/* Copy the attribute name */
attr->name = H5MM_xstrdup(name);
diff --git a/src/H5D.c b/src/H5D.c
index 06b8006..fe36702 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -2034,6 +2034,7 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
H5S_t *space; /* Dataset's dataspace */
H5D_alloc_time_t alloc_time;/* Dataset's allocation time */
H5O_efl_t *efl; /* Dataset's external file list */
+ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
/* fill value variables */
H5D_fill_time_t fill_time;
@@ -2061,6 +2062,9 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
alloc_time = dset->shared->alloc_time;
efl = &dset->shared->efl;
+ /* Get the file's 'use the latest version of the format' flag */
+ use_latest_format = H5F_USE_LATEST_FORMAT(file);
+
/* Add the dataset's raw data size to the size of the header, if the raw data will be stored as compact */
if(layout->type == H5D_COMPACT)
ohdr_size += layout->u.compact.size;
@@ -2138,7 +2142,8 @@ H5D_update_entry_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, H5P_genplist_t *p
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update fill value header message")
/* If there is valid information for the old fill value struct, update it */
- if (fill.buf) {
+ /* (only if we aren't trying to write the latest version of the file format) */
+ if(fill.buf && !use_latest_format) {
/* Clear any previous values */
if(H5O_reset(H5O_FILL_ID, fill_prop)<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release fill info")
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 1ab461d..24e4769 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -74,6 +74,10 @@ const H5O_msg_class_t H5O_MSG_ATTR[1] = {{
/* Add support for different character encodings of attribute names */
#define H5O_ATTR_VERSION_3 3
+/* The latest version of the format. Look through the 'encode'
+ * and 'size' callback for places to change when updating this. */
+#define H5O_ATTR_VERSION_LATEST H5O_ATTR_VERSION_3
+
/* Flags for attribute flag encoding */
#define H5O_ATTR_FLAG_TYPE_SHARED 0x01
@@ -83,6 +87,7 @@ H5FL_EXTERN(H5S_t);
/* Declare external the free list for H5S_extent_t's */
H5FL_EXTERN(H5S_extent_t);
+
/*--------------------------------------------------------------------------
NAME
H5O_attr_decode
@@ -122,25 +127,25 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
H5S_extent_t *extent; /*extent dimensionality information */
size_t name_len; /*attribute name length */
int version; /*message version number*/
- unsigned flags=0; /* Attribute flags */
+ unsigned flags = 0; /* Attribute flags */
H5A_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_attr_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_decode)
/* check args */
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
- if (NULL==(attr = H5FL_CALLOC(H5A_t)))
+ if(NULL == (attr = H5FL_CALLOC(H5A_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Version number */
version = *p++;
- if (version<H5O_ATTR_VERSION_1 || version>H5O_ATTR_VERSION_3)
+ if(version < H5O_ATTR_VERSION_1 || version > H5O_ATTR_VERSION_3)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for attribute message")
/* Get the flags byte if we have a later version of the attribute */
- if(version>H5O_ATTR_VERSION_1)
+ if(version > H5O_ATTR_VERSION_1)
flags = *p++;
else
p++; /* Byte is unused when version<2 */
@@ -158,10 +163,10 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
* as well as some reserved bytes.
*/
if(version >= H5O_ATTR_VERSION_3)
- attr->encoding = *p++;
+ attr->encoding = *p++;
/* Decode and store the name */
- if (NULL==(attr->name=H5MM_strdup((const char *)p)))
+ if(NULL == (attr->name = H5MM_strdup((const char *)p)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
if(version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN(name_len); /* advance the memory pointer */
@@ -169,22 +174,22 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
p += name_len; /* advance the memory pointer */
/* decode the attribute datatype */
- if (flags & H5O_ATTR_FLAG_TYPE_SHARED) {
+ if(flags & H5O_ATTR_FLAG_TYPE_SHARED) {
H5O_shared_t *shared; /* Shared information */
/* Get the shared information */
- if (NULL == (shared = (H5O_MSG_SHARED->decode) (f, dxpl_id, p)))
+ if (NULL == (shared = (H5O_MSG_SHARED->decode)(f, dxpl_id, p)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
/* Get the actual datatype information */
- if((attr->dt= H5O_shared_read(f, dxpl_id, shared, H5O_MSG_DTYPE, NULL))==NULL)
+ if((attr->dt = H5O_shared_read(f, dxpl_id, shared, H5O_MSG_DTYPE, NULL)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
/* Free the shared information */
H5O_free_real(H5O_MSG_SHARED, shared);
} /* end if */
else {
- if((attr->dt=(H5O_MSG_DTYPE->decode)(f,dxpl_id,p))==NULL)
+ if((attr->dt = (H5O_MSG_DTYPE->decode)(f, dxpl_id, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
} /* end else */
if(version < H5O_ATTR_VERSION_2)
@@ -193,20 +198,20 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
p += attr->dt_size;
/* decode the attribute dataspace */
- if (NULL==(attr->ds = H5FL_CALLOC(H5S_t)))
+ if(NULL == (attr->ds = H5FL_CALLOC(H5S_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if((extent=(H5O_MSG_SDSPACE->decode)(f,dxpl_id,p))==NULL)
+ if((extent = (H5O_MSG_SDSPACE->decode)(f, dxpl_id, p)) == NULL)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace")
/* Copy the extent information */
- HDmemcpy(&(attr->ds->extent),extent, sizeof(H5S_extent_t));
+ HDmemcpy(&(attr->ds->extent), extent, sizeof(H5S_extent_t));
/* Release temporary extent information */
- H5FL_FREE(H5S_extent_t,extent);
+ H5FL_FREE(H5S_extent_t, extent);
/* Default to entire dataspace being selected */
- if(H5S_select_all(attr->ds,0)<0)
+ if(H5S_select_all(attr->ds, 0) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
if(version < H5O_ATTR_VERSION_2)
@@ -215,24 +220,24 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p)
p += attr->ds_size;
/* Compute the size of the data */
- H5_ASSIGN_OVERFLOW(attr->data_size,H5S_GET_EXTENT_NPOINTS(attr->ds)*H5T_get_size(attr->dt),hsize_t,size_t);
+ H5_ASSIGN_OVERFLOW(attr->data_size, H5S_GET_EXTENT_NPOINTS(attr->ds) * H5T_get_size(attr->dt), hsize_t, size_t);
/* Go get the data */
if(attr->data_size) {
- if (NULL==(attr->data = H5FL_BLK_MALLOC(attr_buf, attr->data_size)))
+ if(NULL == (attr->data = H5FL_BLK_MALLOC(attr_buf, attr->data_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- HDmemcpy(attr->data,p,attr->data_size);
- }
+ HDmemcpy(attr->data, p, attr->data_size);
+ } /* end if */
/* Indicate that the fill values aren't to be written out */
- attr->initialized=1;
+ attr->initialized = 1;
/* Set return value */
- ret_value=attr;
+ ret_value = attr;
done:
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5O_attr_decode() */
/*--------------------------------------------------------------------------
@@ -273,14 +278,18 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
size_t name_len; /* Attribute name length */
unsigned version; /* Attribute version */
hbool_t type_shared; /* Flag to indicate that a shared datatype is used for this attribute */
- herr_t ret_value=SUCCEED; /* Return value */
+ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_attr_encode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_encode)
/* check args */
- assert(f);
- assert(p);
- assert(attr);
+ HDassert(f);
+ HDassert(p);
+ HDassert(attr);
+
+ /* Get the file's 'use the latest version of the format' flag */
+ use_latest_format = H5F_USE_LATEST_FORMAT(f);
/* Check whether datatype is shared */
if(H5T_committed(attr->dt))
@@ -289,18 +298,20 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
type_shared = FALSE;
/* Check which version to write out */
- if(attr->encoding != H5T_CSET_ASCII)
- version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
+ if(use_latest_format)
+ version = H5O_ATTR_VERSION_LATEST; /* Write out latest version of format */
+ else if(attr->encoding != H5T_CSET_ASCII)
+ version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
else if(type_shared)
- version = H5O_ATTR_VERSION_2; /* Write out version with shared datatype */
+ version = H5O_ATTR_VERSION_2; /* Write out version with shared datatype */
else
- version = H5O_ATTR_VERSION_1; /* Write out basic version */
+ version = H5O_ATTR_VERSION_1; /* Write out basic version */
/* Encode Version */
*p++ = version;
/* Set attribute flags if version >1 */
- if(version>H5O_ATTR_VERSION_1)
+ if(version > H5O_ATTR_VERSION_1)
*p++ = (type_shared ? H5O_ATTR_FLAG_TYPE_SHARED : 0 ); /* Set flags for attribute */
else
*p++ = 0; /* Reserved, for version <2 */
@@ -310,7 +321,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
* encoded lengths are exact but we pad each part except the data to be a
* multiple of eight bytes (in the first version).
*/
- name_len = HDstrlen(attr->name)+1;
+ name_len = HDstrlen(attr->name) + 1;
UINT16ENCODE(p, name_len);
UINT16ENCODE(p, attr->dt_size);
UINT16ENCODE(p, attr->ds_size);
@@ -319,15 +330,15 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
* Encode the character encoding used for the attribute's name
* Also add several "reserved" fields to pad to 16 bytes.
*/
- if(version>=H5O_ATTR_VERSION_3)
- *p++=attr->encoding;
+ if(version >= H5O_ATTR_VERSION_3)
+ *p++ = attr->encoding;
/*
* Write the name including null terminator padded to the correct number
* of bytes.
*/
HDmemcpy(p, attr->name, name_len);
- HDmemset(p+name_len, 0, H5O_ALIGN(name_len)-name_len);
+ HDmemset(p + name_len, 0, H5O_ALIGN(name_len) - name_len);
if(version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN(name_len);
else
@@ -338,33 +349,33 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
H5O_shared_t sh_mesg;
/* Reset shared message information */
- HDmemset(&sh_mesg,0,sizeof(H5O_shared_t));
+ HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t));
/* Get shared message information from datatype */
- if ((H5O_MSG_DTYPE->get_share)(f, attr->dt, &sh_mesg/*out*/)<0)
+ if((H5O_MSG_DTYPE->get_share)(f, attr->dt, &sh_mesg/*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype")
/* Encode shared message information for datatype */
- if((H5O_MSG_SHARED->encode)(f,p,&sh_mesg)<0)
+ if((H5O_MSG_SHARED->encode)(f, p, &sh_mesg) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode shared attribute datatype")
} /* end if */
else {
/* Encode datatype information */
- if((H5O_MSG_DTYPE->encode)(f,p,attr->dt)<0)
+ if((H5O_MSG_DTYPE->encode)(f, p, attr->dt) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype")
} /* end else */
if(version < H5O_ATTR_VERSION_2) {
- HDmemset(p+attr->dt_size, 0, H5O_ALIGN(attr->dt_size)-attr->dt_size);
+ HDmemset(p + attr->dt_size, 0, H5O_ALIGN(attr->dt_size) - attr->dt_size);
p += H5O_ALIGN(attr->dt_size);
} /* end if */
else
p += attr->dt_size;
/* encode the attribute dataspace */
- if((H5O_MSG_SDSPACE->encode)(f,p,&(attr->ds->extent))<0)
+ if((H5O_MSG_SDSPACE->encode)(f, p, &(attr->ds->extent)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace")
if(version < H5O_ATTR_VERSION_2) {
- HDmemset(p+attr->ds_size, 0, H5O_ALIGN(attr->ds_size)-attr->ds_size);
+ HDmemset(p + attr->ds_size, 0, H5O_ALIGN(attr->ds_size) - attr->ds_size);
p += H5O_ALIGN(attr->ds_size);
} /* end if */
else
@@ -372,13 +383,13 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
/* Store attribute data */
if(attr->data)
- HDmemcpy(p,attr->data,attr->data_size);
+ HDmemcpy(p, attr->data, attr->data_size);
else
- HDmemset(p,0,attr->data_size);
+ HDmemset(p, 0, attr->data_size);
done:
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5O_attr_encode() */
/*--------------------------------------------------------------------------
@@ -402,18 +413,18 @@ H5O_attr_copy(const void *_src, void *_dst, unsigned update_flags)
const H5A_t *src = (const H5A_t *) _src;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_attr_copy);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_copy)
/* check args */
- assert(src);
+ HDassert(src);
/* copy */
- if (NULL == (ret_value = H5A_copy(_dst,src,update_flags)))
+ if(NULL == (ret_value = H5A_copy(_dst, src, update_flags)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute")
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_attr_copy() */
/*--------------------------------------------------------------------------
@@ -437,19 +448,23 @@ done:
* Added padding between message parts for alignment.
--------------------------------------------------------------------------*/
static size_t
-H5O_attr_size(const H5F_t UNUSED *f, const void *_mesg)
+H5O_attr_size(const H5F_t *f, const void *_mesg)
{
const H5A_t *attr = (const H5A_t *)_mesg;
size_t name_len;
unsigned version; /* Attribute version */
hbool_t type_shared; /* Flag to indicate that a shared datatype is used for this attribute */
+ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
size_t ret_value = 0;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_size);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_size)
+
+ HDassert(attr);
- assert(attr);
+ name_len = HDstrlen(attr->name) + 1;
- name_len = HDstrlen(attr->name)+1;
+ /* Get the file's 'use the latest version of the format' flag */
+ use_latest_format = H5F_USE_LATEST_FORMAT(f);
/* Check whether datatype is shared */
if(H5T_committed(attr->dt))
@@ -458,47 +473,42 @@ H5O_attr_size(const H5F_t UNUSED *f, const void *_mesg)
type_shared = FALSE;
/* Check which version to write out */
- if(attr->encoding != H5T_CSET_ASCII)
- version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
+ if(use_latest_format)
+ version = H5O_ATTR_VERSION_LATEST; /* Write out latest version of format */
+ else if(attr->encoding != H5T_CSET_ASCII)
+ version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
else if(type_shared)
- version = H5O_ATTR_VERSION_2; /* Write out version with shared datatype */
+ version = H5O_ATTR_VERSION_2; /* Write out version with shared datatype */
else
- version = H5O_ATTR_VERSION_1; /* Write out basic version */
+ version = H5O_ATTR_VERSION_1; /* Write out basic version */
+
+ /* Common size information */
+ ret_value = 1 + /*version */
+ 1 + /*reserved */
+ 2 + /*name size inc. null */
+ 2 + /*type size */
+ 2; /*space size */
+ /* Version-specific size information */
if(version == H5O_ATTR_VERSION_1)
- ret_value = 1 + /*version */
- 1 + /*reserved */
- 2 + /*name size inc. null */
- 2 + /*type size */
- 2 + /*space size */
- H5O_ALIGN(name_len) + /*attribute name */
+ ret_value += H5O_ALIGN(name_len) + /*attribute name */
H5O_ALIGN(attr->dt_size) + /*data type */
H5O_ALIGN(attr->ds_size) + /*data space */
attr->data_size; /*the data itself */
else if(version == H5O_ATTR_VERSION_2)
- ret_value = 1 + /*version */
- 1 + /*flags */
- 2 + /*name size inc. null */
- 2 + /*type size */
- 2 + /*space size */
- name_len + /*attribute name */
+ ret_value += name_len + /*attribute name */
attr->dt_size + /*data type */
attr->ds_size + /*data space */
attr->data_size; /*the data itself */
else if(version == H5O_ATTR_VERSION_3)
- ret_value = 1 + /*version */
- 1 + /*flags */
- 2 + /*name size inc. null */
- 2 + /*type size */
- 2 + /*space size */
- 1 + /*character encoding */
+ ret_value += 1 + /*character encoding */
name_len + /*attribute name */
attr->dt_size + /*data type */
attr->ds_size + /*data space */
attr->data_size; /*the data itself */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_attr_size() */
/*-------------------------------------------------------------------------
@@ -519,16 +529,15 @@ H5O_attr_size(const H5F_t UNUSED *f, const void *_mesg)
static herr_t
H5O_attr_reset(void *_mesg)
{
- H5A_t *attr = (H5A_t *) _mesg;
- herr_t ret_value=SUCCEED; /* Return value */
+ H5A_t *attr = (H5A_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_reset);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_reset)
- if (attr)
+ if(attr)
H5A_free(attr);
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_attr_reset() */
/*-------------------------------------------------------------------------
@@ -546,15 +555,15 @@ H5O_attr_reset(void *_mesg)
*-------------------------------------------------------------------------
*/
static herr_t
-H5O_attr_free (void *mesg)
+H5O_attr_free(void *mesg)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_free);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_attr_free)
- assert (mesg);
+ HDassert(mesg);
- H5FL_FREE(H5A_t,mesg);
+ H5FL_FREE(H5A_t, mesg);
- FUNC_LEAVE_NOAPI(SUCCEED);
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_attr_free() */
@@ -576,24 +585,24 @@ static herr_t
H5O_attr_delete(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
{
const H5A_t *attr = (const H5A_t *) _mesg;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_attr_delete);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_delete)
/* check args */
- assert(f);
- assert(attr);
+ HDassert(f);
+ HDassert(attr);
/* Check whether datatype is shared */
if(H5T_committed(attr->dt)) {
/* Decrement the reference count on the shared datatype, if requested */
if(adj_link)
- if(H5T_link(attr->dt, -1, dxpl_id)<0)
+ if(H5T_link(attr->dt, -1, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_delete() */
@@ -616,23 +625,23 @@ static herr_t
H5O_attr_link(H5F_t UNUSED *f, hid_t dxpl_id, const void *_mesg)
{
const H5A_t *attr = (const H5A_t *) _mesg;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_attr_link);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_link)
/* check args */
- assert(f);
- assert(attr);
+ HDassert(f);
+ HDassert(attr);
/* Check whether datatype is shared */
if(H5T_committed(attr->dt)) {
/* Increment the reference count on the shared datatype */
- if(H5T_link(attr->dt,1,dxpl_id)<0)
+ if(H5T_link(attr->dt,1,dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
} /* end if */
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_link() */
@@ -964,15 +973,15 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in
H5O_shared_t sh_mesg; /* Shared message information */
void *dt_mesg; /* Pointer to datatype message to dump */
herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int)=NULL;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_attr_debug);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_attr_debug)
/* check args */
- assert(f);
- assert(stream);
- assert(indent >= 0);
- assert(fwidth >= 0);
+ HDassert(f);
+ HDassert(stream);
+ HDassert(indent >= 0);
+ HDassert(fwidth >= 0);
fprintf(stream, "%*s%-*s \"%s\"\n", indent, "", fwidth,
"Name:",
@@ -997,18 +1006,18 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in
);
if(H5T_committed(mesg->dt)) {
/* Reset shared message information */
- HDmemset(&sh_mesg,0,sizeof(H5O_shared_t));
+ HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t));
/* Get shared message information from datatype */
- if ((H5O_MSG_DTYPE->get_share)(f, mesg->dt, &sh_mesg/*out*/)<0)
+ if((H5O_MSG_DTYPE->get_share)(f, mesg->dt, &sh_mesg/*out*/) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't retrieve shared message information")
- debug=H5O_MSG_SHARED->debug;
- dt_mesg=&sh_mesg;
+ debug = H5O_MSG_SHARED->debug;
+ dt_mesg = &sh_mesg;
} /* end if */
else {
- debug=H5O_MSG_DTYPE->debug;
- dt_mesg=mesg->dt;
+ debug = H5O_MSG_DTYPE->debug;
+ dt_mesg = mesg->dt;
} /* end else */
if(debug)
(debug)(f, dxpl_id, dt_mesg, stream, indent+3, MAX(0, fwidth-3));
@@ -1016,11 +1025,12 @@ H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int in
fprintf(stream, "%*s<No info for this message>\n", indent + 6, "");
fprintf(stream, "%*sData space...\n", indent, "");
- fprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX(0,fwidth-3),
+ fprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX(0, fwidth - 3),
"Size:",
(unsigned long)(mesg->ds_size));
- H5S_debug(f, dxpl_id, mesg->ds, stream, indent+3, MAX(0, fwidth-3));
+ H5S_debug(f, dxpl_id, mesg->ds, stream, indent+3, MAX(0, fwidth - 3));
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_attr_debug() */
+
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index 0a8671b..f768689 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -121,13 +121,15 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
HDassert(pp && *pp);
HDassert(dt && dt->shared);
- /* decode */
+ /* Version, class & flags */
UINT32DECODE(*pp, flags);
version = (flags>>4) & 0x0f;
if(version < H5O_DTYPE_VERSION_1 || version > H5O_DTYPE_VERSION_3)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "bad version number for datatype message")
dt->shared->type = (H5T_class_t)(flags & 0x0f);
flags >>= 8;
+
+ /* Size */
UINT32DECODE(*pp, dt->shared->size);
switch(dt->shared->type) {
@@ -172,7 +174,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
* Floating-point types...
*/
dt->shared->u.atomic.order = (flags & 0x1) ? H5T_ORDER_BE : H5T_ORDER_LE;
- if(version == H5O_DTYPE_VERSION_3) {
+ if(version >= H5O_DTYPE_VERSION_3) {
/* Unsupported byte order*/
if((flags & 0x40) && !(flags & 0x1))
HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bad byte order for datatype message")
@@ -510,7 +512,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt)
unsigned i;
size_t n, z;
uint8_t version; /* version number */
- hbool_t use_latest_format; /* Flag indicating the new group format should be used */
+ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_encode_helper)
@@ -1073,7 +1075,7 @@ static size_t
H5O_dtype_size(const H5F_t *f, const void *_mesg)
{
const H5T_t *dt = (const H5T_t *)_mesg;
- hbool_t use_latest_format; /* Flag indicating the new group format should be used */
+ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
unsigned u; /* Local index variable */
size_t ret_value;
diff --git a/src/H5Ofill.c b/src/H5Ofill.c
index 37841ad..eb36e4b 100644
--- a/src/H5Ofill.c
+++ b/src/H5Ofill.c
@@ -123,22 +123,22 @@ H5FL_DEFINE(H5O_fill_t);
static void *
H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
- H5O_fill_new_t *mesg=NULL;
+ H5O_fill_new_t *mesg = NULL;
int version;
void *ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_decode)
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
- if (NULL==(mesg=H5FL_CALLOC(H5O_fill_new_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message");
+ if(NULL == (mesg = H5FL_CALLOC(H5O_fill_new_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
/* Version */
version = *p++;
- if( version != H5O_FILL_VERSION && version !=H5O_FILL_VERSION_2)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for fill value message");
+ if(version != H5O_FILL_VERSION && version !=H5O_FILL_VERSION_2)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for fill value message")
/* Space allocation time */
mesg->alloc_time = (H5D_alloc_time_t)*p++;
@@ -152,28 +152,28 @@ H5O_fill_new_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* Only decode fill value information if one is defined */
if(mesg->fill_defined) {
INT32DECODE(p, mesg->size);
- if (mesg->size>0) {
+ if(mesg->size > 0) {
H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
- if (NULL==(mesg->buf=H5MM_malloc((size_t)mesg->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value");
+ if(NULL == (mesg->buf = H5MM_malloc((size_t)mesg->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
HDmemcpy(mesg->buf, p, (size_t)mesg->size);
- }
+ } /* end if */
} /* end if */
else
- mesg->size=(-1);
+ mesg->size = (-1);
/* Set return value */
ret_value = (void*)mesg;
done:
- if (!ret_value && mesg) {
+ if(!ret_value && mesg) {
if(mesg->buf)
H5MM_xfree(mesg->buf);
H5FL_FREE(H5O_fill_new_t,mesg);
- }
+ } /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_new_decode() */
/*-------------------------------------------------------------------------
@@ -195,35 +195,39 @@ done:
static void *
H5O_fill_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
{
- H5O_fill_t *mesg=NULL;
+ H5O_fill_t *mesg = NULL;
void *ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5O_fill_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fill_decode)
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
- if (NULL==(mesg=H5FL_CALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message");
+ if(NULL == (mesg = H5FL_CALLOC(H5O_fill_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message")
+
+ /* Fill value size */
UINT32DECODE(p, mesg->size);
- if (mesg->size>0) {
- if (NULL==(mesg->buf=H5MM_malloc(mesg->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value");
+
+ /* Only encode the fill value itself if there is one */
+ if(mesg->size > 0) {
+ if(NULL == (mesg->buf = H5MM_malloc(mesg->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
HDmemcpy(mesg->buf, p, mesg->size);
- }
+ } /* end if */
/* Set return value */
ret_value = (void*)mesg;
done:
- if (!ret_value && mesg) {
+ if(!ret_value && mesg) {
if(mesg->buf)
H5MM_xfree(mesg->buf);
- H5FL_FREE(H5O_fill_t,mesg);
- }
+ H5FL_FREE(H5O_fill_t, mesg);
+ } /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_decode() */
/*-------------------------------------------------------------------------
@@ -247,33 +251,36 @@ H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
{
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_encode);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_encode)
- assert(f);
- assert(p);
- assert(mesg && NULL==mesg->type);
+ HDassert(f);
+ HDassert(p);
+ HDassert(mesg && NULL == mesg->type);
/* Version */
*p++ = H5O_FILL_VERSION_2;
+
/* Space allocation time */
*p++ = mesg->alloc_time;
+
/* Fill value writing time */
*p++ = mesg->fill_time;
+
/* Whether fill value is defined */
*p++ = mesg->fill_defined;
/* Only write out the size and fill value if it is defined */
if(mesg->fill_defined) {
INT32ENCODE(p, mesg->size);
- if(mesg->size>0)
+ if(mesg->size > 0)
if(mesg->buf) {
- H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
+ H5_CHECK_OVERFLOW(mesg->size, ssize_t, size_t);
HDmemcpy(p, mesg->buf, (size_t)mesg->size);
} /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_new_encode() */
/*-------------------------------------------------------------------------
@@ -295,18 +302,18 @@ H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
{
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_encode);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_encode)
- assert(f);
- assert(p);
- assert(mesg && NULL==mesg->type);
+ HDassert(f);
+ HDassert(p);
+ HDassert(mesg && NULL == mesg->type);
UINT32ENCODE(p, mesg->size);
if(mesg->buf)
HDmemcpy(p, mesg->buf, mesg->size);
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_encode() */
/*-------------------------------------------------------------------------
@@ -335,30 +342,30 @@ H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
H5O_fill_new_t *dest = (H5O_fill_new_t *)_dest;
void *ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_copy);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fill_new_copy)
- assert(mesg);
+ HDassert(mesg);
- if (!dest && NULL==(dest=H5FL_MALLOC(H5O_fill_new_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message");
+ if(!dest && NULL == (dest = H5FL_MALLOC(H5O_fill_new_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
/* Copy data type of fill value */
- if (mesg->type) {
- if(NULL==(dest->type=H5T_copy(mesg->type, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy fill value data type");
+ if(mesg->type) {
+ if(NULL == (dest->type = H5T_copy(mesg->type, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy fill value data type")
} /* end if */
else
- dest->type=NULL;
+ dest->type = NULL;
/* Copy fill value and its size */
- if (mesg->buf) {
- H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
- if (NULL==(dest->buf=H5MM_malloc((size_t)mesg->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value");
+ if(mesg->buf) {
+ H5_CHECK_OVERFLOW(mesg->size, ssize_t, size_t);
+ if(NULL == (dest->buf = H5MM_malloc((size_t)mesg->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
HDmemcpy(dest->buf, mesg->buf, (size_t)mesg->size);
} /* end if */
else
- dest->buf=NULL;
+ dest->buf = NULL;
dest->size = mesg->size;
/* Copy three fill value attributes */
@@ -370,17 +377,17 @@ H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
ret_value = dest;
done:
- if (!ret_value && dest) {
+ if(!ret_value && dest) {
if(dest->buf)
H5MM_xfree(dest->buf);
- if (dest->type)
+ if(dest->type)
H5T_close(dest->type);
- if (!_dest)
- H5FL_FREE(H5O_fill_new_t,dest);
- }
+ if(!_dest)
+ H5FL_FREE(H5O_fill_new_t, dest);
+ } /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_new_copy() */
/*-------------------------------------------------------------------------
@@ -407,27 +414,27 @@ H5O_fill_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
H5O_fill_t *dest = (H5O_fill_t *)_dest;
void *ret_value;
- FUNC_ENTER_NOAPI_NOINIT(H5O_fill_copy);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fill_copy)
- assert(mesg);
+ HDassert(mesg);
- if (!dest && NULL==(dest=H5FL_CALLOC(H5O_fill_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message");
+ if(!dest && NULL == (dest = H5FL_CALLOC(H5O_fill_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message")
- if (mesg->type) {
- if(NULL==(dest->type=H5T_copy(mesg->type, H5T_COPY_TRANSIENT)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy fill value data type");
+ if(mesg->type) {
+ if(NULL == (dest->type = H5T_copy(mesg->type, H5T_COPY_TRANSIENT)))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy fill value data type")
} /* end if */
else
- dest->type=NULL;
+ dest->type = NULL;
- if (mesg->buf) {
- if (NULL==(dest->buf=H5MM_malloc(mesg->size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value");
+ if(mesg->buf) {
+ if(NULL == (dest->buf = H5MM_malloc(mesg->size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value")
HDmemcpy(dest->buf, mesg->buf, mesg->size);
} /* end if */
else
- dest->buf=NULL;
+ dest->buf = NULL;
dest->size = mesg->size;
/* Set return value */
@@ -443,8 +450,8 @@ done:
H5FL_FREE(H5O_fill_t,dest);
}
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_copy() */
/*-------------------------------------------------------------------------
@@ -473,10 +480,10 @@ H5O_fill_new_size(const H5F_t UNUSED *f, const void *_mesg)
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
size_t ret_value;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_size);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_size)
- assert(f);
- assert(mesg);
+ HDassert(f);
+ HDassert(mesg);
ret_value = 1 + /* Version number */
1 + /* Space allocation time */
@@ -484,10 +491,10 @@ H5O_fill_new_size(const H5F_t UNUSED *f, const void *_mesg)
1; /* Fill value defined */
if(mesg->fill_defined)
ret_value += 4 + /* Fill value size */
- (mesg->size>0 ? mesg->size : 0); /* Size of fill value */
+ (mesg->size > 0 ? mesg->size : 0); /* Size of fill value */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_fill_new_size() */
/*-------------------------------------------------------------------------
@@ -513,13 +520,13 @@ H5O_fill_size(const H5F_t UNUSED *f, const void *_mesg)
{
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_size);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_size)
- assert(f);
- assert(mesg);
+ HDassert(f);
+ HDassert(mesg);
- FUNC_LEAVE_NOAPI(4+mesg->size);
-}
+ FUNC_LEAVE_NOAPI(4 + mesg->size)
+} /* end H5O_fill_size() */
/*-------------------------------------------------------------------------
@@ -543,23 +550,23 @@ H5O_fill_new_reset(void *_mesg)
{
H5O_fill_new_t *mesg = (H5O_fill_new_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_reset);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_reset)
- assert(mesg);
+ HDassert(mesg);
if(mesg->buf)
mesg->buf = H5MM_xfree(mesg->buf);
mesg->size = -1;
- if (mesg->type) {
+ if(mesg->type) {
H5T_close(mesg->type);
mesg->type = NULL;
- }
+ } /* end if */
mesg->alloc_time = (H5D_alloc_time_t)0;
mesg->fill_time = (H5D_fill_time_t)0;
mesg->fill_defined = FALSE;
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_new_reset() */
/*-------------------------------------------------------------------------
@@ -581,20 +588,20 @@ H5O_fill_reset(void *_mesg)
{
H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset)
- assert(mesg);
+ HDassert(mesg);
if(mesg->buf)
mesg->buf = H5MM_xfree(mesg->buf);
mesg->size = 0;
- if (mesg->type) {
+ if(mesg->type) {
H5T_close(mesg->type);
mesg->type = NULL;
- }
+ } /* end if */
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_reset() */
/*-------------------------------------------------------------------------
@@ -614,14 +621,14 @@ H5O_fill_reset(void *_mesg)
static herr_t
H5O_fill_new_free (void *mesg)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_free);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_free)
- assert (mesg);
+ HDassert(mesg);
- H5FL_FREE(H5O_fill_new_t,mesg);
+ H5FL_FREE(H5O_fill_new_t, mesg);
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_new_free() */
/*-------------------------------------------------------------------------
@@ -641,14 +648,14 @@ H5O_fill_new_free (void *mesg)
static herr_t
H5O_fill_free (void *mesg)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_free);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_free)
- assert (mesg);
+ HDassert(mesg);
- H5FL_FREE(H5O_fill_t,mesg);
+ H5FL_FREE(H5O_fill_t, mesg);
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_new_free() */
/*-------------------------------------------------------------------------
@@ -672,13 +679,13 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
H5D_fill_value_t fill_status; /* Whether the fill value is defined */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_debug);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_new_debug)
- assert(f);
- assert(mesg);
- assert(stream);
- assert(indent>=0);
- assert(fwidth>=0);
+ HDassert(f);
+ HDassert(mesg);
+ HDassert(stream);
+ HDassert(indent>=0);
+ HDassert(fwidth>=0);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Version:", (unsigned)H5O_FILL_VERSION);
@@ -743,15 +750,15 @@ H5O_fill_new_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FIL
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size:", mesg->size);
fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
- if (mesg->type) {
+ if(mesg->type) {
H5T_debug(mesg->type, stream);
fprintf(stream, "\n");
- } else {
+ } /* end if */
+ else
fprintf(stream, "<dataset type>\n");
- }
FUNC_LEAVE_NOAPI(SUCCEED);
-}
+} /* end H5O_fill_new_debug() */
/*-------------------------------------------------------------------------
@@ -774,26 +781,26 @@ H5O_fill_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FILE *s
{
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_debug);
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_debug)
- assert(f);
- assert(mesg);
- assert(stream);
- assert(indent>=0);
- assert(fwidth>=0);
+ HDassert(f);
+ HDassert(mesg);
+ HDassert(stream);
+ HDassert(indent>=0);
+ HDassert(fwidth>=0);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Bytes:", mesg->size);
fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
- if (mesg->type) {
+ if(mesg->type) {
H5T_debug(mesg->type, stream);
fprintf(stream, "\n");
- } else {
+ } /* end if */
+ else
fprintf(stream, "<dataset type>\n");
- }
- FUNC_LEAVE_NOAPI(SUCCEED);
-}
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5O_fill_debug() */
/*-------------------------------------------------------------------------
@@ -817,75 +824,76 @@ herr_t
H5O_fill_convert(void *_fill, H5T_t *dset_type, hid_t dxpl_id)
{
H5O_fill_new_t *fill = _fill;
- H5T_path_t *tpath=NULL; /*type conversion info */
- void *buf=NULL, *bkg=NULL; /*conversion buffers */
- hid_t src_id=-1, dst_id=-1; /*datatype identifiers */
- herr_t ret_value=SUCCEED; /* Return value */
+ H5T_path_t *tpath; /* Type conversion info */
+ void *buf = NULL, *bkg = NULL; /* Conversion buffers */
+ hid_t src_id = -1, dst_id = -1; /* Datatype identifiers */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_fill_convert);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_fill_convert)
- assert(fill);
- assert(dset_type);
+ HDassert(fill);
+ HDassert(dset_type);
/* No-op cases */
- if (!fill->buf || !fill->type || 0==H5T_cmp(fill->type, dset_type, FALSE)) {
- if (fill->type)
+ if(!fill->buf || !fill->type || 0 == H5T_cmp(fill->type, dset_type, FALSE)) {
+ if(fill->type)
H5T_close(fill->type);
fill->type = NULL;
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)))
+ if(NULL == (tpath = H5T_path_find(fill->type, dset_type, NULL, NULL, dxpl_id, FALSE)))
HGOTO_ERROR(H5E_DATATYPE, 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)) {
+ if(!H5T_path_noop(tpath)) {
if ((src_id = H5I_register(H5I_DATATYPE,
- H5T_copy(fill->type, H5T_COPY_ALL)))<0 ||
+ H5T_copy(fill->type, H5T_COPY_ALL))) < 0 ||
(dst_id = H5I_register(H5I_DATATYPE,
- H5T_copy(dset_type, H5T_COPY_ALL)))<0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type");
+ H5T_copy(dset_type, H5T_COPY_ALL))) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register data type")
/*
* Datatype conversions are always done in place, so we need a buffer
* that is large enough for both source and destination.
*/
- if (H5T_get_size(fill->type)>=H5T_get_size(dset_type)) {
+ if(H5T_get_size(fill->type) >= H5T_get_size(dset_type))
buf = fill->buf;
- } else {
- if (NULL==(buf=H5MM_malloc(H5T_get_size(dset_type))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ else {
+ if(NULL == (buf = H5MM_malloc(H5T_get_size(dset_type))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
HDmemcpy(buf, fill->buf, H5T_get_size(fill->type));
- }
+ } /* end else */
if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(dset_type))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
/* Do the conversion */
if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg, dxpl_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed")
/* Update the fill message */
if(buf != fill->buf) {
H5MM_xfree(fill->buf);
fill->buf = buf;
- }
+ } /* end if */
H5T_close(fill->type);
fill->type = NULL;
- H5_ASSIGN_OVERFLOW(fill->size,H5T_get_size(dset_type),size_t,ssize_t);
+ H5_ASSIGN_OVERFLOW(fill->size, H5T_get_size(dset_type), size_t, ssize_t);
} /* end if */
done:
- if (src_id>=0)
+ if(src_id >= 0)
H5I_dec_ref(src_id);
- if (dst_id>=0)
+ if(dst_id >= 0)
H5I_dec_ref(dst_id);
- if (buf!=fill->buf)
+ if(buf != fill->buf)
H5MM_xfree(buf);
- if (bkg)
+ if(bkg)
H5MM_xfree(bkg);
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5O_fill_convert() */
+
diff --git a/src/H5Oginfo.c b/src/H5Oginfo.c
index 7ca79df..ae8aaef 100644
--- a/src/H5Oginfo.c
+++ b/src/H5Oginfo.c
@@ -104,11 +104,6 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
/* check args */
HDassert(p);
-#ifndef NDEBUG
-{
- const uint8_t *start_p = p;
-#endif /* NDEBUG */
-
/* Version of message */
if(*p++ != H5O_GINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
@@ -130,11 +125,6 @@ H5O_ginfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p)
UINT32DECODE(p, ginfo->est_num_entries)
UINT32DECODE(p, ginfo->est_name_len)
-#ifndef NDEBUG
- HDassert((size_t)(p - start_p) == H5O_ginfo_size(f, ginfo));
-}
-#endif /* NDEBUG */
-
/* Set return value */
ret_value = ginfo;
@@ -174,11 +164,6 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
HDassert(p);
HDassert(ginfo);
-#ifndef NDEBUG
-{
- uint8_t *start_p = p;
-#endif /* NDEBUG */
-
/* Message version */
*p++ = H5O_GINFO_VERSION;
@@ -195,11 +180,6 @@ H5O_ginfo_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
UINT32ENCODE(p, ginfo->est_num_entries)
UINT32ENCODE(p, ginfo->est_name_len)
-#ifndef NDEBUG
- HDassert((size_t)(p - start_p) == H5O_ginfo_size(f, ginfo));
-}
-#endif /* NDEBUG */
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_ginfo_encode() */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 21c2820..6414c37 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -112,28 +112,28 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
unsigned u;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_layout_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_layout_decode)
/* check args */
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
/* decode */
- if (NULL==(mesg = H5FL_CALLOC(H5O_layout_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ if(NULL == (mesg = H5FL_CALLOC(H5O_layout_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Version. 1 when space allocated; 2 when space allocation is delayed */
mesg->version = *p++;
- if (mesg->version<H5O_LAYOUT_VERSION_1 || mesg->version>H5O_LAYOUT_VERSION_3)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message");
+ if(mesg->version < H5O_LAYOUT_VERSION_1 || mesg->version > H5O_LAYOUT_VERSION_3)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message")
if(mesg->version < H5O_LAYOUT_VERSION_3) {
unsigned ndims; /* Num dimensions in chunk */
/* Dimensionality */
ndims = *p++;
- if (ndims>H5O_LAYOUT_NDIMS)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large");
+ if(ndims > H5O_LAYOUT_NDIMS)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large")
/* Layout class */
mesg->type = (H5D_layout_t)*p++;
@@ -143,16 +143,16 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
p += 5;
/* Address */
- if(mesg->type==H5D_CONTIGUOUS)
+ if(mesg->type == H5D_CONTIGUOUS)
H5F_addr_decode(f, &p, &(mesg->u.contig.addr));
- else if(mesg->type==H5D_CHUNKED)
+ else if(mesg->type == H5D_CHUNKED)
H5F_addr_decode(f, &p, &(mesg->u.chunk.addr));
/* Read the size */
- if(mesg->type!=H5D_CHUNKED) {
+ if(mesg->type != H5D_CHUNKED) {
size_t temp_dim[H5O_LAYOUT_NDIMS];
- for (u = 0; u < ndims; u++)
+ for(u = 0; u < ndims; u++)
UINT32DECODE(p, temp_dim[u]);
/* Don't compute size of contiguous storage here, due to possible
@@ -164,23 +164,23 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
} /* end if */
else {
mesg->u.chunk.ndims=ndims;
- for (u = 0; u < ndims; u++)
+ for(u = 0; u < ndims; u++)
UINT32DECODE(p, mesg->u.chunk.dim[u]);
/* Compute chunk size */
- for (u=1, mesg->u.chunk.size=mesg->u.chunk.dim[0]; u<ndims; u++)
+ for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < ndims; u++)
mesg->u.chunk.size *= mesg->u.chunk.dim[u];
} /* end if */
if(mesg->type == H5D_COMPACT) {
UINT32DECODE(p, mesg->u.compact.size);
if(mesg->u.compact.size > 0) {
- if(NULL==(mesg->u.compact.buf=H5MM_malloc(mesg->u.compact.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer");
+ if(NULL == (mesg->u.compact.buf = H5MM_malloc(mesg->u.compact.size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
HDmemcpy(mesg->u.compact.buf, p, mesg->u.compact.size);
p += mesg->u.compact.size;
- }
- }
+ } /* end if */
+ } /* end if */
} /* end if */
else {
/* Layout class */
@@ -196,46 +196,46 @@ H5O_layout_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
case H5D_CHUNKED:
/* Dimensionality */
mesg->u.chunk.ndims = *p++;
- if (mesg->u.chunk.ndims>H5O_LAYOUT_NDIMS)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large");
+ if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large")
/* B-tree address */
H5F_addr_decode(f, &p, &(mesg->u.chunk.addr));
/* Chunk dimensions */
- for (u = 0; u < mesg->u.chunk.ndims; u++)
+ for(u = 0; u < mesg->u.chunk.ndims; u++)
UINT32DECODE(p, mesg->u.chunk.dim[u]);
/* Compute chunk size */
- for (u=1, mesg->u.chunk.size=mesg->u.chunk.dim[0]; u<mesg->u.chunk.ndims; u++)
+ for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
mesg->u.chunk.size *= mesg->u.chunk.dim[u];
break;
case H5D_COMPACT:
UINT16DECODE(p, mesg->u.compact.size);
if(mesg->u.compact.size > 0) {
- if(NULL==(mesg->u.compact.buf=H5MM_malloc(mesg->u.compact.size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer");
+ if(NULL == (mesg->u.compact.buf = H5MM_malloc(mesg->u.compact.size)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer")
HDmemcpy(mesg->u.compact.buf, p, mesg->u.compact.size);
p += mesg->u.compact.size;
} /* end if */
break;
default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
} /* end else */
/* Set return value */
- ret_value=mesg;
+ ret_value = mesg;
done:
- if(ret_value==NULL) {
+ if(ret_value == NULL)
if(mesg)
- H5FL_FREE(H5O_layout_t,mesg);
- } /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ H5FL_FREE(H5O_layout_t, mesg);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_layout_decode() */
/*-------------------------------------------------------------------------
@@ -273,14 +273,14 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg)
{
const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg;
unsigned u;
- herr_t ret_value=SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_layout_encode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_layout_encode)
/* check args */
- assert(f);
- assert(mesg);
- assert(p);
+ HDassert(f);
+ HDassert(mesg);
+ HDassert(p);
/* Version 3 by default now. */
*p++ = H5O_LAYOUT_VERSION_3;
@@ -297,14 +297,14 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg)
case H5D_CHUNKED:
/* Number of dimensions */
- assert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
+ HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS);
*p++ = mesg->u.chunk.ndims;
/* B-tree address */
H5F_addr_encode(f, &p, mesg->u.chunk.addr);
/* Dimension sizes */
- for (u = 0; u < mesg->u.chunk.ndims; u++)
+ for(u = 0; u < mesg->u.chunk.ndims; u++)
UINT32ENCODE(p, mesg->u.chunk.dim[u]);
break;
@@ -313,19 +313,19 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg)
UINT16ENCODE(p, mesg->u.compact.size);
/* Raw data */
- if(mesg->u.compact.size>0 && mesg->u.compact.buf) {
+ if(mesg->u.compact.size > 0 && mesg->u.compact.buf) {
HDmemcpy(p, mesg->u.compact.buf, mesg->u.compact.size);
p += mesg->u.compact.size;
} /* end if */
break;
default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class")
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value);
-}
+} /* end H5O_layout_encode() */
/*-------------------------------------------------------------------------
@@ -357,7 +357,7 @@ H5O_layout_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
/* check args */
assert(mesg);
if (!dest && NULL==(dest=H5FL_MALLOC(H5O_layout_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
*dest = *mesg;
@@ -366,7 +366,7 @@ H5O_layout_copy(const void *_mesg, void *_dest, unsigned UNUSED update_flags)
if(mesg->type==H5D_COMPACT) {
/* Allocate memory for the raw data */
if (NULL==(dest->u.compact.buf=H5MM_malloc(dest->u.compact.size)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset")
/* Copy over the raw data */
HDmemcpy(dest->u.compact.buf,mesg->u.compact.buf,dest->u.compact.size);
@@ -428,12 +428,12 @@ H5O_layout_meta_size(const H5F_t *f, const void *_mesg)
ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */
/* Dimension sizes */
- ret_value += mesg->u.chunk.ndims*4;
+ ret_value += mesg->u.chunk.ndims * 4;
break;
case H5D_COMPACT:
/* Size of raw data */
- ret_value+=2;
+ ret_value += 2;
break;
default:
@@ -586,17 +586,17 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t UNUSED adj
case H5D_CONTIGUOUS: /* Contiguous block on disk */
/* Free the file space for the raw data */
if (H5D_contig_delete(f, dxpl_id, mesg)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
break;
case H5D_CHUNKED: /* Chunked blocks on disk */
/* Free the file space for the raw data */
if (H5D_istore_delete(f, dxpl_id, mesg)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
break;
default:
- HGOTO_ERROR (H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type");
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type")
} /* end switch */
done:
@@ -686,7 +686,7 @@ H5O_layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hid_t dxp
break;
default:
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class")
} /* end switch */
/* Set return value */
diff --git a/src/H5Olinfo.c b/src/H5Olinfo.c
index bac8200..12cf38f 100644
--- a/src/H5Olinfo.c
+++ b/src/H5Olinfo.c
@@ -119,11 +119,6 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
HDassert(f);
HDassert(p);
-#ifndef NDEBUG
-{
- const uint8_t *start_p = p;
-#endif /* NDEBUG */
-
/* Version of message */
if(*p++ != H5O_LINFO_VERSION)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message")
@@ -156,11 +151,6 @@ H5O_linfo_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p)
else
linfo->corder_bt2_addr = HADDR_UNDEF;
-#ifndef NDEBUG
- HDassert((size_t)(p - start_p) == H5O_linfo_size(f, linfo));
-}
-#endif /* NDEBUG */
-
/* Set return value */
ret_value = linfo;
@@ -199,11 +189,6 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
HDassert(p);
HDassert(linfo);
-#ifndef NDEBUG
-{
- uint8_t *start_p = p;
-#endif /* NDEBUG */
-
/* Message version */
*p++ = H5O_LINFO_VERSION;
@@ -231,11 +216,6 @@ H5O_linfo_encode(H5F_t *f, uint8_t *p, const void *_mesg)
else
HDassert(!H5F_addr_defined(linfo->corder_bt2_addr));
-#ifndef NDEBUG
- HDassert((size_t)(p - start_p) == H5O_linfo_size(f, linfo));
-}
-#endif /* NDEBUG */
-
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_linfo_encode() */
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 32be4bc..f1f5d36 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -235,7 +235,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg)
const H5S_extent_t *sdim = (const H5S_extent_t *)_mesg;
unsigned flags = 0;
unsigned version;
- hbool_t use_latest_format; /* Flag indicating the new group format should be used */
+ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
unsigned u; /* Local counting variable */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_encode)
@@ -251,7 +251,7 @@ H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg)
/* Version */
if(use_latest_format)
version = H5O_SDSPACE_VERSION_LATEST;
- else if(sdim->type == H5S_NULL || use_latest_format)
+ else if(sdim->type == H5S_NULL)
version = H5O_SDSPACE_VERSION_2;
else
version = H5O_SDSPACE_VERSION_1;
@@ -361,7 +361,7 @@ static size_t
H5O_sdspace_size(const H5F_t *f, const void *_mesg)
{
const H5S_extent_t *space = (const H5S_extent_t *)_mesg;
- hbool_t use_latest_format; /* Flag indicating the new group format should be used */
+ hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
size_t ret_value;
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_sdspace_size)
diff --git a/test/fillval.c b/test/fillval.c
index b204523..2385585 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -1266,7 +1266,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
*-------------------------------------------------------------------------
*/
static int
-test_compatible(void)
+test_compatible(hid_t fapl)
{
hid_t file=-1, dset1=-1, dset2=-1;
hid_t dcpl1=-1, dcpl2=-1, fspace=-1, mspace=-1;
@@ -1287,7 +1287,7 @@ test_compatible(void)
}
strcat(testfile, FILE_COMPATIBLE);
- if ((file=H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT))<0) {
+ if ((file=H5Fopen(testfile, H5F_ACC_RDONLY, fapl))<0) {
printf(" Could not open file %s. Try set $srcdir to point at the "
"source directory of test\n", testfile);
goto error;
@@ -1409,68 +1409,97 @@ error:
int
main(int argc, char *argv[])
{
- int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1;
const char *envval = NULL;
- hid_t fapl=-1;
envval = HDgetenv("HDF5_DRIVER");
- if (envval == NULL)
+ if(envval == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) {
- if (argc>=2) {
+ if(HDstrcmp(envval, "core") && HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) {
+ int nerrors=0, argno, test_contig=1, test_chunk=1, test_compact=1;
+ hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
+ hbool_t new_format; /* Whether to use the new format or not */
+
+ if(argc >= 2) {
test_contig = test_chunk = test_compact = 0;
- for (argno=1; argno<argc; argno++) {
- if (!strcmp(argv[argno], "contiguous")) {
+ for(argno = 1; argno < argc; argno++) {
+ if(!strcmp(argv[argno], "contiguous"))
test_contig = 1;
- } else if (!strcmp(argv[argno], "chunked")) {
+ else if(!strcmp(argv[argno], "chunked"))
test_chunk = 1;
- } else if (!strcmp(argv[argno], "compact")) {
+ else if(!strcmp(argv[argno], "compact"))
test_compact =1;
- } else {
+ else {
fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]);
exit(1);
}
- }
- }
+ } /* end for */
+ } /* end if */
h5_reset();
fapl = h5_fileaccess();
+ /* Property list tests */
nerrors += test_getset();
- /* Chunked storage layout tests */
- if (test_chunk) {
- nerrors += test_create(fapl, FILENAME[0], H5D_CHUNKED);
- nerrors += test_rdwr (fapl, FILENAME[2], H5D_CHUNKED);
- nerrors += test_extend(fapl, FILENAME[4], H5D_CHUNKED);
- }
-
- /* Contiguous storage layout tests */
- if (test_contig) {
- nerrors += test_create(fapl, FILENAME[1], H5D_CONTIGUOUS);
- nerrors += test_rdwr (fapl, FILENAME[3], H5D_CONTIGUOUS);
- nerrors += test_extend(fapl, FILENAME[5], H5D_CONTIGUOUS);
- nerrors += test_compatible();
- }
-
- /* Compact dataset storage tests */
- if (test_compact) {
- nerrors += test_create(fapl, FILENAME[6], H5D_COMPACT);
- nerrors += test_rdwr (fapl, FILENAME[7], H5D_COMPACT);
- }
-
- if (nerrors) goto error;
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ if(H5Pset_latest_format(fapl2, TRUE) < 0) TEST_ERROR
+
+ /* Loop over using new group format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ puts("\nTesting with new file format:");
+ my_fapl = fapl2;
+ } /* end if */
+ else {
+ puts("Testing with old file format:");
+ my_fapl = fapl;
+ } /* end else */
+
+ /* Chunked storage layout tests */
+ if(test_chunk) {
+ nerrors += test_create(my_fapl, FILENAME[0], H5D_CHUNKED);
+ nerrors += test_rdwr (my_fapl, FILENAME[2], H5D_CHUNKED);
+ nerrors += test_extend(my_fapl, FILENAME[4], H5D_CHUNKED);
+ } /* end if */
+
+ /* Contiguous storage layout tests */
+ if(test_contig) {
+ nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS);
+ nerrors += test_rdwr (my_fapl, FILENAME[3], H5D_CONTIGUOUS);
+ nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS);
+ nerrors += test_compatible(my_fapl);
+ } /* end if */
+
+ /* Compact dataset storage tests */
+ if(test_compact) {
+ nerrors += test_create(my_fapl, FILENAME[6], H5D_COMPACT);
+ nerrors += test_rdwr (my_fapl, FILENAME[7], H5D_COMPACT);
+ } /* end if */
+ } /* end for */
+
+ /* Close 2nd FAPL */
+ H5Pclose(fapl2);
+
+ if(nerrors)
+ goto error;
puts("All fill value tests passed.");
- if (h5_cleanup(FILENAME, fapl)) remove(FILE_NAME_RAW);
- }
+
+ if(h5_cleanup(FILENAME, fapl))
+ remove(FILE_NAME_RAW);
+ } /* end if */
else
- {
puts("All fill value tests skipped - Incompatible with current Virtual File Driver");
- }
- return 0;
- error:
- puts("***** FILL VALUE TESTS FAILED *****");
- return 1;
+ return 0;
+error:
+ puts("***** FILL VALUE TESTS FAILED *****");
+ return 1;
}
+
diff --git a/test/links.c b/test/links.c
index 2290e69..1a5f898 100644
--- a/test/links.c
+++ b/test/links.c
@@ -5266,4 +5266,3 @@ error:
return 1;
}
-
diff --git a/test/tattr.c b/test/tattr.c
index b6514b7..86843d1 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -99,7 +99,7 @@ herr_t attr_op1(hid_t loc_id, const char *name, void *op_data);
**
****************************************************************/
static void
-test_attr_basic_write(void)
+test_attr_basic_write(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -120,7 +120,7 @@ test_attr_basic_write(void)
MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n"));
/* Create file */
- fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for dataset */
@@ -263,7 +263,7 @@ test_attr_basic_write(void)
CHECK(ret, FAIL, "H5Dclose");
/* Create group */
- group = H5Gcreate(fid1, GROUP1_NAME, 0);
+ group = H5Gcreate(fid1, GROUP1_NAME, (size_t)0);
CHECK(group, FAIL, "H5Gcreate");
/* Create dataspace for attribute */
@@ -313,7 +313,7 @@ test_attr_basic_write(void)
**
****************************************************************/
static void
-test_attr_basic_read(void)
+test_attr_basic_read(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -328,7 +328,7 @@ test_attr_basic_read(void)
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
/* Create file */
- fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -400,7 +400,7 @@ test_attr_basic_read(void)
**
****************************************************************/
static void
-test_attr_flush(void)
+test_attr_flush(hid_t fapl)
{
hid_t fil, /* File ID */
att, /* Attribute ID */
@@ -413,7 +413,7 @@ test_attr_flush(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Attribute Flushing\n"));
- fil = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fil = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fil, FAIL, "H5Fcreate");
spc = H5Screate(H5S_SCALAR);
@@ -465,7 +465,7 @@ test_attr_flush(void)
**
****************************************************************/
static void
-test_attr_plist(void)
+test_attr_plist(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -481,7 +481,7 @@ test_attr_plist(void)
MESSAGE(5, ("Testing Attribute Property Lists\n"));
/* Create file */
- fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for dataset */
@@ -578,7 +578,7 @@ test_attr_plist(void)
**
****************************************************************/
static void
-test_attr_compound_write(void)
+test_attr_compound_write(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -593,7 +593,7 @@ test_attr_compound_write(void)
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
/* Create file */
- fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for dataset */
@@ -665,7 +665,7 @@ test_attr_compound_write(void)
**
****************************************************************/
static void
-test_attr_compound_read(void)
+test_attr_compound_read(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -691,7 +691,7 @@ test_attr_compound_read(void)
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
/* Open file */
- fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -812,7 +812,7 @@ test_attr_compound_read(void)
**
****************************************************************/
static void
-test_attr_scalar_write(void)
+test_attr_scalar_write(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -825,7 +825,7 @@ test_attr_scalar_write(void)
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
/* Create file */
- fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for dataset */
@@ -876,7 +876,7 @@ test_attr_scalar_write(void)
**
****************************************************************/
static void
-test_attr_scalar_read(void)
+test_attr_scalar_read(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -890,7 +890,7 @@ test_attr_scalar_read(void)
MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n"));
/* Create file */
- fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -941,7 +941,7 @@ test_attr_scalar_read(void)
**
****************************************************************/
static void
-test_attr_mult_write(void)
+test_attr_mult_write(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -957,7 +957,7 @@ test_attr_mult_write(void)
MESSAGE(5, ("Testing Multiple Attribute Functions\n"));
/* Create file */
- fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ fid1 = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for dataset */
@@ -1059,7 +1059,7 @@ test_attr_mult_write(void)
**
****************************************************************/
static void
-test_attr_mult_read(void)
+test_attr_mult_read(hid_t fapl)
{
hid_t fid1; /* HDF5 File IDs */
hid_t dataset; /* Dataset ID */
@@ -1084,7 +1084,7 @@ test_attr_mult_read(void)
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
/* Open file */
- fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -1315,7 +1315,7 @@ herr_t attr_op1(hid_t UNUSED loc_id, const char *name, void *op_data)
**
****************************************************************/
static void
-test_attr_iterate(void)
+test_attr_iterate(hid_t fapl)
{
hid_t file; /* HDF5 File ID */
hid_t dataset; /* Dataset ID */
@@ -1328,7 +1328,7 @@ test_attr_iterate(void)
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
/* Open file */
- file = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(file, FAIL, "H5Fopen");
/* Create a dataspace */
@@ -1386,7 +1386,7 @@ test_attr_iterate(void)
**
****************************************************************/
static void
-test_attr_delete(void)
+test_attr_delete(hid_t fapl)
{
hid_t fid1; /* HDF5 File ID */
hid_t dataset; /* Dataset ID */
@@ -1399,7 +1399,7 @@ test_attr_delete(void)
MESSAGE(5, ("Testing Basic Attribute Functions\n"));
/* Open file */
- fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -1500,7 +1500,7 @@ test_attr_delete(void)
**
****************************************************************/
static void
-test_attr_dtype_shared(void)
+test_attr_dtype_shared(hid_t fapl)
{
hid_t file_id; /* File ID */
hid_t dset_id; /* Dataset ID */
@@ -1518,7 +1518,7 @@ test_attr_dtype_shared(void)
MESSAGE(5, ("Testing Shared Datatypes with Attributes\n"));
/* Create a file */
- file_id=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id=H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(file_id, FAIL, "H5Fopen");
/* Close file */
@@ -1531,7 +1531,7 @@ test_attr_dtype_shared(void)
TestErrPrintf("Line %d: file size wrong!\n",__LINE__);
/* Re-open file */
- file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,H5P_DEFAULT);
+ file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl);
CHECK(file_id, FAIL, "H5Fopen");
/* Create a datatype to commit and use */
@@ -1616,7 +1616,7 @@ test_attr_dtype_shared(void)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open file */
- file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,H5P_DEFAULT);
+ file_id=H5Fopen(FILENAME,H5F_ACC_RDWR,fapl);
CHECK(file_id, FAIL, "H5Fopen");
/* Open dataset */
@@ -1675,33 +1675,70 @@ test_attr_dtype_shared(void)
void
test_attr(void)
{
+ hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
+ hbool_t new_format; /* Whether to use the new format or not */
+ herr_t ret; /* Generic return value */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing Attributes\n"));
- /* These next two tests use the same file information */
- test_attr_basic_write(); /* Test basic H5A writing code */
- test_attr_basic_read(); /* Test basic H5A reading code */
- test_attr_flush(); /* Test H5A I/O in the presence of H5Fflush calls */
-
- /* This next test uses the same file information */
- test_attr_plist(); /* Test attribute property lists */
-
- /* These next two tests use the same file information */
- test_attr_compound_write(); /* Test complex datatype H5A writing code */
- test_attr_compound_read(); /* Test complex datatype H5A reading code */
-
- /* These next two tests use the same file information */
- test_attr_scalar_write(); /* Test scalar dataspace H5A writing code */
- test_attr_scalar_read(); /* Test scalar dataspace H5A reading code */
-
- /* These next four tests use the same file information */
- test_attr_mult_write(); /* Test H5A writing code for multiple attributes */
- test_attr_mult_read(); /* Test H5A reading code for multiple attributes */
- test_attr_iterate(); /* Test H5A iterator code */
- test_attr_delete(); /* Test H5A code for deleting attributes */
-
- /* This next test use the same file information */
- test_attr_dtype_shared(); /* Test using shared dataypes in attributes */
+ /* Create a default file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Copy the file access property list */
+ fapl2 = H5Pcopy(fapl);
+ CHECK(fapl2, FAIL, "H5Pcopy");
+
+ /* Set the "use the latest version of the format" flag for creating objects in the file */
+ ret = H5Pset_latest_format(fapl2, TRUE);
+ CHECK(ret, FAIL, "H5Pset_latest_format");
+
+ /* Loop over using new group format */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ MESSAGE(7, ("testing with new file format\n"));
+ my_fapl = fapl2;
+ } /* end if */
+ else {
+ MESSAGE(7, ("testing with old file format\n"));
+ my_fapl = fapl;
+ } /* end else */
+
+ /* These next two tests use the same file information */
+ test_attr_basic_write(my_fapl); /* Test basic H5A writing code */
+ test_attr_basic_read(my_fapl); /* Test basic H5A reading code */
+ test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */
+
+ /* This next test uses the same file information */
+ test_attr_plist(my_fapl); /* Test attribute property lists */
+
+ /* These next two tests use the same file information */
+ test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */
+ test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */
+
+ /* These next two tests use the same file information */
+ test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */
+ test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */
+
+ /* These next four tests use the same file information */
+ test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */
+ test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */
+ test_attr_iterate(my_fapl); /* Test H5A iterator code */
+ test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */
+
+ /* This next test use the same file information */
+ test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */
+ } /* end for */
+
+ /* Close FAPLs */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+ ret = H5Pclose(fapl2);
+ CHECK(ret, FAIL, "H5Pclose");
} /* test_attr() */
diff --git a/test/unlink.c b/test/unlink.c
index 908ea1d..cb66177 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -2486,6 +2486,9 @@ main(void)
if(H5Fclose(file) < 0) TEST_ERROR
} /* end for */
+ /* Close 2nd FAPL */
+ H5Pclose(fapl2);
+
if (nerrors) {
printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S");
exit(1);