summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-03-06 18:53:00 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-03-06 18:53:00 (GMT)
commit8b3a2b480b412ebb04997d57343fc0733906afe6 (patch)
tree82dc5ef23e043f8bbbbbd6a3491ff794c2b2aa0d /src
parentaf527abf6c2d0586fef45e9525b8718c36e1c0a7 (diff)
downloadhdf5-8b3a2b480b412ebb04997d57343fc0733906afe6.zip
hdf5-8b3a2b480b412ebb04997d57343fc0733906afe6.tar.gz
hdf5-8b3a2b480b412ebb04997d57343fc0733906afe6.tar.bz2
[svn-r18386] Description:
Bring r18385 from trunk to 1.8 branch: 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.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/H5Doh.c b/src/H5Doh.c
index c6e33fb..a6e93da 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -369,6 +369,11 @@ 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 +387,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 +411,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 +425,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)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset data storage layout message")
+ if(pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message")
+ if(efl_read && H5O_msg_reset(H5O_EFL_ID, &efl) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset external file list message")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_dset_bh_info() */