diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-10-07 13:32:32 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-10-07 13:32:32 (GMT) |
commit | bdbdbb9f89db8d3a76fc71705cdbbd89124f4687 (patch) | |
tree | 53d16d2097c591d2c7094da6b8e2b23ef5663a0f /src/H5Gtraverse.c | |
parent | b256db872d5ce4f81c6486b60c4e29e8122b67c2 (diff) | |
download | hdf5-bdbdbb9f89db8d3a76fc71705cdbbd89124f4687.zip hdf5-bdbdbb9f89db8d3a76fc71705cdbbd89124f4687.tar.gz hdf5-bdbdbb9f89db8d3a76fc71705cdbbd89124f4687.tar.bz2 |
[svn-r15801] Description:
Bring r15800 back from trunk:
- File free space branch changes through r15794
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5Gtraverse.c')
-rw-r--r-- | src/H5Gtraverse.c | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 7693343..87ebc74 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -633,7 +633,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Traverse the path */ while((name = H5G_component(name, &nchars)) && *name) { const char *s; /* Temporary string pointer */ - herr_t lookup_status; /* Status from object lookup */ + htri_t lookup_status; /* Status from object lookup */ /* * Copy the component name into a null-terminated buffer so @@ -661,11 +661,11 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end if */ /* Get information for object in current group */ - /* (Defer issuing error for bad lookup until later) */ - lookup_status = H5G_obj_lookup(grp_loc.oloc, H5G_comp_g, &lnk/*out*/, dxpl_id); + if((lookup_status = H5G_obj_lookup(grp_loc.oloc, H5G_comp_g, &lnk/*out*/, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't look up component") /* If the lookup was OK, build object location and traverse special links, etc. */ - if(lookup_status >= 0) { + if(lookup_status) { /* Sanity check link and indicate it's valid */ HDassert(lnk.type >= H5L_TYPE_HARD); HDassert(!HDstrcmp(H5G_comp_g, lnk.name)); @@ -688,14 +688,14 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G_loc_t *cb_loc; /* Pointer to object location for callback */ /* Set callback parameters appropriately, based on link being found */ - if(lookup_status < 0) { + if(lookup_status) { + cb_lnk = &lnk; + cb_loc = &obj_loc; + } /* end if */ + else { HDassert(!obj_loc_valid); cb_lnk = NULL; cb_loc = NULL; - } /* end if */ - else { - cb_lnk = &lnk; - cb_loc = &obj_loc; } /* end else */ /* Call 'operator' routine */ @@ -706,7 +706,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end if */ /* Handle lookup failures now */ - if(lookup_status < 0) { + if(!lookup_status) { /* If an intermediate group doesn't exist & flag is set, create the group */ if(target & H5G_CRT_INTMD_GROUP) { const H5O_ginfo_t def_ginfo = H5G_CRT_GROUP_INFO_DEF; /* Default group info settings */ @@ -714,31 +714,32 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5O_ginfo_t par_ginfo; /* Group info settings for parent group */ H5O_linfo_t par_linfo; /* Link info settings for parent group */ H5O_linfo_t tmp_linfo; /* Temporary link info settings */ + htri_t exists; /* Whether a group or link info message exists */ const H5O_ginfo_t *ginfo; /* Group info settings for new group */ const H5O_linfo_t *linfo; /* Link info settings for new group */ - /* Get the group info for parent group */ + /* Check for the parent group having a group info message */ /* (OK if not found) */ - if(NULL == H5O_msg_read(grp_loc.oloc, H5O_GINFO_ID, &par_ginfo, dxpl_id)) { - /* Clear error stack from not finding the group info message */ - H5E_clear_stack(NULL); - - /* Use default group info settings */ - ginfo = &def_ginfo; + if((exists = H5O_msg_exists(grp_loc.oloc, H5O_GINFO_ID, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + if(exists) { + /* Get the group info for parent group */ + if(NULL == H5O_msg_read(grp_loc.oloc, H5O_GINFO_ID, &par_ginfo, dxpl_id)) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "group info message not present") + + /* Use parent group info settings */ + ginfo = &par_ginfo; } /* end if */ else - ginfo = &par_ginfo; + /* Use default group info settings */ + ginfo = &def_ginfo; - /* Get the link info for parent group */ + /* Check for the parent group having a link info message */ /* (OK if not found) */ - if(NULL == H5G_obj_get_linfo(grp_loc.oloc, &par_linfo, dxpl_id)) { - /* Clear error stack from not finding the link info message */ - H5E_clear_stack(NULL); - - /* Use default link info settings */ - linfo = &def_linfo; - } /* end if */ - else { + /* Get the link info for parent group */ + if((exists = H5G_obj_get_linfo(grp_loc.oloc, &par_linfo, dxpl_id)) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + if(exists) { /* Only keep the creation order information from the parent * group's link info */ @@ -746,7 +747,10 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, tmp_linfo.track_corder = par_linfo.track_corder; tmp_linfo.index_corder = par_linfo.index_corder; linfo = &tmp_linfo; - } /* end else */ + } /* end if */ + else + /* Use default link info settings */ + linfo = &def_linfo; /* Create the intermediate group */ /* XXX: Should we allow user to control the group creation params here? -QAK */ |