diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2009-03-23 19:14:55 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2009-03-23 19:14:55 (GMT) |
commit | 1598893d1403ff264bff1df49f647f3054b6f3f8 (patch) | |
tree | fa11ad6ac997d90955249790c768944ad63f0104 /src/H5Gobj.c | |
parent | 1cc1da51338ec4ce20f229c315b3943ff6a35070 (diff) | |
download | hdf5-1598893d1403ff264bff1df49f647f3054b6f3f8.zip hdf5-1598893d1403ff264bff1df49f647f3054b6f3f8.tar.gz hdf5-1598893d1403ff264bff1df49f647f3054b6f3f8.tar.bz2 |
[svn-r16595] 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.c | 40 |
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() */ |