summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-03-06 18:44:33 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-03-06 18:44:33 (GMT)
commitfc5fde7a686b3018abc07eb7136cf9b9181b0eb9 (patch)
tree8bf13c9ad317cab9c62fe9c111bc1c4d3e6d5cb5 /src
parent187292532027ed6abdbd8be127381491881d5a59 (diff)
downloadhdf5-fc5fde7a686b3018abc07eb7136cf9b9181b0eb9.zip
hdf5-fc5fde7a686b3018abc07eb7136cf9b9181b0eb9.tar.gz
hdf5-fc5fde7a686b3018abc07eb7136cf9b9181b0eb9.tar.bz2
[svn-r18385] Description:
Tweak fix in r18372 to reset other messages read in also. Tested on: Mac OS X/32 10.6.2 (amazon) w/debug & production (too minor to require h5committest)
Diffstat (limited to 'src')
-rw-r--r--src/H5Doh.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/H5Doh.c b/src/H5Doh.c
index c6e33fb..98e9bf3 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -359,16 +359,17 @@ done:
* Programmer: Vailin Choi
* July 11, 2007
*
- * Modification:Raymond Lu
- * 5 February, 2010
- * I added the call to H5O_msg_reset after H5D_chunk_bh_info
- * to free the PLINE.
*-------------------------------------------------------------------------
*/
static herr_t
H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
{
H5O_layout_t layout; /* Data storage layout message */
+ H5O_pline_t pline; /* I/O pipeline message */
+ H5O_efl_t efl; /* External File List message */
+ hbool_t layout_read = FALSE; /* Whether the layout message was read */
+ hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read */
+ hbool_t efl_read = FALSE; /* Whether the external file list message was read */
htri_t exists; /* Flag if header message of interest exists */
herr_t ret_value = SUCCEED; /* Return value */
@@ -382,28 +383,22 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
/* Get the layout message from the object header */
if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_LAYOUT_ID, &layout))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message")
+ layout_read = TRUE;
/* Check for chunked dataset storage */
if(layout.type == H5D_CHUNKED && H5D_chunk_is_space_alloc(&layout.storage)) {
- H5O_pline_t pline; /* I/O pipeline message */
- herr_t ret = SUCCEED;
-
/* Check for I/O pipeline message */
if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header")
else if(exists) {
if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_PLINE_ID, &pline))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find I/O pipeline message")
+ pline_read = TRUE;
} /* end else if */
else
HDmemset(&pline, 0, sizeof(pline));
- ret = H5D_chunk_bh_info(f, dxpl_id, &layout, &pline, &(bh_info->index_size));
-
- /* Free the PLINE after using it */
- H5O_msg_reset(H5O_PLINE_ID, &pline);
-
- if(ret < 0)
+ if(H5D_chunk_bh_info(f, dxpl_id, &layout, &pline, &(bh_info->index_size)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info")
} /* end if */
@@ -412,14 +407,13 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message")
if(exists && H5D_efl_is_space_alloc(&layout.storage)) {
- H5O_efl_t efl; /* External File List message */
-
/* Start with clean EFL info */
HDmemset(&efl, 0, sizeof(efl));
/* Get External File List message from the object header */
if(NULL == H5O_msg_read_oh(f, dxpl_id, oh, H5O_EFL_ID, &efl))
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message")
+ efl_read = TRUE;
/* Get size of local heap for EFL message's file list */
if(H5D_efl_bh_info(f, dxpl_id, &efl, &(bh_info->heap_size)) < 0)
@@ -427,6 +421,14 @@ H5O_dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
} /* end if */
done:
+ /* Free messages, if they've been read in */
+ if(layout_read && H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset data storage layout message")
+ if(pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message")
+ if(efl_read && H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset external file list message")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_dset_bh_info() */