From ba149f834f1cfa431e320ff6b7f985f71c8ca8c4 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 3 Feb 2009 18:42:24 -0500 Subject: [svn-r16414] Description: Eliminate some more calls to H5E_clear_stack() from within library code. Clean up some warnings & comments also. Tested on: Mac OS X/32 10.5.6 (amazon) (Too minor to require h5committest) --- src/H5Goh.c | 6 +++--- src/H5O.c | 38 ++++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/H5Goh.c b/src/H5Goh.c index aa0fbe6..d727cb7 100644 --- a/src/H5Goh.c +++ b/src/H5Goh.c @@ -110,9 +110,9 @@ H5O_group_isa(struct H5O_t *oh) /* Check for any of the messages that indicate a group */ if((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") if((linfo_exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") ret_value = (stab_exists > 0 || linfo_exists > 0); @@ -273,7 +273,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info) /* Check for "new style" group info */ if((exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") if(exists > 0) { H5O_linfo_t linfo; /* Link info message */ diff --git a/src/H5O.c b/src/H5O.c index 5dfca1b..73c8e73 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1652,11 +1652,11 @@ H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force) HGOTO_DONE(SUCCEED); /*nothing to do*/ /* Allocate space for the modification time message */ - if((idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now)) == UFAIL) + if(UFAIL == (idx = H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for modification time message") /* Set the message's flags if appropriate */ - oh->mesg[idx].flags = mesg_flags; + oh->mesg[idx].flags = (uint8_t)mesg_flags; } /* end if */ /* Allocate 'native' space, if necessary */ @@ -1892,8 +1892,8 @@ done: * * Purpose: Retrieves the type of object pointed to by `loc'. * - * Return: Success: An object type defined in H5Gpublic.h - * Failure: H5G_UNKNOWN + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Robb Matzke * Wednesday, November 4, 1998 @@ -1929,8 +1929,8 @@ done: * * Purpose: Returns the type of object pointed to by `oh'. * - * Return: Success: An object type defined in H5Opublic.h - * Failure: H5G_UNKNOWN + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Monday, November 21, 2005 @@ -2311,6 +2311,8 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o oinfo->btime = oh->btime; } /* end if */ else { + htri_t exists; /* Flag if header message of interest exists */ + /* No information for access & modification fields */ /* (we stopped updating the "modification time" header message for * raw data changes, so the "modification time" header message @@ -2321,13 +2323,25 @@ H5O_get_info(H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *o oinfo->btime = 0; /* Might be information for modification time */ - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) { - H5E_clear_stack(NULL); - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) { - H5E_clear_stack(NULL); - oinfo->ctime = 0; - } /* end if */ + if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message") + if(exists > 0) { + /* Get "old style" modification time info */ + if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message") } /* end if */ + else { + /* Check for "new style" modification time info */ + if((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message") + if(exists > 0) { + /* Get "new style" modification time info */ + if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message") + } /* end if */ + else + oinfo->ctime = 0; + } /* end else */ } /* end else */ /* Set the version for the object header */ -- cgit v0.12