diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-05-18 12:26:32 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-05-18 12:26:32 (GMT) |
commit | 67983bc4313fecf3763f5b337b612357a3ee033b (patch) | |
tree | 0b0fe1bbeed0db06bd66477d10ebc9ba6aa061ba /src/H5Gtest.c | |
parent | 683cc579ea99564c4ce328614d645b10e00f1bc4 (diff) | |
download | hdf5-67983bc4313fecf3763f5b337b612357a3ee033b.zip hdf5-67983bc4313fecf3763f5b337b612357a3ee033b.tar.gz hdf5-67983bc4313fecf3763f5b337b612357a3ee033b.tar.bz2 |
Updated code in H5Xtest.c files and associated tests.
Reverted overlong-strings warning that gives jam issues.
Diffstat (limited to 'src/H5Gtest.c')
-rw-r--r-- | src/H5Gtest.c | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/src/H5Gtest.c b/src/H5Gtest.c index f2f3e3a..02a1dd2 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -28,13 +28,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gpkg.h" /* Groups */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gpkg.h" /* Groups */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5Iprivate.h" /* IDs */ + /****************/ /* Local Macros */ @@ -80,7 +81,7 @@ htri_t H5G__is_empty_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has no link messages and no symbol table message and no "dense" link storage @@ -114,7 +115,7 @@ H5G__is_empty_test(hid_t gid) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { /* Sanity check that new group format shouldn't have old messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) @@ -127,7 +128,7 @@ H5G__is_empty_test(hid_t gid) /* Check for a link info message */ if((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists > 0) { H5O_linfo_t linfo; /* Link info message */ @@ -158,7 +159,7 @@ H5G__is_empty_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_stab_t stab; /* Info about local heap & B-tree */ hsize_t nlinks; /* Number of links in the group */ @@ -202,7 +203,7 @@ done: hid_t gid; IN: group to check unsigned *nmsgs; OUT: # of link messages in header RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has link messages and how many. GLOBAL VARIABLES @@ -232,15 +233,15 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") /* Check if we should retrieve the number of link messages */ if(nmsgs) { @@ -269,7 +270,7 @@ done: htri_t H5G__has_stab_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group has a symbol table message. GLOBAL VARIABLES @@ -299,15 +300,15 @@ H5G__has_stab_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists == 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") done: if(api_ctx_pushed && H5CX_pop() < 0) @@ -326,7 +327,7 @@ done: htri_t H5G__is_new_dense_test(gid) hid_t gid; IN: group to check RETURNS - Non-negative TRUE/FALSE on success, negative on failure + TRUE/FALSE on success, FAIL on failure DESCRIPTION Checks to see if the group is in the "new" format for groups (link messages/ fractal heap+v2 B-tree) and if it is in "dense" storage form (ie. it has @@ -358,19 +359,19 @@ H5G__is_new_dense_test(hid_t gid) /* Check if the group has a symbol table message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has any link messages */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) HGOTO_DONE(FALSE) /* Check if the group has link info message */ if((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(msg_exists > 0) { H5O_linfo_t linfo; /* Link info message */ @@ -404,7 +405,7 @@ done: hsize_t *name_count; OUT: Number of links in name index hsize_t *corder_count; OUT: Number of links in creation order index RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Currently, just retrieves the number of links in each index and returns them. @@ -495,7 +496,7 @@ done: hid_t gid; IN: group to check size_t *lheap_size; OUT: Size of local heap RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Checks the size of the local heap for a group GLOBAL VARIABLES @@ -525,11 +526,11 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) /* Make certain the group has a symbol table message */ if(NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") /* Check the size of the local heap for the group */ if(H5HL_get_size(grp->oloc.file, stab.heap_addr, lheap_size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") done: if(api_ctx_pushed && H5CX_pop() < 0) @@ -551,7 +552,7 @@ done: size_t *user_path_len; OUT: Size of user path unsigned *obj_hidden; OUT: Whether object is hidden RETURNS - Non-negative on success, negative on failure + SUCCEED/FAIL DESCRIPTION Retrieves the user path for an ID. A zero for the length is returned in the case of no user path. @@ -648,15 +649,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5G__verify_cached_stab_test + * Function: H5G__verify_cached_stab_test * * Purpose: Check that a that the provided group entry contains a * cached symbol table entry, that the entry matches that in * the provided group's object header, and check that the * addresses are valid. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL * * Programmer: Neil Fortner * Mar 31, 2009 @@ -666,9 +666,9 @@ done: herr_t H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { - H5O_stab_t stab; /* Symbol table */ - H5HL_t *heap = NULL; /* Pointer to local heap */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /* Symbol table */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) @@ -681,7 +681,8 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message") /* Verify that the cached symbol table info matches the symbol table message - * in the object header */ + * in the object header. + */ if((ent->cache.stab.btree_addr != stab.btree_addr) || (ent->cache.stab.heap_addr != stab.heap_addr)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header") @@ -711,7 +712,7 @@ done: * group with a symbol table, and that that information is * correct. * - * Return: Non-negative on success/Negative on failure + * Return: H5_ITER_STOP/H5_ITER_CONT/H5_ITER_ERROR * * Programmer: Neil Fortner * Apr 8, 2011 @@ -732,9 +733,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, FUNC_ENTER_STATIC - /* - * Check arguments. - */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); @@ -749,7 +748,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, targ_oloc.holding_file = FALSE; /* Iterate over entries */ - for(i=0; i<sn->nsyms; i++) { + for(i = 0; i < sn->nsyms; i++) { /* Update oloc address */ targ_oloc.addr = sn->entry[i].header; @@ -773,7 +772,7 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, if((sn->entry[i].cache.stab.btree_addr != stab.btree_addr) || (sn->entry[i].cache.stab.heap_addr != stab.heap_addr)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "cached symbol table information is incorrect") - } /* end if */ + } else if(sn->entry[i].type == H5G_CACHED_STAB) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached") |