summaryrefslogtreecommitdiffstats
path: root/src/H5Oshared.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-01-19 17:31:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-01-19 17:31:41 (GMT)
commitd4909147e16628c04ce64e272503f96030f1df30 (patch)
treedcffc28e2f1155bc99345ef390a6999821aa94c5 /src/H5Oshared.c
parent46598f35cafc38ff166783e57d5622f4a1a3153e (diff)
downloadhdf5-d4909147e16628c04ce64e272503f96030f1df30.zip
hdf5-d4909147e16628c04ce64e272503f96030f1df30.tar.gz
hdf5-d4909147e16628c04ce64e272503f96030f1df30.tar.bz2
[svn-r13156] Description:
Begin refactoring code to straighten out the contorted code that handles shared messages. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2)
Diffstat (limited to 'src/H5Oshared.c')
-rw-r--r--src/H5Oshared.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/H5Oshared.c b/src/H5Oshared.c
index c06871e..9b2de74 100644
--- a/src/H5Oshared.c
+++ b/src/H5Oshared.c
@@ -169,9 +169,17 @@ H5O_shared_read(H5F_t *f, hid_t dxpl_id, const H5O_shared_t *shared,
if(NULL == (native_mesg = H5O_msg_decode(f, dxpl_id, type->id, buf)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.")
- /* Copy this message to the user's buffer */
- if(NULL == (ret_value = (type->copy)(native_mesg, mesg)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space")
+ /* Check if there is a user buffer to fill */
+ if(mesg) {
+ /* Copy this message to the user's buffer */
+ if(NULL == (ret_value = (type->copy)(native_mesg, mesg)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space")
+ } /* end if */
+ else {
+ /* Otherwise, take ownership of the decoded native message */
+ ret_value = native_mesg;
+ native_mesg = NULL;
+ } /* end else */
} /* end if */
else {
HDassert(shared->flags & H5O_COMMITTED_FLAG);
@@ -653,7 +661,6 @@ H5O_shared_copy_file(H5F_t *file_src, const H5O_msg_class_t *mesg_type,
HDassert(file_dst);
HDassert(cpy_info);
-
/* Committed shared messages create a shared message at the destination
* and also copy the committed object that they point to.
* SOHMs actually write a non-shared message at the destination.