summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-01-30 18:43:28 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-01-30 18:43:28 (GMT)
commit7c733b0afb1b87ddd3314e89b0105b806f6edfb1 (patch)
tree7fbc7652e4ccfa93f672d7eb90a96b08d27c6dbb /src
parent814c226b9b56803a07b3f7ae4298f9ea560f0588 (diff)
downloadhdf5-7c733b0afb1b87ddd3314e89b0105b806f6edfb1.zip
hdf5-7c733b0afb1b87ddd3314e89b0105b806f6edfb1.tar.gz
hdf5-7c733b0afb1b87ddd3314e89b0105b806f6edfb1.tar.bz2
[svn-r13223] Description:
Move datatype messages into new shared message method interface Clean up various formatting & compiler warnings Minor optimizations Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c56
-rw-r--r--src/H5Adense.c8
-rw-r--r--src/H5D.c9
-rw-r--r--src/H5F.c2
-rw-r--r--src/H5Gdense.c4
-rw-r--r--src/H5Gobj.c2
-rw-r--r--src/H5HFcache.c14
-rw-r--r--src/H5HFhdr.c2
-rw-r--r--src/H5Oattr.c100
-rw-r--r--src/H5Ocopy.c16
-rw-r--r--src/H5Odtype.c22
-rw-r--r--src/H5Omessage.c144
-rw-r--r--src/H5Opkg.h2
-rw-r--r--src/H5Opline.c20
-rw-r--r--src/H5Oprivate.h6
-rw-r--r--src/H5Osdspace.c4
-rw-r--r--src/H5Oshared.c47
-rw-r--r--src/H5S.c92
-rwxr-xr-xsrc/H5SM.c61
-rw-r--r--src/H5SMcache.c43
-rw-r--r--src/H5Sprivate.h1
-rw-r--r--src/H5T.c68
22 files changed, 339 insertions, 384 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 9e25d02..ef83826 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -291,7 +291,6 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
const H5S_t *space, hid_t acpl_id, hid_t dxpl_id)
{
H5A_t *attr = NULL;
- H5O_shared_t sh_mesg;
htri_t tri_ret; /* htri_t return value */
hid_t ret_value; /* Return value */
@@ -303,9 +302,6 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
HDassert(type);
HDassert(space);
- /* Reset shared message information */
- HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t));
-
/* Check for existing attribute with same name */
/* (technically, the "attribute create" operation will fail for a duplicated
* name, but it's going to be hard to unwind all the special cases on
@@ -373,50 +369,22 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "trying to share dataspace failed")
+ /* Check whether datatype is committed & increment ref count
+ * (to maintain ref. count incr/decr similarity with "shared message"
+ * type of datatype sharing)
+ */
+ if(H5T_committed(attr->dt)) {
+ /* Increment the reference count on the shared datatype */
+ 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 */
+
/* Compute the size of pieces on disk. This is either the size of the
* datatype and dataspace messages themselves, or the size of the "shared"
* messages if either or both of them are shared.
*/
- if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr->dt)) == FALSE) {
- /* Message wasn't shared after all. Use size of normal datatype
- * message. */
- attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, attr->dt);
- } /* end if */
- else if(tri_ret > 0) {
- /* Check whether datatype is committed & increment ref count */
- /* (to maintain ref. count incr/decr similarity with "shared message"
- * type of datatype sharing)
- */
- if(H5T_committed(attr->dt)) {
- /* Increment the reference count on the shared datatype */
- 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 */
-
- /* Message is shared. Use size of shared message */
- if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg))
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't get size of shared message")
-
- attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_SHARED_ID, &sh_mesg);
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't determine if dataspace is shared")
-
- /* Perform the same test for the dataspace message */
- if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr->ds)) == FALSE) {
- /* Message wasn't shared after all. Use size of normal dataspace
- * message. */
- attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, attr->ds);
- } /* end if */
- else if(tri_ret > 0) {
- /* Message is shared. Use size of shared message */
- if(NULL == H5O_msg_get_share(H5O_SDSPACE_ID, attr->ds, &sh_mesg))
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't get size of shared message")
-
- attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SHARED_ID, &sh_mesg);
- } /* end else-if */
- else
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't determine if datatype is shared")
+ attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, FALSE, attr->dt);
+ attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, FALSE, attr->ds);
HDassert(attr->dt_size > 0);
HDassert(attr->ds_size > 0);
diff --git a/src/H5Adense.c b/src/H5Adense.c
index b58a192..7091856 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -442,7 +442,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_t *oh, unsigned mesg_flags,
size_t attr_size; /* Size of serialized attribute in the heap */
/* Find out the size of buffer needed for serialized message */
- if((attr_size = H5O_msg_raw_size(f, H5O_ATTR_ID, attr)) == 0)
+ if((attr_size = H5O_msg_raw_size(f, H5O_ATTR_ID, FALSE, attr)) == 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get message size")
/* Allocate space for serialized message, if necessary */
@@ -454,7 +454,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_t *oh, unsigned mesg_flags,
attr_ptr = attr_buf;
/* Create serialized form of attribute or shared message */
- if(H5O_msg_encode(f, H5O_ATTR_ID, (unsigned char *)attr_ptr, attr) < 0)
+ if(H5O_msg_encode(f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute")
/* Insert the serialized attribute into the fractal heap */
@@ -549,7 +549,7 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
size_t attr_size; /* Size of serialized attribute in the heap */
/* Find out the size of buffer needed for serialized attribute */
- if((attr_size = H5O_msg_raw_size(op_data->f, H5O_ATTR_ID, op_data->attr)) == 0)
+ if((attr_size = H5O_msg_raw_size(op_data->f, H5O_ATTR_ID, FALSE, op_data->attr)) == 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get attribute size")
/* Allocate space for serialized attribute, if necessary */
@@ -561,7 +561,7 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
attr_ptr = attr_buf;
/* Create serialized form of attribute */
- if(H5O_msg_encode(op_data->f, H5O_ATTR_ID, (unsigned char *)attr_ptr, op_data->attr) < 0)
+ if(H5O_msg_encode(op_data->f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, op_data->attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute")
/* Sanity check */
diff --git a/src/H5D.c b/src/H5D.c
index 15bb875..b49d88a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1213,10 +1213,11 @@ H5D_update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message")
} /* end if */
- /* Update the type and space header messages */
- if(H5O_msg_append(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_SHARED, 0, type, &oh_flags) < 0 ||
- H5S_append(file, dxpl_id, oh, dset->shared->space, &oh_flags) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update type or space header messages")
+ /* Update the datatype and dataspace header messages */
+ if(H5O_msg_append(file, dxpl_id, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update datatype header message")
+ if(H5S_append(file, dxpl_id, oh, dset->shared->space, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update dataspace header message")
/* Update the filters message, if this is a chunked dataset */
if(layout->type == H5D_CHUNKED) {
diff --git a/src/H5F.c b/src/H5F.c
index a073e9a..df58a5e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -2080,7 +2080,7 @@ H5F_try_close(H5F_t *f)
/* Get the list of IDs of open named datatype objects */
/* (Do this separately from the dataset & attribute IDs, because
* they could be using one of the named datatypes and then the
- * open named datatype ID will get closed twice.
+ * open named datatype ID will get closed twice)
*/
while((obj_count = H5F_get_obj_ids(f, H5F_OBJ_LOCAL|H5F_OBJ_DATATYPE, (int)(sizeof(objs)/sizeof(objs[0])), objs)) != 0) {
/* Try to close all the open objects in this file */
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index aaa2ea3..abc7fcc 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -394,7 +394,7 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr)
#endif /* QAK */
/* Find out the size of buffer needed for serialized link */
- if((link_size = H5O_msg_raw_size(f, H5O_LINK_ID, lnk)) == 0)
+ if((link_size = H5O_msg_raw_size(f, H5O_LINK_ID, FALSE, lnk)) == 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
#ifdef QAK
HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDstrlen(lnk->name), link_size);
@@ -409,7 +409,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
link_ptr = link_buf;
/* Create serialized form of link */
- if(H5O_msg_encode(f, H5O_LINK_ID, link_ptr, lnk) < 0)
+ if(H5O_msg_encode(f, H5O_LINK_ID, FALSE, link_ptr, lnk) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link")
/* Open the fractal heap */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 8cb384d..189adf9 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -434,7 +434,7 @@ H5G_obj_insert(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk,
} /* end if */
/* Get the link's message size */
- if((link_msg_size = H5O_msg_raw_size(grp_oloc->file, H5O_LINK_ID, obj_lnk)) == 0)
+ if((link_msg_size = H5O_msg_raw_size(grp_oloc->file, H5O_LINK_ID, FALSE, obj_lnk)) == 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size")
/* If there's still a small enough number of links, use the 'link' message */
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 0fbafba..8150e78 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -375,7 +375,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
UINT32DECODE(p, hdr->pline_root_direct_filter_mask);
/* Decode I/O filter information */
- if(NULL == (pline = H5O_msg_decode(hdr->f, dxpl_id, H5O_PLINE_ID, p)))
+ if(NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, dxpl_id, H5O_PLINE_ID, p)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters")
p += hdr->filter_len;
@@ -416,7 +416,7 @@ HDfprintf(stderr, "%s: hdr->fspace = %p\n", FUNC, hdr->fspace);
done:
if(buf)
- H5FL_BLK_FREE(header_block, buf);
+ buf = H5FL_BLK_FREE(header_block, buf);
if(!ret_value && hdr)
(void)H5HF_cache_hdr_dest(f, hdr);
@@ -530,7 +530,7 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
UINT32ENCODE(p, hdr->pline_root_direct_filter_mask);
/* Encode I/O filter information */
- if(H5O_msg_encode(hdr->f, H5O_PLINE_ID, p, &(hdr->pline)) < 0)
+ if(H5O_msg_encode(hdr->f, H5O_PLINE_ID, FALSE, p, &(hdr->pline)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, FAIL, "can't encode I/O pipeline fiters")
p += hdr->filter_len;
} /* end if */
@@ -546,7 +546,7 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
if(H5F_block_write(f, H5FD_MEM_FHEAP_HDR, addr, size, dxpl_id, buf) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap header to disk")
- H5FL_BLK_FREE(header_block, buf);
+ buf = H5FL_BLK_FREE(header_block, buf);
hdr->dirty = FALSE;
hdr->cache_info.is_dirty = FALSE;
@@ -866,7 +866,7 @@ HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].add
done:
/* Free buffer */
/* XXX: Keep buffer around? */
- H5FL_BLK_FREE(indirect_block, buf);
+ buf = H5FL_BLK_FREE(indirect_block, buf);
if(!ret_value && iblock)
(void)H5HF_cache_iblock_dest(f, iblock);
@@ -1013,7 +1013,7 @@ HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->f
HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap indirect block to disk")
/* Free buffer */
- H5FL_BLK_FREE(indirect_block, buf);
+ buf = H5FL_BLK_FREE(indirect_block, buf);
/* Reset dirty flags */
iblock->cache_info.is_dirty = FALSE;
@@ -1620,7 +1620,7 @@ HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock);
HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block")
/* Free block's buffer */
- H5FL_BLK_FREE(direct_block, dblock->blk);
+ dblock->blk = H5FL_BLK_FREE(direct_block, dblock->blk);
/* Free fractal heap direct block info */
H5FL_FREE(H5HF_direct_t, dblock);
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index 6267e76..ad243cf 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -424,7 +424,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
/* Compute the I/O filters' encoded size */
- if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, &(hdr->pline))))
+ if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline))))
HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size")
#ifdef QAK
HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len);
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 8c9b22d..b2d2712 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -185,25 +185,9 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, unsigned mesg_flags,
else
p += name_len; /* advance the memory pointer */
- /* decode the attribute datatype */
- if(flags & H5O_ATTR_FLAG_TYPE_SHARED) {
- H5O_shared_t *shared; /* Shared information */
-
- /* Get the shared information */
- if(NULL == (shared = (H5O_shared_t *)(H5O_MSG_SHARED->decode)(f, dxpl_id, mesg_flags, p)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message")
-
- /* Get the actual datatype information */
- if((attr->dt = (H5T_t *)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_msg_free_real(H5O_MSG_SHARED, shared);
- } /* end if */
- else {
- if((attr->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, mesg_flags, p)) == NULL)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
- } /* end else */
+ /* Decode the attribute's datatype */
+ if((attr->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)(f, dxpl_id, ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), p)) == NULL)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype")
if(version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(attr->dt_size);
else
@@ -638,8 +622,6 @@ herr_t
H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
{
const H5A_t *attr = (const H5A_t *) _mesg;
- htri_t tri_ret;
- H5O_shared_t sh_mesg;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_delete)
@@ -648,26 +630,9 @@ H5O_attr_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg, hbool_t adj_link)
HDassert(f);
HDassert(attr);
- /* Remove both the datatype and dataspace from the SOHM heap if they're
- * shared there.
- */
- if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr->dt)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't tell if datatype is shared")
- else if(tri_ret > 0) {
- /* 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)
- HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
- } /* end if */
- else {
- if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg))
- HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't get shared message from datatype")
- if(H5SM_try_delete(f, dxpl_id, H5O_DTYPE_ID, &sh_mesg) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "can't remove datatype from heap")
- } /* end else */
- } /* end if */
+ /* Decrement reference count on datatype in file */
+ if((H5O_MSG_DTYPE->del)(f, dxpl_id, attr->dt, adj_link) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count")
/* Decrement reference count on dataspace in file */
if((H5O_MSG_SDSPACE->del)(f, dxpl_id, attr->ds, adj_link) < 0)
@@ -708,18 +673,11 @@ H5O_attr_link(H5F_t *f, hid_t dxpl_id, const void *_mesg)
* Otherwise they may be deleted when the attribute
* message is deleted.
*/
- /* 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)
- HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust shared datatype link count")
- } /* end if */
- else {
- if(H5SM_try_share(f, dxpl_id, H5O_DTYPE_ID, attr->dt) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "error trying to re-share attribute datatype")
- } /* end else */
- if(H5SM_try_share(f, dxpl_id, H5O_SDSPACE_ID, attr->ds) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "error trying to re-share attribute dataspace")
+ /* Increment reference count on datatype & dataspace in file */
+ if((H5O_MSG_DTYPE->link)(f, dxpl_id, attr->dt) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count")
+ if((H5O_MSG_SDSPACE->link)(f, dxpl_id, attr->ds) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -887,9 +845,6 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type,
void *reclaim_buf = NULL; /* Buffer for reclaiming data */
hid_t buf_sid = -1; /* ID for buffer dataspace */
- H5O_shared_t sh_mesg; /* Shared message information */
- htri_t tri_ret; /* htri_t return value */
-
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_attr_copy_file)
@@ -975,38 +930,9 @@ H5O_attr_copy_file(H5F_t *file_src, const H5O_msg_class_t UNUSED *mesg_type,
/* Compute the sizes of the datatype and dataspace. This is their raw
* size unless they're shared.
*/
- if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr_dst->dt)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to determine if datatype is shared")
- if(tri_ret == TRUE) {
- /* Reset shared message information */
- HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t));
-
- /* Get shared message information for datatype */
- if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr_dst->dt, &sh_mesg/*out*/))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to get shared message")
-
- /* Compute shared message size for datatype */
- attr_dst->dt_size = H5O_msg_raw_size(file_dst, H5O_SHARED_ID, &sh_mesg);
- } /* end if */
- else
- attr_dst->dt_size = H5O_msg_raw_size(file_dst, H5O_DTYPE_ID, attr_src->dt);
+ attr_dst->dt_size = H5O_msg_raw_size(file_dst, H5O_DTYPE_ID, FALSE, attr_src->dt);
HDassert(attr_dst->dt_size > 0);
-
- if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr_dst->ds)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "unable to determine if dataspace is shared")
- if(tri_ret == TRUE) {
- /* Reset shared message information */
- HDmemset(&sh_mesg, 0, sizeof(H5O_shared_t));
-
- /* Get shared message information for dataspace */
- if(NULL == H5O_msg_get_share(H5O_SDSPACE_ID, attr_dst->ds, &sh_mesg/*out*/))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to get shared message")
-
- /* Compute shared message size for dataspace */
- attr_dst->ds_size = H5O_msg_raw_size(file_dst, H5O_SHARED_ID, &sh_mesg);
- }
- else
- attr_dst->ds_size = H5O_msg_raw_size(file_dst, H5O_SDSPACE_ID, attr_src->ds);
+ attr_dst->ds_size = H5O_msg_raw_size(file_dst, H5O_SDSPACE_ID, FALSE, attr_src->ds);
HDassert(attr_dst->ds_size > 0);
/* Compute the size of the data */
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index eda97ba..a93b321 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -314,7 +314,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
HDassert(cpy_info);
/* Get source object header */
- if(NULL == (oh_src = H5AC_protect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (oh_src = (H5O_t *)H5AC_protect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Get pointer to object class for this object */
@@ -380,7 +380,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
/* Allocate memory for "deleted" array. This array marks the message in
* the source that shouldn't be copied to the destination.
*/
- if(NULL == (deleted = HDmalloc(sizeof(hbool_t) * oh_src->nmesgs)))
+ if(NULL == (deleted = (hbool_t *)HDmalloc(sizeof(hbool_t) * oh_src->nmesgs)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HDmemset(deleted, FALSE, sizeof(hbool_t) * oh_src->nmesgs);
@@ -526,10 +526,10 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
*/
if(H5O_NEW_SHARED(mesg_dst->type))
mesg_dst->raw_size = H5O_ALIGN_OH(oh_dst,
- H5O_msg_raw_size(oloc_dst->file, mesg_dst->type->id, mesg_dst->native));
+ H5O_msg_raw_size(oloc_dst->file, mesg_dst->type->id, FALSE, mesg_dst->native));
else
mesg_dst->raw_size = H5O_ALIGN_OH(oh_dst,
- H5O_msg_raw_size(oloc_dst->file, H5O_SHARED_ID, mesg_dst->native));
+ H5O_msg_raw_size(oloc_dst->file, H5O_SHARED_ID, FALSE, mesg_dst->native));
} /* end if */
else if(shared == FALSE && (mesg_dst->flags & H5O_MSG_FLAG_SHARED)) {
/* Unset shared flag */
@@ -539,7 +539,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
* an H5O_shared_t)
*/
mesg_dst->raw_size = H5O_ALIGN_OH(oh_dst,
- H5O_msg_raw_size(oloc_dst->file, mesg_dst->type->id, mesg_dst->native));
+ H5O_msg_raw_size(oloc_dst->file, mesg_dst->type->id, FALSE, mesg_dst->native));
} /* end else */
/* Mark the message in the destination as dirty, so it'll get encoded when the object header is flushed */
@@ -592,7 +592,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
* header. This will be written when the header is flushed to disk.
*/
if(oh_dst->version > H5O_VERSION_1)
- HDmemcpy(current_pos, H5O_HDR_MAGIC, H5O_SIZEOF_MAGIC);
+ HDmemcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5O_SIZEOF_MAGIC);
current_pos += H5O_SIZEOF_HDR(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst);
/* Copy each message that wasn't dirtied above */
@@ -936,7 +936,7 @@ H5O_copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name,
HDassert(dst_name);
/* Get the copy property list */
- if(NULL == (ocpy_plist = H5I_object(ocpypl_id)))
+ if(NULL == (ocpy_plist = (H5P_genplist_t *)H5I_object(ocpypl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Retrieve the copy parameters */
@@ -1106,7 +1106,7 @@ H5O_copy_expand_ref(H5F_t *file_src, void *_src_ref, hid_t dxpl_id,
INT32DECODE(p, hobjid.idx);
/* Get the dataset region from the heap (allocate inside routine) */
- if((buf = H5HG_read(src_oloc.file, dxpl_id, &hobjid, NULL, &buf_size)) == NULL)
+ if((buf = (uint8_t *)H5HG_read(src_oloc.file, dxpl_id, &hobjid, NULL, &buf_size)) == NULL)
HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information")
/* Get the object oid for the dataset */
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index fc09760..31de559 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -66,20 +66,20 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{
H5O_DTYPE_ID, /* message id number */
"datatype", /* message name for debugging */
sizeof(H5T_t), /* native message size */
- H5O_dtype_decode, /* decode message */
- H5O_dtype_encode, /* encode message */
+ H5O_dtype_shared_decode, /* decode message */
+ H5O_dtype_shared_encode, /* encode message */
H5O_dtype_copy, /* copy the native value */
- H5O_dtype_size, /* size of raw message */
+ H5O_dtype_shared_size, /* size of raw message */
H5O_dtype_reset, /* reset method */
H5O_dtype_free, /* free method */
- NULL, /* file delete method */
- NULL, /* link method */
+ H5O_dtype_shared_delete, /* file delete method */
+ H5O_dtype_shared_link, /* link method */
H5O_dtype_get_share, /* get share method */
H5O_dtype_set_share, /* set share method */
H5O_dtype_can_share, /* can share method */
H5O_dtype_is_shared, /* is shared method */
H5O_dtype_pre_copy_file, /* pre copy native value to file */
- H5O_dtype_copy_file, /* copy native value to file */
+ H5O_dtype_shared_copy_file, /* copy native value to file */
NULL, /* post copy native value to file */
NULL, /* get creation index */
NULL, /* set creation index */
@@ -179,7 +179,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
*/
z = flags & (H5T_OPAQUE_TAG_MAX - 1);
HDassert(0 == (z & 0x7)); /*must be aligned*/
- if(NULL == (dt->shared->u.opaque.tag = H5MM_malloc(z + 1)))
+ if(NULL == (dt->shared->u.opaque.tag = (char *)H5MM_malloc(z + 1)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
HDmemcpy(dt->shared->u.opaque.tag, *pp, z);
dt->shared->u.opaque.tag[z] = '\0';
@@ -246,7 +246,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
HDassert(dt->shared->u.compnd.nmembs > 0);
dt->shared->u.compnd.packed = TRUE; /* Start off packed */
dt->shared->u.compnd.nalloc = dt->shared->u.compnd.nmembs;
- dt->shared->u.compnd.memb = H5MM_calloc(dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t));
+ dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_calloc(dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t));
if(NULL == dt->shared->u.compnd.memb)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
@@ -373,8 +373,8 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
if(H5O_dtype_decode_helper(f, pp, dt->shared->parent) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode parent datatype")
- if(NULL == (dt->shared->u.enumer.name = H5MM_calloc(dt->shared->u.enumer.nalloc * sizeof(char*))) ||
- NULL == (dt->shared->u.enumer.value = H5MM_calloc(dt->shared->u.enumer.nalloc * dt->shared->parent->shared->size)))
+ if(NULL == (dt->shared->u.enumer.name = (char **)H5MM_calloc(dt->shared->u.enumer.nalloc * sizeof(char*))) ||
+ NULL == (dt->shared->u.enumer.value = (uint8_t *)H5MM_calloc(dt->shared->u.enumer.nalloc * dt->shared->parent->shared->size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Names */
@@ -1509,7 +1509,7 @@ H5O_dtype_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t *mesg_type,
FUNC_ENTER_NOAPI_NOINIT(H5O_dtype_copy_file)
/* Perform a normal copy of the object header message */
- if(NULL == (dst_mesg = H5O_dtype_copy(native_src, NULL)))
+ if(NULL == (dst_mesg = (H5T_t *)H5O_dtype_copy(native_src, NULL)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy")
/* The datatype will be in the new file; set its location. */
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index c9de669..6d4a15c 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -107,8 +107,8 @@ static herr_t H5O_msg_remove_real(const H5O_loc_t *loc, const H5O_msg_class_t *t
static herr_t H5O_msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
static unsigned H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *flags,
- const H5O_msg_class_t *orig_type, const void *orig_mesg, H5O_shared_t *sh_mesg,
- const H5O_msg_class_t **new_type, const void **new_mesg, hid_t dxpl_id,
+ const H5O_msg_class_t *orig_type, void *orig_mesg, H5O_shared_t *sh_mesg,
+ const H5O_msg_class_t **new_type, void **new_mesg, hid_t dxpl_id,
unsigned *oh_flags_ptr);
static herr_t H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx,
const H5O_msg_class_t *type, const void *mesg, unsigned flags,
@@ -167,7 +167,7 @@ H5O_msg_create(H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags,
HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file")
/* Protect the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Go append message to object header */
@@ -221,14 +221,21 @@ H5O_msg_append(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned type_id,
HDassert(oh_flags_ptr);
/* Should this message be written as a SOHM? */
- if(!(mesg_flags & H5O_MSG_FLAG_DONTSHARE)) {
+ if(!(mesg_flags & H5O_MSG_FLAG_DONTSHARE) && !H5O_NEW_SHARED(type)) {
htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
- if((shared_mesg = H5SM_try_share(f, dxpl_id, type_id, mesg)) > 0)
- /* Mark the message as shared */
+ /* Check if message is already shared */
+ if((shared_mesg = H5O_msg_is_shared(type_id, mesg)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message is shared")
+ else if(shared_mesg > 0)
mesg_flags |= H5O_MSG_FLAG_SHARED;
- else if(shared_mesg < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
+ else {
+ if((shared_mesg = H5SM_try_share(f, dxpl_id, type_id, mesg)) > 0)
+ /* Mark the message as shared */
+ mesg_flags |= H5O_MSG_FLAG_SHARED;
+ else if(shared_mesg < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared")
+ } /* end else */
} /* end if */
/* Append new message to object header */
@@ -261,7 +268,7 @@ H5O_msg_append_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, const H5O_msg_class_t *t
unsigned *oh_flags_ptr)
{
const H5O_msg_class_t *new_type; /* Actual H5O class type for the ID */
- const void *new_mesg; /* Actual message to write */
+ void *new_mesg; /* Actual message to write */
H5O_shared_t sh_mesg; /* Shared object header info */
unsigned idx; /* Index of message to modify */
herr_t ret_value = SUCCEED; /* Return value */
@@ -357,7 +364,7 @@ H5O_msg_write(H5O_loc_t *loc, unsigned type_id, unsigned overwrite,
} /* end if */
/* Protect the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Call the "real" modify routine */
@@ -444,7 +451,7 @@ H5O_msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
HDassert(!(((H5O_shared_t *)idx_msg->native)->flags & H5O_COMMITTED_FLAG));
/* Remove the old message from the SOHM index */
- if(H5SM_try_delete(f, dxpl_id, idx_msg->type->id, idx_msg->native) < 0)
+ if(H5SM_try_delete(f, dxpl_id, idx_msg->type->id, (H5O_shared_t *)idx_msg->native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to delete message from SOHM table")
if(H5O_NEW_SHARED(type)) {
@@ -537,7 +544,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, int sequence, void *mesg,
HDassert(sequence >= 0);
/* Get the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header")
/* Call the "real" read routine */
@@ -616,7 +623,7 @@ H5O_msg_read_real(H5F_t *f, H5O_t *oh, unsigned type_id, int sequence,
* H5O_MSG_SHARED message. We use that information to look up the real
* message in the global heap or some other object header.
*/
- if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, oh->mesg[idx].native, type, mesg)))
+ if(NULL == (ret_value = H5O_shared_read(f, dxpl_id, (const H5O_shared_t *)oh->mesg[idx].native, type, mesg)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space")
} else {
/*
@@ -916,7 +923,7 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id)
HDassert(type);
/* Load the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Loop over all messages, counting the ones of the type looked for */
@@ -967,7 +974,7 @@ H5O_msg_exists(H5O_loc_t *loc, unsigned type_id, int sequence, hid_t dxpl_id)
HDassert(sequence >= 0);
/* Load the object header */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Call the "real" exists routine */
@@ -1239,7 +1246,7 @@ H5O_msg_remove_real(const H5O_loc_t *loc, const H5O_msg_class_t *type, int seque
udata.adj_link = adj_link;
/* Protect the object header to iterate over */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Iterate over the messages, deleting appropriate one(s) */
@@ -1311,7 +1318,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, H5O_operator_t app_op,
HDassert(type);
/* Protect the object header to iterate over */
- if(NULL == (oh = H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
+ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header")
/* Call the "real" iterate routine */
@@ -1394,7 +1401,7 @@ H5O_msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type,
else {
/* If the message is shared, get the real message it points to */
if((idx_msg->flags & H5O_MSG_FLAG_SHARED) && !H5O_NEW_SHARED(idx_msg->type)) {
- if(NULL == (native_mesg = H5O_shared_read(f, dxpl_id, idx_msg->native, idx_msg->type, NULL)))
+ if(NULL == (native_mesg = H5O_shared_read(f, dxpl_id, (const H5O_shared_t *)idx_msg->native, idx_msg->type, NULL)))
HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "unable to read shared message")
native_mesg_alloc = TRUE;
} /* end if */
@@ -1459,10 +1466,12 @@ done:
*-------------------------------------------------------------------------
*/
size_t
-H5O_msg_raw_size(const H5F_t *f, unsigned type_id, const void *mesg)
+H5O_msg_raw_size(const H5F_t *f, unsigned type_id, hbool_t disable_shared,
+ const void *mesg)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- size_t ret_value; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ unsigned old_sh_mesg_flags = 0; /* Message's current shared message flags */
+ size_t ret_value; /* Return value */
FUNC_ENTER_NOAPI(H5O_msg_raw_size, 0)
@@ -1474,10 +1483,32 @@ H5O_msg_raw_size(const H5F_t *f, unsigned type_id, const void *mesg)
HDassert(f);
HDassert(mesg);
+ /* Check for disabling shared message encoding, to encode the "base" type */
+ if(disable_shared) {
+ H5O_shared_t *sh_mesg = (H5O_shared_t *)mesg; /* Pointer to message's shared message info */
+
+ /* Try to make certain that this routine doesn't get invoked for
+ * unsharable message classes
+ */
+ HDassert(type->is_shared);
+
+ /* Preserve message's shared message info while getting the
+ * "real" encoded size & buffer (*ick* - QAK)
+ * (XXX: Harmless but ugly for message classes that aren't using shared
+ * message method interface yet - QAK)
+ */
+ old_sh_mesg_flags = sh_mesg->flags;
+ sh_mesg->flags = 0;
+ } /* end if */
+
/* Compute the raw data size for the mesg */
if((ret_value = (type->raw_size)(f, mesg)) == 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message")
+ /* Restore message's shared message info, if appropriate (*ick* - QAK) */
+ if(disable_shared)
+ ((H5O_shared_t *)mesg)->flags = old_sh_mesg_flags;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_raw_size() */
@@ -1778,10 +1809,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_msg_encode(H5F_t *f, unsigned type_id, unsigned char *buf, const void *mesg)
+H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared,
+ unsigned char *buf, const void *mesg)
{
- const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ const H5O_msg_class_t *type; /* Actual H5O class type for the ID */
+ unsigned old_sh_mesg_flags = 0; /* Message's current shared message flags */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5O_msg_encode,FAIL)
@@ -1791,10 +1824,32 @@ H5O_msg_encode(H5F_t *f, unsigned type_id, unsigned char *buf, const void *mesg)
type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
HDassert(type);
+ /* Check for disabling shared message encoding, to encode the "base" type */
+ if(disable_shared) {
+ H5O_shared_t *sh_mesg = (H5O_shared_t *)mesg; /* Pointer to message's shared message info */
+
+ /* Try to make certain that this routine doesn't get invoked for
+ * unsharable message classes
+ */
+ HDassert(type->is_shared);
+
+ /* Preserve message's shared message info while getting the
+ * "real" encoded size & buffer (*ick* - QAK)
+ * (XXX: Harmless but ugly for message classes that aren't using shared
+ * message method interface yet - QAK)
+ */
+ old_sh_mesg_flags = sh_mesg->flags;
+ sh_mesg->flags = 0;
+ } /* end if */
+
/* Encode */
if((type->encode)(f, buf, mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message")
+ /* Restore message's shared message info, if appropriate (*ick* - QAK) */
+ if(disable_shared)
+ ((H5O_shared_t *)mesg)->flags = old_sh_mesg_flags;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_encode() */
@@ -1973,8 +2028,8 @@ done:
*/
static unsigned
H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *orig_type,
- const void *orig_mesg, H5O_shared_t *sh_mesg, const H5O_msg_class_t **new_type,
- const void **new_mesg, hid_t dxpl_id, unsigned *oh_flags_ptr)
+ void *orig_mesg, H5O_shared_t *sh_mesg, const H5O_msg_class_t **new_type,
+ void **new_mesg, hid_t dxpl_id, unsigned *oh_flags_ptr)
{
size_t size; /* Size of space allocated for object header */
unsigned ret_value = UFAIL; /* Return value */
@@ -2024,6 +2079,33 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *o
*new_mesg = orig_mesg;
} /* end else */
+ if(H5O_NEW_SHARED(orig_type)) {
+ htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
+
+ HDassert(!(*mesg_flags & H5O_MSG_FLAG_SHARED));
+
+ /* Check if message is already shared */
+ if((shared_mesg = H5O_msg_is_shared((*new_type)->id, (*new_mesg))) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, UFAIL, "error determining if message is shared")
+ else if(shared_mesg > 0) {
+ /* Increment message's reference count */
+ if((*new_type)->link && ((*new_type)->link)(f, dxpl_id, (*new_mesg)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared message ref count")
+ *mesg_flags |= H5O_MSG_FLAG_SHARED;
+ } /* end if */
+ else {
+ /* Check for unsharable message */
+ if(!(*mesg_flags & H5O_MSG_FLAG_DONTSHARE)) {
+ /* Attempt to share message */
+ if((shared_mesg = H5SM_try_share(f, dxpl_id, (*new_type)->id, (*new_mesg))) > 0)
+ /* Mark the message as shared */
+ *mesg_flags |= H5O_MSG_FLAG_SHARED;
+ else if(shared_mesg < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, UFAIL, "error determining if message should be shared")
+ } /* end if */
+ } /* end else */
+ } /* end if */
+
/* Compute the size needed to store the message on disk */
if((size = ((*new_type)->raw_size)(f, *new_mesg)) >= H5O_MESG_MAX_SIZE)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, UFAIL, "object header message is too large")
@@ -2039,9 +2121,11 @@ H5O_new_mesg(H5F_t *f, H5O_t *oh, unsigned *mesg_flags, const H5O_msg_class_t *o
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, UFAIL, "unable to retrieve creation index")
} /* end if */
- /* Increment any links in message */
- if((*new_type)->link && ((*new_type)->link)(f, dxpl_id, (*new_mesg)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared object link count")
+ if(!H5O_NEW_SHARED(orig_type)) {
+ /* Increment any links in message */
+ if((*new_type)->link && ((*new_type)->link)(f, dxpl_id, (*new_mesg)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, UFAIL, "unable to adjust shared object link count")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2199,7 +2283,7 @@ H5O_delete_mesg(H5F_t *f, hid_t dxpl_id, H5O_mesg_t *mesg, hbool_t adj_link)
* it's a shared message.
*/
if(type == H5O_MSG_SHARED) {
- if(H5SM_try_delete(f, dxpl_id, mesg->type->id, mesg->native) < 0)
+ if(H5SM_try_delete(f, dxpl_id, mesg->type->id, (H5O_shared_t *)mesg->native) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to delete message from SOHM table")
} /* end if */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 1ecf283..83065d4 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -160,7 +160,7 @@
/* Temporary macro to define which message classes are using the "new"
* shared message "interface" for their methods.
*/
-#define H5O_NEW_SHARED(T) ((T) == H5O_MSG_PLINE || (T) == H5O_MSG_FILL_NEW || (T) == H5O_MSG_FILL || (T) == H5O_MSG_SDSPACE)
+#define H5O_NEW_SHARED(T) ((T) == H5O_MSG_PLINE || (T) == H5O_MSG_FILL_NEW || (T) == H5O_MSG_FILL || (T) == H5O_MSG_SDSPACE || (T) == H5O_MSG_DTYPE)
/* The "message class" type */
diff --git a/src/H5Opline.c b/src/H5Opline.c
index 199ad69..d87c781 100644
--- a/src/H5Opline.c
+++ b/src/H5Opline.c
@@ -151,7 +151,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_fla
/* Allocate array for filters */
pline->nalloc = pline->nused;
- if(NULL == (pline->filter = H5MM_calloc(pline->nalloc * sizeof(pline->filter[0]))))
+ 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")
/* Decode filters */
@@ -184,7 +184,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_fla
/* Allocate space for the filter name, or use the internal buffer */
if(actual_name_length > H5Z_COMMON_NAME_LEN) {
- filter->name = H5MM_malloc(actual_name_length);
+ filter->name = (char *)H5MM_malloc(actual_name_length);
if(NULL == filter->name)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter name")
} /* end if */
@@ -201,7 +201,7 @@ H5O_pline_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_fla
/* Allocate space for the client data elements, or use the internal buffer */
if(filter->cd_nelmts > H5Z_COMMON_CD_VALUES) {
- filter->cd_values = H5MM_malloc(filter->cd_nelmts * sizeof(unsigned));
+ filter->cd_values = (unsigned *)H5MM_malloc(filter->cd_nelmts * sizeof(unsigned));
if(NULL == filter->cd_values)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for client data")
} /* end if */
@@ -374,7 +374,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/)
dst->nalloc = dst->nused;
if(dst->nalloc) {
/* Allocate array to hold filters */
- if(NULL == (dst->filter = H5MM_calloc(dst->nalloc * sizeof(dst->filter[0]))))
+ if(NULL == (dst->filter = (H5Z_filter_info_t *)H5MM_calloc(dst->nalloc * sizeof(dst->filter[0]))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Deep-copy filters */
@@ -390,7 +390,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/)
/* Allocate space for the filter name, or use the internal buffer */
if(namelen > H5Z_COMMON_NAME_LEN) {
- dst->filter[i].name = H5MM_malloc(namelen);
+ dst->filter[i].name = (char *)H5MM_malloc(namelen);
if(NULL == dst->filter[i].name)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter name")
@@ -405,7 +405,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/)
if(src->filter[i].cd_nelmts > 0) {
/* Allocate space for the client data elements, or use the internal buffer */
if(src->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES) {
- if(NULL == (dst->filter[i].cd_values = H5MM_malloc(src->filter[i].cd_nelmts* sizeof(unsigned))))
+ if(NULL == (dst->filter[i].cd_values = (unsigned *)H5MM_malloc(src->filter[i].cd_nelmts* sizeof(unsigned))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemcpy(dst->filter[i].cd_values, src->filter[i].cd_values,
@@ -529,16 +529,16 @@ H5O_pline_reset(void *mesg)
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 = H5MM_xfree(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 = H5MM_xfree(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)
- pline->filter = H5MM_xfree(pline->filter);
+ pline->filter = (H5Z_filter_info_t *)H5MM_xfree(pline->filter);
/* Reset # of filters */
pline->nused = pline->nalloc = 0;
@@ -606,7 +606,7 @@ H5O_pline_pre_copy_file(H5F_t UNUSED *file_src, const H5O_msg_class_t UNUSED *ty
* the object copying process.
*/
if(udata)
- if(NULL == (udata->src_pline = H5O_pline_copy(pline_src, NULL)))
+ if(NULL == (udata->src_pline = (H5O_pline_t *)H5O_pline_copy(pline_src, NULL)))
HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to copy")
done:
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index d5a2376..62285e1 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -422,7 +422,8 @@ H5_DLL herr_t H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequ
H5O_operator_t op, void *op_data, hbool_t adj_link, hid_t dxpl_id);
H5_DLL herr_t H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, H5O_operator_t op,
void *op_data, hid_t dxpl_id);
-H5_DLL size_t H5O_msg_raw_size(const H5F_t *f, unsigned type_id, const void *mesg);
+H5_DLL size_t H5O_msg_raw_size(const H5F_t *f, unsigned type_id,
+ hbool_t disable_shared, const void *mesg);
H5_DLL size_t H5O_msg_mesg_size(const H5F_t *f, unsigned type_id, const void *mesg,
size_t extra_raw);
H5_DLL void *H5O_msg_get_share(unsigned type_id, const void *mesg, H5O_shared_t *share);
@@ -430,7 +431,8 @@ H5_DLL htri_t H5O_msg_is_shared(unsigned type_id, const void *mesg);
H5_DLL htri_t H5O_msg_can_share(unsigned type_id, const void *mesg);
H5_DLL herr_t H5O_msg_set_share(unsigned type_id, H5O_shared_t *share, void *mesg);
H5_DLL herr_t H5O_msg_reset_share(unsigned type_id, void *mesg);
-H5_DLL herr_t H5O_msg_encode(H5F_t *f, unsigned type_id, unsigned char *buf, const void *obj);
+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, unsigned type_id,
const unsigned char *buf);
H5_DLL herr_t H5O_msg_delete(H5F_t *f, hid_t dxpl_id, unsigned type_id, const void *mesg);
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 57a48e6..1d406d9 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -171,7 +171,7 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags,
/* Decode dimension sizes */
if(sdim->rank > 0) {
- if(NULL == (sdim->size = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
+ if(NULL == (sdim->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
for(i = 0; i < sdim->rank; i++) {
H5F_DECODE_LENGTH(f, p, sdim->size[i]);
@@ -183,7 +183,7 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags,
} /* end for */
if(flags & H5S_VALID_MAX) {
- if(NULL == (sdim->max = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
+ if(NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
for(i = 0; i < sdim->rank; i++)
H5F_DECODE_LENGTH (f, p, sdim->max[i]);
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index e8c73ca..8a77744 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -196,7 +196,7 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared,
done:
/* Release resources */
if(buf && buf != mesg_buf)
- H5FL_BLK_FREE(ser_mesg, buf);
+ buf = H5FL_BLK_FREE(ser_mesg, buf);
if(native_mesg)
H5O_msg_free(type->id, native_mesg);
if(fheap && H5HF_close(fheap, dxpl_id) < 0)
@@ -218,7 +218,7 @@ done:
* reference count is stored in the file-wide shared message
* index and is changed in a different place in the code.
*
- * Return: Success: New link count, or 1 for messages in heap
+ * Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -227,11 +227,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-static int
+static herr_t
H5O_shared_link_adj_new(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared,
const H5O_msg_class_t *type, int adjust)
{
- int ret_value; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5O_shared_link_adj_new)
@@ -239,29 +239,33 @@ H5O_shared_link_adj_new(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared,
HDassert(f);
HDassert(shared);
- /*
- * The shared message is stored in some other object header.
- * The other object header must be in the same file as the
- * new object header. Adjust the reference count on that
- * object header.
- */
+ /* Check for type of shared message */
if(shared->flags & H5O_COMMITTED_FLAG) {
+ /*
+ * The shared message is stored in some other object header.
+ * The other object header must be in the same file as the
+ * new object header. Adjust the reference count on that
+ * object header.
+ */
if(shared->u.oloc.file->shared != f->shared)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "interfile hard links are not allowed")
- if((ret_value = H5O_link(&(shared->u.oloc), adjust, dxpl_id)) < 0)
+ if(H5O_link(&(shared->u.oloc), adjust, dxpl_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count")
} /* end if */
else {
+ HDassert(shared->flags & H5O_SHARED_IN_HEAP_FLAG);
+
+ /* Check for decrementing reference count on shared message */
if(adjust < 0) {
if(H5SM_try_delete(f, dxpl_id, type->id, shared) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to delete message from SOHM table")
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to delete message from SOHM table")
+ } /* end if */
+ /* Check for incrementing reference count on message */
+ else if(adjust > 0) {
+ /* Casting away const OK -QAK */
+ if(H5SM_try_share(f, dxpl_id, type->id, (void *)shared) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "error trying to share message")
} /* end if */
-
- /* Messages in the heap don't have file object ref counts; they
- * return 1 as a dummy value.
- */
- HDassert(shared->flags & H5O_SHARED_IN_HEAP_FLAG);
- ret_value = 1;
} /* end else */
done:
@@ -395,6 +399,7 @@ H5O_shared_decode_new(H5F_t *f, hid_t dxpl_id, const uint8_t *buf, const H5O_msg
H5F_addr_decode(f, &buf, &sh_mesg.u.oloc.addr);
sh_mesg.u.oloc.file = f;
+ sh_mesg.u.oloc.holding_file = FALSE;
} /* end else */
} /* end else if */
@@ -436,7 +441,7 @@ H5O_shared_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags,
HDassert(buf);
/* Decode */
- if(NULL == (mesg = H5MM_calloc(sizeof(H5O_shared_t))))
+ if(NULL == (mesg = (H5O_shared_t *)H5MM_calloc(sizeof(H5O_shared_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Version */
@@ -625,7 +630,7 @@ H5O_shared_copy(const void *_mesg, void *_dest)
/* check args */
HDassert(mesg);
- if(!dest && NULL == (dest = H5MM_malloc(sizeof(H5O_shared_t))))
+ if(!dest && NULL == (dest = (H5O_shared_t *)H5MM_malloc(sizeof(H5O_shared_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* copy */
@@ -1020,7 +1025,7 @@ H5O_shared_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
*/
if(shared_src->flags & H5O_COMMITTED_FLAG) {
/* Allocate space for the destination message */
- if(NULL == (shared_dst = H5MM_malloc(sizeof(H5O_shared_t))))
+ if(NULL == (shared_dst = (H5O_shared_t *)H5MM_malloc(sizeof(H5O_shared_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Reset group entry for new object */
diff --git a/src/H5S.c b/src/H5S.c
index 820978e..8604750 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -516,7 +516,7 @@ done:
hid_t
H5Scopy(hid_t space_id)
{
- H5S_t *src = NULL;
+ H5S_t *src;
H5S_t *dst = NULL;
hid_t ret_value;
@@ -524,7 +524,7 @@ H5Scopy(hid_t space_id)
H5TRACE1("i", "i", space_id);
/* Check args */
- if (NULL==(src=H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL==(src=(H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
/* Copy */
@@ -562,17 +562,17 @@ done:
herr_t
H5Sextent_copy(hid_t dst_id,hid_t src_id)
{
- H5S_t *src = NULL;
- H5S_t *dst = NULL;
+ H5S_t *src;
+ H5S_t *dst;
hid_t ret_value = SUCCEED;
FUNC_ENTER_API(H5Sextent_copy, FAIL);
H5TRACE2("e", "ii", dst_id, src_id);
/* Check args */
- if (NULL==(src=H5I_object_verify(src_id, H5I_DATASPACE)))
+ if (NULL==(src=(H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
- if (NULL==(dst=H5I_object_verify(dst_id, H5I_DATASPACE)))
+ if (NULL==(dst=(H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
/* Copy */
@@ -620,14 +620,14 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src)
case H5S_SIMPLE:
if(src->size) {
- dst->size = H5FL_ARR_MALLOC(hsize_t, (size_t)src->rank);
+ dst->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)src->rank);
for(u = 0; u < src->rank; u++)
dst->size[u] = src->size[u];
} /* end if */
else
dst->size = NULL;
if(src->max) {
- dst->max = H5FL_ARR_MALLOC(hsize_t, (size_t)src->rank);
+ dst->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)src->rank);
for(u = 0; u < src->rank; u++)
dst->max[u] = src->max[u];
} /* end if */
@@ -756,14 +756,14 @@ done:
hssize_t
H5Sget_simple_extent_npoints(hid_t space_id)
{
- H5S_t *ds = NULL;
+ H5S_t *ds;
hssize_t ret_value;
FUNC_ENTER_API(H5Sget_simple_extent_npoints, FAIL);
H5TRACE1("Hs", "i", space_id);
/* Check args */
- if (NULL == (ds = H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
ret_value = H5S_GET_EXTENT_NPOINTS(ds);
@@ -860,14 +860,14 @@ done:
int
H5Sget_simple_extent_ndims(hid_t space_id)
{
- H5S_t *ds = NULL;
+ H5S_t *ds;
int ret_value;
FUNC_ENTER_API(H5Sget_simple_extent_ndims, FAIL);
H5TRACE1("Is", "i", space_id);
/* Check args */
- if (NULL == (ds = H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
ret_value = H5S_GET_EXTENT_NDIMS(ds);
@@ -951,14 +951,14 @@ int
H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[]/*out*/,
hsize_t maxdims[]/*out*/)
{
- H5S_t *ds = NULL;
+ H5S_t *ds;
int ret_value;
FUNC_ENTER_API(H5Sget_simple_extent_dims, FAIL);
H5TRACE3("Is", "ixx", space_id, dims, maxdims);
/* Check args */
- if (NULL == (ds = H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims);
@@ -1215,14 +1215,14 @@ done:
htri_t
H5Sis_simple(hid_t space_id)
{
- H5S_t *space = NULL; /* dataspace to modify */
+ H5S_t *space; /* dataspace to modify */
htri_t ret_value;
FUNC_ENTER_API(H5Sis_simple, FAIL);
H5TRACE1("t", "i", space_id);
/* Check args and all the boring stuff. */
- if ((space = H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
+ if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space");
ret_value = H5S_is_simple(space);
@@ -1268,7 +1268,7 @@ herr_t
H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
const hsize_t max[/*rank*/])
{
- H5S_t *space = NULL; /* dataspace to modify */
+ H5S_t *space; /* dataspace to modify */
int u; /* local counting variable */
herr_t ret_value=SUCCEED; /* Return value */
@@ -1276,7 +1276,7 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/],
H5TRACE4("e", "iIs*[a1]h*[a1]h", space_id, rank, dims, max);
/* Check args */
- if ((space = H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
+ if ((space = (H5S_t *)H5I_object_verify(space_id,H5I_DATASPACE)) == NULL)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space");
if (rank > 0 && dims == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified");
@@ -1351,7 +1351,7 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims,
/* Set the rank and allocate space for the dims */
space->extent.rank = rank;
- space->extent.size = H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
+ space->extent.size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
/* Copy the dimensions & compute the number of elements in the extent */
for(u = 0, nelem = 1; u < space->extent.rank; u++) {
@@ -1362,7 +1362,7 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims,
/* Copy the maximum dimensions if specified */
if(max != NULL) {
- space->extent.max = H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
+ space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank);
HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank);
} /* end if */
else
@@ -1696,10 +1696,10 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc)
H5TRACE3("e", "ix*z", obj_id, buf, nalloc);
/* Check argument and retrieve object */
- if (NULL==(dspace=H5I_object_verify(obj_id, H5I_DATASPACE)))
+ if (NULL==(dspace=(H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE)))
HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
- if(H5S_encode(dspace, buf, nalloc)<0)
+ if(H5S_encode(dspace, (unsigned char *)buf, nalloc)<0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype");
done:
@@ -1739,7 +1739,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct")
/* Find out the size of buffer needed for extent */
- if((extent_size = H5O_msg_raw_size(f, H5O_SDSPACE_ID, obj)) == 0)
+ if((extent_size = H5O_msg_raw_size(f, H5O_SDSPACE_ID, TRUE, obj)) == 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size")
/* Find out the size of buffer needed for selection */
@@ -1765,7 +1765,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc)
UINT32ENCODE(buf, extent_size);
/* Encode the extent part of dataspace */
- if(H5O_msg_encode(f, H5O_SDSPACE_ID, buf, obj) < 0)
+ if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, buf, obj) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space")
buf += extent_size;
@@ -1811,7 +1811,7 @@ H5Sdecode(const void *buf)
if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
- if((ds = H5S_decode(buf)) == NULL)
+ if((ds = H5S_decode((const unsigned char *)buf)) == NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, FAIL, "can't decode object");
/* Register the type and return the ID */
@@ -1871,7 +1871,7 @@ H5S_decode(const unsigned char *buf)
/* Decode the extent part of dataspace */
/* (pass mostly bogus file pointer and bogus DXPL) */
- if((extent = H5O_msg_decode(f, H5P_DEFAULT, H5O_SDSPACE_ID, buf))==NULL)
+ if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, H5O_SDSPACE_ID, buf))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
buf += extent_size;
@@ -1905,30 +1905,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5S_raw_size
- *
- * Purpose: Compute the 'raw' size of the extent, as stored on disk.
- *
- * Return: Success: non-zero
- * Failure: zero
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * October 14, 2004
- *
- *-------------------------------------------------------------------------
- */
-size_t
-H5S_raw_size(const H5F_t *f, const H5S_t *space)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_raw_size)
-
- /* Return the size of buffer needed for extent */
- FUNC_LEAVE_NOAPI(H5O_msg_raw_size(f, H5O_SDSPACE_ID, &(space->extent)))
-} /* end H5S_raw_size() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5S_get_simple_extent_type
*
* Purpose: Internal function for retrieving the type of extent for a dataspace object
@@ -1987,14 +1963,14 @@ done:
H5S_class_t
H5Sget_simple_extent_type(hid_t sid)
{
- H5S_class_t ret_value;
H5S_t *space;
+ H5S_class_t ret_value;
FUNC_ENTER_API(H5Sget_simple_extent_type, H5S_NO_CLASS);
H5TRACE1("Sc", "i", sid);
/* Check arguments */
- if (NULL == (space = H5I_object_verify(sid, H5I_DATASPACE)))
+ if (NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace");
ret_value=H5S_GET_EXTENT_TYPE(space);
@@ -2021,14 +1997,14 @@ done:
herr_t
H5Sset_extent_none(hid_t space_id)
{
- H5S_t *space = NULL; /* dataspace to modify */
+ H5S_t *space; /* dataspace to modify */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Sset_extent_none, FAIL);
H5TRACE1("e", "i", space_id);
/* Check args */
- if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space");
/* Clear the previous extent from the dataspace */
@@ -2061,14 +2037,14 @@ done:
herr_t
H5Soffset_simple(hid_t space_id, const hssize_t *offset)
{
- H5S_t *space = NULL; /* dataspace to modify */
+ H5S_t *space; /* dataspace to modify */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_API(H5Soffset_simple, FAIL);
H5TRACE2("e", "i*Hs", space_id, offset);
/* Check args */
- if (NULL == (space = H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space");
if (space->extent.rank==0 || (H5S_GET_EXTENT_TYPE(space)==H5S_SCALAR
|| H5S_GET_EXTENT_TYPE(space)==H5S_NULL))
@@ -2230,8 +2206,8 @@ H5Sextent_equal(hid_t space1_id, hid_t space2_id)
H5TRACE2("t", "ii", space1_id, space2_id);
/* check args */
- if(NULL == (ds1 = H5I_object_verify(space1_id, H5I_DATASPACE)) ||
- NULL == (ds2 = H5I_object_verify(space2_id, H5I_DATASPACE)))
+ if(NULL == (ds1 = (const H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)) ||
+ NULL == (ds2 = (const H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
/* Check dataspaces for extent's equality */
diff --git a/src/H5SM.c b/src/H5SM.c
index 5a656fb..8b5faf9 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -417,7 +417,7 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
H5HF_t *fheap = NULL;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5SM_create_index, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_create_index)
HDassert(header);
HDassert(header->index_addr == HADDR_UNDEF);
@@ -506,7 +506,7 @@ H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id, hbool_t
hsize_t list_size; /* Size of list on disk */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5SM_delete_index, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_delete_index)
/* Determine whether index is a list or a B-tree. */
if(header->index_type == H5SM_LIST) {
@@ -570,7 +570,7 @@ H5SM_create_list(H5F_t *f, H5SM_index_header_t * header, hid_t dxpl_id)
haddr_t addr = HADDR_UNDEF; /* Address of the list on disk */
haddr_t ret_value;
- FUNC_ENTER_NOAPI(H5SM_create_list, HADDR_UNDEF)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_create_list)
HDassert(f);
HDassert(header);
@@ -726,7 +726,7 @@ H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_i
haddr_t btree_addr;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5SM_convert_btree_to_list, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_convert_btree_to_list)
/* Remember the address of the old B-tree, but change the header over to be
* a list..
@@ -829,7 +829,7 @@ H5SM_try_share(H5F_t *f, hid_t dxpl_id, unsigned type_id, void *mesg)
if(H5SM_create_index(f, &(table->indexes[index_num]), dxpl_id) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create SOHM index")
cache_flags |= H5AC__DIRTIED_FLAG;
- }
+ } /* end if */
/* Write the message as a shared message */
if(H5SM_write_mesg(f, dxpl_id, &(table->indexes[index_num]), type_id, mesg, &cache_flags) < 0)
@@ -867,12 +867,9 @@ static herr_t
H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
unsigned type_id, void *mesg, unsigned *cache_flags_ptr)
{
- H5O_shared_t *sh_mesg = (H5O_shared_t *)mesg; /* Pointer to message's shared message info */
- unsigned old_sh_mesg_flags; /* Message's current shared message flags */
H5SM_list_t *list = NULL; /* List index */
H5SM_mesg_key_t key; /* Key used to search the index */
H5O_shared_t shared; /* Shared H5O message */
- hsize_t list_pos; /* Position in a list index */
hbool_t found = FALSE; /* Was the message in the index? */
H5HF_t *fheap = NULL; /* Fractal heap handle */
size_t buf_size; /* Size of the encoded message */
@@ -880,31 +877,20 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
size_t empty_pos = UFAIL; /* Empty entry in list */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5SM_write_mesg, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_write_mesg)
HDassert(cache_flags_ptr);
HDassert(header);
HDassert(header->index_type != H5SM_BADTYPE);
- /* Preserve message's shared message info while getting the
- * "real" encoded size & buffer (*ick* - QAK)
- * (XXX: Harmless but ugly for message classes that aren't using shared
- * message method interface yet - QAK)
- */
- old_sh_mesg_flags = sh_mesg->flags;
- sh_mesg->flags = 0;
-
/* Encode the message to be written */
- if((buf_size = H5O_msg_raw_size(f, type_id, mesg)) <= 0)
+ if((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) <= 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADSIZE, FAIL, "can't find message size")
if(NULL == (encoding_buf = H5MM_calloc(buf_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding")
- if(H5O_msg_encode(f, type_id, (unsigned char *)encoding_buf, mesg) < 0)
+ if(H5O_msg_encode(f, type_id, TRUE, (unsigned char *)encoding_buf, mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "can't encode message to be shared")
- /* Restore message's shared message info (*ick* - QAK) */
- sh_mesg->flags = old_sh_mesg_flags;
-
/* Open the fractal heap for this index */
if(NULL == (fheap = H5HF_open(f, dxpl_id, header->heap_addr)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap")
@@ -924,6 +910,8 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
*/
if(header->index_type == H5SM_LIST)
{
+ size_t list_pos; /* Position in a list index */
+
/* The index is a list; get it from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
@@ -1083,7 +1071,7 @@ H5SM_try_delete(H5F_t *f, hid_t dxpl_id, unsigned type_id,
* master table needs to be unprotected when we do this.
*/
if(mesg_buf) {
- if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, type_id, mesg_buf)))
+ if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, type_id, (const unsigned char *)mesg_buf)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode shared message.")
if(H5O_msg_delete(f, dxpl_id, type_id, native_mesg) < 0)
@@ -1215,12 +1203,12 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
H5SM_list_t *list = NULL;
H5SM_mesg_key_t key;
H5SM_sohm_t message; /* Deleted message returned from index */
- size_t list_pos = UFAIL; /* Position of the message in the list */
+ H5SM_sohm_t *message_ptr; /* Pointer to deleted message returned from index */
H5HF_t *fheap = NULL; /* Fractal heap that contains the message */
H5SM_fh_ud_gh_t udata; /* User data for fractal heap 'op' callback */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5SM_delete_from_index, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_delete_from_index)
HDassert(header);
HDassert(mesg);
@@ -1252,6 +1240,8 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
/* Try to find the message in the index */
if(header->index_type == H5SM_LIST)
{
+ size_t list_pos; /* Position of the message in the list */
+
/* If the index is stored as a list, get it from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, header->index_addr, NULL, header, H5AC_WRITE)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
@@ -1262,9 +1252,9 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
--(list->messages[list_pos].ref_count);
- /* Copy the message */
- message = list->messages[list_pos];
- }
+ /* Point to the message */
+ message_ptr = &list->messages[list_pos];
+ } /* end if */
else /* Index is a B-tree */
{
HDassert(header->index_type == H5SM_BTREE);
@@ -1273,10 +1263,13 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
* If it succeeds, a copy of the modified message will be returned. */
if(H5B2_modify(f, dxpl_id, H5SM_INDEX, header->index_addr, &key, H5SM_decr_ref, &message) <0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
- }
+
+ /* Point to the message */
+ message_ptr = &message;
+ } /* end else */
/* If the ref count is zero, delete the message from the index */
- if(message.ref_count <= 0)
+ if(message_ptr->ref_count <= 0)
{
size_t buf_size;
@@ -1285,7 +1278,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
* shared datatype).
*/
/* Get the size of the message in the heap */
- if(H5HF_get_obj_len(fheap, dxpl_id, &(message.fheap_id), &buf_size) < 0)
+ if(H5HF_get_obj_len(fheap, dxpl_id, &(message_ptr->fheap_id), &buf_size) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get message size from fractal heap.")
/* Allocate a buffer to hold the message */
@@ -1294,7 +1287,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
/* Remove the message from the index */
if(header->index_type == H5SM_LIST)
- list->messages[list_pos].ref_count = 0;
+ message_ptr->ref_count = 0;
else
{
if(H5B2_remove(f, dxpl_id, H5SM_INDEX, header->index_addr, &key, NULL, NULL) < 0)
@@ -1309,11 +1302,11 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5SM_index_header_t *header,
/* Retrieve the message from the heap so we can return it (to free any
* other messages it may reference)
*/
- if(H5HF_read(fheap, dxpl_id, &(message.fheap_id), *encoded_mesg) < 0)
+ if(H5HF_read(fheap, dxpl_id, &(message_ptr->fheap_id), *encoded_mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "can't read message from fractal heap.")
/* Remove the message from the heap */
- if(H5HF_remove(fheap, dxpl_id, &(message.fheap_id)) < 0)
+ if(H5HF_remove(fheap, dxpl_id, &(message_ptr->fheap_id)) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap")
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index a1f5ac5..2caf83a 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -104,7 +104,7 @@ H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
uint8_t *buf=NULL; /* Temporary buffer */
herr_t ret_value=SUCCEED;
- FUNC_ENTER_NOAPI(H5SM_flush_table, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_flush_table)
/* check arguments */
HDassert(f);
@@ -170,7 +170,7 @@ H5SM_flush_table(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
done:
/* Free buffer if allocated */
if(buf)
- H5FL_BLK_FREE(shared_mesg_cache, buf);
+ buf = H5FL_BLK_FREE(shared_mesg_cache, buf);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_flush_table */
@@ -202,7 +202,7 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
uint8_t x; /* Counter variable for index headers */
H5SM_master_table_t *ret_value;
- FUNC_ENTER_NOAPI(H5SM_load_table, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_load_table)
/* Verify that we're reading version 0 of the table; this is the only
* version defined so far.
@@ -210,7 +210,7 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
HDassert(f->shared->sohm_vers == HDF5_SHAREDHEADER_VERSION);
/* Allocate space for the master table in memory */
- if(NULL == (table = H5MM_calloc(sizeof(H5SM_master_table_t))))
+ if(NULL == (table = (H5SM_master_table_t *)H5MM_calloc(sizeof(H5SM_master_table_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read number of indexes and version from file superblock */
@@ -246,7 +246,7 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
HDassert((size_t)(p - buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM);
/* Allocate space for the index headers in memory*/
- if(NULL == (table->indexes = H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes)))
+ if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes")
/* Read in the index headers */
@@ -282,7 +282,7 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
done:
/* Free buffer if allocated */
if(buf)
- H5FL_BLK_FREE(shared_mesg_cache, buf);
+ buf = H5FL_BLK_FREE(shared_mesg_cache, buf);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_load_table */
@@ -341,7 +341,7 @@ done:
static herr_t
H5SM_dest_table(H5F_t UNUSED *f, H5SM_master_table_t* table)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5SM_dest_table)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_dest_table)
HDassert(table);
HDassert(table->indexes);
@@ -402,7 +402,7 @@ H5SM_flush_list(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
uint8_t *buf=NULL; /* Temporary buffer */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5SM_flush_list, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_flush_list)
/* check arguments */
HDassert(f);
@@ -463,7 +463,7 @@ H5SM_flush_list(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
done:
/* Free buffer if allocated */
if(buf)
- H5FL_BLK_FREE(shared_mesg_cache, buf);
+ buf = H5FL_BLK_FREE(shared_mesg_cache, buf);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_flush_list */
@@ -495,7 +495,7 @@ H5SM_load_list(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
hsize_t x; /* Counter variable for messages in list */
H5SM_list_t *ret_value=NULL;
- FUNC_ENTER_NOAPI(H5SM_load_list, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_load_list)
HDassert(header);
@@ -505,7 +505,7 @@ H5SM_load_list(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
HDmemset(&list->cache_info, 0, sizeof(H5AC_info_t));
/* Allocate list in memory as an array*/
- if((list->messages = H5FL_ARR_MALLOC(H5SM_sohm_t, header->list_max)) == NULL)
+ if((list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, header->list_max)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for SOHM list")
list->header = header;
@@ -528,12 +528,12 @@ H5SM_load_list(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
p += H5SM_LIST_SIZEOF_MAGIC;
/* Read messages into the list array */
- for(x=0; x<header->num_messages; x++)
+ for(x = 0; x < header->num_messages; x++)
{
if(H5SM_message_decode(f, p, &(list->messages[x])) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message");
p += H5SM_SOHM_ENTRY_SIZE(f);
- }
+ } /* end for */
/* Read in checksum */
UINT32DECODE(p, stored_chksum);
@@ -551,25 +551,24 @@ H5SM_load_list(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
/* Initialize the rest of the array */
- for(x=header->num_messages; x<header->list_max; x++)
- {
+ for(x = header->num_messages; x < header->list_max; x++)
list->messages[x].ref_count = 0;
- }
ret_value = list;
+
done:
/* Free buffer if allocated */
if(buf)
- H5FL_BLK_FREE(shared_mesg_cache, buf);
+ buf = H5FL_BLK_FREE(shared_mesg_cache, buf);
if(ret_value == NULL) {
if(list) {
- if(list->messages) {
+ if(list->messages)
H5FL_ARR_FREE(H5SM_sohm_t, list->messages);
- }
H5FL_FREE(H5SM_list_t, list);
- }
- }
+ } /* end if */
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SM_load_list */
@@ -625,7 +624,7 @@ done:
static herr_t
H5SM_dest_list(H5F_t UNUSED *f, H5SM_list_t* list)
{
- FUNC_ENTER_NOAPI_NOFUNC(H5SM_dest_list)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SM_dest_list)
HDassert(list);
HDassert(list->messages);
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index 7538cbd..8e1f2e7 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -206,7 +206,6 @@ H5_DLL herr_t H5S_write(struct H5O_loc_t *loc, const H5S_t *space,
hbool_t update_time, hid_t dxpl_id);
H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh,
const H5S_t *ds, unsigned * oh_flags_ptr);
-H5_DLL size_t H5S_raw_size(const H5F_t *f, const H5S_t *space);
H5_DLL H5S_t *H5S_read(const struct H5O_loc_t *loc, hid_t dxpl_id);
H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size);
H5_DLL int H5S_set_extent(H5S_t *space, const hsize_t *size);
diff --git a/src/H5T.c b/src/H5T.c
index e9ba093..b3395de 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -463,13 +463,13 @@ static H5T_t *H5T_decode(const unsigned char *buf);
#define H5T_INIT_TYPE_COPY_CREATE(BASE) { \
/* Base off of existing datatype */ \
if(NULL==(dt = H5T_copy(BASE,H5T_COPY_TRANSIENT))) \
- HGOTO_ERROR (H5E_RESOURCE, H5E_CANTCOPY, FAIL, "duplicating base type failed") \
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "duplicating base type failed") \
}
#define H5T_INIT_TYPE_ALLOC_CREATE(BASE) { \
/* Allocate new datatype info */ \
if (NULL==(dt = H5T_alloc())) \
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") \
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") \
}
@@ -550,12 +550,12 @@ H5T_init_inf(void)
/* Get the float datatype */
if (NULL==(dst_p=H5I_object(H5T_NATIVE_FLOAT_g)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
dst = &dst_p->shared->u.atomic;
/* Check that we can re-order the bytes correctly */
if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g)
- HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
/* +Inf */
d=(uint8_t *)&H5T_NATIVE_FLOAT_POS_INF_g;
@@ -591,12 +591,12 @@ H5T_init_inf(void)
/* Get the double datatype */
if (NULL==(dst_p=H5I_object(H5T_NATIVE_DOUBLE_g)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype");
dst = &dst_p->shared->u.atomic;
/* Check that we can re-order the bytes correctly */
if (H5T_ORDER_LE!=H5T_native_order_g && H5T_ORDER_BE!=H5T_native_order_g)
- HGOTO_ERROR (H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order");
/* +Inf */
d=(uint8_t *)&H5T_NATIVE_DOUBLE_POS_INF_g;
@@ -1644,19 +1644,19 @@ H5Tcopy(hid_t type_id)
case H5I_DATATYPE:
/* The argument is a data type handle */
if (NULL==(dt=H5I_object (type_id)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
break;
case H5I_DATASET:
/* The argument is a dataset handle */
if (NULL==(dset=H5I_object (type_id)))
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
if (NULL==(dt=H5D_typeof (dset)))
- HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get the dataset data type");
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get the dataset data type");
break;
default:
- HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type or dataset");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type or dataset");
} /* end switch */
/* Copy */
@@ -1792,10 +1792,10 @@ H5Tlock(hid_t type_id)
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
if (H5T_STATE_NAMED==dt->shared->state || H5T_STATE_OPEN==dt->shared->state)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named data type");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named data type");
if (H5T_lock (dt, TRUE)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient data type");
done:
FUNC_LEAVE_API(ret_value);
@@ -2413,7 +2413,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id,
if (H5T_PERS_HARD!=pers && H5T_PERS_SOFT!=pers)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid function persistence");
if (!name || !*name)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "conversion must have a name for debugging");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conversion must have a name for debugging");
if (NULL==(src=H5I_object_verify(src_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
if (NULL==(dst=H5I_object_verify(dst_id,H5I_DATATYPE)))
@@ -2459,7 +2459,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst,
int i; /*counter */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5T_unregister, FAIL);
+ FUNC_ENTER_NOAPI_NOINIT(H5T_unregister);
/* Remove matching entries from the soft list */
if (H5T_PERS_DONTCARE==pers || H5T_PERS_SOFT==pers) {
@@ -2607,7 +2607,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata)
NULL == (dst = H5I_object_verify(dst_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type");
if (!pcdata)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer");
/* Find it */
if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE)))
@@ -2716,10 +2716,10 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf,
/* Find the conversion function */
if (NULL==(tpath=H5T_path_find(src, dst, NULL, NULL, dxpl_id, FALSE)))
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types");
if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, buf, background, dxpl_id)<0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed");
done:
FUNC_LEAVE_API(ret_value);
@@ -2790,18 +2790,20 @@ H5Tdecode(const void *buf)
H5T_t *dt;
hid_t ret_value;
- FUNC_ENTER_API (H5Tdecode, FAIL);
+ FUNC_ENTER_API(H5Tdecode, FAIL)
H5TRACE1("i", "x", buf);
+ /* Check args */
if(buf == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer")
+ /* Create datatype by decoding buffer */
if((dt = H5T_decode(buf)) == NULL)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object")
/* Register the type and return the ID */
- if((ret_value = H5I_register (H5I_DATATYPE, dt)) < 0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type")
+ if((ret_value = H5I_register(H5I_DATATYPE, dt)) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type")
done:
FUNC_LEAVE_API(ret_value)
@@ -2836,14 +2838,14 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc)
H5F_t *f = NULL; /* Fake file structure*/
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5T_encode, FAIL)
+ FUNC_ENTER_NOAPI_NOINIT(H5T_encode)
/* Allocate "fake" file structure */
if(NULL == (f = H5F_fake_alloc((size_t)0)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct")
/* Find out the size of buffer needed */
- if((buf_size = H5O_msg_raw_size(f, H5O_DTYPE_ID, obj)) == 0)
+ if((buf_size = H5O_msg_raw_size(f, H5O_DTYPE_ID, TRUE, obj)) == 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "can't find datatype size")
/* Don't encode if buffer size isn't big enough or buffer is empty */
@@ -2857,7 +2859,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc)
*buf++ = H5T_ENCODE_VERSION;
/* Encode into user's buffer */
- if(H5O_msg_encode(f, H5O_DTYPE_ID, buf, obj) < 0)
+ if(H5O_msg_encode(f, H5O_DTYPE_ID, TRUE, buf, obj) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode object")
} /* end else */
@@ -2892,7 +2894,7 @@ H5T_decode(const unsigned char *buf)
H5F_t *f = NULL; /* Fake file structure*/
H5T_t *ret_value;
- FUNC_ENTER_NOAPI(H5T_decode, NULL)
+ FUNC_ENTER_NOAPI_NOINIT(H5T_decode)
/* Allocate "fake" file structure */
if(NULL == (f = H5F_fake_alloc((size_t)0)))
@@ -2957,7 +2959,7 @@ H5T_create(H5T_class_t type, size_t size)
case H5T_OPAQUE:
case H5T_COMPOUND:
if(NULL == (dt = H5T_alloc()))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
dt->shared->type = type;
if(type==H5T_COMPOUND)
@@ -3068,9 +3070,9 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
/* Allocate space */
if (NULL==(new_dt = H5FL_MALLOC(H5T_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
if (NULL==(new_dt->shared = H5FL_MALLOC(H5T_shared_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
/* Copy shared information (entry information is copied last) */
*(new_dt->shared) = *(old_dt->shared);
@@ -3113,7 +3115,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
/* Open named datatype again */
if(H5O_open(&(old_dt->sh_loc.u.oloc)) < 0)
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type");
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type");
/* Insert opened named datatype into opened object list for the file */
if(H5FO_insert(old_dt->sh_loc.u.oloc.file, old_dt->sh_loc.u.oloc.addr, new_dt->shared, FALSE)<0)
@@ -3164,7 +3166,7 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method)
new_dt->shared->u.compnd.memb = H5MM_malloc(new_dt->shared->u.compnd.nalloc *
sizeof(H5T_cmemb_t));
if (NULL==new_dt->shared->u.compnd.memb)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb,
new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t));
@@ -3834,7 +3836,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.compnd.nmembs * sizeof(unsigned))) ||
NULL==(idx2 = H5MM_malloc(dt2->shared->u.compnd.nmembs * sizeof(unsigned))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
for (u=0; u<dt1->shared->u.compnd.nmembs; u++)
idx1[u] = idx2[u] = u;
if(dt1->shared->u.enumer.nmembs > 1) {
@@ -3912,7 +3914,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset)
/* Build an index for each type so the names are sorted */
if (NULL==(idx1 = H5MM_malloc(dt1->shared->u.enumer.nmembs * sizeof(unsigned))) ||
NULL==(idx2 = H5MM_malloc(dt2->shared->u.enumer.nmembs * sizeof(unsigned))))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed");
for (u=0; u<dt1->shared->u.enumer.nmembs; u++)
idx1[u] = u;
if(dt1->shared->u.enumer.nmembs > 1)
@@ -4431,7 +4433,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
H5T_path_t **x = H5MM_realloc (H5T_g.path,
na*sizeof(H5T_path_t*));
if (!x)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
H5T_g.apaths = (int)na;
H5T_g.path = x;
}
@@ -4687,7 +4689,7 @@ H5T_nameof(H5T_t *dt)
case H5T_STATE_TRANSIENT:
case H5T_STATE_RDONLY:
case H5T_STATE_IMMUTABLE:
- HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, NULL, "not a named datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "not a named datatype")
case H5T_STATE_NAMED:
case H5T_STATE_OPEN:
ret_value = &(dt->path);