summaryrefslogtreecommitdiffstats
path: root/src/H5Gobj.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-03-23 18:51:29 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-03-23 18:51:29 (GMT)
commit849d015bbd0e12c8a920c3367bd67515842790bf (patch)
tree5e041cef4b5b9e932f6ff1101c42efadf88f8b1d /src/H5Gobj.c
parent6f342514df3dbf035f5401783b9322f6deb0c87a (diff)
downloadhdf5-849d015bbd0e12c8a920c3367bd67515842790bf.zip
hdf5-849d015bbd0e12c8a920c3367bd67515842790bf.tar.gz
hdf5-849d015bbd0e12c8a920c3367bd67515842790bf.tar.bz2
[svn-r16594] Purpose: fix bug 1189
Description: Some files apparently exist in the wild which have corrupt symbol table messages on the root group. These files can be opened by 1.6 (which uses the cached information in the superblock) but not by 1.8. This patch fixes 1.8 and 1.9 so they can now open these files, and will correct them if necessary. Also fix some potential (rare) problems with array datatype versions. Tested: jam (parallel; h5committest not working on linew or smirom)
Diffstat (limited to 'src/H5Gobj.c')
-rw-r--r--src/H5Gobj.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 3220b67..2eb1924 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -237,31 +237,49 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5G_obj_ent_decode(H5F_t *f, const uint8_t **pp, H5O_loc_t *oloc)
+H5G_obj_ent_decode(H5F_t *f, const uint8_t **pp, H5O_loc_t *oloc, H5G_entry_t **entp)
{
const uint8_t *p_ret = *pp;
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOFUNC(H5G_obj_ent_decode)
+ FUNC_ENTER_NOAPI(H5G_obj_ent_decode, FAIL)
/* check arguments */
HDassert(f);
HDassert(pp);
HDassert(oloc);
- /* Set file pointer for root object location */
- oloc->file = f;
+ if(entp) {
+ /* If entp is not NULL we allocate space for the symbol table entry and
+ * decode the entire entry. */
+ if(!(*entp)) /* Only allocate space if *entp is NULL */
+ if(NULL == (*entp = (H5G_entry_t *) H5MM_calloc(sizeof(H5G_entry_t))))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for symbol table entry")
+ if(H5G_ent_decode_vec(f, pp, *entp, 1) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode symbol table entry")
+
+ /* Set oloc to the correct values */
+ oloc->file = (*entp)->file;
+ oloc->addr = (*entp)->header;
+ } else {
+ /* Set file pointer for root object location */
+ oloc->file = f;
+
+ /* decode header */
+ *pp += H5F_SIZEOF_SIZE(f); /* Skip over local heap address */
+ H5F_addr_decode(f, pp, &(oloc->addr));
+ *pp += 4; /* Skip over "cache type" */
+ *pp += 4; /* Reserved */
+ }
+
+ /* Common oloc settings */
oloc->holding_file = FALSE;
- /* decode header */
- *pp += H5F_SIZEOF_SIZE(f); /* Skip over local heap address */
- H5F_addr_decode(f, pp, &(oloc->addr));
- *pp += 4; /* Skip over "cache type" */
- *pp += 4; /* Reserved */
-
/* Set decode pointer */
*pp = p_ret + H5G_SIZEOF_ENTRY(f);
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_obj_ent_decode() */