diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-08-28 15:02:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-08-28 15:02:54 (GMT) |
commit | ea343ef85416b42f68f28fb1024702c6726f7eea (patch) | |
tree | d5c401bf83f7f5578df06c54f9fd9fb198732ed2 | |
parent | eb16d8bc2b2f37c7a1d75fe7bf5258eba21515b2 (diff) | |
download | hdf5-ea343ef85416b42f68f28fb1024702c6726f7eea.zip hdf5-ea343ef85416b42f68f28fb1024702c6726f7eea.tar.gz hdf5-ea343ef85416b42f68f28fb1024702c6726f7eea.tar.bz2 |
[svn-r14115] Description:
Remove all plain calls to H5Gopen() from source, replacing them with
either H5Gopen2().
Add test for H5Gopen1().
Reformatted several pieces of code, to clean them up.
Tested on:
FreeBSD/32 6.2 (duty)
FreeBSD/64 6.2 (liberty)
Linux/32 2.6 (kagiso)
Linux/64 2.6 (smirom)
Solaris/32 5.10 (linew)
Mac OS X/32 10.4.10 (amazon)
53 files changed, 2863 insertions, 2968 deletions
diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index c3415b6..f7dc733 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -234,7 +234,7 @@ file_info(hid_t loc_id, const char *name, void *opdata) /* * Open the group using its name. */ - group = H5Gopen(loc_id, name); + group = H5Gopen2(loc_id, name, H5P_DEFAULT); /* * Display group name. diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index ee4303c..2b20541 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -119,14 +119,14 @@ Group CommonFG::createGroup( const H5std_string& name, size_t size_hint ) const //-------------------------------------------------------------------------- Group CommonFG::openGroup( const char* name ) const { - // Call C routine H5Gopen to open the named group, giving the + // Call C routine H5Gopen2 to open the named group, giving the // location id which can be a file id or a group id - hid_t group_id = H5Gopen( getLocId(), name ); + hid_t group_id = H5Gopen2( getLocId(), name, H5P_DEFAULT ); // If the opening of the group failed, throw an exception if( group_id < 0 ) { - throwException("openGroup", "H5Gopen failed"); + throwException("openGroup", "H5Gopen2 failed"); } // No failure, create and return the Group object diff --git a/examples/h5_elink_unix2win.c b/examples/h5_elink_unix2win.c index f9a7fca..a82e23d 100644 --- a/examples/h5_elink_unix2win.c +++ b/examples/h5_elink_unix2win.c @@ -169,7 +169,7 @@ unix2win_example(void) #endif /* Now follow the link */ - if((gid = H5Gopen(fid, "ext_link")) < 0) goto error; + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) goto error; printf("Successfully followed external link.\n"); /* Close the group and the file */ diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index ecd8b52..0f86135 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -82,7 +82,7 @@ static void extlink_example(void) * Here, group_id and group2_id point to the same group inside the * target file. */ - group2_id = H5Gopen(targ_file_id, "target_group/new_group"); + group2_id = H5Gopen2(targ_file_id, "target_group/new_group", H5P_DEFAULT); /* Don't forget to close the IDs we opened. */ H5Gclose(group2_id); @@ -173,8 +173,8 @@ static void extlink_prefix_example(void) H5Gclose(group_id); /* Each file has had a group created inside it using the same external link. */ - group_id = H5Gopen(red_file_id, "pink"); - group2_id = H5Gopen(blue_file_id, "sky blue"); + group_id = H5Gopenw(red_file_id, "pink", H5P_DEFAULT); + group2_id = H5Gopen2(blue_file_id, "sky blue", H5P_DEFAULT); /* Clean up our open IDs */ H5Gclose(group2_id); @@ -265,7 +265,7 @@ static void soft_link_example(void) * a normal soft link. This link will still dangle if the object's * original name is changed or unlinked. */ - group_id = H5Gopen(file_id, UD_SOFT_LINK_NAME); + group_id = H5Gopen2(file_id, UD_SOFT_LINK_NAME, H5P_DEFAULT); /* The group is now open normally. Don't forget to close it! */ H5Gclose(group_id); @@ -382,7 +382,7 @@ static void hard_link_example(void) /* The group is still accessible through the UD hard link. If this were * a soft link instead, the object would have been deleted when the last * hard link to it was unlinked. */ - group_id = H5Gopen(file_id, UD_HARD_LINK_NAME); + group_id = H5Gopen2(file_id, UD_HARD_LINK_NAME, H5P_DEFAULT); /* The group is now open normally. Don't forget to close it! */ H5Gclose(group_id); diff --git a/examples/h5_group.c b/examples/h5_group.c index 80cfd04..52f9f53 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -101,7 +101,7 @@ main(void) * Now reopen the file and group in the file. */ file = H5Fopen(H5FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); - grp = H5Gopen(file, "Data"); + grp = H5Gopen2(file, "Data", H5P_DEFAULT); /* * Access "Compressed_Data" dataset in the group. diff --git a/examples/h5_interm_group.c b/examples/h5_interm_group.c index caa0a88..95ed910 100644 --- a/examples/h5_interm_group.c +++ b/examples/h5_interm_group.c @@ -68,7 +68,7 @@ main(void) * Check that group G2/G3 exists in /G1 and if not create it using * intermediate group creation property. */ - g1_id = H5Gopen(file, "/G1"); + g1_id = H5Gopen2(file, "/G1", H5P_DEFAULT); /* Next commented call causes error stack to be printed out; the next one * works fine; is it a bug or a feature? EIP 04-25-07 */ @@ -90,7 +90,7 @@ main(void) */ if (H5Lexists(file, "/G1/G2", H5P_DEFAULT)) { - g2_id = H5Gopen(file, "/G1/G2"); + g2_id = H5Gopen2(file, "/G1/G2", H5P_DEFAULT); status = H5Gget_info(g2_id, ".", &g2_info, H5P_DEFAULT); printf("Group /G1/G2 has %d member(s)\n", (int)g2_info.nlinks); diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 3a78567..55faff9 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -34,7 +34,8 @@ * QAK - 2007/08/23 *---------------------------------------------------------------------------*/ int_f -nh5gcreate_c (hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id) +nh5gcreate_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, + hid_t_f *grp_id) { hid_t gcpl_id = -1; /* Group creation property list */ char *c_name = NULL; @@ -92,33 +93,31 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5gopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *grp_id) +nh5gopen_c(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *grp_id) { - int ret_value = -1; - char *c_name; - size_t c_namelen; + char *c_name = NULL; hid_t c_grp_id; - hid_t c_loc_id; + int ret_value = -1; /* * Convert FORTRAN name to C name */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + goto DONE; /* * Call H5Gopen function. */ - c_loc_id = *loc_id; - c_grp_id = H5Gopen(c_loc_id, c_name); + if((c_grp_id = H5Gopen2((hid_t)*loc_id, c_name, H5P_DEFAULT)) < 0) + goto DONE; - if (c_grp_id < 0) goto DONE; - ret_value = 0; - *grp_id = (hid_t_f)c_grp_id; + /* Everything OK, set values to return */ + *grp_id = (hid_t_f)c_grp_id; + ret_value = 0; DONE: - HDfree(c_name); + if(c_name) + HDfree(c_name); return ret_value; } @@ -139,57 +138,61 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5gget_obj_info_idx_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type) +nh5gget_obj_info_idx_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, + _fcd obj_name, int_f *obj_namelen, int_f *obj_type) { - int ret_value = -1; - hid_t c_loc_id = (hid_t)*loc_id; - char *c_name; - size_t c_namelen; - size_t c_obj_namelen; - char *c_obj_name = NULL; - int type; - hsize_t c_idx = *idx; - hid_t gid = (-1); /* Temporary group ID */ - - /* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_obj_namelen = *obj_namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + hid_t c_loc_id = (hid_t)*loc_id; + char *c_name = NULL; + size_t c_obj_namelen; + char *c_obj_name = NULL; + int type; + hsize_t c_idx = *idx; + hid_t gid = (-1); /* Temporary group ID */ + int ret_value = -1; - /* - * Allocate buffer to hold name of the object - */ - if (c_obj_namelen) c_obj_name = (char *)HDmalloc(c_obj_namelen + 1); - if (c_obj_name == NULL) { HDfree(c_name); - return ret_value; - } + /* + * Convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + goto DONE; - /* Get a temporary group ID for the group to query */ - if((gid=H5Gopen(c_loc_id,c_name))<0) goto DONE; + /* + * Allocate buffer to hold name of the object + */ + c_obj_namelen = *obj_namelen; + if(c_obj_namelen) { + if(NULL == (c_obj_name = (char *)HDmalloc(c_obj_namelen + 1))) + goto DONE; + } /* end if */ + + /* Get a temporary group ID for the group to query */ + if((gid = H5Gopen2(c_loc_id, c_name, H5P_DEFAULT)) < 0) + goto DONE; - /* Query the object's information */ - if(H5Gget_objname_by_idx(gid, c_idx, c_obj_name, c_obj_namelen)<0) goto DONE; - if((type=H5Gget_objtype_by_idx(gid, c_idx))==H5G_UNKNOWN) goto DONE; + /* Query the object's information */ + if(H5Gget_objname_by_idx(gid, c_idx, c_obj_name, c_obj_namelen) < 0) + goto DONE; + if((type = H5Gget_objtype_by_idx(gid, c_idx)) == H5G_UNKNOWN) + goto DONE; - *obj_type = type; + *obj_type = type; - /* - * Convert C name to FORTRAN and place it in the given buffer - */ - HD5packFstring(c_obj_name, _fcdtocp(obj_name), c_obj_namelen); - ret_value = 0; + /* + * Convert C name to FORTRAN and place it in the given buffer + */ + HD5packFstring(c_obj_name, _fcdtocp(obj_name), c_obj_namelen); + ret_value = 0; DONE: - /* Close the temporary group, if it was opened */ - if(gid>0) H5Gclose(gid); + /* Close the temporary group, if it was opened */ + if(gid > 0) + H5Gclose(gid); - HDfree(c_obj_name); - HDfree(c_name); - return ret_value; + if(c_obj_name) + HDfree(c_obj_name); + if(c_name) + HDfree(c_name); + return ret_value; } /*---------------------------------------------------------------------------- @@ -205,38 +208,40 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5gn_members_c (hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers) +nh5gn_members_c(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers) { - int ret_value = -1; - hid_t c_loc_id=(hid_t)*loc_id; - char *c_name; - size_t c_namelen; - hsize_t c_nmembers; - hid_t gid = (-1); + char *c_name = NULL; + hsize_t c_nmembers; + hid_t gid = (-1); + int ret_value = -1; - /* - * Convert FORTRAN name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if (c_name == NULL) return ret_value; + /* + * Convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + goto DONE; - /* Get a temporary group ID for the group to query */ - if((gid=H5Gopen(c_loc_id,c_name))<0) goto DONE; + /* Get a temporary group ID for the group to query */ + if((gid = H5Gopen2((hid_t)*loc_id, c_name, H5P_DEFAULT)) < 0) + goto DONE; - /* Call H5Gget_num_objs() for the number of objects in the group */ - if(H5Gget_num_objs(gid,&c_nmembers)<0) goto DONE; + /* Call H5Gget_num_objs() for the number of objects in the group */ + if(H5Gget_num_objs(gid, &c_nmembers) < 0) + goto DONE; - *nmembers = (int_f)c_nmembers; - ret_value = 0; + *nmembers = (int_f)c_nmembers; + ret_value = 0; DONE: /* Close the temporary group, if it was opened */ - if(gid>0) H5Gclose(gid); + if(gid > 0) + H5Gclose(gid); - HDfree(c_name); - return ret_value; + if(c_name) + HDfree(c_name); + return ret_value; } + /*---------------------------------------------------------------------------- * Name: h5gclose_c * Purpose: Call H5Gclose to close the group diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 8ee7fd0..717352f 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1299,31 +1299,26 @@ herr_t H5LT_open_id( hid_t loc_id, const char *obj_name, int obj_type /*basic object type*/ ) { + hid_t obj_id = -1; - hid_t obj_id = -1; - - switch ( obj_type ) - { - case H5G_DATASET: - - /* Open the dataset. */ - if ( (obj_id = H5Dopen( loc_id, obj_name )) < 0 ) - return -1; - break; - - case H5G_GROUP: - - /* Open the group. */ - if ( (obj_id = H5Gopen( loc_id, obj_name )) < 0 ) - return -1; - break; + switch(obj_type) { + case H5G_DATASET: + /* Open the dataset. */ + if((obj_id = H5Dopen(loc_id, obj_name)) < 0) + return -1; + break; - default: - return -1; - } + case H5G_GROUP: + /* Open the group. */ + if((obj_id = H5Gopen2(loc_id, obj_name, H5P_DEFAULT)) < 0) + return -1; + break; - return obj_id; + default: + return -1; + } + return obj_id; } diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 265a45e..c4bd1ab 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1962,7 +1962,7 @@ static int test_errors(void) goto out; /* open the group. */ - if ((gid = H5Gopen(fid,"grp"))<0) + if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0) goto out; /* verify that it is not a dimension scale dataset */ @@ -2016,7 +2016,7 @@ static int test_errors(void) goto out; /* open the group. */ - if ((gid = H5Gopen(fid,"grp"))<0) + if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0) goto out; /* try to detach "ds_a" from "grp" */ @@ -2044,7 +2044,7 @@ static int test_errors(void) goto out; /* open the group. */ - if ((gid = H5Gopen(fid,"grp"))<0) + if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0) goto out; /* try to detach "grp" from "dset_a" */ @@ -2212,7 +2212,7 @@ static int test_iterators(void) TESTING2("iterate on group "); /* open */ - if ((gid = H5Gopen(fid,"grp"))<0) + if ((gid = H5Gopen2(fid, "grp", H5P_DEFAULT)) < 0) goto out; /* try to iterate, return error */ @@ -329,7 +329,7 @@ done: * call H5Gclose() to close it and release resources. * * This function allows the user the pass in a Group Access - * Property List, which H5Gopen() does not. + * Property List, which H5Gopen1() does not. * * Return: Success: Object ID of the group. * Failure: FAIL @@ -342,13 +342,8 @@ done: hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { - H5G_t *grp = NULL; - H5G_loc_t loc; - H5G_loc_t grp_loc; /* Location used to open group */ - H5G_name_t grp_path; /* Opened object group hier. path */ - H5O_loc_t grp_oloc; /* Opened object object location */ - H5O_type_t obj_type; /* Type of object at location */ - hbool_t loc_found = FALSE; /* Location at 'name' found */ + H5G_t *grp = NULL; /* Group opened */ + H5G_loc_t loc; /* Location of parent for group */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5Gopen2, FAIL) @@ -367,24 +362,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") - /* Set up opened group location to fill in */ - grp_loc.oloc = &grp_oloc; - grp_loc.path = &grp_path; - H5G_loc_reset(&grp_loc); - - /* Find the group object using the gapl passed in */ - if(H5G_loc_find(&loc, name, &grp_loc/*out*/, gapl_id, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") - loc_found = TRUE; - - /* Check that the object found is the correct type */ - if(H5O_obj_type(&grp_oloc, &obj_type, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - /* Open the group */ - if((grp = H5G_open(&grp_loc, H5AC_dxpl_id)) == NULL) + if((grp = H5G_open_name(&loc, name, gapl_id, H5AC_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an atom for the group */ @@ -393,14 +372,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) done: if(ret_value < 0) { - if(grp) { - if(H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") - } /* end if */ - else { - if(loc_found && H5G_loc_free(&grp_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - } /* end else */ + if(grp && H5G_close(grp) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") } /* end if */ FUNC_LEAVE_API(ret_value) @@ -982,6 +955,70 @@ done: /*------------------------------------------------------------------------- + * Function: H5G_open_name + * + * Purpose: Opens an existing group by name. + * + * Return: Success: Ptr to a new group. + * Failure: NULL + * + * Programmer: Quincey Koziol + * Monday, August 27, 2007 + * + *------------------------------------------------------------------------- + */ +H5G_t * +H5G_open_name(const H5G_loc_t *loc, const char *name, hid_t gapl_id, + hid_t dxpl_id) +{ + H5G_t *grp = NULL; /* Group to open */ + H5G_loc_t grp_loc; /* Location used to open group */ + H5G_name_t grp_path; /* Opened object group hier. path */ + H5O_loc_t grp_oloc; /* Opened object object location */ + H5O_type_t obj_type; /* Type of object at location */ + hbool_t loc_found = FALSE; /* Location at 'name' found */ + H5G_t *ret_value; /* Return value */ + + FUNC_ENTER_NOAPI(H5G_open_name, NULL) + + /* Check args */ + HDassert(loc); + HDassert(name); + + /* Set up opened group location to fill in */ + grp_loc.oloc = &grp_oloc; + grp_loc.path = &grp_path; + H5G_loc_reset(&grp_loc); + + /* Find the group object using the gapl passed in */ + if(H5G_loc_find(loc, name, &grp_loc/*out*/, gapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found") + loc_found = TRUE; + + /* Check that the object found is the correct type */ + if(H5O_obj_type(&grp_oloc, &obj_type, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, NULL, "not a group") + + /* Open the group */ + if((grp = H5G_open(&grp_loc, dxpl_id)) == NULL) + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") + + /* Set return value */ + ret_value = grp; + +done: + if(!ret_value) { + if(loc_found && H5G_loc_free(&grp_loc) < 0) + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_open_name() */ + + +/*------------------------------------------------------------------------- * Function: H5G_open * * Purpose: Opens an existing group. The group should eventually be @@ -999,9 +1036,9 @@ done: H5G_t * H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) { - H5G_t *grp = NULL; - H5G_shared_t *shared_fo = NULL; - H5G_t *ret_value = NULL; + H5G_t *grp = NULL; /* Group opened */ + H5G_shared_t *shared_fo; /* Shared group object */ + H5G_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_open, NULL) @@ -1064,12 +1101,11 @@ H5G_open(const H5G_loc_t *loc, hid_t dxpl_id) ret_value = grp; done: - if (!ret_value && grp) - { + if (!ret_value && grp) { H5O_loc_free(&(grp->oloc)); H5G_name_free(&(grp->path)); H5FL_FREE(H5G_t,grp); - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_open() */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 613c922..3814c44 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -215,11 +215,10 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Gcreate1() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- - * Function: H5Gopen + * Function: H5Gopen1 * * Purpose: Opens an existing group for modification. When finished, * call H5Gclose() to close it and release resources. @@ -234,18 +233,13 @@ done: *------------------------------------------------------------------------- */ hid_t -H5Gopen(hid_t loc_id, const char *name) +H5Gopen1(hid_t loc_id, const char *name) { - H5G_t *grp = NULL; - H5G_loc_t loc; - H5G_loc_t grp_loc; /* Location used to open group */ - H5G_name_t grp_path; /* Opened object group hier. path */ - H5O_loc_t grp_oloc; /* Opened object object location */ - H5O_type_t obj_type; /* Type of object at location */ - hbool_t loc_found = FALSE; /* Location at 'name' found */ + H5G_t *grp = NULL; /* Group opened */ + H5G_loc_t loc; /* Location of parent for group */ hid_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Gopen, FAIL) + FUNC_ENTER_API(H5Gopen1, FAIL) H5TRACE2("i", "i*s", loc_id, name); /* Check args */ @@ -254,24 +248,8 @@ H5Gopen(hid_t loc_id, const char *name) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Set up opened group location to fill in */ - grp_loc.oloc = &grp_oloc; - grp_loc.path = &grp_path; - H5G_loc_reset(&grp_loc); - - /* Find the group object */ - if(H5G_loc_find(&loc, name, &grp_loc/*out*/, H5P_DEFAULT, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") - loc_found = TRUE; - - /* Check that the object found is the correct type */ - if(H5O_obj_type(&grp_oloc, &obj_type, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - /* Open the group */ - if((grp = H5G_open(&grp_loc, H5AC_dxpl_id)) == NULL) + if((grp = H5G_open_name(&loc, name, H5P_DEFAULT, H5AC_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an atom for the group */ @@ -280,18 +258,13 @@ H5Gopen(hid_t loc_id, const char *name) done: if(ret_value < 0) { - if(grp) { - if(H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") - } /* end if */ - else { - if(loc_found && H5G_loc_free(&grp_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") - } /* end else */ + if(grp && H5G_close(grp) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") } /* end if */ FUNC_LEAVE_API(ret_value) -} /* end H5Gopen() */ +} /* end H5Gopen1() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- diff --git a/src/H5Gobj.c b/src/H5Gobj.c index a3166ba..397c753 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -640,6 +640,7 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_link_iterate_t *lnk_op, void *op_data, hid_t dxpl_id) { + H5G_loc_t loc; /* Location of parent for group */ H5O_linfo_t linfo; /* Link info message */ hid_t gid = -1; /* ID of group to iterate over */ H5G_t *grp; /* Pointer to group data structure to iterate over */ @@ -656,10 +657,12 @@ H5G_obj_iterate(hid_t loc_id, const char *group_name, * Open the group on which to operate. We also create a group ID which * we can pass to the application-defined operator. */ - if((gid = H5Gopen(loc_id, group_name)) < 0) + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + if((grp = H5G_open_name(&loc, group_name, H5P_DEFAULT, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") - if((grp = H5I_object(gid)) == NULL) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "bad group ID") + if((gid = H5I_register(H5I_GROUP, grp)) < 0) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") /* Attempt to get the link info for this group */ if(H5G_obj_get_linfo(&(grp->oloc), &linfo, dxpl_id)) { diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 5567782..b17a54d 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -336,6 +336,8 @@ H5_DLLVAR const H5B2_class_t H5G_BT2_CORDER[1]; H5_DLL H5G_t *H5G_create(H5F_t *file, hid_t gcpl_id, hid_t dxpl_id); H5_DLL H5G_t *H5G_create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id); +H5_DLL H5G_t *H5G_open_name(const H5G_loc_t *loc, const char *name, + hid_t gapl_id, hid_t dxpl_id); /* * Group hierarchy traversal routines diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 912a637..8b09ea5 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -137,7 +137,6 @@ H5_DLL herr_t H5Gclose(hid_t group_id); * * Use of these functions and variables is deprecated. */ -H5_DLL hid_t H5Gopen(hid_t loc_id, const char *name); H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, const char *new_name); H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, @@ -170,6 +169,7 @@ H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); /* Function prototypes */ H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); +H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5vers.txt b/src/H5vers.txt index 4a3ee46..6267fbb 100644 --- a/src/H5vers.txt +++ b/src/H5vers.txt @@ -52,6 +52,7 @@ FUNCTION: H5Epush; ; v14, v18 FUNCTION: H5Eset_auto; ; v10, v18 FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 FUNCTION: H5Gcreate; ; v10, v18 +FUNCTION: H5Gopen; ; v10, v18 # API typedefs # (although not required, it's easier to compare this file with the headers diff --git a/src/H5version.h b/src/H5version.h index e22ea8c..e239a75 100644 --- a/src/H5version.h +++ b/src/H5version.h @@ -66,6 +66,10 @@ #define H5Gcreate_vers 1 #endif /* !defined(H5Gcreate_vers) */ +#if !defined(H5Gopen_vers) +#define H5Gopen_vers 1 +#endif /* !defined(H5Gopen_vers) */ + /************/ /* Typedefs */ /************/ @@ -168,6 +172,17 @@ #error "H5Gcreate_vers set to invalid value" #endif /* H5Gcreate_vers */ +#if !defined(H5Gopen_vers) || H5Gopen_vers == 2 +#ifndef H5Gopen_vers +#define H5Gopen_vers 2 +#endif /* H5Gopen_vers */ +#define H5Gopen H5Gopen2 +#elif H5Gopen_vers == 1 +#define H5Gopen H5Gopen1 +#else /* H5Gopen_vers */ +#error "H5Gopen_vers set to invalid value" +#endif /* H5Gopen_vers */ + /************/ /* Typedefs */ /************/ diff --git a/test/dangle.c b/test/dangle.c index 4e1154a..2f6ad7b 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -186,13 +186,12 @@ test_dangle_group(H5F_close_degree_t degree) if(gid >= 0) TEST_ERROR /* Leave open a _lot_ of objects */ - for(u=0; u<MAX_DANGLE; u++) { - if((gid = H5Gopen (fid, GROUPNAME))<0) - TEST_ERROR; - } /* end for */ + for(u = 0; u < MAX_DANGLE; u++) + if((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - if((gid = H5Gopen (fid, GROUPNAME))<0) - TEST_ERROR; + if((gid = H5Gopen2(fid, GROUPNAME, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR if(degree==H5F_CLOSE_SEMI) { H5E_BEGIN_TRY { diff --git a/test/flush2.c b/test/flush2.c index 6a07c78..46f61da 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -90,7 +90,7 @@ error: return 1; } - + /*------------------------------------------------------------------------- * Function: check_file * @@ -112,33 +112,31 @@ check_file(char* filename, hid_t fapl, int flag) char name[1024]; int i; - if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error; + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; if(check_dset(file, "dset")) goto error; /* Open some groups */ - if ((groups=H5Gopen(file, "some_groups"))<0) goto error; - for (i=0; i<100; i++) { + if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error; + for(i = 0; i < 100; i++) { sprintf(name, "grp%02u", (unsigned)i); - if ((grp=H5Gopen(groups, name))<0) goto error; - if (H5Gclose(grp)<0) goto error; - } + if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error; + if(H5Gclose(grp) < 0) goto error; + } /* end for */ /* Check to see if that last added dataset in the third file is accessible * (it shouldn't be...but it might. Flag an error in case it is for now */ - if(flag) - { - if(check_dset(file, "dset2")) goto error; - } + if(flag && check_dset(file, "dset2")) goto error; + + if(H5Gclose(groups) < 0) goto error; + if(H5Fclose(file) < 0) goto error; - if (H5Gclose(groups)<0) goto error; - if (H5Fclose(file)<0) goto error; return 0; + error: return 1; +} /* end check_file() */ - -} - + /*------------------------------------------------------------------------- * Function: main * @@ -177,8 +175,7 @@ main(void) if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split")) { /* Check the case where the file was flushed */ h5_fixname(FILENAME[0], fapl, name, sizeof name); - if(check_file(name, fapl, FALSE)) - { + if(check_file(name, fapl, FALSE)) { H5_FAILED() goto error; } diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c index f070901..c543c4c 100644 --- a/test/gen_mergemsg.c +++ b/test/gen_mergemsg.c @@ -77,7 +77,7 @@ int main() assert(fid > 0); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1); + gid = H5Gopen2(fid, GROUP1, H5P_DEFAULT); assert(gid > 0); /* Create dataspace for attribute */ @@ -154,7 +154,7 @@ int main() assert(ret >= 0); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1); + gid = H5Gopen2(fid, GROUP1, H5P_DEFAULT); assert(gid > 0); /* Delete 2nd attribute */ @@ -177,7 +177,7 @@ int main() assert(fid > 0); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1); + gid = H5Gopen2(fid, GROUP1, H5P_DEFAULT); assert(gid > 0); /* Create dataspace for 3rd attribute */ @@ -221,7 +221,7 @@ int main() assert(fid > 0); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1); + gid = H5Gopen2(fid, GROUP1, H5P_DEFAULT); assert(gid > 0); /* Delete 3rd attribute */ @@ -268,7 +268,7 @@ int main() assert(fid > 0); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1); + gid = H5Gopen2(fid, GROUP1, H5P_DEFAULT); assert(gid > 0); /* Delete 2nd attribute */ @@ -289,7 +289,7 @@ int main() assert(fid > 0); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1); + gid = H5Gopen2(fid, GROUP1, H5P_DEFAULT); assert(gid > 0); /* Create dataspace for 3rd attribute */ diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c index 2d2bf15..80e5590 100644 --- a/test/gen_nullspace.c +++ b/test/gen_nullspace.c @@ -59,8 +59,8 @@ main(void) assert(ret>=0); /* Open the root group */ - gid = H5Gopen(fid,"/"); - assert(gid>0); + gid = H5Gopen2(fid, "/", H5P_DEFAULT); + assert(gid > 0); /* Create an attribute for the group */ attr=H5Acreate(gid,NULLATTR,H5T_NATIVE_INT,sid,H5P_DEFAULT); diff --git a/test/getname.c b/test/getname.c index 9700df3..8348362 100644 --- a/test/getname.c +++ b/test/getname.c @@ -118,10 +118,10 @@ test_main(hid_t file_id, hid_t fapl) if((group_id = H5Gcreate2(file_id, "/g0", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g0", "/g0") < 0) TEST_ERROR; + if(check_name(group_id, "/g0", "/g0") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + H5Gclose(group_id); PASSED(); @@ -140,40 +140,40 @@ test_main(hid_t file_id, hid_t fapl) if((group2_id = H5Gcreate2(file_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); + H5Gclose(group_id); + H5Gclose(group2_id); PASSED(); /*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gopen + * Test H5Iget_name with H5Gopen2 *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gopen"); + TESTING("H5Iget_name with H5Gopen2"); /* Reopen the group */ - if ((group_id = H5Gopen( file_id, "/g1" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Reopen the group */ - if ((group2_id = H5Gopen( file_id, "/g1/g2" ))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -188,30 +188,30 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Dcreate"); /* Create the dataspace */ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR; + if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR /* Reopen the group */ - if ((group_id = H5Gopen( file_id, "g1" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a new dataset inside "g1" */ - if ((dataset_id = H5Dcreate( group_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(group_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Dclose( dataset_id ); - H5Sclose( space_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -225,27 +225,27 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Dopen"); /* Reopen the dataset */ - if ((dataset_id = H5Dopen( file_id, "d1"))<0) TEST_ERROR; + if((dataset_id = H5Dopen(file_id, "d1"))<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR; + if(check_name(dataset_id, "/d1", "/d1") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); + H5Dclose(dataset_id); /* Reopen the group */ - if ((group_id = H5Gopen( file_id, "g1" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Reopen the dataset */ - if ((dataset_id = H5Dopen( group_id, "d1"))<0) TEST_ERROR; + if((dataset_id = H5Dopen(group_id, "d1")) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g1/d1", "/g1/d1") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Gclose( group_id ); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -264,24 +264,24 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "g2/bar/baz", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a dataset */ - if((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; - if((dataset_id = H5Dcreate(group3_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR + if((dataset_id = H5Dcreate(group3_id , "d1", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Dclose(dataset_id); + H5Sclose(space_id); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Reopen the dataset */ - if ((dataset_id = H5Dopen( file_id, "/g2/bar/baz/d1"))<0) TEST_ERROR; + if((dataset_id = H5Dopen(file_id, "/g2/bar/baz/d1"))<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g2/bar/baz/d1", "/g2/bar/baz/d1") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); + H5Dclose(dataset_id); PASSED(); @@ -294,18 +294,18 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Tcommit"); /* Create a datatype */ - if ((type_id = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR; + if((type_id = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR /* Insert fields */ - if (H5Tinsert (type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR; - if (H5Tinsert (type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR; - if (H5Tinsert (type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR; + if(H5Tinsert(type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR + if(H5Tinsert(type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR + if(H5Tinsert(type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR /* Save datatype for later */ - if (H5Tcommit (file_id, "t1", type_id)<0) TEST_ERROR; + if(H5Tcommit(file_id, "t1", type_id)<0) TEST_ERROR /* Verify */ - if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR; + if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR /* Close datatype */ H5Tclose(type_id); @@ -320,10 +320,10 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Topen"); /* Open the named datatype */ - if((type_id=H5Topen(file_id, "t1"))<0) TEST_ERROR; + if((type_id=H5Topen(file_id, "t1"))<0) TEST_ERROR /* Verify */ - if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR; + if(check_name(type_id, "/t1", "/t1") < 0) TEST_ERROR /* Close datatype */ H5Tclose(type_id); @@ -332,24 +332,24 @@ test_main(hid_t file_id, hid_t fapl) -/*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gmove and H5Gopen + /*------------------------------------------------------------------------- + * Test H5Iget_name with H5Gmove and H5Gopen2 *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gmove and H5Gopen"); + TESTING("H5Iget_name with H5Gmove and H5Gopen2"); /* Reopen the group */ - if ((group_id = H5Gopen( file_id, "/g1" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Rename group */ - if (H5Gmove( file_id, "/g1", "/g1a" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g1", "/g1a") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR; + if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -364,16 +364,16 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Gmove and H5Dopen"); /* Reopen the dataset */ - if ((dataset_id = H5Dopen( file_id, "/d1"))<0) TEST_ERROR; + if((dataset_id = H5Dopen(file_id, "/d1"))<0) TEST_ERROR /* Rename dataset */ - if (H5Gmove( file_id, "/d1", "/d1a" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/d1", "/d1a")<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "/d1a", "/d1a") < 0) TEST_ERROR; + if(check_name(dataset_id, "/d1a", "/d1a") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); + H5Dclose(dataset_id); PASSED(); @@ -388,13 +388,13 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Gmove and H5Topen"); /* Open the named datatype */ - if((type_id=H5Topen(file_id, "/t1"))<0) TEST_ERROR; + if((type_id=H5Topen(file_id, "/t1"))<0) TEST_ERROR /* Rename datatype */ - if (H5Gmove( file_id, "/t1", "/t1a" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/t1", "/t1a")<0) TEST_ERROR /* Verify */ - if(check_name(type_id, "/t1a", "/t1a") < 0) TEST_ERROR; + if(check_name(type_id, "/t1a", "/t1a") < 0) TEST_ERROR /* Close datatype */ H5Tclose(type_id); @@ -415,36 +415,36 @@ test_main(hid_t file_id, hid_t fapl) if((group2_id = H5Gcreate2(file_id, "/g3/foo1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open group "/g3/foo" again */ - if ((group3_id = H5Gopen( file_id, "/g3/foo1"))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g3/foo1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Rename group */ - if (H5Gmove( group_id, "foo1", "foo2" )<0) TEST_ERROR; + if(H5Gmove(group_id, "foo1", "foo2") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR; + if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR; + if(check_name(group3_id, "/g3/foo2", "/g3/foo2") < 0) TEST_ERROR /* Rename group again */ - if (H5Gmove( file_id, "g3/foo2", "g3/foo1" )<0) TEST_ERROR; + if(H5Gmove(file_id, "g3/foo2", "g3/foo1") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR; + if(check_name(group_id, "/g3", "/g3") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR; + if(check_name(group3_id, "/g3/foo1", "/g3/foo1") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); PASSED(); @@ -468,35 +468,35 @@ test_main(hid_t file_id, hid_t fapl) if((group5_id = H5Gcreate2(file_id, "g5/C", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR; + if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR /* Move group "B" to "D"*/ - if (H5Gmove( file_id, "/g4/A/B", "/g5/C/D" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g4/A/B", "/g5/C/D")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g5/C/D", "/g5/C/D") < 0) TEST_ERROR; + if(check_name(group3_id, "/g5/C/D", "/g5/C/D") < 0) TEST_ERROR /* Move group "/g5/C/D" back to "/g4/A/B" using relative name */ - if (H5Gmove2( group5_id, "D", group2_id, "B" )<0) TEST_ERROR; + if(H5Gmove2(group5_id, "D", group2_id, "B")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR; + if(check_name(group3_id, "/g4/A/B", "/g4/A/B") < 0) TEST_ERROR /* Move group "/g4/A/B" to "/g4/F/B" using relative name */ - if (H5Gmove2( group_id, "A", group_id, "F")<0) TEST_ERROR; + if(H5Gmove2(group_id, "A", group_id, "F")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g4/F/B", "/g4/F/B") < 0) TEST_ERROR; + if(check_name(group3_id, "/g4/F/B", "/g4/F/B") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g4/F", "/g4/F") < 0) TEST_ERROR; + if(check_name(group2_id, "/g4/F", "/g4/F") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); - H5Gclose( group5_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); + H5Gclose(group5_id); PASSED(); @@ -515,22 +515,22 @@ test_main(hid_t file_id, hid_t fapl) if((group4_id = H5Gcreate2(file_id, "g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g6/A/B", "/g6/A/B") < 0) TEST_ERROR; + if(check_name(group3_id, "/g6/A/B", "/g6/A/B") < 0) TEST_ERROR /* Move group "A" to "C"*/ - if (H5Gmove( file_id, "/g6/A", "/g7/C" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g6/A", "/g7/C")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g7/C", "/g7/C") < 0) TEST_ERROR; + if(check_name(group2_id, "/g7/C", "/g7/C") < 0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g7/C/B", "/g7/C/B") < 0) TEST_ERROR; + if(check_name(group3_id, "/g7/C/B", "/g7/C/B") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); PASSED(); @@ -545,13 +545,13 @@ test_main(hid_t file_id, hid_t fapl) if((group_id = H5Gcreate2(file_id, "/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if (H5Gunlink( file_id, "/g8")<0) TEST_ERROR; + if(H5Gunlink(file_id, "/g8")<0) TEST_ERROR /* Verify */ - if(check_name(group_id, "", "") < 0) TEST_ERROR; + if(check_name(group_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + H5Gclose(group_id); PASSED(); @@ -568,37 +568,37 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "g9/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if (H5Gunlink( file_id, "/g9/a")<0) TEST_ERROR; + if(H5Gunlink(file_id, "/g9/a")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Recreate groups */ if((group2_id = H5Gcreate2(group_id, "a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete, using relative path */ - if (H5Gunlink( group_id, "a")<0) TEST_ERROR; + if(H5Gunlink(group_id, "a")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Close */ - H5Gclose( group_id ); + H5Gclose(group_id); /* Create group "g10/a/b" */ if((group_id = H5Gcreate2(file_id, "g10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -606,29 +606,29 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "g10/a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if (H5Gunlink( file_id, "/g10/a/b")<0) TEST_ERROR; + if(H5Gunlink(file_id, "/g10/a/b")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group3_id ); + H5Gclose(group3_id); /* Recreate group */ if((group3_id = H5Gcreate2(group_id, "a/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete, using relative path */ - if (H5Gunlink( group_id, "a/b")<0) TEST_ERROR; + if(H5Gunlink(group_id, "a/b")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group3_id ); + H5Gclose(group3_id); /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); + H5Gclose(group_id); + H5Gclose(group2_id); PASSED(); @@ -645,25 +645,25 @@ test_main(hid_t file_id, hid_t fapl) if((group2_id = H5Gcreate2(file_id, "g11/g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create two datasets "g11/d" and "g11/g/d"*/ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; - if ((dataset_id = H5Dcreate( group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; - if ((dataset2_id = H5Dcreate( group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR + if((dataset_id = H5Dcreate(group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR + if((dataset2_id = H5Dcreate(group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Delete */ - if (H5Gunlink( file_id, "/g11/d")<0) TEST_ERROR; + if(H5Gunlink(file_id, "/g11/d")<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "", "") < 0) TEST_ERROR; + if(check_name(dataset_id, "", "") < 0) TEST_ERROR /* Verify */ - if(check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0) TEST_ERROR; + if(check_name(dataset2_id, "/g11/g/d", "/g11/g/d") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Dclose( dataset2_id ); - H5Sclose( space_id ); - H5Gclose( group_id ); - H5Gclose( group2_id ); + H5Dclose(dataset_id); + H5Dclose(dataset2_id); + H5Sclose(space_id); + H5Gclose(group_id); + H5Gclose(group2_id); PASSED(); @@ -679,35 +679,35 @@ test_main(hid_t file_id, hid_t fapl) if((group_id = H5Gcreate2(file_id, "/g12", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); + H5Gclose(group_id); /* Create second file and dataset "d" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); /* Create a dataspace */ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR /* Create the dataset */ - if ((dataset_id = H5Dcreate( file1_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file1_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); + H5Dclose(dataset_id); /* Mount second file under "g12" in the first file */ - if (H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g12", file1_id, H5P_DEFAULT)<0) TEST_ERROR /* Access dataset D in the first file under "/G/D" name */ - if ((dataset_id = H5Dopen( file_id, "/g12/d"))<0) TEST_ERROR; + if((dataset_id = H5Dopen(file_id, "/g12/d"))<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g12/d", "/g12/d") < 0) TEST_ERROR - if (H5Funmount(file_id, "/g12")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g12")<0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Fclose( file1_id ); - H5Sclose( space_id ); + H5Dclose(dataset_id); + H5Fclose(file1_id); + H5Sclose(space_id); PASSED(); @@ -726,9 +726,9 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file_id, "/g13/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create second file and group "g" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -738,165 +738,165 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file1_id, "/g14/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Mount second file under "/g13/g1" in the first file */ - if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access group in the first file */ - if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR - if (H5Funmount(file_id, "/g13/g1")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g13/g1") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR; + if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR /* Access group in the file to mount */ - if ((group3_id = H5Gopen( file1_id, "/g14/g3/g4"))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file1_id, "/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Mount second file under "/g13/g1" in the first file (again) */ - if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + /* Mount second file under "/g13/g1" in the first file(again) */ + if(H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Get a group ID for the parent of the newly mounted group */ - if ((group2_id = H5Gopen( file_id, "/g13"))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g13", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Access group in the first file */ - if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; - if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR + if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR - if (H5Funmount(group2_id, "g1")<0) TEST_ERROR; + if(H5Funmount(group2_id, "g1") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR; - if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR + if(check_name(group3_id, "/g14/g3/g4", "/g14/g3/g4") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR - /* Mount second file under "/g13/g1" in the first file (again) */ - if (H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + /* Mount second file under "/g13/g1" in the first file(again) */ + if(H5Fmount(file_id, "/g13/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Get a group ID for the newly mounted group */ - if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Access group in the first file */ - if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; - if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR + if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR - if (H5Funmount(group2_id, ".")<0) TEST_ERROR; + if(H5Funmount(group2_id, ".") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR; - if(check_name(group2_id, "/", "") < 0) TEST_ERROR; + if(check_name(group_id, "/g14/g3/g4", "") < 0) TEST_ERROR + if(check_name(group2_id, "/", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR /* Mount second file under "/g13/g1" in the first file, using relative path */ - if ((group3_id = H5Gopen( file_id, "/g13"))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g13", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g13", "/g13") < 0) TEST_ERROR; + if(check_name(group3_id, "/g13", "/g13") < 0) TEST_ERROR - if (H5Fmount(group3_id, "g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(group3_id, "g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Get a group ID for the newly mounted group */ - if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR /* Access group in the first file */ - if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR /* Access group in the first file, with relative path */ - if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR; + if((group_id = H5Gopen2(group2_id, "g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR - if (H5Funmount(group2_id, ".")<0) TEST_ERROR; + if(H5Funmount(group2_id, ".") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/", "") < 0) TEST_ERROR; + if(check_name(group2_id, "/", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group2_id ); - H5Gclose( group3_id ); + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Mount second file under "/g13/g1" in the first file, using relative path */ - if ((group3_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; + if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR - if (H5Fmount(group3_id, ".", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(group3_id, ".", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Get a group ID for the newly mounted group */ - if ((group2_id = H5Gopen( file_id, "/g13/g1"))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g13/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR /* Access group in the first file */ - if ((group_id = H5Gopen( file_id, "/g13/g1/g14/g3/g4"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g13/g1/g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR /* Access group in the first file, with relative path */ - if ((group_id = H5Gopen( group2_id, "g14/g3/g4"))<0) TEST_ERROR; + if((group_id = H5Gopen2(group2_id, "g14/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g13/g1/g14/g3/g4", "/g13/g1/g14/g3/g4") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR - if (H5Funmount(group2_id, ".")<0) TEST_ERROR; + if(H5Funmount(group2_id, ".") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/", "") < 0) TEST_ERROR; - if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/", "") < 0) TEST_ERROR + if(check_name(group3_id, "/g13/g1", "/g13/g1") < 0) TEST_ERROR /* Close */ - H5Gclose( group2_id ); - H5Gclose( group3_id ); + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR - H5Fclose( file1_id ); + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -916,10 +916,10 @@ test_main(hid_t file_id, hid_t fapl) if((group4_id = H5Gcreate2(file_id, "/g15/g1/g2/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); /* Create second file and group "g" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -929,37 +929,37 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gcreate2(file1_id, "/g16/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Access group in the first file */ - if ((group_id = H5Gopen( file_id, "/g15/g1/g2/g3"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g15/g1/g2/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Mount second file under "/g13/g1" in the first file */ - if (H5Fmount(file_id, "/g15/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g15/g1", file1_id, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access group in the second file */ - if ((group2_id = H5Gopen( file_id, "/g15/g1/g16/g4/g5"))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g15/g1/g16/g4/g5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "", "/g15/g1/g2/g3") < 0) TEST_ERROR; + if(check_name(group_id, "", "/g15/g1/g2/g3") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g15/g1/g16/g4/g5", "/g15/g1/g16/g4/g5") < 0) TEST_ERROR; + if(check_name(group2_id, "/g15/g1/g16/g4/g5", "/g15/g1/g16/g4/g5") < 0) TEST_ERROR - if (H5Funmount(file_id, "/g15/g1")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g15/g1") < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g15/g1/g2/g3", "/g15/g1/g2/g3") < 0) TEST_ERROR; + if(check_name(group_id, "/g15/g1/g2/g3", "/g15/g1/g2/g3") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g16/g4/g5", "") < 0) TEST_ERROR; + if(check_name(group2_id, "/g16/g4/g5", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Fclose( file1_id ); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -973,53 +973,53 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with a defined type dataset"); /* Create a datatype */ - if ((type_id = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR; + if((type_id = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)))<0) TEST_ERROR /* Insert fields */ - if (H5Tinsert (type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR; - if (H5Tinsert (type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR; - if (H5Tinsert (type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR; + if(H5Tinsert(type_id, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT)<0) TEST_ERROR + if(H5Tinsert(type_id, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT)<0) TEST_ERROR + if(H5Tinsert(type_id, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT)<0) TEST_ERROR /* Create group "g17" */ if((group_id = H5Gcreate2(file_id, "g17", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Save datatype for later */ - if (H5Tcommit (group_id, "t", type_id)<0) TEST_ERROR; + if(H5Tcommit(group_id, "t", type_id)<0) TEST_ERROR /* Create a dataspace */ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR /* Create a new dataset */ - if ((dataset_id = H5Dcreate( group_id , "d", type_id, space_id, - H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(group_id , "d", type_id, space_id, + H5P_DEFAULT))<0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Tclose( type_id ); - H5Sclose( space_id ); - H5Gclose( group_id ); + H5Dclose(dataset_id); + H5Tclose(type_id); + H5Sclose(space_id); + H5Gclose(group_id); /* Open the named datatype */ - if((type_id=H5Topen(file_id, "/g17/t"))<0) TEST_ERROR; + if((type_id=H5Topen(file_id, "/g17/t"))<0) TEST_ERROR /* Verify */ - if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR; + if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR /* Close datatype */ H5Tclose(type_id); /* Reopen the dataset */ - if ((dataset_id = H5Dopen( file_id, "/g17/d"))<0) TEST_ERROR; + if((dataset_id = H5Dopen(file_id, "/g17/d"))<0) TEST_ERROR /* Get datatype*/ - if((type_id=H5Dget_type(dataset_id))<0) TEST_ERROR; + if((type_id=H5Dget_type(dataset_id))<0) TEST_ERROR /* Verify */ - if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR; + if(check_name(type_id, "/g17/t", "/g17/t") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Tclose( type_id ); + H5Dclose(dataset_id); + H5Tclose(type_id); PASSED(); @@ -1032,18 +1032,18 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with datasets that have two names"); /* Open dataset named "d"*/ -if ((dataset_id = H5Dopen( file_id, "/g17/d"))<0) TEST_ERROR; +if((dataset_id = H5Dopen(file_id, "/g17/d"))<0) TEST_ERROR /* Create link to dataset named "link" */ -if (H5Glink2(dataset_id,".",H5G_LINK_HARD,file_id,"/g17/link")<0) TEST_ERROR; -if ((dataset2_id = H5Dopen( file_id, "/g17/link"))<0) TEST_ERROR; +if(H5Glink2(dataset_id,".",H5G_LINK_HARD,file_id,"/g17/link")<0) TEST_ERROR +if((dataset2_id = H5Dopen(file_id, "/g17/link"))<0) TEST_ERROR /* Make sure that the two IDs use two different names */ - if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR; - if(check_name(dataset2_id, "/g17/link", "/g17/link") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g17/d", "/g17/d") < 0) TEST_ERROR + if(check_name(dataset2_id, "/g17/link", "/g17/link") < 0) TEST_ERROR -if(H5Dclose(dataset_id)<0) TEST_ERROR; -if(H5Dclose(dataset2_id)<0) TEST_ERROR; +if(H5Dclose(dataset_id)<0) TEST_ERROR +if(H5Dclose(dataset2_id)<0) TEST_ERROR PASSED(); @@ -1055,35 +1055,35 @@ PASSED(); TESTING("H5Iget_name with different files"); /* Create a new file using default properties. */ - if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR; + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR /* Create a new file using default properties. */ - if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR; + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR /* Create the dataspace */ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Create a new dataset */ - if ((dataset2_id = H5Dcreate( file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset2_id = H5Dcreate(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Delete */ - if (H5Gunlink( file2_id, "/d")<0) TEST_ERROR; + if(H5Gunlink(file2_id, "/d")<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "", "") < 0) TEST_ERROR; + if(check_name(dataset_id, "", "") < 0) TEST_ERROR /* Verify */ - if(check_name(dataset2_id, "/d", "/d") < 0) TEST_ERROR; + if(check_name(dataset2_id, "/d", "/d") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Dclose( dataset2_id ); - H5Sclose( space_id ); - H5Fclose( file2_id ); - H5Fclose( file3_id ); + H5Dclose(dataset_id); + H5Dclose(dataset2_id); + H5Sclose(space_id); + H5Fclose(file2_id); + H5Fclose(file3_id); PASSED(); @@ -1096,35 +1096,35 @@ PASSED(); TESTING("H5Iget_name with different files #2"); /* Create a new file using default properties. */ - if ((file2_id = H5Fcreate( filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR; + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR /* Create a new file using default properties. */ - if ((file3_id = H5Fcreate( filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl ))<0) TEST_ERROR; + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) TEST_ERROR /* Create the dataspace */ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Create a new dataset */ - if ((dataset2_id = H5Dcreate( file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset2_id = H5Dcreate(file3_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT))<0) TEST_ERROR /* Delete */ - if (H5Gunlink( file3_id, "/d")<0) TEST_ERROR; + if(H5Gunlink(file3_id, "/d")<0) TEST_ERROR /* Verify */ - if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR; + if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR /* Verify */ - if(check_name(dataset2_id, "", "") < 0) TEST_ERROR; + if(check_name(dataset2_id, "", "") < 0) TEST_ERROR /* Close */ - H5Dclose( dataset_id ); - H5Dclose( dataset2_id ); - H5Sclose( space_id ); - H5Fclose( file2_id ); - H5Fclose( file3_id ); + H5Dclose(dataset_id); + H5Dclose(dataset2_id); + H5Sclose(space_id); + H5Fclose(file2_id); + H5Fclose(file3_id); PASSED(); @@ -1136,25 +1136,25 @@ PASSED(); TESTING("H5Iget_name with a small buffer for name"); /* Reopen the group */ - if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR { /*small buffer to hold name and its size */ char name2[SMALL_NAME_BUF_SIZE]; /* Get name */ - name_len=H5Iget_name( group_id, name2, SMALL_NAME_BUF_SIZE ); + name_len=H5Iget_name(group_id, name2, SMALL_NAME_BUF_SIZE); /* Check that name is longer */ - if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR; - if(HDstrcmp(name2, "/")) TEST_ERROR; + if(name_len <= SMALL_NAME_BUF_SIZE) TEST_ERROR + if(HDstrcmp(name2, "/")) TEST_ERROR } /* Verify */ - if(check_name(group_id, "/g17", "/g17") < 0) TEST_ERROR; + if(check_name(group_id, "/g17", "/g17") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); + H5Gclose(group_id); PASSED(); @@ -1167,7 +1167,7 @@ PASSED(); TESTING("H5Iget_name with a dynamic buffer for name"); /* Reopen the group */ - if ((group_id = H5Gopen( file_id, "/g17" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g17", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get name */ name_len = H5Iget_name(group_id, NULL, NAME_BUF_SIZE); @@ -1178,26 +1178,26 @@ PASSED(); /* Include the extra null character */ name3 = HDmalloc(name_len + 1); - if(!name3) TEST_ERROR; + if(!name3) TEST_ERROR /* Get name with dynamic buffer */ - if(H5Iget_name(group_id, name3, name_len + 1) < 0) TEST_ERROR; + if(H5Iget_name(group_id, name3, name_len + 1) < 0) TEST_ERROR /* Verify */ - if(HDstrcmp(name3, "/g17")) TEST_ERROR; + if(HDstrcmp(name3, "/g17")) TEST_ERROR *name3 = '\0'; /* Get name with smaller buffer */ - if(H5Iget_name(group_id, name3, 3) < 0) TEST_ERROR; + if(H5Iget_name(group_id, name3, 3) < 0) TEST_ERROR /* Verify */ - if(HDstrcmp(name3, "/g")) TEST_ERROR; + if(HDstrcmp(name3, "/g")) TEST_ERROR HDfree(name3); } /* Close */ - H5Gclose( group_id ); + H5Gclose(group_id); PASSED(); @@ -1211,32 +1211,32 @@ PASSED(); TESTING("H5Iget_name with invalid IDs"); /* Create a dataspace */ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR /* Define a datatype */ - if ((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR; + if((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR /* Create a new dataset */ - if ((dataset_id = H5Dcreate( file_id , "d2", type_id, space_id, H5P_DEFAULT ))<0) TEST_ERROR; + if((dataset_id = H5Dcreate(file_id , "d2", type_id, space_id, H5P_DEFAULT))<0) TEST_ERROR { char name[NAME_BUF_SIZE]; /* Buffer to hold name and its size */ /* Get name for non commited datatype, it should fail */ H5E_BEGIN_TRY { - if(H5Iget_name( type_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR; + if(H5Iget_name(type_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR } H5E_END_TRY; /* Get name for dataspace, it should fail */ H5E_BEGIN_TRY { - if(H5Iget_name( space_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR; + if(H5Iget_name(space_id, name, NAME_BUF_SIZE) > 0) TEST_ERROR } H5E_END_TRY; } /* Close */ - H5Dclose( dataset_id ); - H5Sclose( space_id ); - H5Tclose( type_id ); + H5Dclose(dataset_id); + H5Sclose(space_id); + H5Tclose(type_id); PASSED(); @@ -1253,12 +1253,12 @@ PASSED(); if((group2_id = H5Gcreate2(file_id, "/g18/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Also create a dataset and a datatype */ - if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) TEST_ERROR; - if ((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR; - if ((dataset_id = H5Dcreate( file_id, "g18/d2", type_id, space_id, - H5P_DEFAULT ))<0) TEST_ERROR; + if((space_id = H5Screate_simple(1, dims, NULL))<0) TEST_ERROR + if((type_id = H5Tcopy(H5T_NATIVE_INT))<0) TEST_ERROR + if((dataset_id = H5Dcreate(file_id, "g18/d2", type_id, space_id, + H5P_DEFAULT))<0) TEST_ERROR - if (H5Tcommit(file_id, "g18/t2", type_id) <0) TEST_ERROR; + if(H5Tcommit(file_id, "g18/t2", type_id) <0) TEST_ERROR /* Create second file and group "/g3/g4/g5" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -1267,56 +1267,56 @@ PASSED(); if((group5_id = H5Gcreate2(file1_id, "/g3/g4/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Mount first file at "g3/g4" in the second file */ - if (H5Fmount(file1_id, "/g3/g4", file_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file1_id, "/g3/g4", file_id, H5P_DEFAULT)<0) TEST_ERROR /* Get name for the group ID in the first file, should be "/g18/g2" still */ - if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */ - if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR; + if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR /* Get name for the datatype ID in the first file, should be "/g18/g2/t2" still */ - if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR; + if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR /* Open the mounted group, dataset, and datatype through their new names */ - if ((group6_id = H5Gopen( file1_id, "/g3/g4/g18/g2" ))<0) TEST_ERROR; - if ((dataset2_id = H5Dopen( file1_id, "/g3/g4/g18/d2" ))<0) TEST_ERROR; - if ((type2_id = H5Topen( file1_id, "/g3/g4/g18/t2" ))<0) TEST_ERROR; + if((group6_id = H5Gopen2(file1_id, "/g3/g4/g18/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((dataset2_id = H5Dopen(file1_id, "/g3/g4/g18/d2")) < 0) FAIL_STACK_ERROR + if((type2_id = H5Topen(file1_id, "/g3/g4/g18/t2")) < 0) FAIL_STACK_ERROR /* Verify names */ - if(check_name(group6_id, "/g3/g4/g18/g2", "/g3/g4/g18/g2") < 0) TEST_ERROR; - if(check_name(dataset2_id, "/g3/g4/g18/d2", "/g3/g4/g18/d2") < 0) TEST_ERROR; - if(check_name(type2_id, "/g3/g4/g18/t2", "/g3/g4/g18/t2") < 0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g18/g2", "/g3/g4/g18/g2") < 0) TEST_ERROR + if(check_name(dataset2_id, "/g3/g4/g18/d2", "/g3/g4/g18/d2") < 0) TEST_ERROR + if(check_name(type2_id, "/g3/g4/g18/t2", "/g3/g4/g18/t2") < 0) TEST_ERROR /* Verify that old IDs still refer to objects by their old names */ - if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR; - if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR; - if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR + if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR + if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR /* Unmount */ - if (H5Funmount(file1_id, "/g3/g4")<0) TEST_ERROR; + if(H5Funmount(file1_id, "/g3/g4")<0) TEST_ERROR /* Get name for the IDs of the first file, should be unchanged */ - if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR; - if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR; - if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g18/g2", "/g18/g2") < 0) TEST_ERROR + if(check_name(dataset_id, "/g18/d2", "/g18/d2") < 0) TEST_ERROR + if(check_name(type_id, "/g18/t2", "/g18/t2") < 0) TEST_ERROR /* Get name for the IDs of the second file, should be local names now */ - if(check_name(group6_id, "/g18/g2", "") < 0) TEST_ERROR; - if(check_name(dataset2_id, "/g18/d2", "") < 0) TEST_ERROR; - if(check_name(type2_id, "/g18/t2", "") < 0) TEST_ERROR; - - H5Tclose( type_id ); - H5Tclose( type2_id ); - H5Dclose( dataset_id ); - H5Dclose( dataset2_id ); - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); - H5Gclose( group5_id ); - H5Gclose( group6_id ); - H5Fclose( file1_id ); + if(check_name(group6_id, "/g18/g2", "") < 0) TEST_ERROR + if(check_name(dataset2_id, "/g18/d2", "") < 0) TEST_ERROR + if(check_name(type2_id, "/g18/t2", "") < 0) TEST_ERROR + + H5Tclose(type_id); + H5Tclose(type2_id); + H5Dclose(dataset_id); + H5Dclose(dataset2_id); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); + H5Gclose(group5_id); + H5Gclose(group6_id); + H5Fclose(file1_id); PASSED(); @@ -1334,17 +1334,17 @@ PASSED(); if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR /* Close file */ - H5Fclose( file1_id ); + H5Fclose(file1_id); /* Verify */ - if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); + H5Gclose(group_id); + H5Gclose(group2_id); PASSED(); @@ -1362,36 +1362,36 @@ PASSED(); if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a new file and group "/g3/g4" in it */ - if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl )) < 0) FAIL_STACK_ERROR + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group3_id = H5Gcreate2(file2_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group4_id = H5Gcreate2(file2_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Mount first file at "/g3/g4" in the second file */ - if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR /* Open the mounted group */ - if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR; + if((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR /* Delete */ - if (H5Gunlink( file1_id, "/g3/g4/g1/g2")<0) TEST_ERROR; + if(H5Gunlink(file1_id, "/g3/g4/g1/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group5_id, "", "") < 0) TEST_ERROR; + if(check_name(group5_id, "", "") < 0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "", "") < 0) TEST_ERROR; + if(check_name(group2_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); - H5Gclose( group5_id ); - H5Fclose( file1_id ); - H5Fclose( file2_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); + H5Gclose(group5_id); + H5Fclose(file1_id); + H5Fclose(file2_id); PASSED(); @@ -1410,89 +1410,89 @@ PASSED(); if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a new file and group "/g3/g4" in it */ - if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl )) < 0) FAIL_STACK_ERROR + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group3_id = H5Gcreate2(file2_id, "/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group4_id = H5Gcreate2(file2_id, "/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Mount first file at "g3/g4" in the second file */ - if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file2_id, "/g3/g4", file1_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR; + if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR /* Open the mounted group */ - if ((group5_id = H5Gopen( file2_id, "/g3/g4/g1/g2" ))<0) TEST_ERROR; + if((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR /* Open another mounted group, in the middle of the path */ - if ((group6_id = H5Gopen( file2_id, "/g3/g4/g1" ))<0) TEST_ERROR; + if((group6_id = H5Gopen2(file2_id, "/g3/g4/g1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR /* Rename group */ - if (H5Gmove( file2_id, "/g3/g4/g1/g2", "/g3/g4/g1/g5" )<0) TEST_ERROR; + if(H5Gmove(file2_id, "/g3/g4/g1/g2", "/g3/g4/g1/g5")<0) TEST_ERROR /* Verify */ - if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR; - if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR + if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR /* Rename group */ - if (H5Gmove( file2_id, "/g3/g4/g1", "/g3/g4/g1a" )<0) TEST_ERROR; + if(H5Gmove(file2_id, "/g3/g4/g1", "/g3/g4/g1a")<0) TEST_ERROR /* Verify */ - if(check_name(group5_id, "/g3/g4/g1a/g5", "/g3/g4/g1a/g5") < 0) TEST_ERROR; - if(check_name(group2_id, "/g1a/g5", "/g1a/g5") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1a/g5", "/g3/g4/g1a/g5") < 0) TEST_ERROR + if(check_name(group2_id, "/g1a/g5", "/g1a/g5") < 0) TEST_ERROR /* Verify */ - if(check_name(group6_id, "/g3/g4/g1a", "/g3/g4/g1a") < 0) TEST_ERROR; - if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR; + if(check_name(group6_id, "/g3/g4/g1a", "/g3/g4/g1a") < 0) TEST_ERROR + if(check_name(group_id, "/g1a", "/g1a") < 0) TEST_ERROR /* Rename middle group back, using relative path */ - if (H5Gmove( group3_id, "g4/g1a", "g4/g1" )<0) TEST_ERROR; + if(H5Gmove(group3_id, "g4/g1a", "g4/g1")<0) TEST_ERROR /* Verify */ - if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR; - if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR; - if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; - if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g5", "/g3/g4/g1/g5") < 0) TEST_ERROR + if(check_name(group2_id, "/g1/g5", "/g1/g5") < 0) TEST_ERROR + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR /* Rename end group back, using relative path */ - if (H5Gmove( group3_id, "g4/g1/g5", "g4/g1/g2" )<0) TEST_ERROR; + if(H5Gmove(group3_id, "g4/g1/g5", "g4/g1/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR; - if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR; - if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; - if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR; + if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR + if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR + if(check_name(group_id, "/g1", "/g1") < 0) TEST_ERROR /* Rename mount point */ - if (H5Gmove( file2_id, "/g3/g4", "/g3/g4a" )<0) TEST_ERROR; + if(H5Gmove(file2_id, "/g3/g4", "/g3/g4a")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g3/g4a", "/g3/g4a") < 0) TEST_ERROR; - if(check_name(group5_id, "/g3/g4a/g1/g2", "/g3/g4a/g1/g2") < 0) TEST_ERROR; - if(check_name(group6_id, "/g3/g4a/g1", "/g3/g4a/g1") < 0) TEST_ERROR; + if(check_name(group4_id, "/g3/g4a", "/g3/g4a") < 0) TEST_ERROR + if(check_name(group5_id, "/g3/g4a/g1/g2", "/g3/g4a/g1/g2") < 0) TEST_ERROR + if(check_name(group6_id, "/g3/g4a/g1", "/g3/g4a/g1") < 0) TEST_ERROR /* Rename mount point back, using relative path*/ - if (H5Gmove( group3_id, "g4a", "g4" )<0) TEST_ERROR; + if(H5Gmove(group3_id, "g4a", "g4")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR; - if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR; - if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR; + if(check_name(group4_id, "/g3/g4", "/g3/g4") < 0) TEST_ERROR + if(check_name(group5_id, "/g3/g4/g1/g2", "/g3/g4/g1/g2") < 0) TEST_ERROR + if(check_name(group6_id, "/g3/g4/g1", "/g3/g4/g1") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); - H5Gclose( group5_id ); - H5Gclose( group6_id ); - H5Fclose( file1_id ); - H5Fclose( file2_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); + H5Gclose(group5_id); + H5Gclose(group6_id); + H5Fclose(file1_id); + H5Fclose(file2_id); PASSED(); @@ -1508,75 +1508,75 @@ PASSED(); if((group2_id = H5Gcreate2(file_id, "/g19/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create hard link to "g19/g1/ group */ - if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g2")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR /* Open the group */ - if ((group3_id = H5Gopen( file_id, "/g19/g2" ))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g19/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR /* Rename original group */ - if (H5Gmove( file_id, "/g19/g1", "/g19/g3" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g19/g1", "/g19/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR; - if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR /* Rename original group back, using relative path */ - if (H5Gmove( group_id, "g3", "g1" )<0) TEST_ERROR; + if(H5Gmove(group_id, "g3", "g1")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; - if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR /* Create another hard link to "/g19/g1" group */ - if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR /* Open the group */ - if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR; + if((group4_id = H5Gopen2(file_id, "/g19/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR; + if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR /* Delete group */ - if (H5Gunlink( file_id, "/g19/g3")<0) TEST_ERROR; + if(H5Gunlink(file_id, "/g19/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR; - if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; - if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR /* Close the unlinked group */ - H5Gclose( group4_id ); + H5Gclose(group4_id); /* Create another hard link to "/g19/g1" group */ - if (H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_HARD, "/g19/g1", "/g19/g3")<0) TEST_ERROR /* Open the group */ - if ((group4_id = H5Gopen( file_id, "/g19/g3" ))<0) TEST_ERROR; + if((group4_id = H5Gopen2(file_id, "/g19/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR; + if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR /* Delete group, using relative path */ - if (H5Gunlink( group_id, "g3")<0) TEST_ERROR; + if(H5Gunlink(group_id, "g3")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR; - if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR; - if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR + if(check_name(group2_id, "/g19/g1", "/g19/g1") < 0) TEST_ERROR + if(check_name(group3_id, "/g19/g2", "/g19/g2") < 0) TEST_ERROR /* Close the unlinked group */ - H5Gclose( group4_id ); + H5Gclose(group4_id); /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); PASSED(); @@ -1594,21 +1594,21 @@ PASSED(); if((group2_id = H5Gcreate2(file_id, "/g20/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create symbolic link to "g20/g1/ group */ - if (H5Glink(file_id, H5G_LINK_SOFT, "/g20/g1", "/g20/g2")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_SOFT, "/g20/g1", "/g20/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g20/g1", "/g20/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g20/g1", "/g20/g1") < 0) TEST_ERROR /* Open the group */ - if ((group3_id = H5Gopen( file_id, "/g20/g2" ))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g20/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g20/g2", "/g20/g2") < 0) TEST_ERROR; + if(check_name(group3_id, "/g20/g2", "/g20/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); PASSED(); @@ -1625,25 +1625,25 @@ PASSED(); if((group2_id = H5Gcreate2(file_id, "/g21/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create symbolic link to "g21/g1/ group */ - if (H5Glink(file_id, H5G_LINK_SOFT, "/g21/g1", "/g21/g2")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_SOFT, "/g21/g1", "/g21/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g21/g1", "/g21/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g21/g1", "/g21/g1") < 0) TEST_ERROR /* Open the group */ - if ((group3_id = H5Gopen( file_id, "/g21/g2" ))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g21/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Rename group */ - if (H5Gmove( file_id, "/g21/g1", "/g21/g3" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g21/g1", "/g21/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g21/g3", "/g21/g3") < 0) TEST_ERROR; - if(check_name(group3_id, "/g21/g2", "/g21/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g21/g3", "/g21/g3") < 0) TEST_ERROR + if(check_name(group3_id, "/g21/g2", "/g21/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); PASSED(); @@ -1660,32 +1660,32 @@ PASSED(); if((group2_id = H5Gcreate2(file_id, "/g22/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create symbolic link to "g22/g1/ group */ - if (H5Glink(file_id, H5G_LINK_SOFT, "/g22/g1", "/g22/g2")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_SOFT, "/g22/g1", "/g22/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR /* Open the group */ - if ((group3_id = H5Gopen( file_id, "/g22/g2" ))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g22/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Rename soft link */ - if (H5Gmove( file_id, "/g22/g2", "/g22/g3" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g22/g2", "/g22/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR; - if(check_name(group3_id, "/g22/g3", "/g22/g3") < 0) TEST_ERROR; + if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR + if(check_name(group3_id, "/g22/g3", "/g22/g3") < 0) TEST_ERROR /* Rename soft link, using relative paths */ - if (H5Gmove( group_id, "g3", "g2" )<0) TEST_ERROR; + if(H5Gmove(group_id, "g3", "g2")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR; - if(check_name(group3_id, "/g22/g2", "/g22/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g22/g1", "/g22/g1") < 0) TEST_ERROR + if(check_name(group3_id, "/g22/g2", "/g22/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); PASSED(); @@ -1703,24 +1703,24 @@ PASSED(); if((group2_id = H5Gcreate2(file_id, "/g23/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create symbolic link to "g23/g1/ group */ - if (H5Glink(file_id, H5G_LINK_SOFT, "/g23/g1", "/g23/g2")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_SOFT, "/g23/g1", "/g23/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g23/g1", "/g23/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g23/g1", "/g23/g1") < 0) TEST_ERROR /* Open the group */ - if ((group3_id = H5Gopen( file_id, "/g23/g2" ))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g23/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete group */ - if (H5Gunlink( file_id, "/g23/g1")<0) TEST_ERROR; + if(H5Gunlink(file_id, "/g23/g1")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR; + if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); PASSED(); @@ -1736,24 +1736,24 @@ PASSED(); if((group2_id = H5Gcreate2(file_id, "/g24/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create symbolic link to "g24/g1/ group */ - if (H5Glink(file_id, H5G_LINK_SOFT, "/g24/g1", "/g24/g2")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_SOFT, "/g24/g1", "/g24/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g24/g1", "/g24/g1") < 0) TEST_ERROR; + if(check_name(group2_id, "/g24/g1", "/g24/g1") < 0) TEST_ERROR /* Open the group */ - if ((group3_id = H5Gopen( file_id, "/g24/g2" ))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g24/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete symbolic link */ - if (H5Gunlink( file_id, "/g24/g2")<0) TEST_ERROR; + if(H5Gunlink(file_id, "/g24/g2")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g24/g1", "") < 0) TEST_ERROR; + if(check_name(group3_id, "/g24/g1", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); PASSED(); @@ -1770,9 +1770,9 @@ PASSED(); if((group3_id = H5Gcreate2(file_id, "/g25/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create second file and group "/g26/g3/g4" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -1782,9 +1782,9 @@ PASSED(); if((group3_id = H5Gcreate2(file1_id, "/g26/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create third file and group "/g27/g5/g6" in it */ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -1794,9 +1794,9 @@ PASSED(); if((group3_id = H5Gcreate2(file2_id, "/g27/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create fourth file and group "/g28/g5/g6" in it */ file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -1806,85 +1806,85 @@ PASSED(); if((group3_id = H5Gcreate2(file3_id, "/g28/g7/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Access group which will be hidden in the first file */ - if ((group_id = H5Gopen( file_id, "/g25/g1/g2"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g25/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR; + if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR /* Mount second file under "/g25/g1" in the first file */ - if (H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g25/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR; + if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR /* Access group which will be hidden in the second file */ - if ((group2_id = H5Gopen( file_id, "/g25/g1/g26/g3/g4"))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR; + if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR /* Mount third file under "/g25/g1/g26/g3" in the first file */ - if (H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g25/g1/g26/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR; + if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR /* Access group in the third file */ - if ((group3_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g6"))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g27/g5/g6", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR; + if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR /* Mount fourth file under "/g25/g1/g26/g3/g27/g5" in the first file */ - if (H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g25/g1/g26/g3/g27/g5", file3_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR; + if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR /* Access group in the fourth file */ - if ((group4_id = H5Gopen( file_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8"))<0) TEST_ERROR; + if((group4_id = H5Gopen2(file_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group4_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", "/g25/g1/g26/g3/g27/g5/g28/g7/g8") < 0) TEST_ERROR; + if(check_name(group4_id, "/g25/g1/g26/g3/g27/g5/g28/g7/g8", "/g25/g1/g26/g3/g27/g5/g28/g7/g8") < 0) TEST_ERROR - if (H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g28/g7/g8", "") < 0) TEST_ERROR; - if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR; - if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR; - if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g28/g7/g8", "") < 0) TEST_ERROR + if(check_name(group3_id, "/g25/g1/g26/g3/g27/g5/g6", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR + if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR + if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group4_id ); - H5Fclose( file3_id ); + H5Gclose(group4_id); + H5Fclose(file3_id); - if (H5Funmount(file_id, "/g25/g1/g26/g3")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g25/g1/g26/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g27/g5/g6", "") < 0) TEST_ERROR; - if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR; - if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR; + if(check_name(group3_id, "/g27/g5/g6", "") < 0) TEST_ERROR + if(check_name(group2_id, "/g25/g1/g26/g3/g4", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR + if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group3_id ); - H5Fclose( file2_id ); + H5Gclose(group3_id); + H5Fclose(file2_id); - if (H5Funmount(file_id, "/g25/g1")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g25/g1")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g26/g3/g4", "") < 0) TEST_ERROR; - if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR; + if(check_name(group2_id, "/g26/g3/g4", "") < 0) TEST_ERROR + if(check_name(group_id, "/g25/g1/g2", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Fclose( file1_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Fclose(file1_id); PASSED(); @@ -1905,31 +1905,31 @@ PASSED(); if((group5_id = H5Gcreate2(file_id, "/g29/g1/g2/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Rename group */ - if (H5Gmove( file_id, "/g29/g1/g2/g1/g2", "/g29/g1/g2/g1/g3" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g29/g1/g2/g1/g2", "/g29/g1/g2/g1/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group5_id, "/g29/g1/g2/g1/g3", "/g29/g1/g2/g1/g3") < 0) TEST_ERROR; + if(check_name(group5_id, "/g29/g1/g2/g1/g3", "/g29/g1/g2/g1/g3") < 0) TEST_ERROR /* Rename group in middle of path, keeping within the same group */ - if (H5Gmove( file_id, "/g29/g1/g2/g1", "/g29/g1/g2/g3" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g29/g1/g2/g1", "/g29/g1/g2/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g29/g1/g2/g3", "/g29/g1/g2/g3") < 0) TEST_ERROR; - if(check_name(group5_id, "/g29/g1/g2/g3/g3", "/g29/g1/g2/g3/g3") < 0) TEST_ERROR; + if(check_name(group4_id, "/g29/g1/g2/g3", "/g29/g1/g2/g3") < 0) TEST_ERROR + if(check_name(group5_id, "/g29/g1/g2/g3/g3", "/g29/g1/g2/g3/g3") < 0) TEST_ERROR /* Rename group in middle of path, moving to another group in file */ - if (H5Gmove( file_id, "/g29/g1/g2/g3", "/g29/g3" )<0) TEST_ERROR; + if(H5Gmove(file_id, "/g29/g1/g2/g3", "/g29/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g29/g3", "/g29/g3") < 0) TEST_ERROR; - if(check_name(group5_id, "/g29/g3/g3", "/g29/g3/g3") < 0) TEST_ERROR; + if(check_name(group4_id, "/g29/g3", "/g29/g3") < 0) TEST_ERROR + if(check_name(group5_id, "/g29/g3/g3", "/g29/g3/g3") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); - H5Gclose( group5_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); + H5Gclose(group5_id); PASSED(); @@ -1947,9 +1947,9 @@ PASSED(); if((group3_id = H5Gcreate2(file_id, "/g30/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create second file and group "/g31/g3/g4" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -1959,9 +1959,9 @@ PASSED(); if((group3_id = H5Gcreate2(file1_id, "/g31/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create third file and group "/g32/g5/g6" in it */ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -1971,9 +1971,9 @@ PASSED(); if((group3_id = H5Gcreate2(file2_id, "/g32/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create fourth file and group "/g33/g5/g6" in it */ file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -1983,89 +1983,89 @@ PASSED(); if((group3_id = H5Gcreate2(file3_id, "/g33/g7/g8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Access group which will be hidden in the first file */ - if ((group_id = H5Gopen( file_id, "/g30/g1/g2"))<0) TEST_ERROR; + if((group_id = H5Gopen2(file_id, "/g30/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR; + if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR /* Mount second file under "/g30/g1" in the first file */ - if (H5Fmount(file_id, "/g30/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g30/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR; + if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR /* Access group which will be hidden in the second file */ - if ((group2_id = H5Gopen( file_id, "/g30/g1/g31/g3/g4"))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file_id, "/g30/g1/g31/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; + if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR /* Mount third file under "/g30/g1/g31/g3" in the first file */ - if (H5Fmount(file_id, "/g30/g1/g31/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g30/g1/g31/g3", file2_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; + if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR /* Access group which will be hidden in the third file */ - if ((group3_id = H5Gopen( file_id, "/g30/g1/g31/g3/g32/g5/g6"))<0) TEST_ERROR; + if((group3_id = H5Gopen2(file_id, "/g30/g1/g31/g3/g32/g5/g6", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR; + if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR /* Mount fourth file under "/g30" in the first file, hiding the files below it */ - if (H5Fmount(file_id, "/g30", file3_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g30", file3_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR; + if(check_name(group3_id, "", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR /* Access group which will be in the fourth file */ - if ((group4_id = H5Gopen( file_id, "/g30/g33/g7/g8"))<0) TEST_ERROR; + if((group4_id = H5Gopen2(file_id, "/g30/g33/g7/g8", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group4_id, "/g30/g33/g7/g8", "/g30/g33/g7/g8") < 0) TEST_ERROR; + if(check_name(group4_id, "/g30/g33/g7/g8", "/g30/g33/g7/g8") < 0) TEST_ERROR /* Unmount fourth file */ - if (H5Funmount(file_id, "/g30")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g30")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR; - if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR; - if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; - if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR + if(check_name(group3_id, "/g30/g1/g31/g3/g32/g5/g6", "/g30/g1/g31/g3/g32/g5/g6") < 0) TEST_ERROR + if(check_name(group2_id, "", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR + if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR /* Unmount third file */ - if (H5Funmount(file_id, "/g30/g1/g31/g3")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g30/g1/g31/g3")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR; - if(check_name(group3_id, "/g32/g5/g6", "") < 0) TEST_ERROR; - if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR; - if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR + if(check_name(group3_id, "/g32/g5/g6", "") < 0) TEST_ERROR + if(check_name(group2_id, "/g30/g1/g31/g3/g4", "/g30/g1/g31/g3/g4") < 0) TEST_ERROR + if(check_name(group_id, "", "/g30/g1/g2") < 0) TEST_ERROR /* Unmount second file */ - if (H5Funmount(file_id, "/g30/g1")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g30/g1")<0) TEST_ERROR /* Verify */ - if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR; - if(check_name(group3_id, "/g32/g5/g6", "") < 0) TEST_ERROR; - if(check_name(group2_id, "/g31/g3/g4", "") < 0) TEST_ERROR; - if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR; + if(check_name(group4_id, "/g33/g7/g8", "") < 0) TEST_ERROR + if(check_name(group3_id, "/g32/g5/g6", "") < 0) TEST_ERROR + if(check_name(group2_id, "/g31/g3/g4", "") < 0) TEST_ERROR + if(check_name(group_id, "/g30/g1/g2", "/g30/g1/g2") < 0) TEST_ERROR /* Close groups */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); /* Close files */ - H5Fclose( file1_id ); - H5Fclose( file2_id ); - H5Fclose( file3_id ); + H5Fclose(file1_id); + H5Fclose(file2_id); + H5Fclose(file3_id); PASSED(); @@ -2085,9 +2085,9 @@ PASSED(); if((group3_id = H5Gcreate2(file1_id, "/g35/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create group "/g34/g1/g2" in first file */ if((group_id = H5Gcreate2(file_id, "/g34", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2095,37 +2095,37 @@ PASSED(); if((group3_id = H5Gcreate2(file_id, "/g34/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create hard link to "/g34/g1/g2 group */ - if (H5Glink(file_id, H5G_LINK_HARD, "/g34/g1/g2", "/g34/g2a")<0) TEST_ERROR; + if(H5Glink(file_id, H5G_LINK_HARD, "/g34/g1/g2", "/g34/g2a")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR; + if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR /* Open the link to the group */ - if ((group4_id = H5Gopen( file_id, "/g34/g2a" ))<0) TEST_ERROR; + if((group4_id = H5Gopen2(file_id, "/g34/g2a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR; + if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR /* Mount second file under "/g34/g1" in the first file */ - if (H5Fmount(file_id, "/g34/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g34/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "", "/g34/g1/g2") < 0) TEST_ERROR; - if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR; + if(check_name(group3_id, "", "/g34/g1/g2") < 0) TEST_ERROR + if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR /* Unmount second file */ - if (H5Funmount(file_id, "/g34/g1")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g34/g1")<0) TEST_ERROR /* Verify */ - if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR; - if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR; + if(check_name(group3_id, "/g34/g1/g2", "/g34/g1/g2") < 0) TEST_ERROR + if(check_name(group4_id, "/g34/g2a", "/g34/g2a") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); - H5Fclose( file1_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); + H5Fclose(file1_id); PASSED(); @@ -2144,9 +2144,9 @@ PASSED(); if((group3_id = H5Gcreate2(file_id, "/g36/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create second file and group "/g37/g4" in it */ file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -2157,62 +2157,62 @@ PASSED(); if((group4_id = H5Gcreate2(file1_id, "/g37/g4/g5b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Mount second file under "/g36/g1" in the first file */ - if (H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file_id, "/g36/g1", file1_id, H5P_DEFAULT)<0) TEST_ERROR /* Open group in mounted file */ - if ((group5_id = H5Gopen( file_id, "/g36/g1/g37/" ))<0) TEST_ERROR; + if((group5_id = H5Gopen2(file_id, "/g36/g1/g37/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group5_id, "/g36/g1/g37", "/g36/g1/g37") < 0) TEST_ERROR; + if(check_name(group5_id, "/g36/g1/g37", "/g36/g1/g37") < 0) TEST_ERROR /* Open group to delete in mounted file */ - if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5a" ))<0) TEST_ERROR; + if((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4/g5a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group6_id, "/g36/g1/g37/g4/g5a", "/g36/g1/g37/g4/g5a") < 0) TEST_ERROR; + if(check_name(group6_id, "/g36/g1/g37/g4/g5a", "/g36/g1/g37/g4/g5a") < 0) TEST_ERROR /* Delete end group in mounted file, using relative paths */ - if (H5Gunlink( group5_id, "g4/g5a")<0) TEST_ERROR; + if(H5Gunlink(group5_id, "g4/g5a")<0) TEST_ERROR /* Verify */ - if(check_name(group6_id, "", "") < 0) TEST_ERROR; - if(check_name(group3_id, "", "") < 0) TEST_ERROR; + if(check_name(group6_id, "", "") < 0) TEST_ERROR + if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close deleted group */ - H5Gclose( group6_id ); + H5Gclose(group6_id); /* Open groups to delete in mounted file */ - if ((group6_id = H5Gopen( file_id, "/g36/g1/g37/g4" ))<0) TEST_ERROR; - if ((group7_id = H5Gopen( file_id, "/g36/g1/g37/g4/g5b" ))<0) TEST_ERROR; + if((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group7_id = H5Gopen2(file_id, "/g36/g1/g37/g4/g5b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group6_id, "/g36/g1/g37/g4", "/g36/g1/g37/g4") < 0) TEST_ERROR; - if(check_name(group7_id, "/g36/g1/g37/g4/g5b", "/g36/g1/g37/g4/g5b") < 0) TEST_ERROR; + if(check_name(group6_id, "/g36/g1/g37/g4", "/g36/g1/g37/g4") < 0) TEST_ERROR + if(check_name(group7_id, "/g36/g1/g37/g4/g5b", "/g36/g1/g37/g4/g5b") < 0) TEST_ERROR /* Delete middle group in mounted file, using relative paths */ - if (H5Gunlink( group5_id, "g4")<0) TEST_ERROR; + if(H5Gunlink(group5_id, "g4")<0) TEST_ERROR /* Verify */ - if(check_name(group6_id, "", "") < 0) TEST_ERROR; - if(check_name(group2_id, "", "") < 0) TEST_ERROR; - if(check_name(group7_id, "", "") < 0) TEST_ERROR; - if(check_name(group4_id, "", "") < 0) TEST_ERROR; + if(check_name(group6_id, "", "") < 0) TEST_ERROR + if(check_name(group2_id, "", "") < 0) TEST_ERROR + if(check_name(group7_id, "", "") < 0) TEST_ERROR + if(check_name(group4_id, "", "") < 0) TEST_ERROR /* Close deleted groups */ - H5Gclose( group6_id ); - H5Gclose( group7_id ); + H5Gclose(group6_id); + H5Gclose(group7_id); /* Close group in mounted file */ - H5Gclose( group5_id ); + H5Gclose(group5_id); - if (H5Funmount(file_id, "/g36/g1")<0) TEST_ERROR; + if(H5Funmount(file_id, "/g36/g1")<0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); - H5Gclose( group4_id ); - H5Fclose( file1_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); + H5Gclose(group4_id); + H5Fclose(file1_id); PASSED(); @@ -2233,9 +2233,9 @@ PASSED(); if((group3_id = H5Gcreate2(file1_id, "/g38/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create second file and group "/g39/g1/g2" in it */ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -2245,9 +2245,9 @@ PASSED(); if((group3_id = H5Gcreate2(file2_id, "/g39/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create third file and group "/g40/g5/g6" in it */ file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -2257,46 +2257,46 @@ PASSED(); if((group3_id = H5Gcreate2(file3_id, "/g40/g5/g6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Mount second file under "/g38/g1" in the first file */ - if (H5Fmount(file1_id, "/g38/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file1_id, "/g38/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR - if ((group_id = H5Gopen( file1_id, "/g38/g1/g39/g3/g4" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file1_id, "/g38/g1/g39/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR; + if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR /* Mount first file under "/g40/g5" in the third file */ - if (H5Fmount(file3_id, "/g40/g5", file1_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file3_id, "/g40/g5", file1_id, H5P_DEFAULT)<0) TEST_ERROR - if ((group2_id = H5Gopen( file3_id, "/g40/g5/g38/g1/g39/g3/g4" ))<0) TEST_ERROR; + if((group2_id = H5Gopen2(file3_id, "/g40/g5/g38/g1/g39/g3/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/g40/g5/g38/g1/g39/g3/g4", "/g40/g5/g38/g1/g39/g3/g4") < 0) TEST_ERROR; - if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR; + if(check_name(group2_id, "/g40/g5/g38/g1/g39/g3/g4", "/g40/g5/g38/g1/g39/g3/g4") < 0) TEST_ERROR + if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR /* Unmount first file */ - if (H5Funmount(file3_id, "/g40/g5")<0) TEST_ERROR; + if(H5Funmount(file3_id, "/g40/g5")<0) TEST_ERROR /* Verify */ - if(check_name(group2_id, "/g38/g1/g39/g3/g4", "") < 0) TEST_ERROR; - if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR; + if(check_name(group2_id, "/g38/g1/g39/g3/g4", "") < 0) TEST_ERROR + if(check_name(group_id, "/g38/g1/g39/g3/g4", "/g38/g1/g39/g3/g4") < 0) TEST_ERROR /* Unmount second file */ - if (H5Funmount(file1_id, "/g38/g1")<0) TEST_ERROR; + if(H5Funmount(file1_id, "/g38/g1")<0) TEST_ERROR /* Verify */ - if(check_name(group_id, "/g39/g3/g4", "") < 0) TEST_ERROR; + if(check_name(group_id, "/g39/g3/g4", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Fclose( file1_id ); - H5Fclose( file2_id ); - H5Fclose( file3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Fclose(file1_id); + H5Fclose(file2_id); + H5Fclose(file3_id); PASSED(); @@ -2315,9 +2315,9 @@ PASSED(); if((group3_id = H5Gcreate2(file1_id, "/g41/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Create second file and group "/g42/g1/g2" in it */ file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); @@ -2327,31 +2327,31 @@ PASSED(); if((group3_id = H5Gcreate2(file2_id, "/g42/g3/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Gclose( group3_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Gclose(group3_id); /* Mount second file under "/g41/g1" in the first file */ - if (H5Fmount(file1_id, "/g41/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR; + if(H5Fmount(file1_id, "/g41/g1", file2_id, H5P_DEFAULT)<0) TEST_ERROR - if ((group_id = H5Gopen( file1_id, "/g41/g1/g42/g3" ))<0) TEST_ERROR; + if((group_id = H5Gopen2(file1_id, "/g41/g1/g42/g3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group_id, "/g41/g1/g42/g3", "/g41/g1/g42/g3") < 0) TEST_ERROR; + if(check_name(group_id, "/g41/g1/g42/g3", "/g41/g1/g42/g3") < 0) TEST_ERROR /* Unmount file */ - if (H5Funmount(file1_id, "/g41/g1")<0) TEST_ERROR; + if(H5Funmount(file1_id, "/g41/g1")<0) TEST_ERROR - if ((group2_id = H5Gopen( group_id, "g4" ))<0) TEST_ERROR; + if((group2_id = H5Gopen2(group_id, "g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify */ - if(check_name(group2_id, "/g42/g3/g4", "") < 0) TEST_ERROR; + if(check_name(group2_id, "/g42/g3/g4", "") < 0) TEST_ERROR /* Close */ - H5Gclose( group_id ); - H5Gclose( group2_id ); - H5Fclose( file1_id ); - H5Fclose( file2_id ); + H5Gclose(group_id); + H5Gclose(group2_id); + H5Fclose(file1_id); + H5Fclose(file2_id); PASSED(); @@ -2401,7 +2401,7 @@ test_obj_ref(hid_t fapl) if(H5Dclose(dataset) < 0) TEST_ERROR - /* Create a dataset (inside Group1) */ + /* Create a dataset(inside Group1) */ if((dataset = H5Dcreate(group, "Dataset1", H5T_STD_U32LE, sid1, H5P_DEFAULT)) < 0) TEST_ERROR @@ -2417,7 +2417,7 @@ test_obj_ref(hid_t fapl) if(H5Dclose(dataset) < 0) TEST_ERROR - /* Create another dataset (inside Group1) */ + /* Create another dataset(inside Group1) */ if((dataset = H5Dcreate(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT)) < 0) TEST_ERROR @@ -2467,8 +2467,8 @@ test_obj_ref(hid_t fapl) TEST_ERROR /* Open up that hard link and make a new dataset there */ - if((group = H5Gopen(fid1, "/Group1/Group2/Link")) < 0) - TEST_ERROR + if((group = H5Gopen2(fid1, "/Group1/Group2/Link", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR if((dataset = H5Dcreate(group, "Dataset5", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT)) < 0) TEST_ERROR @@ -2515,81 +2515,81 @@ test_obj_ref(hid_t fapl) TESTING("getting path to normal dataset in root group"); if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[0])) < 0) TEST_ERROR - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + i = H5Iget_name(dataset2,(char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/Dataset3") == 0) && (i == 9))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Dataset3") == 0) && (i == 9))) TEST_ERROR + if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[0],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Dataset3") == 0) &&(i == 9))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to dataset in /Group1"); if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[1])) < 0) TEST_ERROR - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + i = H5Iget_name(dataset2,(char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) && (i == 16))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) && (i == 16))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Dataset2") == 0) &&(i == 16))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to /Group1"); if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[2])) < 0) TEST_ERROR - i = H5Iget_name(group, (char*)buf, sizeof(buf)); + i = H5Iget_name(group,(char*)buf, sizeof(buf)); if(H5Gclose(group) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/Group1") == 0) && (i == 7))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1") == 0) && (i == 7))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[2],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1") == 0) &&(i == 7))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to datatype in /Group1"); if((tid1 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[3])) < 0) TEST_ERROR - i = H5Iget_name(tid1, (char*)buf, sizeof(buf)); + i = H5Iget_name(tid1,(char*)buf, sizeof(buf)); if(H5Tclose(tid1) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) && (i == 17))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) && (i == 17))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[3],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Datatype1") == 0) &&(i == 17))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to dataset in nested group"); if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[4])) < 0) TEST_ERROR - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + i = H5Iget_name(dataset2,(char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) && (i == 23))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) && (i == 23))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Group2/Dataset4") == 0) &&(i == 23))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to nested group"); if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[5])) < 0) TEST_ERROR - i = H5Iget_name(group, (char*)buf, sizeof(buf)); + i = H5Iget_name(group,(char*)buf, sizeof(buf)); if(H5Gclose(group) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/Group1/Group2") == 0) && (i == 14))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Group2") == 0) && (i == 14))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[5],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Group2") == 0) &&(i == 14))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to dataset created via hard link"); if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[6])) < 0) TEST_ERROR - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + i = H5Iget_name(dataset2,(char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) && (i == 16))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) && (i == 16))) TEST_ERROR + if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[6],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/Group1/Dataset5") == 0) &&(i == 16))) TEST_ERROR PASSED() HDmemset(buf, 0, sizeof(buf)); TESTING("getting path to root group"); if((group = H5Rdereference(dataset, H5R_OBJECT, &wbuf[7])) < 0) TEST_ERROR - i = H5Iget_name(group, (char*)buf, sizeof(buf)); + i = H5Iget_name(group,(char*)buf, sizeof(buf)); if(H5Gclose(group) < 0) TEST_ERROR - if(!((HDstrcmp(buf, "/") == 0) && (i == 1))) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7], (char*)buf, sizeof(buf)); - if(!((HDstrcmp(buf, "/") == 0) && (i == 1))) TEST_ERROR + if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[7],(char*)buf, sizeof(buf)); + if(!((HDstrcmp(buf, "/") == 0) &&(i == 1))) TEST_ERROR PASSED() /* Now we mount fid2 at /Group2 and look for dataset4. It shouldn't be found */ @@ -2598,10 +2598,10 @@ test_obj_ref(hid_t fapl) TESTING("getting path to dataset hidden by a mounted file"); if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[4])) < 0) TEST_ERROR - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + i = H5Iget_name(dataset2,(char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) TEST_ERROR if(i != 0) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4], (char*)buf, sizeof(buf)); + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[4],(char*)buf, sizeof(buf)); if(i != 0) TEST_ERROR PASSED() @@ -2612,10 +2612,10 @@ test_obj_ref(hid_t fapl) TEST_ERROR TESTING("getting path to dataset that has been unlinked"); - i = H5Iget_name(dataset2, (char*)buf, sizeof(buf)); + i = H5Iget_name(dataset2,(char*)buf, sizeof(buf)); if(H5Dclose(dataset2) < 0) TEST_ERROR if(i != 0) TEST_ERROR - i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1], (char*)buf, sizeof(buf)); + i = H5Rget_name(dataset, H5R_OBJECT, &wbuf[1],(char*)buf, sizeof(buf)); if(i != 0) TEST_ERROR PASSED() @@ -2704,7 +2704,7 @@ test_reg_ref(hid_t fapl) /* Create a reference to elements selection */ if((status = H5Sselect_none(space_id)) < 0) TEST_ERROR - if((status = H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t **)coord)) < 0) + if((status = H5Sselect_elements(space_id, H5S_SELECT_SET, num_points,(const hsize_t **)coord)) < 0) TEST_ERROR if((status = H5Rcreate(&ref[1], file_id, REFREG_DSETNAMEV, H5R_DATASET_REGION, space_id)) < 0) TEST_ERROR @@ -2736,38 +2736,38 @@ test_reg_ref(hid_t fapl) TEST_ERROR /* Get name of the dataset the first region reference points to using H5Rget_name */ - TESTING("H5Rget_name to get name from region reference (hyperslab)"); - name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0], (char*)buf1, NAME_BUF_SIZE); - if(!((HDstrcmp(buf1, "/MATRIX") == 0) && (name_size1 == 7))) TEST_ERROR + TESTING("H5Rget_name to get name from region reference(hyperslab)"); + name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[0],(char*)buf1, NAME_BUF_SIZE); + if(!((HDstrcmp(buf1, "/MATRIX") == 0) &&(name_size1 == 7))) TEST_ERROR PASSED() - TESTING("H5Iget_name to get name from region reference (hyperslab)"); + TESTING("H5Iget_name to get name from region reference(hyperslab)"); /* Dereference the first reference */ dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[0]); /* Get name of the dataset the first region reference points using H5Iget_name */ - name_size2 = H5Iget_name(dsetv_id, (char*)buf2, NAME_BUF_SIZE); - if(!((HDstrcmp(buf2, "/MATRIX") == 0) && (name_size2 == 7))) TEST_ERROR + name_size2 = H5Iget_name(dsetv_id,(char*)buf2, NAME_BUF_SIZE); + if(!((HDstrcmp(buf2, "/MATRIX") == 0) &&(name_size2 == 7))) TEST_ERROR if((status = H5Dclose(dsetv_id)) < 0) TEST_ERROR PASSED() /* Get name of the dataset the second region reference points to using H5Rget_name */ - TESTING("H5Rget_name to get name from region reference (pnt selec)"); - name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[1], (char*)buf1, NAME_BUF_SIZE); - if(!((HDstrcmp(buf1, "/MATRIX") == 0) && (name_size1 == 7))) TEST_ERROR + TESTING("H5Rget_name to get name from region reference(pnt selec)"); + name_size1 = H5Rget_name(dsetr_id, H5R_DATASET_REGION, &ref_out[1],(char*)buf1, NAME_BUF_SIZE); + if(!((HDstrcmp(buf1, "/MATRIX") == 0) &&(name_size1 == 7))) TEST_ERROR PASSED() - TESTING("H5Iget_name to get name from region reference (pnt selec)"); + TESTING("H5Iget_name to get name from region reference(pnt selec)"); /* Dereference the second reference */ if((dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[1])) < 0) TEST_ERROR /* Get name of the dataset the first region reference points using H5Iget_name */ - name_size2 = H5Iget_name(dsetv_id, (char*)buf2, NAME_BUF_SIZE); - if(!((HDstrcmp(buf2, "/MATRIX") == 0) && (name_size2 == 7))) TEST_ERROR + name_size2 = H5Iget_name(dsetv_id,(char*)buf2, NAME_BUF_SIZE); + if(!((HDstrcmp(buf2, "/MATRIX") == 0) &&(name_size2 == 7))) TEST_ERROR if((status = H5Dclose(dsetv_id)) < 0) TEST_ERROR @@ -2787,7 +2787,7 @@ error: int main(void) { - hid_t file_id = (-1); + hid_t file_id =(-1); int nerrors = 0; hid_t fapl; char filename0[1024]; @@ -2800,7 +2800,7 @@ main(void) /* Create a new file_id using default create property but vfd access * property. */ - if((file_id = H5Fcreate(filename0,H5F_ACC_TRUNC, H5P_DEFAULT, fapl )) < 0) TEST_ERROR + if((file_id = H5Fcreate(filename0,H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Call "main" test routine */ nerrors += test_main(file_id, fapl); diff --git a/test/links.c b/test/links.c index 45baae6..9fd6c09 100644 --- a/test/links.c +++ b/test/links.c @@ -631,7 +631,7 @@ toomany(hid_t fapl, hbool_t new_format) if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through last hard link */ - if((gid = H5Gopen(fid, "hard21")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "hard21", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -648,16 +648,16 @@ toomany(hid_t fapl, hbool_t new_format) /* Open object through too deep soft link */ H5E_BEGIN_TRY { - gid = H5Gopen(fid, "soft17"); + gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } H5E_END_TRY; - if (gid >= 0) { + if(gid >= 0) { H5_FAILED(); puts(" Should have failed for sequence of too many nested links."); TEST_ERROR - } + } /* end if */ /* Open object through lesser soft link */ - if((gid = H5Gopen(fid, "soft16")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "soft16", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -1039,25 +1039,29 @@ test_move(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR if( H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is no longer in the original location */ H5E_BEGIN_TRY { - if((moved_grp = H5Gopen(grp_1, "group_move"))>=0) - TEST_ERROR + moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } H5E_END_TRY; + if(moved_grp >= 0) { + H5_FAILED(); + puts(" Group still in original location?"); + TEST_ERROR + } /* end if */ /* Use H5Lmove to rename a group without moving it. */ if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen(grp_2, "group_newer_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lmove to move a group without renaming it. */ @@ -1065,9 +1069,9 @@ test_move(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen(grp_1, "group_newer_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Move the group while giving long paths. */ @@ -1075,22 +1079,22 @@ test_move(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen(grp_2, "group_newest_name")) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR - if( H5Gclose(moved_grp) < 0) + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is in no previous locations */ H5E_BEGIN_TRY { - if((moved_grp = H5Gopen(grp_1, "group_newer_name"))>=0) - TEST_ERROR - if((moved_grp = H5Gopen(grp_2, "group_newer_name"))>=0) - TEST_ERROR - if((moved_grp = H5Gopen(grp_2, "group_new_name"))>=0) - TEST_ERROR - if((moved_grp = H5Gopen(grp_1, "group_copy"))>=0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) + FAIL_STACK_ERROR } H5E_END_TRY; H5Gclose(grp_1); @@ -1181,15 +1185,15 @@ test_copy(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen(grp_1, "group_copy")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to create a group in the same location with a different name. */ @@ -1197,14 +1201,14 @@ test_copy(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen(grp_2, "group_newer_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to copy to a different location with the same name. */ @@ -1212,14 +1216,14 @@ test_copy(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen(grp_1, "group_newer_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in the previous location */ - if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Copy the group while giving long paths. */ @@ -1227,27 +1231,27 @@ test_copy(hid_t fapl, hbool_t new_format) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen(grp_2, "group_newest_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in all previous original locations */ - if((moved_grp = H5Gopen(grp_1, "group_newer_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR - if((moved_grp = H5Gopen(grp_2, "group_newer_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR - if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR - if((moved_grp = H5Gopen(grp_1, "group_copy")) < 0) - TEST_ERROR - if( H5Gclose(moved_grp) < 0) + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR H5Gclose(grp_1); @@ -1531,8 +1535,8 @@ test_compat(hid_t fapl, hbool_t new_format) if(H5Gclose(group2_id) < 0) TEST_ERROR if(H5Gclose(group1_id) < 0) TEST_ERROR - if((group1_id = H5Gopen(file_id, "moved_group1")) < 0) TEST_ERROR - if((group2_id = H5Gopen(file_id, "moved_group1/moved_group2")) < 0) TEST_ERROR + if((group1_id = H5Gopen2(file_id, "moved_group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2_id = H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close open IDs */ if(H5Gclose(group2_id) < 0) TEST_ERROR @@ -1542,7 +1546,7 @@ test_compat(hid_t fapl, hbool_t new_format) if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) TEST_ERROR H5E_BEGIN_TRY { - if(H5Gopen(file_id, "moved_group1/moved_group2") >=0) TEST_ERROR + if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR } H5E_END_TRY; if(H5Fclose(file_id) < 0) TEST_ERROR @@ -1639,7 +1643,7 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Open object through external link */ - if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -1667,8 +1671,8 @@ external_link_root(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR /* Open objects created through external link */ - if((gid = H5Gopen(fid, "new_group")) < 0) TEST_ERROR - if((gid2 = H5Gopen(fid, "newer_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check names */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -1769,7 +1773,7 @@ external_link_path(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "/A/B/C", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -1792,7 +1796,7 @@ external_link_path(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR /* Open object created through external link */ - if((gid = H5Gopen(fid, "/A/B/C/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -1916,7 +1920,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename3, "/G/H/I", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -1939,7 +1943,7 @@ external_link_mult(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR /* Open object created through external link */ - if((gid = H5Gopen(fid, "/A/B/C/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/A/B/C/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -1954,14 +1958,14 @@ external_link_mult(hid_t fapl, hbool_t new_format) /* Open an object through external links */ if((fid = H5Fopen(filename4, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid = H5Gopen(fid, "ext_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* The intermediate files should not stay open. Replace one of them with a new file. */ - if((fid2=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the other with write access and delete the external link in it */ - if((fid2=H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fopen(filename3, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR if(H5Ldelete(fid2, "G/H/I", H5P_DEFAULT) < 0) TEST_ERROR if(H5Fclose(fid2) < 0) TEST_ERROR @@ -2040,7 +2044,7 @@ external_link_self(hid_t fapl, hbool_t new_format) if(H5Lcreate_external(filename1, "/X", fid, "A/B/C", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "A/B/C/")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "A/B/C/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -2056,7 +2060,7 @@ external_link_self(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Check on object created */ - if((gid = H5Gopen(fid, "X/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "X/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -2099,7 +2103,7 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ if((fid=H5Fopen(filename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - if((gid=H5Gopen(fid, "ext_link/B/C/Y/Z/end")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ext_link/B/C/Y/Z/end", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create object through external link */ if((gid2 = H5Gcreate2(gid, "newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -2110,9 +2114,9 @@ external_link_self(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Open up file3 and make sure the object was created successfully */ - if((fid=H5Fopen(filename3, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename3, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if((gid=H5Gopen(fid, "end/newer_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "end/newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Cleanup */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2206,7 +2210,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "link1")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -2229,7 +2233,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR /* Open object created through external link */ - if((gid = H5Gopen(fid, "/final/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/final/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -2360,7 +2364,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Open object through external link */ H5E_BEGIN_TRY { - gid = H5Gopen(fid, "link1"); + gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -2369,7 +2373,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format) } /* Open object through external link */ - if((gid = H5Gopen(fid, "link3")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "link3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -2457,7 +2461,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) /* Open object through dangling file external link */ H5E_BEGIN_TRY { - gid = H5Gopen(fid, "no_file"); + gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -2467,7 +2471,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) /* Open object through dangling object external link */ H5E_BEGIN_TRY { - gid = H5Gopen(fid, "no_object"); + gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -2536,7 +2540,7 @@ external_link_recursive(hid_t fapl, hbool_t new_format) /* Open object through dangling file external link */ H5E_BEGIN_TRY { - gid = H5Gopen(fid, "recursive"); + gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { H5_FAILED(); @@ -2754,7 +2758,7 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group for external link */ - if((gid = H5Gopen(fid, "dst")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2815,7 +2819,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Open root group */ - if((gid = H5Gopen(fid, "/")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check on root group's status */ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR @@ -2872,7 +2876,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open root group */ - if((gid = H5Gopen(fid, "/")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Unlink external link */ if(H5Gunlink(fid, "src") < 0) TEST_ERROR @@ -2900,7 +2904,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group for external link (should be unaffected) */ - if((gid = H5Gopen(fid, "dst")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2982,7 +2986,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Gmove(fid, "src", "src2") < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "src2")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "src2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -3004,7 +3008,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group created through external link */ - if((gid = H5Gopen(fid, "dst/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -3027,7 +3031,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "/group2/src3")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -3049,7 +3053,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group created through external link */ - if((gid = H5Gopen(fid, "dst/new_group2")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -3063,7 +3067,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "/group2/src3")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/group2/src3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -3092,7 +3096,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group created through external link */ - if((gid = H5Gopen(fid, "dst/new_group3")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "dst/new_group3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -3155,7 +3159,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Open root group */ - if((gid = H5Gopen(fid, "/")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check on root group's status */ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR @@ -3215,7 +3219,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "src")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -3231,7 +3235,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Open root group */ - if((gid = H5Gopen(fid, "/")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 3); u++) { @@ -3250,7 +3254,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Open object through external link */ - if((gid = H5Gopen(fid, "src")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -3272,13 +3276,13 @@ external_link_ride(hid_t fapl, hbool_t new_format) if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group created through external link */ - if((gid = H5Gopen(fid, "dst/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ if(H5Gclose(gid) < 0) TEST_ERROR /* Open group created through external link */ - if((gid = H5Gopen(fid, "dst/new_group2")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -3413,7 +3417,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Gget_comment(fid1, "elink/elink/elink/group1_moved", sizeof(buf), buf) < 0) TEST_ERROR /* Test H5*open */ - if((gid = H5Gopen(fid1, "elink/elink/elink/group1_moved")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((tid = H5Topen(fid1, "elink/elink/elink/type1_moved")) < 0) TEST_ERROR if((did = H5Dopen(fid1, "elink/elink/elink/dataset1_moved")) < 0) TEST_ERROR /* Close objects */ @@ -3422,7 +3426,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) if(H5Dclose(did) < 0) TEST_ERROR /* Test H5*open2 */ - if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) TEST_ERROR if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR /* Close objects */ @@ -3586,7 +3590,7 @@ external_link_endian(hid_t fapl, hbool_t new_format) if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen(gid, "subgroup")) < 0) TEST_ERROR + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close the IDs */ if(H5Gclose(gid2) < 0) TEST_ERROR @@ -3602,7 +3606,7 @@ external_link_endian(hid_t fapl, hbool_t new_format) if((gid = H5Oopen(fid, "ext_link", lapl_id)) < 0) TEST_ERROR /* Open a group in the external file using that group ID */ - if((gid2 = H5Gopen(gid, "subgroup")) < 0) TEST_ERROR + if((gid2 = H5Gopen2(gid, "subgroup", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close the IDs */ if(H5Gclose(gid2) < 0) TEST_ERROR @@ -3683,7 +3687,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) /* Access external link from file #1 */ if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR - if((gid2 = H5Gopen(fid2, "/W/X/DLINK")) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid2, "/W/X/DLINK", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((name_len = H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR if(H5Gclose(gid2) < 0) TEST_ERROR @@ -3909,7 +3913,7 @@ ud_hard_links(hid_t fapl) if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR /* Open group through UD link */ - if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -3923,7 +3927,7 @@ ud_hard_links(hid_t fapl) if(H5Gclose(gid) < 0) TEST_ERROR /* Re-open group without using ud link to check that it was created properly */ - if((gid = H5Gopen(fid, "group/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -3947,7 +3951,7 @@ ud_hard_links(hid_t fapl) if(H5Gunlink(fid, "/group") < 0) TEST_ERROR /* Ensure we can open the group through the UD link */ - if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Unlink the group contained within it. */ if(H5Gunlink(gid, "new_group") < 0) TEST_ERROR @@ -4077,7 +4081,7 @@ ud_link_reregister(hid_t fapl) /* Verify that we can't traverse the ud link anymore */ H5E_BEGIN_TRY { - if((gid = H5Gopen(fid, "ud_link")) >= 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR } H5E_END_TRY /* Verify that we can't create any new links of this type */ @@ -4096,7 +4100,7 @@ ud_link_reregister(hid_t fapl) /* Open a group through the ud link (now a different class of link). * It should be a different group * than the UD hard link pointed to */ - if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -4110,7 +4114,7 @@ ud_link_reregister(hid_t fapl) if(H5Gclose(gid) < 0) TEST_ERROR /* Re-open group without using ud link to check that it was created properly */ - if((gid = H5Gopen(fid, "rereg_target/new_group")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ if((name_len = H5Iget_name( gid, objname, (size_t)NAME_BUF_SIZE )) < 0) TEST_ERROR @@ -4131,7 +4135,7 @@ ud_link_reregister(hid_t fapl) /* Ensure we can open the group through the UD link (now that UD hard * links have been registered) */ - if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) TEST_ERROR /* Delete the UD hard link. This should cause the group to be @@ -4346,7 +4350,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Try opening group through UD link */ - if((gid = H5Gopen(fid, UD_CB_LINK_NAME)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) TEST_ERROR /* Query the link to test its query callback */ @@ -4366,7 +4370,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gmove(fid, UD_CB_LINK_NAME, NEW_UD_CB_LINK_NAME) < 0) TEST_ERROR /* Re-open group to ensure that move worked */ - if((gid = H5Gopen(fid, NEW_UD_CB_LINK_NAME)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) TEST_ERROR /* Remove UD link */ @@ -4394,7 +4398,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR if(H5Gmove(fid, UD_CB_LINK_NAME, NEW_UD_CB_LINK_NAME) >= 0) TEST_ERROR if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) TEST_ERROR - if((gid = H5Gopen(gid, UD_CB_LINK_NAME)) >= 0) TEST_ERROR + if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) TEST_ERROR } H5E_END_TRY @@ -4530,7 +4534,7 @@ lapl_udata(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Verify that we can open the new group without using the ud link */ - if((gid2 = H5Gopen(fid, "/group_a/subgroup_a")) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid, "/group_a/subgroup_a", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) TEST_ERROR /* Now use the same ud link to access group_b */ @@ -4544,7 +4548,7 @@ lapl_udata(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR /* Verify that we can open the new group without using the ud link */ - if((gid2 = H5Gopen(fid, "/group_b/subgroup_b")) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid, "/group_b/subgroup_b", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid2) < 0) TEST_ERROR /* Close property list */ @@ -4814,7 +4818,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcreate_ud(fid, "/ud_link", UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group through the ud link */ - if((gid = H5Gopen(fid, "ud_link")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) TEST_ERROR /* Now test that each of the callbacks will cause a failure if it returns -1 */ @@ -4826,7 +4830,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcopy(fid, "ud_link", fid, "copy_fail", H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR /* The traversal callback will fail if we remove its target */ if(H5Gunlink(fid, "group") < 0) TEST_ERROR - if((gid = H5Gopen(gid, "ud_link")) >= 0) TEST_ERROR + if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR /* The deletion callback will always fail */ if(H5Gunlink(fid, "ud_link") >= 0) TEST_ERROR /* The query callback will fail */ @@ -5088,7 +5092,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* We should now be able to use these property lists to open each kind * of object. */ - if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR @@ -5342,7 +5346,7 @@ corder_create_empty(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group created */ - if((group_id = H5Gopen(file_id, CORDER_GROUP_NAME)) < 0) TEST_ERROR + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check on group's status */ if(H5G_is_empty_test(group_id) != TRUE) TEST_ERROR @@ -5453,7 +5457,7 @@ corder_create_compact(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group created */ - if((group_id = H5Gopen(file_id, CORDER_GROUP_NAME)) < 0) TEST_ERROR + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify state of group */ if(H5G_has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR @@ -5587,7 +5591,7 @@ corder_create_dense(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open group created */ - if((group_id = H5Gopen(file_id, CORDER_GROUP_NAME)) < 0) TEST_ERROR + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify state of group */ if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR @@ -5698,7 +5702,7 @@ corder_transition(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Open group created */ - if((group_id = H5Gopen(file_id, CORDER_GROUP_NAME)) < 0) TEST_ERROR + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -5773,7 +5777,7 @@ corder_transition(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open group created */ - if((group_id = H5Gopen(file_id, CORDER_GROUP_NAME)) < 0) TEST_ERROR + if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify state of group */ if(H5G_has_links_test(group_id, NULL) == TRUE) TEST_ERROR @@ -9466,8 +9470,8 @@ timestamps(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR /* Open groups */ - if((group_id = H5Gopen(file_id, TIMESTAMP_GROUP_1)) < 0) TEST_ERROR - if((group_id2 = H5Gopen(file_id, TIMESTAMP_GROUP_2)) < 0) TEST_ERROR + if((group_id = H5Gopen2(file_id, TIMESTAMP_GROUP_1, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group_id2 = H5Gopen2(file_id, TIMESTAMP_GROUP_2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Retrieve the groups' creation properties */ if((gcpl_id = H5Gget_create_plist(group_id)) < 0) TEST_ERROR diff --git a/test/mount.c b/test/mount.c index 11c769d..4ffbbce 100644 --- a/test/mount.c +++ b/test/mount.c @@ -96,7 +96,7 @@ error: H5Fclose(file); } H5E_END_TRY; return -1; -} +} /* end setup() */ /*------------------------------------------------------------------------- @@ -119,28 +119,22 @@ error: static int test_basic(hid_t fapl) { - hid_t file1=-1, file2=-1, grp=-1; + hid_t file1 = -1, file2 = -1, grp = -1; char filename1[1024], filename2[1024]; TESTING("basic functionality"); h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - if ((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || - (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) - TEST_ERROR - if ((grp = H5Gopen(file1, "/mnt1/file2")) < 0) - TEST_ERROR - if (H5Gclose(grp) < 0) - TEST_ERROR - if (H5Funmount(file1, "/mnt1") < 0) - TEST_ERROR - if (H5Fclose(file1) < 0) - TEST_ERROR - if (H5Fclose(file2) < 0) - TEST_ERROR + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -151,7 +145,7 @@ test_basic(hid_t fapl) H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_basic() */ /*------------------------------------------------------------------------- @@ -174,7 +168,7 @@ test_basic(hid_t fapl) static int test_illegal(hid_t fapl) { - hid_t file1=-1, file2=-1, file3=-1, mnt=-1; + hid_t file1 = -1, file2 = -1, file3 = -1, mnt = -1; herr_t status; char filename1[1024], filename2[1024], filename3[1024]; @@ -185,48 +179,49 @@ test_illegal(hid_t fapl) /* Open the files */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0 || - (file3=H5Fopen(filename3, H5F_ACC_RDONLY, fapl))<0) - goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0 || + (file3 = H5Fopen(filename3, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR /* Try mounting a file on itself */ H5E_BEGIN_TRY { status = H5Fmount(file1, "/mnt1", file1, H5P_DEFAULT); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Mounting a file on itself should have failed."); - goto error; - } + TEST_ERROR + } /* end if */ /* * Try mounting two files at the same place. We have to open the mount * point before we mount the first file or we'll end up mounting file3 at * the root of file2 and the mount will succeed. */ - if ((mnt=H5Gopen(file1, "/mnt1"))<0) goto error; - if (H5Fmount(mnt, ".", file2, H5P_DEFAULT)<0) goto error; + if((mnt = H5Gopen2(file1, "/mnt1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Fmount(mnt, ".", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { status = H5Fmount(mnt, ".", file3, H5P_DEFAULT); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Mounting two files at one mount point should have failed."); - goto error; - } - if (H5Funmount(mnt, ".")<0) goto error; - if (H5Gclose(mnt)<0) goto error; + TEST_ERROR + } /* end if */ + if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR + if(H5Gclose(mnt) < 0) FAIL_STACK_ERROR /* Close everything and return */ - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; - if (H5Fclose(file3)<0) goto error; + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + if(H5Fclose(file3) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(mnt); H5Fclose(file1); @@ -234,7 +229,7 @@ test_illegal(hid_t fapl) H5Fclose(file3); } H5E_END_TRY; return 1; -} +} /* end test_illegal() */ /*------------------------------------------------------------------------- @@ -258,7 +253,7 @@ test_illegal(hid_t fapl) static int test_hide(hid_t fapl) { - hid_t file1=-1, file2=-1, grp=-1; + hid_t file1 = -1, file2 = -1, grp = -1; H5G_stat_t sb1, sb2; char filename1[1024], filename2[1024]; @@ -266,52 +261,53 @@ test_hide(hid_t fapl) h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0) - goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR /* Get information about file1:/mnt1/file1 for later */ - if (H5Gget_objinfo(file1, "/mnt1/file1", TRUE, &sb1)<0) goto error; + if(H5Gget_objinfo(file1, "/mnt1/file1", TRUE, &sb1) < 0) FAIL_STACK_ERROR /* Build the virtual file */ - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Original names under file1:/mnt1 should not be accessible */ H5E_BEGIN_TRY { - grp = H5Gopen(file1, "/mnt1/file1"); + grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT); } H5E_END_TRY; - if (grp>=0) { + if(grp >= 0) { H5_FAILED(); puts(" Name is still accessible under mount point."); - goto error; - } + TEST_ERROR + } /* end if */ /* * The original objects under file1:/mnt1 are still accessible by their * other names. This is a rather stupid test but demonstrates a point. */ - if (H5Gget_objinfo(file1, "/file1", TRUE, &sb2)<0) goto error; - if (HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { + if(H5Gget_objinfo(file1, "/file1", TRUE, &sb2) < 0) FAIL_STACK_ERROR + if(HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Hard link failed for hidden object."); - goto error; - } + TEST_ERROR + } /* end if */ /* Unmount and close objects */ - if (H5Funmount(file1, "/mnt1")<0) goto error; - H5Fclose(file1); - H5Fclose(file2); + if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(grp); H5Fclose(file1); H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_hide() */ /*------------------------------------------------------------------------- @@ -345,36 +341,30 @@ test_assoc(hid_t fapl) /* Open the files */ if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Get information about the root of file2 */ - if(H5Gget_objinfo(file2, "/", TRUE, &sb1) < 0) - TEST_ERROR + if(H5Gget_objinfo(file2, "/", TRUE, &sb1) < 0) FAIL_STACK_ERROR /* Create the virtual file */ - if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* * Get info about the mount point -- should be the same as the root group * of file2. */ - if(H5Gget_objinfo(file1, "/mnt1", TRUE, &sb2) < 0) - TEST_ERROR + if(H5Gget_objinfo(file1, "/mnt1", TRUE, &sb2) < 0) FAIL_STACK_ERROR if(HDmemcmp(&sb1.fileno, &sb2.fileno, sizeof(sb1.fileno)) || HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) { H5_FAILED(); puts(" Association failed."); - AT(); - goto error; - } + TEST_ERROR + } /* end if */ /* Shut down */ - if(H5Funmount(file1, "/mnt1_link") < 0) - TEST_ERROR - if(H5Fclose(file1) < 0) - TEST_ERROR - if(H5Fclose(file2) < 0) - TEST_ERROR + if(H5Funmount(file1, "/mnt1_link") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; @@ -384,7 +374,7 @@ error: H5Fclose(file1); } H5E_END_TRY; return 1; -} +} /* end test_assoc() */ /*------------------------------------------------------------------------- @@ -408,7 +398,7 @@ error: static int test_mntlnk(hid_t fapl) { - hid_t file1=-1, file2=-1, grp=-1; + hid_t file1 = -1, file2 = -1, grp = -1; char filename1[1024], filename2[1024]; TESTING("multi-linked mount point"); @@ -417,35 +407,36 @@ test_mntlnk(hid_t fapl) /* Build the virtual file */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0) - goto error; - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* * Can we see file2:/file2 as both file1:/mnt1/file2 and * file1:/mnt1_link/file2? */ - if ((grp=H5Gopen(file1, "/mnt1/file2"))<0) goto error; - if (H5Gclose(grp)<0) goto error; - if ((grp=H5Gopen(file1, "/mnt1_link/file2"))<0) goto error; - if (H5Gclose(grp)<0) goto error; + if((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if((grp = H5Gopen2(file1, "/mnt1_link/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR /* Unlink using second name */ - if (H5Funmount(file1, "/mnt1_link")<0) goto error; - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; + if(H5Funmount(file1, "/mnt1_link") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(grp); H5Fclose(file1); H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_mntlnk() */ /*------------------------------------------------------------------------- @@ -469,7 +460,7 @@ test_mntlnk(hid_t fapl) static int test_move(hid_t fapl) { - hid_t file1=-1, file2=-1; + hid_t file1 = -1, file2 = -1; herr_t status; char filename1[1024], filename2[1024]; @@ -478,36 +469,37 @@ test_move(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Build the virtual file */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - goto error; - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* First rename an object in the mounted file, then try it across files */ - if (H5Lmove(file1, "/mnt1/rename_a/x", H5L_SAME_LOC, "/mnt1/rename_b/y", H5P_DEFAULT, H5P_DEFAULT)<0) goto error; + if(H5Lmove(file1, "/mnt1/rename_a/x", H5L_SAME_LOC, "/mnt1/rename_b/y", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { status = H5Lmove(file1, "/mnt1/rename_b/y", H5L_SAME_LOC, "/y", H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Moving an object across files should't have been possible"); - goto error; - } + TEST_ERROR + } /* end if */ /* Shut down */ - if (H5Funmount(file1, "/mnt1")<0) goto error; - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; + if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Fclose(file1); H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_move() */ /*------------------------------------------------------------------------- @@ -530,42 +522,43 @@ test_move(hid_t fapl) static int test_preopen(hid_t fapl) { - hid_t file1=-1, file2=-1, grp=-1; + hid_t file1 = -1, file2 = -1, grp = -1; char filename1[1024], filename2[1024]; TESTING("preopening objects under the mount point"); h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0) - goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR /* Open something under the mount point */ - if ((grp=H5Gopen(file1, "/mnt1/file1"))<0) goto error; + if((grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Build the virtual file */ - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if (H5Gget_objinfo(grp, ".", TRUE, NULL)<0) goto error; + if(H5Gget_objinfo(grp, ".", TRUE, NULL) < 0) FAIL_STACK_ERROR /* Shut down */ - if (H5Funmount(file1, "/mnt1")<0) goto error; - if (H5Gclose(grp)<0) goto error; - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; + if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(grp); H5Fclose(file2); H5Fclose(file1); } H5E_END_TRY; return 1; -} +} /* end test_preopen() */ /*------------------------------------------------------------------------- @@ -590,7 +583,7 @@ static int test_postopen(hid_t fapl) { - hid_t file1=-1, file2=-1, grp=-1; + hid_t file1 = -1, file2 = -1, grp = -1; char filename1[1024], filename2[1024]; TESTING("open object access after unmount"); @@ -598,38 +591,39 @@ test_postopen(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Create the virtual file */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDONLY, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDONLY, fapl))<0) - goto error; - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Open some object in the mounted file */ - if ((grp=H5Gopen(file1, "/mnt1/file2"))<0) goto error; + if((grp = H5Gopen2(file1, "/mnt1/file2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Unmount the file */ - if (H5Funmount(file1, "/mnt1")<0) goto error; + if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR /* Now access the thing we previously opened */ - if (H5Gget_objinfo(grp, ".", TRUE, NULL)<0) goto error; + if(H5Gget_objinfo(grp, ".", TRUE, NULL) < 0) FAIL_STACK_ERROR /* Try accessing it from the file */ - if (H5Gget_objinfo(file2, "/file2", TRUE, NULL)<0) goto error; + if(H5Gget_objinfo(file2, "/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR /* Shut down */ - if (H5Gclose(grp)<0) goto error; - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(grp); H5Fclose(file2); H5Fclose(file1); } H5E_END_TRY; return 1; -} +} /* end test_postopen() */ /*------------------------------------------------------------------------- @@ -653,7 +647,7 @@ test_postopen(hid_t fapl) static int test_unlink(hid_t fapl) { - hid_t file1=-1, file2=-1, mnt=-1, root=-1; + hid_t file1 = -1, file2 = -1, mnt = -1, root = -1; herr_t status; char filename1[1024], filename2[1024]; @@ -662,18 +656,18 @@ test_unlink(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Open files */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR /* * Opening the mount point before mounting opens the group in the parent * file, but opening the mount point after mounting is the same as * opening the root group of the child file. */ - if ((mnt=H5Gopen(file1, "/mnt_unlink"))<0) goto error; - if (H5Fmount(file1, "/mnt_unlink", file2, H5P_DEFAULT)<0) goto error; - if ((root=H5Gopen(file1, "/mnt_unlink"))<0) goto error; + if((mnt = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt_unlink", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if((root = H5Gopen2(file1, "/mnt_unlink", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* * "/file2" of file2 should be visible as an absolute name through either @@ -681,43 +675,43 @@ test_unlink(hid_t fapl) * before the H5Fmount() and thus refers to the mount point itself rather * than the group mounted there. */ - if (H5Gget_objinfo(file1, "/mnt_unlink/file2", TRUE, NULL)<0) goto error; - if (H5Gget_objinfo(mnt, "/mnt_unlink/file2", TRUE, NULL)<0) goto error; - if (H5Gget_objinfo(root, "/mnt_unlink/file2", TRUE, NULL)<0) goto error; - if (H5Gget_objinfo(root, "file2", TRUE, NULL)<0) goto error; + if(H5Gget_objinfo(file1, "/mnt_unlink/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(mnt, "/mnt_unlink/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(root, "/mnt_unlink/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(root, "file2", TRUE, NULL) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { status = H5Gget_objinfo(mnt, "file2", TRUE, NULL); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Incorrect traversal from mount point!"); - goto error; - } + TEST_ERROR + } /* end if */ /* Unlink the mount point */ - if (H5Gunlink(file1, "/mnt_unlink")<0) goto error; + if(H5Gunlink(file1, "/mnt_unlink") < 0) FAIL_STACK_ERROR /* * We should still be able to get to "/file2" of file2 by starting at * `root' which is still open, but not by name. */ - if (H5Gget_objinfo(root, "file2", TRUE, NULL)<0) goto error; + if(H5Gget_objinfo(root, "file2", TRUE, NULL) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { status = H5Gget_objinfo(mnt, "file2", TRUE, NULL); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Traversal through mount point should not have worked!"); - goto error; - } + TEST_ERROR + } /* end if */ H5E_BEGIN_TRY { status = H5Gget_objinfo(file2, "/mnt_unlink/file2", TRUE, NULL); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Traversal through mount point should not have worked!"); - goto error; - } + TEST_ERROR + } /* end if */ /* * It's no longer possible to unmount the child by supplying the name of @@ -727,30 +721,31 @@ test_unlink(hid_t fapl) H5E_BEGIN_TRY { status = H5Funmount(file1, "/mnt_unlink"); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); - goto error; - } + TEST_ERROR + } /* end if */ H5E_BEGIN_TRY { status = H5Funmount(file2, "/"); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); printf(" %d: Unmount by name should not have been allowed!\n",__LINE__); - goto error; - } - if (H5Funmount(mnt, ".")<0) goto error; + TEST_ERROR + } /* end if */ + if(H5Funmount(mnt, ".") < 0) FAIL_STACK_ERROR /* Close files */ - if (H5Gclose(mnt)<0) goto error; - if (H5Gclose(root)<0) goto error; - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; + if(H5Gclose(mnt) < 0) FAIL_STACK_ERROR + if(H5Gclose(root) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(mnt); H5Gclose(root); @@ -758,7 +753,7 @@ test_unlink(hid_t fapl) H5Fclose(file1); } H5E_END_TRY; return 1; -} +} /* end test_unlink() */ /*------------------------------------------------------------------------- @@ -780,7 +775,7 @@ test_unlink(hid_t fapl) static int test_mvmpt(hid_t fapl) { - hid_t file1=-1, file2=-1; + hid_t file1 = -1, file2 = -1; char filename1[1024], filename2[1024]; TESTING("mount point renaming"); @@ -788,32 +783,32 @@ test_mvmpt(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Build the virtual file */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - TEST_ERROR - if (H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT)<0) TEST_ERROR + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt_move_a", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Rename the mount point */ - if (H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT)<0) TEST_ERROR + if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access something under the new name */ - if (H5Gget_objinfo(file1, "/mnt_move_b/file2", TRUE, NULL)<0) TEST_ERROR + if(H5Gget_objinfo(file1, "/mnt_move_b/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR /* Shut down */ - if (H5Funmount(file1, "/mnt_move_b")<0) TEST_ERROR - if (H5Fclose(file1)<0) TEST_ERROR - if (H5Fclose(file2)<0) TEST_ERROR + if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Fclose(file1); H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_mvmpt() */ /*------------------------------------------------------------------------- @@ -835,7 +830,7 @@ test_mvmpt(hid_t fapl) static int test_interlink(hid_t fapl) { - hid_t file1=-1, file2=-1, type=-1, space=-1, dset=-1; + hid_t file1 = -1, file2 = -1, type = -1, space = -1, dset = -1; char filename1[1024], filename2[1024]; herr_t status; hsize_t cur_dims[1] = {2}; @@ -845,54 +840,55 @@ test_interlink(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Build the virtual file */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - goto error; - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Try an interfile hard link directly */ H5E_BEGIN_TRY { status = H5Glink(file1, H5L_TYPE_HARD, "/mnt1/file2", "/file2"); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Interfile hard link should not have been allowed!"); - goto error; - } + TEST_ERROR + } /* end if */ /* Try an interfile hard link by renaming something */ H5E_BEGIN_TRY { status = H5Lmove(file1, "/mnt1/file2", H5L_SAME_LOC, "/file2", H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; - if (status>=0) { + if(status >= 0) { H5_FAILED(); puts(" Interfile renaming should not have been allowed!"); - goto error; - } + TEST_ERROR + } /* end if */ /* Try an interfile hard link by sharing a data type */ - if ((type=H5Tcopy(H5T_NATIVE_INT))<0) goto error; - if (H5Tcommit(file1, "/type1", type)<0) goto error; - if ((space=H5Screate_simple(1, cur_dims, NULL))<0) goto error; + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR + if(H5Tcommit(file1, "/type1", type) < 0) FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_dims, NULL)) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { dset = H5Dcreate(file1, "/mnt1/file2/dset", type, space, H5P_DEFAULT); } H5E_END_TRY; - if (dset>=0) { + if(dset >= 0) { H5_FAILED(); puts(" Dataset and shared type must be in the same file!"); - goto error; - } + TEST_ERROR + } /* end if */ /* Shut down */ - if (H5Sclose(space)<0) goto error; - if (H5Tclose(type)<0) goto error; - if (H5Funmount(file1, "/mnt1")<0) goto error; - if (H5Fclose(file1)<0) goto error; - if (H5Fclose(file2)<0) goto error; + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR + if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Dclose(dset); H5Sclose(space); @@ -901,7 +897,7 @@ test_interlink(hid_t fapl) H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_interlink() */ /*------------------------------------------------------------------------- @@ -924,7 +920,7 @@ test_interlink(hid_t fapl) static int test_uniformity(hid_t fapl) { - hid_t file1=-1, file2=-1; + hid_t file1 = -1, file2 = -1; char filename1[1024], filename2[1024]; TESTING("file handle uniformity"); @@ -932,39 +928,40 @@ test_uniformity(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Build the virtual file */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - TEST_ERROR; - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) TEST_ERROR; + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Access some things from the file1 handle */ - if (H5Gget_objinfo(file1, "/", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file1, "/mnt1", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file1, "mnt1", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file1, "/mnt1/file2", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file1, "mnt1/file2", TRUE, NULL)<0) TEST_ERROR; + if(H5Gget_objinfo(file1, "/", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file1, "/mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file1, "mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file1, "/mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file1, "mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR /* Access the same things from the file2 handle */ - if (H5Gget_objinfo(file2, "/", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file2, "/mnt1", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file2, "mnt1", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file2, "/mnt1/file2", TRUE, NULL)<0) TEST_ERROR; - if (H5Gget_objinfo(file2, "mnt1/file2", TRUE, NULL)<0) TEST_ERROR; + if(H5Gget_objinfo(file2, "/", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file2, "/mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file2, "mnt1", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file2, "/mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file2, "mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR /* Shut down */ - if (H5Funmount(file1, "/mnt1")<0) TEST_ERROR; - if (H5Fclose(file1)<0) TEST_ERROR; - if (H5Fclose(file2)<0) TEST_ERROR; + if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Fclose(file1); H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_uniformity() */ /*------------------------------------------------------------------------- @@ -986,7 +983,7 @@ test_uniformity(hid_t fapl) static int test_close(hid_t fapl) { - hid_t file1=-1, file2=-1; + hid_t file1 = -1, file2 = -1; char filename1[1024], filename2[1024]; TESTING("file handle close"); @@ -994,47 +991,43 @@ test_close(hid_t fapl) h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); /* Build the virtual file */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - goto error; - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* * Close file1 unmounting it from the virtual file. Objects in file1 are * still accessible through the file2 handle. */ - if (H5Fclose(file1)<0) goto error; + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR if(H5Gget_objinfo(file2, "/mnt1", TRUE, NULL) < 0) { H5_FAILED(); puts(" File1 contents are not accessible!"); - goto error; - } - if (H5Fclose(file2)<0) goto error; + TEST_ERROR + } /* end if */ + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ - if(H5I_nmembers(H5I_FILE) != 0) - TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + if(H5F_sfile_assert_num(0) != 0) TEST_ERROR /* Build the virtual file again */ - if ((file1=H5Fopen(filename1, H5F_ACC_RDWR, fapl))<0 || - (file2=H5Fopen(filename2, H5F_ACC_RDWR, fapl))<0) - goto error; - if (H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT)<0) goto error; + if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0 || + (file2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* * Close file2. It is not actually closed because it's a child of file1. */ - if (H5Fclose(file2)<0) goto error; - if (H5Gget_objinfo(file1, "/mnt1/file2", TRUE, NULL)<0) goto error; - if (H5Fclose(file1)<0) goto error; + if(H5Fclose(file2) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file1, "/mnt1/file2", TRUE, NULL) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1) < 0) FAIL_STACK_ERROR /* Check that all file IDs have been closed */ - if(H5I_nmembers(H5I_FILE) != 0) - TEST_ERROR - if(H5F_sfile_assert_num(0) != 0) - TEST_ERROR + if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR + if(H5F_sfile_assert_num(0) != 0) TEST_ERROR /* Shut down */ PASSED(); @@ -1046,7 +1039,7 @@ test_close(hid_t fapl) H5Fclose(file2); } H5E_END_TRY; return 1; -} +} /* end test_close() */ /*------------------------------------------------------------------------- @@ -1069,11 +1062,11 @@ test_close(hid_t fapl) static int test_mount_after_close(hid_t fapl) { - hid_t fid1=-1, fid2=-1; /* File IDs */ - hid_t gidA=-1, gidAB=-1, gidABM=-1, gidX=-1, gidXY=-1; /* Group identifiers */ - hid_t gidABMX=-1, gidABC=-1, gidABT=-1; /* Group IDs for testing */ - hid_t didABMXYD=-1; /* Dataset ID for testing */ - hid_t did=-1, sid=-1; /* Dataset and dataspace identifiers */ + hid_t fid1 = -1, fid2 = -1; /* File IDs */ + hid_t gidA = -1, gidAB = -1, gidABM = -1, gidX = -1, gidXY = -1; /* Group identifiers */ + hid_t gidABMX = -1, gidABC = -1, gidABT = -1; /* Group IDs for testing */ + hid_t didABMXYD = -1; /* Dataset ID for testing */ + hid_t did = -1, sid = -1; /* Dataset and dataspace identifiers */ char filename1[1024], filename2[1024]; /* Name of files to mount */ char objname[NAME_BUF_SIZE]; /* Name of object opened */ hsize_t dims[] = {NX,NY}; /* Dataset dimensions */ @@ -1086,8 +1079,8 @@ test_mount_after_close(hid_t fapl) /* * Initialization of buffer matrix "bm" */ - for(i =0; i<NX; i++) - for(j = 0; j<NY; j++) + for(i =0; i < NX; i++) + for(j = 0; j < NY; j++) bm[i][j] = i + j; /* Create first file and a groups in it. */ @@ -1098,28 +1091,21 @@ test_mount_after_close(hid_t fapl) /A/B/M Group /A/B/T -> /A */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - if((gidAB = H5Gcreate2(gidA, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - if((gidABM = H5Gcreate2(gidAB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) /* Mount point */ - TEST_ERROR - if(H5Glink(gidAB, H5L_TYPE_SOFT, "./M/X/Y", "C") < 0) /* Soft link */ - TEST_ERROR - if(H5Glink(gidAB, H5L_TYPE_SOFT, "/A", "T") < 0) /* Soft link */ - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + if((gidA = H5Gcreate2(fid1, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gidAB = H5Gcreate2(gidA, "B", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Mount point */ + if((gidABM = H5Gcreate2(gidAB, "M", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Soft link */ + if(H5Glink(gidAB, H5L_TYPE_SOFT, "./M/X/Y", "C") < 0) FAIL_STACK_ERROR + /* Soft link */ + if(H5Glink(gidAB, H5L_TYPE_SOFT, "/A", "T") < 0) FAIL_STACK_ERROR /* Close groups and file */ - if(H5Gclose(gidABM) < 0) - TEST_ERROR - if(H5Gclose(gidAB) < 0) - TEST_ERROR - if(H5Gclose(gidA) < 0) - TEST_ERROR - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Gclose(gidABM) < 0) FAIL_STACK_ERROR + if(H5Gclose(gidAB) < 0) FAIL_STACK_ERROR + if(H5Gclose(gidA) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR /* Create second file and dataset "D" in it. */ /* h5ls shows: */ @@ -1128,127 +1114,94 @@ test_mount_after_close(hid_t fapl) /X/Y Group /X/Y/D Dataset {4, 5} */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR dims[0] = NX; dims[1] = NY; - if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) - TEST_ERROR + if((sid = H5Screate_simple(RANK, dims, NULL)) < 0) FAIL_STACK_ERROR - if((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - if((gidXY = H5Gcreate2(gidX, "Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR - if((did = H5Dcreate(gidXY, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Glink(gidX, H5L_TYPE_SOFT, "./Y", "T") < 0) /* Soft link */ - TEST_ERROR + if((gidX = H5Gcreate2(fid2, "/X", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((gidXY = H5Gcreate2(gidX, "Y", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((did = H5Dcreate(gidXY, "D", H5T_NATIVE_INT, sid, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Soft link */ + if(H5Glink(gidX, H5L_TYPE_SOFT, "./Y", "T") < 0) FAIL_STACK_ERROR /* Write data to the dataset. */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm) < 0) - TEST_ERROR + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, bm) < 0) FAIL_STACK_ERROR /* Close all identifiers. */ - if(H5Sclose(sid) < 0) - TEST_ERROR - if(H5Dclose(did) < 0) - TEST_ERROR - if(H5Gclose(gidXY) < 0) - TEST_ERROR - if(H5Gclose(gidX) < 0) - TEST_ERROR - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + if(H5Gclose(gidXY) < 0) FAIL_STACK_ERROR + if(H5Gclose(gidX) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR /* Beginning of the actual test code */ /* * Reopen both files */ - if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* * Open /A/B to use as a mount point */ - if((gidAB = H5Gopen(fid1, "/A/B")) < 0) - TEST_ERROR + if((gidAB = H5Gopen2(fid1, "/A/B", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* * Close the parent file. This keeps the file open because of the other handle on the group within */ - if(H5Fclose(fid1) < 0) /* We close the file (it should stay open from the group) */ - TEST_ERROR + /* We close the file (it should stay open from the group) */ + if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR /* * Mount second file under G in the first file. */ - if(H5Fmount(gidAB, "M", fid2, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Fmount(gidAB, "M", fid2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Open "normal" group in mounted file */ /* (This shows we successfully mounted) */ - if((gidABMX = H5Gopen(gidAB, "M/X")) < 0) - TEST_ERROR + if((gidABMX = H5Gopen2(gidAB, "M/X", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ - if(H5Iget_name( gidABMX, objname, (size_t)NAME_BUF_SIZE ) < 0) - TEST_ERROR - if(HDstrcmp(objname, "/A/B/M/X")) - TEST_ERROR + if(H5Iget_name(gidABMX, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/A/B/M/X")) TEST_ERROR /* Close object in mounted file */ - if(H5Gclose(gidABMX) < 0) - TEST_ERROR + if(H5Gclose(gidABMX) < 0) FAIL_STACK_ERROR /* Open group in mounted file through softlink */ - if((gidABC = H5Gopen(gidAB, "C")) < 0) - TEST_ERROR + if((gidABC = H5Gopen2(gidAB, "C", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ - if(H5Iget_name( gidABC, objname, (size_t)NAME_BUF_SIZE ) < 0) - TEST_ERROR - if(HDstrcmp(objname, "/A/B/C")) - TEST_ERROR + if(H5Iget_name(gidABC, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/A/B/C")) TEST_ERROR /* Close object in mounted file */ - if(H5Gclose(gidABC) < 0) - TEST_ERROR + if(H5Gclose(gidABC) < 0) FAIL_STACK_ERROR /* Open group in original file through softlink */ - if((gidABT = H5Gopen(gidAB, "T")) < 0) - TEST_ERROR + if((gidABT = H5Gopen2(gidAB, "T", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check name */ - if(H5Iget_name( gidABT, objname, (size_t)NAME_BUF_SIZE ) < 0) - TEST_ERROR - if(HDstrcmp(objname, "/A/B/T")) - TEST_ERROR + if(H5Iget_name(gidABT, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/A/B/T")) TEST_ERROR /* Close object in original file */ - if(H5Gclose(gidABT) < 0) - TEST_ERROR + if(H5Gclose(gidABT) < 0) FAIL_STACK_ERROR /* Open "normal" dataset in mounted file */ - if((didABMXYD = H5Dopen(gidAB, "M/X/Y/D")) < 0) - TEST_ERROR + if((didABMXYD = H5Dopen(gidAB, "M/X/Y/D")) < 0) FAIL_STACK_ERROR /* Check name */ - if(H5Iget_name( didABMXYD, objname, (size_t)NAME_BUF_SIZE ) < 0) - TEST_ERROR - if(HDstrcmp(objname, "/A/B/M/X/Y/D")) - TEST_ERROR + if(H5Iget_name(didABMXYD, objname, (size_t)NAME_BUF_SIZE) < 0) FAIL_STACK_ERROR + if(HDstrcmp(objname, "/A/B/M/X/Y/D")) TEST_ERROR /* Close object in mounted file */ - if(H5Dclose(didABMXYD) < 0) - TEST_ERROR + if(H5Dclose(didABMXYD) < 0) FAIL_STACK_ERROR - if(H5Gclose(gidAB) < 0) - TEST_ERROR - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Gclose(gidAB) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR /* Shut down */ PASSED(); @@ -1271,7 +1224,7 @@ error: H5Fclose(fid2); } H5E_END_TRY; return 1; -} +} /* end test_mount_after_close() */ /*------------------------------------------------------------------------- @@ -1394,9 +1347,9 @@ test_mount_after_unmount(hid_t fapl) /* * Open /A & /B to use as a mount points */ - if((gidA = H5Gopen(fid1, "/A")) < 0) + if((gidA = H5Gopen2(fid1, "/A", H5P_DEFAULT)) < 0) TEST_ERROR - if((gidB = H5Gopen(fid1, "/B")) < 0) + if((gidB = H5Gopen2(fid1, "/B", H5P_DEFAULT)) < 0) TEST_ERROR /* @@ -1407,7 +1360,7 @@ test_mount_after_unmount(hid_t fapl) /* Open group in mounted file */ /* (This shows we successfully mounted) */ - if((gidAMXX = H5Gopen(gidA, "M/X/X")) < 0) + if((gidAMXX = H5Gopen2(gidA, "M/X/X", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -1417,7 +1370,7 @@ test_mount_after_unmount(hid_t fapl) TEST_ERROR /* Open group in mounted file #2 */ - if((gidAMX = H5Gopen(gidA, "M/X")) < 0) + if((gidAMX = H5Gopen2(gidA, "M/X", H5P_DEFAULT)) < 0) TEST_ERROR /* Mount third file */ @@ -1426,7 +1379,7 @@ test_mount_after_unmount(hid_t fapl) /* Open group in mounted file #3 */ /* (This shows we successfully mounted) */ - if((gidAMXMY = H5Gopen(gidAMX, "M/Y")) < 0) + if((gidAMXMY = H5Gopen2(gidAMX, "M/Y", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -1436,7 +1389,7 @@ test_mount_after_unmount(hid_t fapl) TEST_ERROR /* Unmount second file */ - if(H5Funmount(fid1, "/A/M")<0) + if(H5Funmount(fid1, "/A/M") < 0) TEST_ERROR /* Check name */ @@ -1456,7 +1409,7 @@ test_mount_after_unmount(hid_t fapl) TEST_ERROR /* Re-open group in file #3 */ - if((gidAMXMY = H5Gopen(gidAMX, "M/Z")) < 0) + if((gidAMXMY = H5Gopen2(gidAMX, "M/Z", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name again */ @@ -1472,7 +1425,7 @@ test_mount_after_unmount(hid_t fapl) /* Open group in mounted file */ /* (This shows we successfully mounted) */ - if((gidBMZ = H5Gopen(gidB, "M/Z")) < 0) + if((gidBMZ = H5Gopen2(gidB, "M/Z", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -1482,11 +1435,11 @@ test_mount_after_unmount(hid_t fapl) TEST_ERROR /* Unmount third file */ - if (H5Funmount(fid2, "/X/M")<0) + if (H5Funmount(fid2, "/X/M") < 0) TEST_ERROR /* Unmount fourth file */ - if (H5Funmount(fid1, "/B/M")<0) + if (H5Funmount(fid1, "/B/M") < 0) TEST_ERROR /* Close objects in mounted files */ @@ -1622,7 +1575,7 @@ test_missing_unmount(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #1 */ @@ -1636,7 +1589,7 @@ test_missing_unmount(hid_t fapl) TEST_ERROR /* Open group in mounted file */ - if((gidAE = H5Gopen(fid2, "A/E")) < 0) + if((gidAE = H5Gopen2(fid2, "A/E", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #2 */ @@ -1650,7 +1603,7 @@ test_missing_unmount(hid_t fapl) TEST_ERROR /* Open group in mounted file */ - if((gidAEM = H5Gopen(fid3, "A/E/M")) < 0) + if((gidAEM = H5Gopen2(fid3, "A/E/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #3 */ @@ -1762,7 +1715,7 @@ test_hold_open_file(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) @@ -1771,7 +1724,7 @@ test_hold_open_file(hid_t fapl) if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0) TEST_ERROR - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #2 */ @@ -1784,7 +1737,7 @@ test_hold_open_file(hid_t fapl) /* Attempt to open group in mounted file */ /* (Should work because file is still mounted) */ - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #1 */ @@ -1797,7 +1750,7 @@ test_hold_open_file(hid_t fapl) /* Attempt to open group in mounted file */ /* (Should work because file is still mounted) */ - if((gidAM = H5Gopen(gidA, "/A/M")) < 0) + if((gidAM = H5Gopen2(gidA, "/A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close group in mounted file */ @@ -1895,7 +1848,7 @@ test_hold_open_group(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) @@ -1904,7 +1857,7 @@ test_hold_open_group(hid_t fapl) if(H5Fmount(gidA, ".", fid2, H5P_DEFAULT) < 0) TEST_ERROR - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #2 */ @@ -1919,7 +1872,7 @@ test_hold_open_group(hid_t fapl) /* Retry to opening group in mounted file */ /* (Should work because file is still mounted) */ - if((gidAM2 = H5Gopen(fid1, "A/M")) < 0) + if((gidAM2 = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close group in mounted file */ @@ -1932,7 +1885,7 @@ test_hold_open_group(hid_t fapl) /* Attempt to open group in mounted file */ /* (Should work because file is still mounted) */ - if((gidAM2 = H5Gopen(fid1, "/A/M")) < 0) + if((gidAM2 = H5Gopen2(fid1, "/A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #1 */ @@ -1949,7 +1902,7 @@ test_hold_open_group(hid_t fapl) /* Attempt to open group in mounted file */ /* (Should work because file is still mounted) */ - if((gidAM2 = H5Gopen(fid2, "/A/M")) < 0) + if((gidAM2 = H5Gopen2(fid2, "/A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #2 */ @@ -1958,7 +1911,7 @@ test_hold_open_group(hid_t fapl) /* Attempt to open group in parent file */ /* (Should work because files should be mounted together) */ - if((gid = H5Gopen(gidAM2, "/")) < 0) + if((gid = H5Gopen2(gidAM2, "/", H5P_DEFAULT)) < 0) TEST_ERROR /* Close group in mounted file */ @@ -2056,7 +2009,7 @@ test_fcdegree_same(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR /* Create FAPL & set file close degree for file #2 to be different */ @@ -2092,7 +2045,7 @@ test_fcdegree_same(hid_t fapl) TEST_ERROR /* Verify opening group in mounted file */ - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close group in mounted file */ @@ -2209,7 +2162,7 @@ test_fcdegree_semi(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0) @@ -2220,7 +2173,7 @@ test_fcdegree_semi(hid_t fapl) TEST_ERROR /* Verify opening group in mounted file */ - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #1 (should succeed, since file #2 is open still) */ @@ -2351,7 +2304,7 @@ test_fcdegree_strong(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl_id)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl_id)) < 0) @@ -2362,7 +2315,7 @@ test_fcdegree_strong(hid_t fapl) TEST_ERROR /* Open group in mounted file */ - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close file #1 */ @@ -2486,7 +2439,7 @@ test_acc_perm(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR /* Get and verify file name */ @@ -2515,7 +2468,7 @@ test_acc_perm(hid_t fapl) TEST_ERROR /* Open group in mounted file */ - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Get and verify file name */ @@ -2723,10 +2676,10 @@ test_mult_mount(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR - if((gidB = H5Gopen(fid1, "B")) < 0) + if((gidB = H5Gopen2(fid1, "B", H5P_DEFAULT)) < 0) TEST_ERROR if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) @@ -2737,7 +2690,7 @@ test_mult_mount(hid_t fapl) TEST_ERROR /* Open group in mounted file */ - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Open file #3 again */ @@ -2757,7 +2710,7 @@ test_mult_mount(hid_t fapl) TEST_ERROR /* Open object in file #3 through file #2 mount path */ - if((gidAMT = H5Gopen(fid1, "A/M/T")) < 0) + if((gidAMT = H5Gopen2(fid1, "A/M/T", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -2774,7 +2727,7 @@ test_mult_mount(hid_t fapl) TEST_ERROR /* Open object in file #3 through file #1 mount path */ - if((gidBS = H5Gopen(fid1, "B/S")) < 0) + if((gidBS = H5Gopen2(fid1, "B/S", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -2784,7 +2737,7 @@ test_mult_mount(hid_t fapl) TEST_ERROR /* Re-open object created in file #3 through file #1 mount path */ - if((gidU = H5Gopen(gidBS, "/B/T/U")) < 0) + if((gidU = H5Gopen2(gidBS, "/B/T/U", H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(gidU) < 0) @@ -2933,7 +2886,7 @@ test_nested_survive(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) @@ -2944,7 +2897,7 @@ test_nested_survive(hid_t fapl) TEST_ERROR /* Open group in mounted file */ - if((gidAM = H5Gopen(fid1, "A/M")) < 0) + if((gidAM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Open file #3 again */ @@ -2956,7 +2909,7 @@ test_nested_survive(hid_t fapl) TEST_ERROR /* Open object in file #3 through file #1 mount path */ - if((gidAMS = H5Gopen(fid1, "A/M/S")) < 0) + if((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0) TEST_ERROR /* Close group in file #3 */ @@ -2981,13 +2934,13 @@ test_nested_survive(hid_t fapl) /* Open object in file #3 through file #1 mount path (should fail) */ H5E_BEGIN_TRY { - gidAMS = H5Gopen(fid1, "A/M/S"); + gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT); } H5E_END_TRY; if(gidAMS >= 0) TEST_ERROR /* Open object in file #3 through file #2 mount path */ - if((gidMS = H5Gopen(fid2, "M/S")) < 0) + if((gidMS = H5Gopen2(fid2, "M/S", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -3005,7 +2958,7 @@ test_nested_survive(hid_t fapl) TEST_ERROR /* Open object in file #3 through file #1 mount path again */ - if((gidAMS = H5Gopen(fid1, "A/M/S")) < 0) + if((gidAMS = H5Gopen2(fid1, "A/M/S", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -3129,7 +3082,7 @@ test_close_parent(hid_t fapl) if((fid1 = H5Fopen(filename1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) TEST_ERROR - if((gidA = H5Gopen(fid1, "A")) < 0) + if((gidA = H5Gopen2(fid1, "A", H5P_DEFAULT)) < 0) TEST_ERROR if((fid2 = H5Fopen(filename2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) @@ -3140,7 +3093,7 @@ test_close_parent(hid_t fapl) TEST_ERROR /* Open group in mounted file */ - if((gidM = H5Gopen(fid1, "A/M")) < 0) + if((gidM = H5Gopen2(fid1, "A/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Close group in file #1 */ @@ -3443,7 +3396,7 @@ test_cut_graph(hid_t fapl) TEST_ERROR /* Open object in file #5 */ - if((gidM = H5Gopen(fid1, "A/E/M")) < 0) + if((gidM = H5Gopen2(fid1, "A/E/M", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -3453,7 +3406,7 @@ test_cut_graph(hid_t fapl) TEST_ERROR /* Open object in file #7 */ - if((gidQ = H5Gopen(fid1, "B/I/Q")) < 0) + if((gidQ = H5Gopen2(fid1, "B/I/Q", H5P_DEFAULT)) < 0) TEST_ERROR /* Check name */ @@ -3507,13 +3460,13 @@ test_cut_graph(hid_t fapl) /* Attempt to open an object in file #4, from file #1 */ H5E_BEGIN_TRY { - gidK = H5Gopen(gidQ, "/A/D/K"); + gidK = H5Gopen2(gidQ, "/A/D/K", H5P_DEFAULT); } H5E_END_TRY; if(gidK >= 0) TEST_ERROR /* Open object in file #4 from file #5 */ - if((gidK = H5Gopen(gidM, "/D/K")) < 0) + if((gidK = H5Gopen2(gidM, "/D/K", H5P_DEFAULT)) < 0) TEST_ERROR /* Check the name of "K" is correct */ @@ -3527,13 +3480,13 @@ test_cut_graph(hid_t fapl) /* Attempt to open an object in file #6, from file #5 */ H5E_BEGIN_TRY { - gidO = H5Gopen(gidM, "/B/H/O"); + gidO = H5Gopen2(gidM, "/B/H/O", H5P_DEFAULT); } H5E_END_TRY; if(gidO >= 0) TEST_ERROR /* Open object in file #6 from file #7 */ - if((gidO = H5Gopen(gidQ, "/B/H/O")) < 0) + if((gidO = H5Gopen2(gidQ, "/B/H/O", H5P_DEFAULT)) < 0) TEST_ERROR /* Check the name of "O" is correct */ @@ -3585,7 +3538,7 @@ test_cut_graph(hid_t fapl) TEST_ERROR /* Open object in file #6 from file #7 */ - if((gidO = H5Gopen(gidQ, "/H/O")) < 0) + if((gidO = H5Gopen2(gidQ, "/H/O", H5P_DEFAULT)) < 0) TEST_ERROR /* Check the name of "O" is correct */ @@ -3741,7 +3694,7 @@ test_symlink(hid_t fapl) /* Attempt to open an object in file #3 (should fail) */ H5E_BEGIN_TRY { - gidL = H5Gopen(fid1, "L"); + gidL = H5Gopen2(fid1, "L", H5P_DEFAULT); } H5E_END_TRY; if(gidL >= 0) TEST_ERROR @@ -3755,7 +3708,7 @@ test_symlink(hid_t fapl) TEST_ERROR /* Open soft link to object in file #3 */ - if((gidL = H5Gopen(fid1, "L")) < 0) + if((gidL = H5Gopen2(fid1, "L", H5P_DEFAULT)) < 0) TEST_ERROR /* Check the name of "L" is correct */ @@ -3829,7 +3782,7 @@ main(void) if (HDstrcmp(envval, "split") && HDstrcmp(envval, "multi")) { h5_reset(); fapl = h5_fileaccess(); - if (setup(fapl)<0) goto error; + if (setup(fapl) < 0) goto error; nerrors += test_basic(fapl); nerrors += test_illegal(fapl); diff --git a/test/objcopy.c b/test/objcopy.c index 32b0995..8cdca26 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1334,8 +1334,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags) case H5G_GROUP: /* Open groups */ - if((oid = H5Gopen(gid, objname)) < 0) TEST_ERROR - if((oid2 = H5Gopen(gid2, objname2)) < 0) TEST_ERROR + if((oid = H5Gopen2(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((oid2 = H5Gopen2(gid2, objname2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Compare groups */ if(compare_groups(oid, oid2, pid, depth - 1, copy_flags) != TRUE) TEST_ERROR @@ -3045,10 +3045,10 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -3184,10 +3184,10 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -3318,10 +3318,10 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -3459,10 +3459,10 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -4228,10 +4228,10 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_EMPTY, fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_EMPTY)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_EMPTY)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_EMPTY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -4359,10 +4359,10 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -4492,10 +4492,10 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, "/", fid_dst, "/root_from_src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, "/")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, "/root_from_src")) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, "/root_from_src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -4634,10 +4634,10 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -4745,10 +4745,10 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -4874,10 +4874,10 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -5010,10 +5010,10 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_LINK)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Check if the groups are equal */ if(compare_groups(gid, gid2, H5P_DEFAULT, -1, 0) != TRUE) TEST_ERROR @@ -7081,10 +7081,10 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo if(H5Pclose(lcpl_id) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, "/new_g0/new_g00")) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } else if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) { if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) TEST_ERROR @@ -7094,27 +7094,27 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo if(H5Gunlink(fid_src, NAME_DATASET_SUB_SUB) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_LINK2)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_LINK)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } else if(flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) { if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } else if(flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) { if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_TOP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Set the copy depth */ depth = 1; @@ -7122,10 +7122,10 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo if(H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0) TEST_ERROR /* open the group for copy */ - if((gid = H5Gopen(fid_src, NAME_GROUP_REF)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* open the destination group */ - if((gid2 = H5Gopen(fid_dst, NAME_GROUP_REF)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } else { /* Unknown flag */ TEST_ERROR diff --git a/test/stab.c b/test/stab.c index f8d452d..d49d3a8 100644 --- a/test/stab.c +++ b/test/stab.c @@ -117,9 +117,9 @@ test_misc(hid_t fapl, hbool_t new_format) if(H5Gclose(g3) < 0) TEST_ERROR /* Open all groups with absolute names to check for exsistence */ - if((g1 = H5Gopen(fid, "/test_1a")) < 0) TEST_ERROR - if((g2 = H5Gopen(fid, "/test_1a/sub_1")) < 0) TEST_ERROR - if((g3 = H5Gopen(fid, "/test_1b")) < 0) TEST_ERROR + if((g1 = H5Gopen2(fid, "/test_1a", H5P_DEFAULT)) < 0) TEST_ERROR + if((g2 = H5Gopen2(fid, "/test_1a/sub_1", H5P_DEFAULT)) < 0) TEST_ERROR + if((g3 = H5Gopen2(fid, "/test_1b", H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gget_comment(g3, "././.", sizeof comment, comment) < 0) TEST_ERROR if(HDstrcmp(comment, "hello world")) { H5_FAILED(); @@ -204,8 +204,8 @@ test_long(hid_t fapl, hbool_t new_format) if(H5Gclose(g2) < 0) TEST_ERROR /* Open groups */ - if((g1 = H5Gopen(fid, name1)) < 0) TEST_ERROR - if((g2 = H5Gopen(fid, name2)) < 0) TEST_ERROR + if((g1 = H5Gopen2(fid, name1, H5P_DEFAULT)) < 0) TEST_ERROR + if((g2 = H5Gopen2(fid, name2, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(g1) < 0) TEST_ERROR if(H5Gclose(g2) < 0) TEST_ERROR @@ -708,7 +708,7 @@ read_old(hid_t fapl2) if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl2)) < 0) TEST_ERROR /* Attempt to open "old" group */ - if((gid = H5Gopen(fid, "old")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "old", H5P_DEFAULT)) < 0) TEST_ERROR /* Check on old group's status */ if(H5G_is_empty_test(gid) == FALSE) TEST_ERROR @@ -929,7 +929,7 @@ gcpl_on_root(hid_t fapl2) if(H5Pclose(fcpl) < 0) TEST_ERROR /* Open the root group */ - if((gid = H5Gopen(fid, "/")) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR /* Query the group creation properties */ if((gcpl = H5Gget_create_plist(gid)) < 0) TEST_ERROR @@ -963,7 +963,7 @@ gcpl_on_root(hid_t fapl2) if(H5Gclose(gid2) < 0) TEST_ERROR /* Open the middle group */ - if((gid2 = H5Gopen(fid, GCPL_ON_ROOT_MIDDLE_GROUP)) < 0) TEST_ERROR + if((gid2 = H5Gopen2(fid, GCPL_ON_ROOT_MIDDLE_GROUP, H5P_DEFAULT)) < 0) TEST_ERROR /* Query the group creation properties */ if((gcpl = H5Gget_create_plist(gid2)) < 0) TEST_ERROR @@ -1058,6 +1058,12 @@ old_api(hid_t fapl, const char *driver) /* Close group */ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Re-open group */ + if((gid = H5Gopen1(fid, OLD_API_GROUP)) < 0) FAIL_STACK_ERROR + + /* Close group */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + /* Close file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR @@ -1074,6 +1080,7 @@ old_api(hid_t fapl, const char *driver) #else /* H5_NO_DEPRECATED_SYMBOLS */ /* Shut compiler up */ fapl = fapl; + driver = driver; SKIPPED(); puts(" Deprecated API symbols not enabled"); diff --git a/test/tattr.c b/test/tattr.c index 969a0d9..b836d98 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -199,8 +199,8 @@ test_attr_basic_write(hid_t fapl) CHECK(ret, FAIL, "H5Aclose"); /* Open the root group */ - group = H5Gopen(fid1, "/"); - CHECK(group, FAIL, "H5Gopen"); + group = H5Gopen2(fid1, "/", H5P_DEFAULT); + CHECK(group, FAIL, "H5Gopen2"); /* Open attribute again */ attr = H5Aopen_name(group, ATTR1_NAME); @@ -432,8 +432,8 @@ test_attr_basic_read(hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Open the group */ - group = H5Gopen(fid1,GROUP1_NAME); - CHECK(group, FAIL, "H5Gopen"); + group = H5Gopen2(fid1, GROUP1_NAME, H5P_DEFAULT); + CHECK(group, FAIL, "H5Gopen2"); /* Verify the correct number of attributes */ ret=H5Aget_num_attrs(group); @@ -3908,8 +3908,8 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Re-open group */ - gid = H5Gopen(fid, GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Delete attribute */ ret = H5Adelete2(gid, ".", "attr-003", H5P_DEFAULT); @@ -8121,8 +8121,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Gclose"); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Create attribute on first group */ aid = H5Acreate(gid, ATTR7_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT); @@ -8154,8 +8154,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Gunlink"); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Create another attribute on first group */ aid = H5Acreate(gid, ATTR8_NAME, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT); @@ -8176,8 +8176,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Re-open first group */ - gid = H5Gopen(fid, GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Delete first attribute */ ret = H5Adelete(gid, ATTR7_NAME); diff --git a/test/tfile.c b/test/tfile.c index 882061f..e477622 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -833,13 +833,13 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, if(ret_gid1 != NULL) *ret_gid1 = gid1; - gid2 = H5Gopen(fid2, "/group"); - CHECK(gid2, FAIL, "H5Gopen"); + gid2 = H5Gopen2(fid2, "/group", H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gopen2"); if(ret_gid2 != NULL) *ret_gid2 = gid2; - gid3 = H5Gopen(fid2, "/group"); - CHECK(gid3, FAIL, "H5Gopen"); + gid3 = H5Gopen2(fid2, "/group", H5P_DEFAULT); + CHECK(gid3, FAIL, "H5Gopen2"); if(ret_gid3 != NULL) *ret_gid3 = gid3; } @@ -917,8 +917,8 @@ test_get_file_id(void) fid = H5Fopen(FILE4, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); - group_id = H5Gopen(fid, GRP_NAME); - CHECK(group_id, FAIL, "H5Gopen"); + group_id = H5Gopen2(fid, GRP_NAME, H5P_DEFAULT); + CHECK(group_id, FAIL, "H5Gopen2"); /* Test H5Iget_file_id() */ check_file_id(fid, group_id); @@ -1446,15 +1446,15 @@ test_file_open_dot(void) VERIFY(gid2, FAIL, "H5Gcreate2"); /* Open a group with no name using the file ID (should open the root group) */ - gid2 = H5Gopen(fid, "."); - CHECK(gid2, FAIL, "H5Gopen"); + gid2 = H5Gopen2(fid, ".", H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gopen2"); ret = H5Gclose(gid2); CHECK(ret, FAIL, "H5Gclose"); /* Open a group with no name using the group ID (should open the group again) */ - gid2 = H5Gopen(gid, "."); - CHECK(gid2, FAIL, "H5Gopen"); + gid2 = H5Gopen2(gid, ".", H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gopen2"); ret = H5Gclose(gid2); CHECK(ret, FAIL, "H5Gclose"); @@ -1695,10 +1695,10 @@ test_file_double_root_open(void) file2_id = H5Fopen (FILE1, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file2_id, FAIL, "H5Fopen"); - grp1_id = H5Gopen(file1_id, "/"); - CHECK(grp1_id, FAIL, "H5Gopen"); - grp2_id = H5Gopen(file2_id, "/"); - CHECK(grp2_id, FAIL, "H5Gopen"); + grp1_id = H5Gopen2(file1_id, "/", H5P_DEFAULT); + CHECK(grp1_id, FAIL, "H5Gopen2"); + grp2_id = H5Gopen2(file2_id, "/", H5P_DEFAULT); + CHECK(grp2_id, FAIL, "H5Gopen2"); /* Note "assymetric" close order */ ret = H5Gclose(grp1_id); @@ -1736,8 +1736,8 @@ test_file_double_group_open(void) grp1_id = H5Gcreate2(file1_id, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); CHECK(grp1_id, FAIL, "H5Gcreate2"); - grp2_id = H5Gopen(file2_id, GRP_NAME); - CHECK(grp2_id, FAIL, "H5Gopen"); + grp2_id = H5Gopen2(file2_id, GRP_NAME, H5P_DEFAULT); + CHECK(grp2_id, FAIL, "H5Gopen2"); /* Note "assymetric" close order */ ret = H5Gclose(grp1_id); diff --git a/test/th5o.c b/test/th5o.c index e83b920..86c8c84 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -213,8 +213,8 @@ test_h5o_close(void) CHECK(ret, FAIL, "H5Oclose"); /* Make sure H5Oclose can close objects opened with H5*open */ - grp = H5Gopen(fid, "group"); - CHECK(grp, FAIL, "H5Gopen"); + grp = H5Gopen2(fid, "group", H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen(fid, "group/datatype"); CHECK(dtype, FAIL, "H5Topen"); dset = H5Dopen(fid, "dataset"); @@ -478,12 +478,12 @@ test_h5o_refcount(void) fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); - grp = H5Gopen(fid, "group"); - CHECK(grp, FAIL, "H5Gopen"); + grp = H5Gopen2(fid, "group", H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen(fid, "datatype"); - CHECK(dtype, FAIL, "H5Gopen"); + CHECK(dtype, FAIL, "H5Topen"); dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Gopen"); + CHECK(dset, FAIL, "H5Dopen"); ret = H5Gget_objinfo(fid, "group", FALSE, &sb); CHECK(ret, FAIL, "H5Gget_objinfo"); @@ -516,12 +516,12 @@ test_h5o_refcount(void) fid = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); - grp = H5Gopen(fid, "group"); - CHECK(grp, FAIL, "H5Gopen"); + grp = H5Gopen2(fid, "group", H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen(fid, "datatype"); - CHECK(dtype, FAIL, "H5Gopen"); + CHECK(dtype, FAIL, "H5Topen"); dset = H5Dopen(fid, "dataset"); - CHECK(dset, FAIL, "H5Gopen"); + CHECK(dset, FAIL, "H5Dopen"); ret = H5Gget_objinfo(fid, "group", FALSE, &sb); CHECK(ret, FAIL, "H5Gget_objinfo"); @@ -706,8 +706,8 @@ test_h5o_plist(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open objects */ - grp = H5Gopen(fid, "group"); - CHECK(grp, FAIL, "H5Gopen"); + grp = H5Gopen2(fid, "group", H5P_DEFAULT); + CHECK(grp, FAIL, "H5Gopen2"); dtype = H5Topen(fid, "datatype"); CHECK(dtype, FAIL, "H5Topen"); dset = H5Dopen(fid, "dataset"); diff --git a/test/titerate.c b/test/titerate.c index 5fc568f..289c3bb 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -202,8 +202,8 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) * iterate through B-tree for group members in internal library design. */ { - root_group = H5Gopen(file, "/"); - CHECK(root_group, FAIL, "H5Gopen"); + root_group = H5Gopen2(file, "/", H5P_DEFAULT); + CHECK(root_group, FAIL, "H5Gopen2"); ret = H5Gget_num_objs(root_group, &num_membs); CHECK(ret, FAIL, "H5Gget_num_objs"); @@ -765,8 +765,8 @@ static void test_grp_memb_funcs(hid_t fapl) /* These two functions, H5Gget_num_objs and H5Gget_objname_by_idx, actually * iterate through B-tree for group members in internal library design. */ - root_group = H5Gopen(file, "/"); - CHECK(root_group, FAIL, "H5Gopen"); + root_group = H5Gopen2(file, "/", H5P_DEFAULT); + CHECK(root_group, FAIL, "H5Gopen2"); ret = H5Gget_num_objs(root_group, &num_membs); CHECK(ret, FAIL, "H5Gget_num_objs"); diff --git a/test/tmisc.c b/test/tmisc.c index 58cad14..8320979 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -423,8 +423,8 @@ static void test_misc2_write_attribute(void) file1 = H5Fcreate(MISC2_FILE_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); - root1 = H5Gopen(file1, "/"); - CHECK(root1, FAIL, "H5Gopen"); + root1 = H5Gopen2(file1, "/", H5P_DEFAULT); + CHECK(root1, FAIL, "H5Gopen2"); att1 = H5Acreate(root1, MISC2_ATT_NAME_1, type, dataspace, H5P_DEFAULT); CHECK(att1, FAIL, "H5Acreate"); @@ -450,8 +450,8 @@ static void test_misc2_write_attribute(void) - root2 = H5Gopen(file2, "/"); - CHECK(root2, FAIL, "H5Gopen"); + root2 = H5Gopen2(file2, "/", H5P_DEFAULT); + CHECK(root2, FAIL, "H5Gopen2"); att2 = H5Acreate(root2, MISC2_ATT_NAME_2, type, dataspace, H5P_DEFAULT); CHECK(att2, FAIL, "H5Acreate"); @@ -499,8 +499,8 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name file = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); - root = H5Gopen(file, "/"); - CHECK(root, FAIL, "H5Gopen"); + root = H5Gopen2(file, "/", H5P_DEFAULT); + CHECK(root, FAIL, "H5Gopen2"); att = H5Aopen_name(root, att_name); CHECK(att, FAIL, "H5Aopen_name"); @@ -2330,8 +2330,8 @@ verify_file(const char *name, hsize_t blk_size, unsigned check_new_data) CHECK(ret, FAIL, "H5Tclose"); /* Open the first group */ - gid = H5Gopen(fid, MISC13_GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC13_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Verify the contiguous dataset in the first group */ verify_dataset(gid,MISC13_DSET1_NAME); @@ -2351,8 +2351,8 @@ verify_file(const char *name, hsize_t blk_size, unsigned check_new_data) CHECK(ret, FAIL, "H5Tclose"); /* Open the second group */ - gid2 = H5Gopen(gid, MISC13_GROUP2_NAME); - CHECK(gid2, FAIL, "H5Gopen"); + gid2 = H5Gopen2(gid, MISC13_GROUP2_NAME, H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gopen2"); /* Close the second group */ ret = H5Gclose(gid2); @@ -3199,8 +3199,8 @@ test_misc19(void) CHECK(fid, FAIL, "H5Fcreate"); /* Open the root group */ - gid = H5Gopen(fid,"/"); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, "/", H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Create a dataspace */ sid = H5Screate(H5S_SCALAR); @@ -3877,8 +3877,8 @@ test_misc23(void) CHECK(status, FAIL, "H5Gclose"); /* Check that intermediate group is set up correctly */ - tmp_id = H5Gopen(file_id, "/A/B01"); - CHECK(tmp_id, FAIL, "H5Gopen"); + tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT); + CHECK(tmp_id, FAIL, "H5Gopen2"); status = H5Gget_objinfo(tmp_id, ".", FALSE, &sb); CHECK(status, FAIL, "H5Gget_objinfo"); @@ -4132,14 +4132,14 @@ test_misc24(void) VERIFY(tmp_id, FAIL, "H5Topen"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATASET_NAME); + tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATASET_LINK); + tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { tmp_id = H5Topen(file_id, MISC24_DATASET_NAME); @@ -4152,14 +4152,14 @@ test_misc24(void) VERIFY(tmp_id, FAIL, "H5Topen"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATATYPE_NAME); + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATATYPE_LINK); + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { tmp_id = H5Dopen(file_id, MISC24_DATATYPE_NAME); @@ -4173,8 +4173,8 @@ test_misc24(void) /* Try again, with the object already open through valid call */ /* Open group */ - group_id = H5Gopen(file_id, MISC24_GROUP_NAME); - CHECK(group_id, FAIL, "H5Gopen"); + group_id = H5Gopen2(file_id, MISC24_GROUP_NAME, H5P_DEFAULT); + CHECK(group_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { tmp_id = H5Dopen(file_id, MISC24_GROUP_NAME); @@ -4204,14 +4204,14 @@ test_misc24(void) CHECK(dset_id, FAIL, "H5Dopen"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATASET_NAME); + tmp_id = H5Gopen2(file_id, MISC24_DATASET_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATASET_LINK); + tmp_id = H5Gopen2(file_id, MISC24_DATASET_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { tmp_id = H5Topen(file_id, MISC24_DATASET_NAME); @@ -4231,14 +4231,14 @@ test_misc24(void) CHECK(ret, FAIL, "H5Topen"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATATYPE_NAME); + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_NAME, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { - tmp_id = H5Gopen(file_id, MISC24_DATATYPE_LINK); + tmp_id = H5Gopen2(file_id, MISC24_DATATYPE_LINK, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(tmp_id, FAIL, "H5Gopen"); + VERIFY(tmp_id, FAIL, "H5Gopen2"); H5E_BEGIN_TRY { tmp_id = H5Dopen(file_id, MISC24_DATATYPE_NAME); @@ -4315,8 +4315,8 @@ test_misc25a(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open first group */ - gid = H5Gopen(fid, MISC25A_GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25A_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Create dataspace for attribute */ sid = H5Screate(H5S_SCALAR); @@ -4392,8 +4392,8 @@ test_misc25a(void) CHECK(ret, FAIL, "H5Gclose"); /* Re-open first group */ - gid = H5Gopen(fid, MISC25A_GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25A_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Delete 2nd attribute */ ret = H5Adelete(gid, MISC25A_ATTR2_NAME); @@ -4414,8 +4414,8 @@ test_misc25a(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open first group */ - gid = H5Gopen(fid, MISC25A_GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25A_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Create dataspace for 3rd attribute */ sid = H5Screate(H5S_SCALAR); @@ -4458,8 +4458,8 @@ test_misc25a(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open first group */ - gid = H5Gopen(fid, MISC25A_GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25A_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Delete 3rd attribute */ ret = H5Adelete(gid, MISC25A_ATTR3_NAME); @@ -4505,8 +4505,8 @@ test_misc25a(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open first group */ - gid = H5Gopen(fid, MISC25A_GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25A_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Delete 2nd attribute */ ret = H5Adelete(gid, MISC25A_ATTR2_NAME); @@ -4526,8 +4526,8 @@ test_misc25a(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open first group */ - gid = H5Gopen(fid, MISC25A_GROUP1_NAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25A_GROUP1_NAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Create dataspace for 3rd attribute */ sid = H5Screate(H5S_SCALAR); @@ -4595,8 +4595,8 @@ test_misc25b(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open group with object header messages that will merge */ - gid = H5Gopen(fid, MISC25B_GROUP); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25B_GROUP, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Close first group */ ret = H5Gclose(gid); @@ -4721,8 +4721,8 @@ test_misc25c(void) CHECK(fid, FAIL, "H5Fopen"); /* Re-open the dataset group */ - gid = H5Gopen(fid, MISC25C_DSETGRPNAME); - CHECK(gid, FAIL, "H5Gopen"); + gid = H5Gopen2(fid, MISC25C_DSETGRPNAME, H5P_DEFAULT); + CHECK(gid, FAIL, "H5Gopen2"); /* Rename the dataset */ ret = H5Gmove(gid, MISC25C_DSETNAME, MISC25C_DSETNAME2); diff --git a/test/tsohm.c b/test/tsohm.c index 7948443..16acf71 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -1549,8 +1549,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size CHECK_I(ret, "H5Gclose"); file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - group_id = H5Gopen(file_id, "group"); - CHECK_I(group_id, "H5Gopen"); + group_id = H5Gopen2(file_id, "group", H5P_DEFAULT); + CHECK_I(group_id, "H5Gopen2"); } } @@ -1603,8 +1603,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size CHECK_I(ret, "H5Gclose"); file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - group_id = H5Gopen(file_id, "interleaved group"); - CHECK_I(group_id, "H5Gopen"); + group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); + CHECK_I(group_id, "H5Gopen2"); } } @@ -1620,8 +1620,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size */ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - group_id = H5Gopen(file_id, "group"); - CHECK_I(group_id, "H5Gopen"); + group_id = H5Gopen2(file_id, "group", H5P_DEFAULT); + CHECK_I(group_id, "H5Gopen2"); strcpy(attr_name, "00 index"); @@ -1646,8 +1646,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size CHECK_I(ret, "H5Gclose"); file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - group_id = H5Gopen(file_id, "group"); - CHECK_I(group_id, "H5Gopen"); + group_id = H5Gopen2(file_id, "group", H5P_DEFAULT); + CHECK_I(group_id, "H5Gopen2"); } } @@ -1662,8 +1662,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size /* Create all of the attributes again on the other group */ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - group_id = H5Gopen(file_id, "interleaved group"); - CHECK_I(group_id, "H5Gopen"); + group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); + CHECK_I(group_id, "H5Gopen2"); for(x=0; x<NUM_ATTRIBUTES; ++x) { @@ -1686,8 +1686,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size CHECK_I(ret, "H5Gclose"); file_id = close_reopen_file(file_id, FILENAME, H5P_DEFAULT); CHECK_I(file_id, "H5Fopen"); - group_id = H5Gopen(file_id, "interleaved group"); - CHECK_I(group_id, "H5Gopen"); + group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); + CHECK_I(group_id, "H5Gopen2"); } } /* Close file and get its size now */ @@ -1784,8 +1784,8 @@ static void size2_verify(void) } /* Get property lists from second batch of datasets */ - group1_id = H5Gopen(file_id, "group"); - CHECK_I(group1_id, "H5Gopen"); + group1_id = H5Gopen2(file_id, "group", H5P_DEFAULT); + CHECK_I(group1_id, "H5Gopen2"); for(x=0; x<NUM_DATASETS; ++x) { dset_id = H5Dopen(group1_id, DSETNAME[x]); @@ -1814,8 +1814,8 @@ static void size2_verify(void) CHECK_I(ret, "H5Gclose"); /* Get property lists from interleaved group of datasets */ - group1_id = H5Gopen(file_id, "interleaved group"); - CHECK_I(group1_id, "H5Gopen"); + group1_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); + CHECK_I(group1_id, "H5Gopen2"); for(x = 0; x < NUM_DATASETS; x += 2) { /* First "type 1" dataset */ dset_id = H5Dopen(group1_id, DSETNAME[x]); @@ -1876,10 +1876,10 @@ static void size2_verify(void) CHECK_I(ret, "H5Tset_size"); /* Read attributes on both groups and verify that they are correct */ - group1_id = H5Gopen(file_id, "group"); - CHECK_I(group1_id, "H5Gopen"); - group2_id = H5Gopen(file_id, "interleaved group"); - CHECK_I(group2_id, "H5Gopen"); + group1_id = H5Gopen2(file_id, "group", H5P_DEFAULT); + CHECK_I(group1_id, "H5Gopen2"); + group2_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT); + CHECK_I(group2_id, "H5Gopen2"); HDmemset(attr_string, 0, NAME_BUF_SIZE); HDmemset(attr_correct_string, 0, NAME_BUF_SIZE); diff --git a/test/tvlstr.c b/test/tvlstr.c index a73151b..272186b 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -590,8 +590,8 @@ static void test_write_vl_string_attribute(void) ret = H5Tset_size (type, H5T_VARIABLE); CHECK(ret, FAIL, "H5Tset_size"); - root = H5Gopen(file, "/"); - CHECK(root, FAIL, "H5Gopen"); + root = H5Gopen2(file, "/", H5P_DEFAULT); + CHECK(root, FAIL, "H5Gopen2"); dataspace = H5Screate(H5S_SCALAR); CHECK(dataspace, FAIL, "H5Screate"); @@ -676,8 +676,8 @@ static void test_read_vl_string_attribute(void) ret = H5Tset_size (type, H5T_VARIABLE); CHECK(ret, FAIL, "H5Tset_size"); - root = H5Gopen(file, "/"); - CHECK(root, FAIL, "H5Gopen"); + root = H5Gopen2(file, "/", H5P_DEFAULT); + CHECK(root, FAIL, "H5Gopen2"); /* Test reading "normal" sized string attribute */ att = H5Aopen_name(root, "test_scalar"); diff --git a/test/unlink.c b/test/unlink.c index 9a515b3..f2391b1 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -314,7 +314,7 @@ test_rename(hid_t file) if((inner = H5Gcreate2(foo, "inner", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR if(H5Gclose(inner) < 0) TEST_ERROR if(H5Gclose(foo) < 0) TEST_ERROR - if((inner = H5Gopen(work, "bar/inner")) < 0) TEST_ERROR + if((inner = H5Gopen2(work, "bar/inner", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(inner) < 0) TEST_ERROR PASSED(); @@ -393,7 +393,7 @@ test_new_move(hid_t fapl) if(H5Gmove2(grp_1, "group_move", grp_2, "group_new_name") < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen(grp_2, "group_new_name")) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(grp_1) < 0) TEST_ERROR if(H5Gclose(grp_2) < 0) TEST_ERROR @@ -1010,13 +1010,13 @@ test_filespace(hid_t fapl) for(u=FILESPACE_TOP_GROUPS; u>0; u--) { /* Open group */ sprintf(objname,"%s %u",GROUPNAME,(u-1)); - if((group = H5Gopen (file, objname)) < 0) TEST_ERROR + if((group = H5Gopen2(file, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open nested groups inside top groups */ for(v=0; v<FILESPACE_NESTED_GROUPS; v++) { /* Create group */ sprintf(objname,"%s %u",GROUP2NAME,v); - if((group2 = H5Gopen (group, objname)) < 0) TEST_ERROR + if((group2 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Remove datasets inside nested groups */ for(w=0; w<FILESPACE_NDATASETS; w++) { @@ -1400,7 +1400,7 @@ test_unlink_slashes(hid_t fapl) if((fid=H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR /* Open the top level group */ - if((gid = H5Gopen(fid, SLASHES_GROUP_NAME)) < 0) TEST_ERROR + if((gid = H5Gopen2(fid, SLASHES_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete the root link */ if(H5Gunlink(gid,SLASHES_ROOTLINK_NAME) < 0) TEST_ERROR @@ -1456,7 +1456,7 @@ static int delete_node (hid_t pid, hid_t id) if(HDstrcmp(name,"/Zone81")==0) { hid_t gid; - if((gid = H5Gopen (pid, "/Zone80")) < 0) return(-1); + if((gid = H5Gopen2(pid, "/Zone80", H5P_DEFAULT)) < 0) return(-1); if(H5Gclose(gid) < 0) return(-1); } /* end if */ @@ -1493,10 +1493,9 @@ test_unlink_rightleaf(hid_t fid) TESTING("deleting right-most child in non-leaf B-tree node"); /* Allocate space for the group IDs */ - gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t)); - if(gids==NULL) TEST_ERROR + if(NULL == (gids = (hid_t *)HDmalloc(ngroups * sizeof(hid_t)))) TEST_ERROR - if((rootid = H5Gopen (fid, "/")) < 0) TEST_ERROR + if((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create all the groups */ for (n = 0; n < ngroups; n++) { @@ -1557,10 +1556,9 @@ test_unlink_rightnode(hid_t fid) TESTING("deleting right-most child in non-leaf B-tree node"); /* Allocate space for the group IDs */ - gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t)); - if(gids==NULL) TEST_ERROR + if(NULL == (gids = (hid_t *)HDmalloc(ngroups * sizeof(hid_t)))) TEST_ERROR - if((rootid = H5Gopen (fid, "/")) < 0) TEST_ERROR + if((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create all the groups */ for (n = 0; n < ngroups; n++) { @@ -1621,10 +1619,9 @@ test_unlink_middlenode(hid_t fid) TESTING("deleting right-most child in non-leaf B-tree node"); /* Allocate space for the group IDs */ - gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t)); - if(gids==NULL) TEST_ERROR + if(NULL == (gids = (hid_t *)HDmalloc(ngroups * sizeof(hid_t)))) TEST_ERROR - if((rootid = H5Gopen (fid, "/")) < 0) TEST_ERROR + if((rootid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create all the groups */ for (n = 0; n < ngroups; n++) { @@ -1987,10 +1984,10 @@ test_resurrect_group(hid_t fapl) if(H5Fclose(file) < 0) TEST_ERROR /* Re-open the file */ - if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Attempt to open the datatype under the new name */ - if((group=H5Gopen(file,GROUP2NAME)) < 0) TEST_ERROR + if((group = H5Gopen2(file, GROUP2NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close things */ if(H5Gclose(group) < 0) TEST_ERROR @@ -1068,8 +1068,8 @@ test_multi(void) TEST_ERROR; /* Create and write attribute for the root group. */ - if((root = H5Gopen(file, "/"))<0) - TEST_ERROR; + if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* Attribute string. */ if((atype = H5Tcopy(H5T_C_S1))<0) diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index c282408..085fbfc 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -893,7 +893,7 @@ void group_dataset_read(hid_t fid, int mpi_rank, int m) /* open every group under root group. */ sprintf(gname, "group%d", m); - gid = H5Gopen(fid, gname); + gid = H5Gopen2(fid, gname, H5P_DEFAULT); VRFY((gid > 0), gname); /* check the data. */ @@ -1020,7 +1020,7 @@ void multiple_group_write(void) } /* recursively creates subgroups under the first group. */ - gid = H5Gopen(fid, "group0"); + gid = H5Gopen2(fid, "group0", H5P_DEFAULT); create_group_recursive(memspace, filespace, gid, 0); ret = H5Gclose(gid); VRFY((ret>=0), "H5Gclose"); @@ -1163,7 +1163,7 @@ void multiple_group_read(void) /* open every group under root group. */ for(m=0; m<ngroups; m++) { sprintf(gname, "group%d", m); - gid = H5Gopen(fid, gname); + gid = H5Gopen2(fid, gname, H5P_DEFAULT); VRFY((gid > 0), gname); /* check the data. */ @@ -1185,7 +1185,7 @@ void multiple_group_read(void) } /* open all the groups in vertical direction. */ - gid = H5Gopen(fid, "group0"); + gid = H5Gopen2(fid, "group0", H5P_DEFAULT); VRFY((gid>0), "group0"); recursive_read_group(memspace, filespace, gid, 0); H5Gclose(gid); @@ -1278,7 +1278,7 @@ void recursive_read_group(hid_t memspace, hid_t filespace, hid_t gid, if( counter < GROUP_DEPTH ) { sprintf(gname, "%dth_child_group", counter+1); - child_gid = H5Gopen(gid, gname); + child_gid = H5Gopen2(gid, gname, H5P_DEFAULT); VRFY((child_gid>0), gname); recursive_read_group(memspace, filespace, child_gid, counter+1); H5Gclose(child_gid); diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index 5c3326b..2839cf8 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -89,25 +89,26 @@ int check_file(char* name, hid_t fapl) } /* Open some groups */ - if ((groups=H5Gopen(file, "some_groups"))<0) goto error; - for (i=0; i<100; i++) { + if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error; + for(i = 0; i < 100; i++) { sprintf(name, "grp%02u", (unsigned)i); - if ((grp=H5Gopen(groups, name))<0) goto error; - if (H5Gclose(grp)<0) goto error; + if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error; + if(H5Gclose(grp) < 0) goto error; } - if (H5Gclose(groups)<0) goto error; - if (H5Dclose(dset)<0) goto error; - if (H5Fclose(file)<0) goto error; - if (H5Pclose(plist)<0) goto error; + if(H5Gclose(groups) < 0) goto error; + if(H5Dclose(dset) < 0) goto error; + if(H5Fclose(file) < 0) goto error; + if(H5Pclose(plist) < 0) goto error; + return 0; -error: - if (H5Fclose(file)<0) goto error; - if (H5Pclose(plist)<0) goto error; +error: + H5E_BEGIN_TRY { + H5Fclose(file); + H5Pclose(plist); + } H5E_END_TRY; return 1; - - } /*------------------------------------------------------------------------- diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 12acd77..fa3ec77 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -629,7 +629,7 @@ int test_attributes(const char *file, /* Create groups */ gid = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen(fid, "/"); + root_id = H5Gopen2(fid, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group, and root group diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ac4c1d2..ec89210 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -28,10 +28,12 @@ const char *progname = "h5dump"; /* Macros for displaying objects */ #define begin_obj(obj,name,begin) \ - if (name) \ - printf("%s \"%s\" %s\n", (obj), (name), (begin)); \ - else \ - printf("%s %s\n", (obj), (begin)); + do { \ + if (name) \ + printf("%s \"%s\" %s\n", (obj), (name), (begin)); \ + else \ + printf("%s %s\n", (obj), (begin)); \ + } while(0); #define end_obj(obj,end) \ if(HDstrlen(end)) { \ @@ -1294,99 +1296,95 @@ dump_selected_attr(hid_t loc_id, const char *name) dump_header_format->attributeblockbegin); H5Gget_objinfo(loc_id, obj_name, FALSE, &statbuf); - switch (statbuf.type) { - case H5G_GROUP: - if ((oid = H5Gopen(loc_id, obj_name)) < 0) { - indentation(COL); - error_msg(progname, "unable to open group \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } - break; + switch(statbuf.type) { + case H5G_GROUP: + if((oid = H5Gopen2(loc_id, obj_name, H5P_DEFAULT)) < 0) { + indentation(COL); + error_msg(progname, "unable to open group \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - case H5G_DATASET: - if ((oid = H5Dopen(loc_id, obj_name)) < 0) { - indentation(COL); - error_msg(progname, "unable to open dataset \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } - break; + case H5G_DATASET: + if((oid = H5Dopen(loc_id, obj_name)) < 0) { + indentation(COL); + error_msg(progname, "unable to open dataset \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - case H5G_TYPE: - if ((oid = H5Topen(loc_id, obj_name)) < 0) { - indentation(COL); - error_msg(progname, "unable to open datatype \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } - break; + case H5G_TYPE: + if((oid = H5Topen(loc_id, obj_name)) < 0) { + indentation(COL); + error_msg(progname, "unable to open datatype \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - default: - indentation(COL); - error_msg(progname, "unable to open unknown \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - return FAIL; - } + default: + indentation(COL); + error_msg(progname, "unable to open unknown \"%s\"\n", obj_name); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); + d_status = EXIT_FAILURE; + return FAIL; + } /* end switch */ - if ((attr_id = H5Aopen_name(oid, attr_name)) >= 0) { - type = H5Aget_type(attr_id); - space = H5Aget_space(attr_id); - dump_datatype(type); - dump_dataspace(space); + if((attr_id = H5Aopen_name(oid, attr_name)) >= 0) { + type = H5Aget_type(attr_id); + space = H5Aget_space(attr_id); + dump_datatype(type); + dump_dataspace(space); - if (display_oid) - dump_oid(attr_id); + if(display_oid) + dump_oid(attr_id); - if (display_data || display_attr_data) - dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); + if(display_data || display_attr_data) + dump_data(attr_id, ATTRIBUTE_DATA, NULL, display_ai); - H5Tclose(type); - H5Sclose(space); - H5Aclose(attr_id); - end_obj(dump_header_format->attributeend, + H5Tclose(type); + H5Sclose(space); + H5Aclose(attr_id); + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); } else { - indentation(COL); + indentation(COL); error_msg(progname, "unable to open attribute \"%s\"\n", obj_name); - end_obj(dump_header_format->attributeend, - dump_header_format->attributeblockend); - d_status = EXIT_FAILURE; - } - - switch (statbuf.type) { - case H5G_GROUP: - if (H5Gclose(oid) < 0) { + end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend); d_status = EXIT_FAILURE; - return FAIL; } - break; - case H5G_DATASET: - if (H5Dclose(oid) < 0) { - d_status = EXIT_FAILURE; - return FAIL; - } - break; + switch(statbuf.type) { + case H5G_GROUP: + if(H5Gclose(oid) < 0) { + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; - case H5G_TYPE: - if (H5Tclose(oid) < 0) { - d_status = EXIT_FAILURE; - return FAIL; - } - break; - default: - d_status = EXIT_FAILURE; - return FAIL; - } + case H5G_DATASET: + if(H5Dclose(oid) < 0) { + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; + + case H5G_TYPE: + if(H5Tclose(oid) < 0) { + d_status = EXIT_FAILURE; + return FAIL; + } /* end if */ + break; + + default: + d_status = EXIT_FAILURE; + return FAIL; + } /* end switch */ free(obj_name); return SUCCEED; @@ -1542,130 +1540,124 @@ dump_all(hid_t group, const char *name, void * op_data) break; } case H5G_UDLINK: - { indentation(indent); switch(linfo.type) { - case H5L_TYPE_EXTERNAL: - { - char *targbuf; - - targbuf = HDmalloc(statbuf.linklen); - HDassert(targbuf); - if(!doxml) { - begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin); - } /* end if */ + case H5L_TYPE_EXTERNAL: + { + char *targbuf; - if(H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) { - error_msg(progname, "unable to get external link value\n"); - d_status = EXIT_FAILURE; - ret = FAIL; - } else { - const char *filename; - const char *targname; + targbuf = HDmalloc(statbuf.linklen); + HDassert(targbuf); + if(!doxml) + begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin); - if(H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &targname) < 0) { - error_msg(progname, "unable to unpack external link value\n"); - d_status = EXIT_FAILURE; - ret = FAIL; + if(H5Lget_val(group, name, targbuf, statbuf.linklen, H5P_DEFAULT) < 0) { + error_msg(progname, "unable to get external link value\n"); + d_status = EXIT_FAILURE; + ret = FAIL; } else { - if (!doxml) { - indentation(indent + COL); - printf("LINKCLASS %d\n", linfo.type); - indentation(indent + COL); - printf("TARGETFILE \"%s\"\n", filename); - indentation(indent + COL); - printf("TARGETPATH \"%s\"\n", targname); - } - else /* XML */ - { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - char *t_filename = xml_escape_the_name(filename); - char *t_targname = xml_escape_the_name(targname); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - printf("<%sExternalLink LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "TargetFilename=\"%s\" " - "TargetPath=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - filename, /* TargetFilename */ - targname, /* TargetPath*/ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_filename); - HDfree(t_targname); - HDfree(t_obj_path); - } + const char *filename; + const char *targname; + + if(H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &targname) < 0) { + error_msg(progname, "unable to unpack external link value\n"); + d_status = EXIT_FAILURE; + ret = FAIL; + } else { + if (!doxml) { + indentation(indent + COL); + printf("LINKCLASS %d\n", linfo.type); + indentation(indent + COL); + printf("TARGETFILE \"%s\"\n", filename); + indentation(indent + COL); + printf("TARGETPATH \"%s\"\n", targname); + } + /* XML */ + else { + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + char *t_filename = xml_escape_the_name(filename); + char *t_targname = xml_escape_the_name(targname); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + printf("<%sExternalLink LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "TargetFilename=\"%s\" " + "TargetPath=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + filename, /* TargetFilename */ + targname, /* TargetPath*/ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_filename); + HDfree(t_targname); + HDfree(t_obj_path); + } + } } - } - if (!doxml) { - end_obj(dump_header_format->extlinkend, - dump_header_format->extlinkblockend); - } - HDfree(targbuf); - } - break; + if (!doxml) + end_obj(dump_header_format->extlinkend, dump_header_format->extlinkblockend); + HDfree(targbuf); + } + break; + default: if (!doxml) { - begin_obj(dump_header_format->udlinkbegin, name, - dump_header_format->udlinkblockbegin); + begin_obj(dump_header_format->udlinkbegin, name, dump_header_format->udlinkblockbegin); indentation(indent + COL); } - if (!doxml) { + if (!doxml) printf("LINKCLASS %d\n", linfo.type); - } else /* XML */ { - char linkxid[100]; - char parentxid[100]; - char *t_name = xml_escape_the_name(name); - char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); - char *t_obj_path = xml_escape_the_name(obj_path); - - /* Create OBJ-XIDs for the parent and object */ - xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); - xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); - - printf("<%sUserDefined LinkName=\"%s\" " - "OBJ-XID=\"%s\" " - "H5SourcePath=\"%s\" " - "LinkClass=\"%d\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", - xmlnsprefix, - t_name, /* LinkName */ - linkxid, /* OBJ-XID */ - t_obj_path, /* H5SourcePath */ - linfo.type, /* LinkClass */ - parentxid, /* Parents */ - t_prefix); /* H5ParentPaths */ - HDfree(t_prefix); - HDfree(t_name); - HDfree(t_obj_path); + char linkxid[100]; + char parentxid[100]; + char *t_name = xml_escape_the_name(name); + char *t_prefix = xml_escape_the_name(HDstrcmp(prefix,"") ? prefix : "/"); + char *t_obj_path = xml_escape_the_name(obj_path); + + /* Create OBJ-XIDs for the parent and object */ + xml_name_to_XID(t_obj_path, linkxid, sizeof(linkxid), 1); + xml_name_to_XID(prefix, parentxid, sizeof(parentxid), 1); + + printf("<%sUserDefined LinkName=\"%s\" " + "OBJ-XID=\"%s\" " + "H5SourcePath=\"%s\" " + "LinkClass=\"%d\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", + xmlnsprefix, + t_name, /* LinkName */ + linkxid, /* OBJ-XID */ + t_obj_path, /* H5SourcePath */ + linfo.type, /* LinkClass */ + parentxid, /* Parents */ + t_prefix); /* H5ParentPaths */ + HDfree(t_prefix); + HDfree(t_name); + HDfree(t_obj_path); } if (!doxml) { indentation(indent); - end_obj(dump_header_format->udlinkend, - dump_header_format->udlinkblockend); + end_obj(dump_header_format->udlinkend, dump_header_format->udlinkblockend); } } break; - } + case H5G_GROUP: - if ((obj = H5Gopen(group, name)) < 0) { + if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { error_msg(progname, "unable to dump group \"%s\"\n", name); d_status = EXIT_FAILURE; ret = FAIL; @@ -1689,7 +1681,6 @@ dump_all(hid_t group, const char *name, void * op_data) /* Close group */ H5Gclose(obj); } - break; case H5G_DATASET: @@ -3173,29 +3164,27 @@ handle_groups(hid_t fid, char *group, void UNUSED * data) { hid_t gid; - if ((gid = H5Gopen(fid, group)) < 0) { - begin_obj(dump_header_format->groupbegin, group, - dump_header_format->groupblockbegin); + if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { + begin_obj(dump_header_format->groupbegin, group, dump_header_format->groupblockbegin); indentation(COL); error_msg(progname, "unable to open group \"%s\"\n", group); - end_obj(dump_header_format->groupend, - dump_header_format->groupblockend); + end_obj(dump_header_format->groupend, dump_header_format->groupblockend); d_status = EXIT_FAILURE; } else { size_t new_len = HDstrlen(group) + 1; - if (prefix_len <= new_len) { + if(prefix_len <= new_len) { prefix_len = new_len; prefix = HDrealloc(prefix, prefix_len); - } + } /* end if */ HDstrcpy(prefix, group); dump_group(gid, group); - if (H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) d_status = EXIT_FAILURE; - } -} + } /* end else */ +} /* end handle_groups() */ /*------------------------------------------------------------------------- * Function: handle_links @@ -3797,32 +3786,31 @@ main(int argc, const char *argv[]) init_ref_path_table(fid); /* Insert the root group into the ref. path table */ H5Giterate(fid, (const char *)"/", NULL, fill_ref_path_table, (void *)""); - if (doxml) { - /* initialize XML */ + if(doxml) { + /* initialize XML */ - /* reset prefix! */ - HDstrcpy(prefix, ""); + /* reset prefix! */ + HDstrcpy(prefix, ""); - /* make sure the URI is initialized to something */ - if (xml_dtd_uri == NULL) { - if (useschema) { - xml_dtd_uri = DEFAULT_XSD; + /* make sure the URI is initialized to something */ + if (xml_dtd_uri == NULL) { + if (useschema) { + xml_dtd_uri = DEFAULT_XSD; + } else { + xml_dtd_uri = DEFAULT_DTD; + xmlnsprefix = ""; + } } else { - xml_dtd_uri = DEFAULT_DTD; - xmlnsprefix = ""; - } - } else { - if (useschema && strcmp(xmlnsprefix,"")) { - error_msg(progname, "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); - leave(EXIT_FAILURE); + if (useschema && strcmp(xmlnsprefix,"")) { + error_msg(progname, "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); + leave(EXIT_FAILURE); + } } } - } /* find all shared objects */ if(init_objs(fid, &info, &group_table, &dset_table, &type_table) < 0) { - error_msg(progname, "internal error (file %s:line %d)\n", - __FILE__, __LINE__); + error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__); d_status = EXIT_FAILURE; goto done; } @@ -3882,42 +3870,40 @@ main(int argc, const char *argv[]) dump_fcpl(fid); } - if (display_all) { - if ((gid = H5Gopen(fid, "/")) < 0) { + if(display_all) { + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { error_msg(progname, "unable to open root group\n"); d_status = EXIT_FAILURE; } else { - dump_function_table->dump_group_function(gid, "/"); + dump_function_table->dump_group_function(gid, "/"); } - if (H5Gclose(gid) < 0) { + if(H5Gclose(gid) < 0) { error_msg(progname, "unable to close root group\n"); d_status = EXIT_FAILURE; } } else { - if (doxml) { /* Note: this option is not supported for XML */ - error_msg(progname, "internal error (file %s:line %d)\n", - __FILE__, __LINE__); + if(doxml) { + error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__); d_status = EXIT_FAILURE; - goto done; - } + goto done; + } /* end if */ - for (i = 0; i < argc; i++) - if (hand[i].func) + for(i = 0; i < argc; i++) + if(hand[i].func) hand[i].func(fid, hand[i].obj, hand[i].subset_info); } if (!doxml) { - end_obj(dump_header_format->fileend, - dump_header_format->fileblockend); + end_obj(dump_header_format->fileend, dump_header_format->fileblockend); } else { - printf("</%sHDF5-File>\n", xmlnsprefix); + printf("</%sHDF5-File>\n", xmlnsprefix); } done: if (H5Fclose(fid) < 0) - d_status = EXIT_FAILURE; + d_status = EXIT_FAILURE; free_handler(hand, argc); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 321a15d..38b1f27 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -225,7 +225,8 @@ typedef struct s1_t { /* "File 51" macros */ #define F51_MAX_NAME_LEN ((64*1024)+1024) -static void gent_group(void) +static void +gent_group(void) { hid_t fid, group; @@ -270,7 +271,8 @@ static void gent_group(void) H5Fclose(fid); } -static void gent_dataset(void) +static void +gent_dataset(void) { hid_t fid, dataset, space; hsize_t dims[2]; @@ -309,7 +311,8 @@ static void gent_dataset(void) H5Fclose(fid); } -static void gent_dataset2(void) +static void +gent_dataset2(void) { hid_t fid, dataset, space, create_plist; hsize_t dims[2]; @@ -356,7 +359,8 @@ static void gent_dataset2(void) } -static void gent_attribute(void) +static void +gent_attribute(void) { hid_t fid, root, space, attr, type; hsize_t dims[2]; @@ -367,7 +371,7 @@ static void gent_attribute(void) int point = 100; fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - root = H5Gopen (fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); /* attribute 1 */ dims[0] = 24; @@ -426,7 +430,7 @@ static void gent_softlink(void) hid_t fid, root; fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - root = H5Gopen (fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); H5Glink (root, H5L_TYPE_SOFT, "somevalue", "slink1"); H5Glink (root, H5L_TYPE_SOFT, "linkvalue", "slink2"); @@ -472,7 +476,7 @@ static void gent_hardlink(void) H5Glink (group, H5L_TYPE_HARD, "/dset1", "dset3"); H5Gclose(group); - group = H5Gopen(fid, "/g1"); + group = H5Gopen2(fid, "/g1", H5P_DEFAULT); H5Glink (group, H5L_TYPE_HARD, "/g2", "g1.1"); H5Gclose(group); @@ -921,7 +925,7 @@ static void gent_all(void) H5Gclose(group); /* root attributes */ - group = H5Gopen (fid, "/"); + group = H5Gopen2(fid, "/", H5P_DEFAULT); dims[0] = 10; space = H5Screate_simple(1, dims, NULL); @@ -941,7 +945,7 @@ static void gent_all(void) H5Gclose(group); - group = H5Gopen (fid, "/g1/g1.1"); + group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT); /* dset1.1.1 */ dims[0] = 10; dims[1] = 10; @@ -988,11 +992,11 @@ static void gent_all(void) H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT); /* soft link */ - group = H5Gopen (fid, "/g1/g1.2/g1.2.1"); + group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT); H5Glink (group, H5L_TYPE_SOFT, "somevalue", "slink"); H5Gclose(group); - group = H5Gopen (fid, "/g2"); + group = H5Gopen2(fid, "/g2", H5P_DEFAULT); /* dset2.1 */ dims[0] = 10; @@ -1238,7 +1242,7 @@ static void gent_many(void) H5Sclose(space); H5Gclose(group); - group = H5Gopen(fid, "/g3"); + group = H5Gopen2(fid, "/g3", H5P_DEFAULT); H5Glink (group, H5L_TYPE_HARD, "/g4/dset2", "link3"); H5Gclose(group); @@ -1261,7 +1265,7 @@ static void gent_many(void) H5Sclose(space); H5Gclose(group); - group = H5Gopen(fid, "/g5"); + group = H5Gopen2(fid, "/g5", H5P_DEFAULT); H5Glink (group, H5L_TYPE_SOFT, "/g6/dset3", "slink4"); H5Gclose(group); H5Pclose(create_plist); @@ -2937,7 +2941,7 @@ void gent_split_file(void) fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT); fid = H5Fcreate(FILE34, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - root = H5Gopen(fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); atype = H5Tcopy(H5T_C_S1); H5Tset_size(atype, strlen(meta) + 1); @@ -3112,7 +3116,7 @@ static void gent_vlstr(void) H5Tcommit(fid1, "vl_string_type", tid1); /* Create an group attribute of VL string type */ - root = H5Gopen(fid1, "/"); + root = H5Gopen2(fid1, "/", H5P_DEFAULT); dataspace = H5Screate(H5S_SCALAR); att = H5Acreate(root, "test_scalar", tid1, dataspace, H5P_DEFAULT); @@ -4094,7 +4098,7 @@ static void gent_attr_all(void) /* Create groups */ group_id = H5Gcreate2(fid, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); group2_id = H5Gcreate2(fid, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen(fid, "/"); + root_id = H5Gopen2(fid, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group @@ -4497,7 +4501,7 @@ static void gent_null_space(void) int point = 4; fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - root = H5Gopen (fid, "/"); + root = H5Gopen2(fid, "/", H5P_DEFAULT); /* null space */ space = H5Screate(H5S_NULL); @@ -5017,7 +5021,7 @@ static void gent_fcontents(void) /* hard link to "g2" */ - gid1 = H5Gopen(fid, "/g1"); + gid1 = H5Gopen2(fid, "/g1", H5P_DEFAULT); H5Glink (gid1, H5L_TYPE_HARD, "/g2", "g1.1"); H5Gclose(gid1); @@ -5626,7 +5630,8 @@ gent_binary(void) #define GB4LL ((unsigned long_long) 4*1024*1024*1024) #define DIM_4GB (GB4LL + 10) -static void gent_bigdims(void) +static void +gent_bigdims(void) { hid_t fid; hid_t did; @@ -5727,27 +5732,28 @@ out: * *------------------------------------------------------------------------- */ -static void gent_hyperslab(void) +static void +gent_hyperslab(void) { - hid_t fid; /* file id */ - hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */ - double *buf; - int i, ret; + hid_t fid; /* file id */ + hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */ + double *buf; + int i, ret; - buf = malloc(32 * 4097 * sizeof(double) ); - for (i = 0; i < 32 * 4097; i++) - buf[i] = 1; + buf = malloc(32 * 4097 * sizeof(double) ); + for (i = 0; i < 32 * 4097; i++) + buf[i] = 1; - /* create a file */ - fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid>=0); + /* create a file */ + fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid>=0); - write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf); + write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf); - ret=H5Fclose(fid); - assert(ret>=0); + ret=H5Fclose(fid); + assert(ret>=0); - free(buf); + free(buf); } diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index b494a67..1babd9e 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -852,7 +852,7 @@ processStrData(FILE **strm, struct Input *in, hid_t file_id) j = 0; handle = file_id; while(j < in->path.count - 1) { - if((group_id = H5Gopen(handle, in->path.group[j])) < 0) { + if((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) { group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for(; j < in->path.count - 1; j++) group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -2444,7 +2444,7 @@ process(struct Options *opt) j = 0; handle = file_id; while(j < in->path.count - 1) { - if((group_id = H5Gopen(handle, in->path.group[j])) < 0) { + if((group_id = H5Gopen2(handle, in->path.group[j], H5P_DEFAULT)) < 0) { group_id = H5Gcreate2(handle, in->path.group[j++], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (; j < in->path.count - 1; j++) group_id = H5Gcreate2(group_id, in->path.group[j], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index d0c1283..fe31658 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -203,7 +203,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) H5Gclose(group); /* root attributes */ - group = H5Gopen(fid, "/"); + group = H5Gopen2(fid, "/", H5P_DEFAULT); dims[0] = 10; space = H5Screate_simple(1, dims, NULL); @@ -223,7 +223,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) H5Gclose(group); - group = H5Gopen (fid, "/g1/g1.1"); + group = H5Gopen2(fid, "/g1/g1.1", H5P_DEFAULT); /* dset1.1.1 */ dims[0] = 10; dims[1] = 10; @@ -270,11 +270,11 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) H5Lcreate_external("somefile", "somepath", fid, "/g1/g1.2/extlink", H5P_DEFAULT, H5P_DEFAULT); /* soft link */ - group = H5Gopen (fid, "/g1/g1.2/g1.2.1"); + group = H5Gopen2(fid, "/g1/g1.2/g1.2.1", H5P_DEFAULT); H5Glink (group, H5L_TYPE_SOFT, "somevalue", "slink"); H5Gclose(group); - group = H5Gopen (fid, "/g2"); + group = H5Gopen2(fid, "/g2", H5P_DEFAULT); /* dset2.1 */ dims[0] = 10; diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index a362250..f127f3f 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -62,7 +62,7 @@ static struct { /* Information about how to display each type of object */ static struct dispatch_t { const char *name; - hid_t (*open)(hid_t loc, const char *name); + hid_t (*open)(hid_t loc, const char *name, hid_t apl_id); herr_t (*close)(hid_t obj); herr_t (*list1)(hid_t obj); herr_t (*list2)(hid_t obj, const char *name); @@ -1728,11 +1728,11 @@ datatype_list2(hid_t type, const char UNUSED *name) *------------------------------------------------------------------------- */ static hid_t -slink_open(hid_t location, const char *name) +slink_open(hid_t location, const char *name, hid_t UNUSED apl_id) { H5G_stat_t statbuf; - if (H5Gget_objinfo(location, name, FALSE, &statbuf) < 0) + if(H5Gget_objinfo(location, name, FALSE, &statbuf) < 0) return -1; if(statbuf.type == H5G_LINK) { /* Soft link */ @@ -1771,7 +1771,7 @@ slink_open(hid_t location, const char *name) *------------------------------------------------------------------------- */ static hid_t -udlink_open(hid_t location, const char *name) +udlink_open(hid_t location, const char *name, hid_t UNUSED apl_id) { H5L_info_t linfo; char * buf = NULL; @@ -1789,7 +1789,8 @@ udlink_open(hid_t location, const char *name) if(H5Lget_val(location, name, buf, linfo.u.val_size, H5P_DEFAULT) < 0) goto error; - if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &filename, &path) < 0) goto error; + if(H5Lunpack_elink_val(buf, linfo.u.val_size, NULL, &filename, &path) < 0) + goto error; HDfputs("file: ", stdout); HDfputs(filename, stdout); HDfputs(" path: ", stdout); @@ -1879,17 +1880,16 @@ list (hid_t group, const char *name, void *_iter) /* Open the object. Not all objects can be opened. If this is the case * then return right away. */ - if (sb.type>=0 && - (NULL==dispatch_g[sb.type].open || - (obj=(dispatch_g[sb.type].open)(group, name))<0)) { + if(sb.type >= 0 && + (NULL == dispatch_g[sb.type].open || + (obj = (dispatch_g[sb.type].open)(group, name, H5P_DEFAULT)) < 0)) { printf(" *ERROR*\n"); goto done; - } + } /* end if */ /* List the first line of information for the object. */ - if (sb.type>=0 && dispatch_g[sb.type].list1) { + if(sb.type >= 0 && dispatch_g[sb.type].list1) (dispatch_g[sb.type].list1)(obj); - } putchar('\n'); /* Show detailed information about the object, beginning with information @@ -2120,9 +2120,9 @@ main (int argc, const char *argv[]) h5tools_init(); /* Build display table */ - DISPATCH(H5G_DATASET, "Dataset", H5Dopen, H5Dclose, dataset_list1, dataset_list2); - DISPATCH(H5G_GROUP, "Group", H5Gopen, H5Gclose, NULL, group_list2); - DISPATCH(H5G_TYPE, "Type", H5Topen, H5Tclose, NULL, datatype_list2); + DISPATCH(H5G_DATASET, "Dataset", H5Dopen2, H5Dclose, dataset_list1, dataset_list2); + DISPATCH(H5G_GROUP, "Group", H5Gopen2, H5Gclose, NULL, group_list2); + DISPATCH(H5G_TYPE, "Type", H5Topen2, H5Tclose, NULL, datatype_list2); DISPATCH(H5G_LINK, "-> ", slink_open, NULL, NULL, NULL); DISPATCH(H5G_UDLINK, "-> ", udlink_open, NULL, NULL, NULL); @@ -2317,30 +2317,31 @@ main (int argc, const char *argv[]) fprintf(stderr, "%s: unable to open file\n", argv[argno-1]); continue; } - if (oname) oname++; - if (!oname || !*oname) oname = root_name; + if(oname) + oname++; + if(!oname || !*oname) + oname = root_name; /* Open the object and display it's information */ - if (H5Gget_objinfo(file, oname, TRUE, &sb)>=0 && - H5G_GROUP==sb.type && !grp_literal_g) { - /* Specified name is a group. List the complete contents of the - * group. */ + if(H5Gget_objinfo(file, oname, TRUE, &sb) >= 0 && H5G_GROUP == sb.type && !grp_literal_g) { + /* Specified name is a group. List the complete contents of the group. */ sym_insert(&sb, oname); - iter.container = container = fix_name(show_file_name_g?fname:"", oname); + iter.container = container = fix_name((show_file_name_g ? fname : ""), oname); + /* list root attributes */ - if (verbose_g>0) - { - if ((root=H5Gopen(file, "/"))<0) - leave(1); - H5Aiterate(root, NULL, list_attr, NULL); - if (H5Gclose(root)<0) - leave(1); - } + if(verbose_g > 0) { + if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0) + leave(1); + H5Aiterate(root, NULL, list_attr, NULL); + if(H5Gclose(root) < 0) + leave(1); + } /* end if */ + /* list */ H5Giterate(file, oname, NULL, list, &iter); free(container); - } else if ((root=H5Gopen(file, "/"))<0) { + } else if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0) { leave(1); /*major problem!*/ } else { @@ -2348,7 +2349,8 @@ main (int argc, const char *argv[]) * container for the object is everything up to the base name. */ iter.container = show_file_name_g ? fname : "/"; list(root, oname, &iter); - if (H5Gclose(root)<0) leave(1); + if(H5Gclose(root) < 0) + leave(1); } H5Fclose(file); free(fname); diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index f8f642b..d986cc0 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -174,10 +174,6 @@ int apply_filters(const char* name, /* object name from traverse list */ pack_opt_t *options, /* repack options */ int *has_filter); /* (OUT) object NAME has a filter */ -int has_filter(hid_t dcpl_id, - H5Z_filter_t filtnin); - - int can_read(const char* name, /* object name from traverse list */ hid_t dcpl_id, /* dataset creation property list */ pack_opt_t *options); /* repack options */ diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index e9a89e2..f32d15d 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -281,566 +281,547 @@ int do_copy_objects(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in=-1; /* group ID */ - hid_t grp_out=-1; /* group ID */ - hid_t dset_in=-1; /* read dataset ID */ - hid_t dset_out=-1; /* write dataset ID */ - hid_t gcpl_id=-1; /* group creation property list */ - hid_t type_in=-1; /* named type ID */ - hid_t type_out=-1; /* named type ID */ - hid_t dcpl_id=-1; /* dataset creation property list ID */ - hid_t dcpl_out=-1; /* dataset creation property list ID */ - hid_t f_space_id=-1; /* file space ID */ - hid_t ftype_id=-1; /* file type ID */ - hid_t wtype_id=-1; /* read/write type ID */ - size_t msize; /* size of type */ - hsize_t nelmts; /* number of elements in dataset */ - int rank; /* rank of dataset */ - hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ - hsize_t dsize_in; /* input dataset size before filter */ - hsize_t dsize_out; /* output dataset size after filter */ - int apply_s; /* flag for apply filter to small dataset sizes */ - int apply_f; /* flag for apply filter to return error on H5Dcreate */ - double per; /* percent utilization of storage */ - void *buf=NULL; /* buffer for raw data */ - void *sm_buf=NULL; /* buffer for raw data */ - int has_filter; /* current object has a filter */ - unsigned i; - int is_ref=0; + hid_t grp_in=-1; /* group ID */ + hid_t grp_out=-1; /* group ID */ + hid_t dset_in=-1; /* read dataset ID */ + hid_t dset_out=-1; /* write dataset ID */ + hid_t gcpl_id=-1; /* group creation property list */ + hid_t type_in=-1; /* named type ID */ + hid_t type_out=-1; /* named type ID */ + hid_t dcpl_id=-1; /* dataset creation property list ID */ + hid_t dcpl_out=-1; /* dataset creation property list ID */ + hid_t f_space_id=-1; /* file space ID */ + hid_t ftype_id=-1; /* file type ID */ + hid_t wtype_id=-1; /* read/write type ID */ + size_t msize; /* size of type */ + hsize_t nelmts; /* number of elements in dataset */ + int rank; /* rank of dataset */ + hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */ + hsize_t dsize_in; /* input dataset size before filter */ + hsize_t dsize_out; /* output dataset size after filter */ + int apply_s; /* flag for apply filter to small dataset sizes */ + int apply_f; /* flag for apply filter to return error on H5Dcreate */ + double per; /* percent utilization of storage */ + void *buf=NULL; /* buffer for raw data */ + void *sm_buf=NULL; /* buffer for raw data */ + int has_filter; /* current object has a filter */ + unsigned i; + int is_ref=0; -/*------------------------------------------------------------------------- - * copy the suppplied object list - *------------------------------------------------------------------------- - */ - - if (options->verbose) { - printf("-----------------------------------------\n"); - printf(" Type Filter (Ratio) Name\n"); - printf("-----------------------------------------\n"); - } - - for ( i = 0; i < travt->nobjs; i++) - { - - buf = NULL; - - switch ( travt->objs[i].type ) - { -/*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - case H5G_GROUP: - if (options->verbose) - printf(FORMAT_OBJ,"group",travt->objs[i].name ); - - if (options->grp_compact>0 || options->grp_indexed>0) { - /* Set up group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) - goto error; - - if(H5Pset_link_phase_change(gcpl_id, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) - goto error; - - if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) - goto error; - } - else { - if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - goto error; - } - - if((grp_in = H5Gopen (fidin,travt->objs[i].name))<0) - goto error; - - /*------------------------------------------------------------------------- - * copy attrs + /*------------------------------------------------------------------------- + * copy the suppplied object list *------------------------------------------------------------------------- */ - if (copy_attr(grp_in,grp_out,options)<0) - goto error; - if (gcpl_id>0) { - if (H5Pclose(gcpl_id)<0) - goto error; - } - if (H5Gclose(grp_out)<0) - goto error; - if (H5Gclose(grp_in)<0) - goto error; - - - break; - -/*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - case H5G_DATASET: + if (options->verbose) { + printf("-----------------------------------------\n"); + printf(" Type Filter (Ratio) Name\n"); + printf("-----------------------------------------\n"); + } - has_filter = 0; + for ( i = 0; i < travt->nobjs; i++) { + + buf = NULL; + switch ( travt->objs[i].type ) { + /*------------------------------------------------------------------------- + * H5G_GROUP + *------------------------------------------------------------------------- + */ + case H5G_GROUP: + if (options->verbose) + printf(FORMAT_OBJ,"group",travt->objs[i].name ); + + if (options->grp_compact>0 || options->grp_indexed>0) { + /* Set up group creation property list */ + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + goto error; + + if(H5Pset_link_phase_change(gcpl_id, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0) + goto error; + + if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + goto error; + } + else { + if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + } + + if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(grp_in,grp_out,options)<0) + goto error; + + if (gcpl_id>0) { + if (H5Pclose(gcpl_id)<0) + goto error; + } + if (H5Gclose(grp_out)<0) + goto error; + if (H5Gclose(grp_in)<0) + goto error; + + break; + + /*------------------------------------------------------------------------- + * H5G_DATASET + *------------------------------------------------------------------------- + */ + case H5G_DATASET: + + has_filter = 0; + + /* early detection of references */ + if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) + goto error; + if ((ftype_id=H5Dget_type (dset_in))<0) + goto error; + if (H5T_REFERENCE==H5Tget_class(ftype_id)) + is_ref=1; + if (H5Tclose(ftype_id)<0) + goto error; + if (H5Dclose(dset_in)<0) + goto error; + + + /*------------------------------------------------------------------------- + * check if we should use H5Ocopy or not + * if there is a request for filters/layout, we read/write the object + * otherwise we do a copy using H5Ocopy + *------------------------------------------------------------------------- + */ + if (options->op_tbl->nelems + || + options->all_filter==1 || options->all_layout==1 + || is_ref + ) + { + int j; + + if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) + goto error; + if ((f_space_id=H5Dget_space(dset_in))<0) + goto error; + if ((ftype_id=H5Dget_type (dset_in))<0) + goto error; + if ((dcpl_id=H5Dget_create_plist(dset_in))<0) + goto error; + if ((dcpl_out = H5Pcopy (dcpl_id))<0) + goto error; + if ( (rank=H5Sget_simple_extent_ndims(f_space_id))<0) + goto error; + HDmemset(dims, 0, sizeof dims); + if ( H5Sget_simple_extent_dims(f_space_id,dims,NULL)<0) + goto error; + nelmts=1; + for (j=0; j<rank; j++) + nelmts*=dims[j]; + + if (options->use_native==1) + wtype_id = h5tools_get_native_type(ftype_id); + else + wtype_id = H5Tcopy(ftype_id); + + if ((msize=H5Tget_size(wtype_id))==0) + goto error; + + /*------------------------------------------------------------------------- + * check if the dataset creation property list has filters that + * are not registered in the current configuration + * 1) the external filters GZIP and SZIP might not be available + * 2) the internal filters might be turned off + *------------------------------------------------------------------------- + */ + if (h5tools_canreadf((travt->objs[i].name),dcpl_id)==1) + { + apply_s=1; + apply_f=1; + + /*------------------------------------------------------------------------- + * references are a special case + * we cannot just copy the buffers, but instead we recreate the reference + * in a second traversal of the output file + *------------------------------------------------------------------------- + */ + if (H5T_REFERENCE!=H5Tget_class(wtype_id)) + { + /* get the storage size of the input dataset */ + dsize_in=H5Dget_storage_size(dset_in); + + /* check for datasets too small */ + if (nelmts*msize < options->threshold ) + apply_s=0; + + /* apply the filter */ + if (apply_s) { + if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options,&has_filter)<0) + goto error; + } + + /*------------------------------------------------------------------------- + * create the output dataset; + * disable error checking in case the dataset cannot be created with the + * modified dcpl; in that case use the original instead + *------------------------------------------------------------------------- + */ + H5E_BEGIN_TRY { + dset_out=H5Dcreate(fidout,travt->objs[i].name,wtype_id,f_space_id,dcpl_out); + } H5E_END_TRY; + if (dset_out==FAIL) + { + if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,wtype_id,f_space_id,dcpl_id))<0) + goto error; + apply_f=0; + } + + /*------------------------------------------------------------------------- + * read/write + *------------------------------------------------------------------------- + */ + if (nelmts) + { + size_t need = (size_t)(nelmts*msize); /* bytes needed */ + if ( need < H5TOOLS_MALLOCSIZE ) + buf = HDmalloc(need); + + if (buf != NULL ) + { + if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + goto error; + if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + goto error; + } + + else /* possibly not enough memory, read/write by hyperslabs */ + { + size_t p_type_nbytes = msize; /*size of memory type */ + hsize_t p_nelmts = nelmts; /*total selected elmts */ + hsize_t elmtno; /*counter */ + int carry; /*counter carry value */ + unsigned int vl_data = 0; /*contains VL datatypes */ + + /* stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ + hsize_t sm_nbytes; /*bytes per stripmine */ + hsize_t sm_nelmts; /*elements per stripmine*/ + hid_t sm_space; /*stripmine data space */ + + /* hyperslab info */ + hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ + hsize_t hs_nelmts; /*elements in request */ + hsize_t zero[8]; /*vector of zeros */ + int k; + + /* check if we have VL data in the dataset's datatype */ + if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) + vl_data = TRUE; + + /* + * determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + sm_nbytes = p_type_nbytes; + + for (k = rank; k > 0; --k) { + sm_size[k - 1] = MIN(dims[k - 1], H5TOOLS_BUFSIZE / sm_nbytes); + sm_nbytes *= sm_size[k - 1]; + assert(sm_nbytes > 0); + } + sm_buf = HDmalloc((size_t)sm_nbytes); + + sm_nelmts = sm_nbytes / p_type_nbytes; + sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + + /* the stripmine loop */ + memset(hs_offset, 0, sizeof hs_offset); + memset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + { + /* calculate the hyperslab size */ + if (rank > 0) + { + for (k = 0, hs_nelmts = 1; k < rank; k++) + { + hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); + hs_nelmts *= hs_size[k]; + } + + if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0) + goto error; + if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL)<0) + goto error; + } + else + { + H5Sselect_all(f_space_id); + H5Sselect_all(sm_space); + hs_nelmts = 1; + } /* rank */ + + /* read/write */ + if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + goto error; + if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + goto error; + + /* reclaim any VL memory, if necessary */ + if(vl_data) + H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); + + /* calculate the next hyperslab offset */ + for (k = rank, carry = 1; k > 0 && carry; --k) + { + hs_offset[k - 1] += hs_size[k - 1]; + if (hs_offset[k - 1] == dims[k - 1]) + hs_offset[k - 1] = 0; + else + carry = 0; + } /* k */ + } /* elmtno */ + + H5Sclose(sm_space); + /* free */ + if (sm_buf!=NULL) + { + HDfree(sm_buf); + sm_buf=NULL; + } + } /* hyperslab read */ + }/*nelmts*/ + + /*------------------------------------------------------------------------- + * amount of compression used + *------------------------------------------------------------------------- + */ + if (options->verbose) + { + if (apply_s && apply_f) + { + /* get the storage size of the input dataset */ + dsize_out=H5Dget_storage_size(dset_out); + PER((hssize_t)dsize_in,(hssize_t)dsize_out); + print_dataset_info(dcpl_out,travt->objs[i].name,per*100.0); + } + else + print_dataset_info(dcpl_id,travt->objs[i].name,0.0); + + /* print a message that the filter was not applied + (in case there was a filter) + */ + if ( has_filter && apply_s == 0 ) + printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", + travt->objs[i].name, + (int)options->threshold); + + if ( has_filter && apply_f == 0 ) + printf(" <warning: could not apply the filter to %s>\n", + travt->objs[i].name); + + } /* verbose */ + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(dset_in,dset_out,options)<0) + goto error; + + /*close */ + if (H5Dclose(dset_out)<0) + goto error; + + }/*!H5T_REFERENCE*/ + }/*h5tools_canreadf*/ + + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + if (H5Tclose(ftype_id)<0) + goto error; + if (H5Tclose(wtype_id)<0) + goto error; + if (H5Pclose(dcpl_id)<0) + goto error; + if (H5Pclose(dcpl_out)<0) + goto error; + if (H5Sclose(f_space_id)<0) + goto error; + if (H5Dclose(dset_in)<0) + goto error; + + } + /*------------------------------------------------------------------------- + * we do not have request for filter/chunking use H5Ocopy instead + *------------------------------------------------------------------------- + */ + else + { + hid_t pid; + + /* create property to pass copy options */ + if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + goto error; + + /* set options for object copy */ + if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + goto error; + + /*------------------------------------------------------------------------- + * do the copy + *------------------------------------------------------------------------- + */ + + if (H5Ocopy(fidin, /* Source file or group identifier */ + travt->objs[i].name, /* Name of the source object to be copied */ + fidout, /* Destination file or group identifier */ + travt->objs[i].name, /* Name of the destination object */ + pid, /* Properties which apply to the copy */ + H5P_DEFAULT)<0) /* Properties which apply to the new hard link */ + goto error; + + /* close property */ + if (H5Pclose(pid)<0) + goto error; + + + /*------------------------------------------------------------------------- + * copy attrs manually + *------------------------------------------------------------------------- + */ + if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) + goto error; + if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0) + goto error; + if (copy_attr(dset_in,dset_out,options)<0) + goto error; + if (H5Dclose(dset_in)<0) + goto error; + if (H5Dclose(dset_out)<0) + goto error; + + } /* end do we have request for filter/chunking */ + + + break; + + /*------------------------------------------------------------------------- + * H5G_TYPE + *------------------------------------------------------------------------- + */ + case H5G_TYPE: + + if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) + goto error; + + if ((type_out = H5Tcopy(type_in))<0) + goto error; + + if ((H5Tcommit(fidout,travt->objs[i].name,type_out))<0) + goto error; + + /*------------------------------------------------------------------------- + * copy attrs + *------------------------------------------------------------------------- + */ + if (copy_attr(type_in,type_out,options)<0) + goto error; + + if (H5Tclose(type_in)<0) + goto error; + if (H5Tclose(type_out)<0) + goto error; + + if (options->verbose) + printf(FORMAT_OBJ,"type",travt->objs[i].name ); + + break; + + + /*------------------------------------------------------------------------- + * H5G_LINK + * H5G_UDLINK + * + * Only handles external links; H5Lcopy will fail for other UD link types + * since we don't have creation or copy callbacks for them. + *------------------------------------------------------------------------- + */ + + case H5G_LINK: + case H5G_UDLINK: + { + if(H5Lcopy(fidin, travt->objs[i].name,fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) + goto error; + + if (options->verbose) + printf(FORMAT_OBJ,"link",travt->objs[i].name ); + + } + break; + + default: + goto error; + } /* switch */ - /* early detection of references */ - if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) - goto error; - if ((ftype_id=H5Dget_type (dset_in))<0) - goto error; - if (H5T_REFERENCE==H5Tget_class(ftype_id)) - { - is_ref=1; - } - if (H5Tclose(ftype_id)<0) - goto error; - if (H5Dclose(dset_in)<0) - goto error; - - -/*------------------------------------------------------------------------- - * check if we should use H5Ocopy or not - * if there is a request for filters/layout, we read/write the object - * otherwise we do a copy using H5Ocopy - *------------------------------------------------------------------------- - */ - if (options->op_tbl->nelems - || - options->all_filter==1 || options->all_layout==1 - || is_ref - ) - { - int j; - - if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) - goto error; - if ((f_space_id=H5Dget_space(dset_in))<0) - goto error; - if ((ftype_id=H5Dget_type (dset_in))<0) - goto error; - if ((dcpl_id=H5Dget_create_plist(dset_in))<0) - goto error; - if ((dcpl_out = H5Pcopy (dcpl_id))<0) - goto error; - if ( (rank=H5Sget_simple_extent_ndims(f_space_id))<0) - goto error; - HDmemset(dims, 0, sizeof dims); - if ( H5Sget_simple_extent_dims(f_space_id,dims,NULL)<0) - goto error; - nelmts=1; - for (j=0; j<rank; j++) - nelmts*=dims[j]; - - if (options->use_native==1) - wtype_id = h5tools_get_native_type(ftype_id); - else - wtype_id = H5Tcopy(ftype_id); - - if ((msize=H5Tget_size(wtype_id))==0) - goto error; - - /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration - * 1) the external filters GZIP and SZIP might not be available - * 2) the internal filters might be turned off - *------------------------------------------------------------------------- - */ - if (h5tools_canreadf((travt->objs[i].name),dcpl_id)==1) - { - apply_s=1; - apply_f=1; - - /*------------------------------------------------------------------------- - * references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - * in a second traversal of the output file - *------------------------------------------------------------------------- - */ - if (H5T_REFERENCE==H5Tget_class(wtype_id)) - { - ; - } - else /* H5T_REFERENCE */ - { - /* get the storage size of the input dataset */ - dsize_in=H5Dget_storage_size(dset_in); - - /* check for datasets too small */ - if (nelmts*msize < options->threshold ) - apply_s=0; - - /* apply the filter */ - if (apply_s){ - if (apply_filters(travt->objs[i].name,rank,dims,dcpl_out,options,&has_filter)<0) - goto error; - } - - /*------------------------------------------------------------------------- - * create the output dataset; - * disable error checking in case the dataset cannot be created with the - * modified dcpl; in that case use the original instead - *------------------------------------------------------------------------- - */ - H5E_BEGIN_TRY { - dset_out=H5Dcreate(fidout,travt->objs[i].name,wtype_id,f_space_id,dcpl_out); - } H5E_END_TRY; - if (dset_out==FAIL) - { - if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,wtype_id,f_space_id,dcpl_id))<0) - goto error; - apply_f=0; - } - - /*------------------------------------------------------------------------- - * read/write - *------------------------------------------------------------------------- - */ - if (nelmts) - { - size_t need = (size_t)(nelmts*msize); /* bytes needed */ - if ( need < H5TOOLS_MALLOCSIZE ) - buf = HDmalloc(need); - - if (buf != NULL ) - { - if (H5Dread(dset_in,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) - goto error; - if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) - goto error; - } - - else /* possibly not enough memory, read/write by hyperslabs */ - - { - size_t p_type_nbytes = msize; /*size of memory type */ - hsize_t p_nelmts = nelmts; /*total selected elmts */ - hsize_t elmtno; /*counter */ - int carry; /*counter carry value */ - unsigned int vl_data = 0; /*contains VL datatypes */ - - /* stripmine info */ - hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ - hsize_t sm_nbytes; /*bytes per stripmine */ - hsize_t sm_nelmts; /*elements per stripmine*/ - hid_t sm_space; /*stripmine data space */ - - /* hyperslab info */ - hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */ - hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ - hsize_t hs_nelmts; /*elements in request */ - hsize_t zero[8]; /*vector of zeros */ - int k; - - /* check if we have VL data in the dataset's datatype */ - if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) - vl_data = TRUE; - - /* - * determine the strip mine size and allocate a buffer. The strip mine is - * a hyperslab whose size is manageable. - */ - sm_nbytes = p_type_nbytes; - - for (k = rank; k > 0; --k) { - sm_size[k - 1] = MIN(dims[k - 1], H5TOOLS_BUFSIZE / sm_nbytes); - sm_nbytes *= sm_size[k - 1]; - assert(sm_nbytes > 0); - } - sm_buf = HDmalloc((size_t)sm_nbytes); - - sm_nelmts = sm_nbytes / p_type_nbytes; - sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - - /* the stripmine loop */ - memset(hs_offset, 0, sizeof hs_offset); - memset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) - { - /* calculate the hyperslab size */ - if (rank > 0) - { - for (k = 0, hs_nelmts = 1; k < rank; k++) - { - hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); - hs_nelmts *= hs_size[k]; - } - - if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL)<0) - goto error; - if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL)<0) - goto error; - } - else - { - H5Sselect_all(f_space_id); - H5Sselect_all(sm_space); - hs_nelmts = 1; - } /* rank */ - - /* read/write */ - if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) - goto error; - if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) - goto error; - - /* reclaim any VL memory, if necessary */ - if(vl_data) - H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); - - /* calculate the next hyperslab offset */ - for (k = rank, carry = 1; k > 0 && carry; --k) - { - hs_offset[k - 1] += hs_size[k - 1]; - if (hs_offset[k - 1] == dims[k - 1]) - hs_offset[k - 1] = 0; - else - carry = 0; - } /* k */ - } /* elmtno */ - - H5Sclose(sm_space); /* free */ - if (sm_buf!=NULL) + if (buf!=NULL) { - HDfree(sm_buf); - sm_buf=NULL; + HDfree(buf); + buf=NULL; } - } /* hyperslab read */ - }/*nelmts*/ - + + } /* i */ + /*------------------------------------------------------------------------- - * amount of compression used - *------------------------------------------------------------------------- - */ - if (options->verbose) - { - if (apply_s && apply_f) - { - /* get the storage size of the input dataset */ - dsize_out=H5Dget_storage_size(dset_out); - PER((hssize_t)dsize_in,(hssize_t)dsize_out); - print_dataset_info(dcpl_out,travt->objs[i].name,per*100.0); - } - else - print_dataset_info(dcpl_id,travt->objs[i].name,0.0); - - /* print a message that the filter was not applied - (in case there was a filter) - */ - if ( has_filter && apply_s == 0 ) - printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", - travt->objs[i].name, - (int)options->threshold); - - if ( has_filter && apply_f == 0 ) - printf(" <warning: could not apply the filter to %s>\n", - travt->objs[i].name); - - } /* verbose */ - - /*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(dset_in,dset_out,options)<0) - goto error; - - /*close */ - if (H5Dclose(dset_out)<0) - goto error; - - }/*H5T_REFERENCE*/ - }/*h5tools_canreadf*/ - - - /*------------------------------------------------------------------------- - * close + * the root is a special case, we get an ID for the root group + * and copy its attributes using that ID *------------------------------------------------------------------------- */ - if (H5Tclose(ftype_id)<0) - goto error; - if (H5Tclose(wtype_id)<0) - goto error; - if (H5Pclose(dcpl_id)<0) - goto error; - if (H5Pclose(dcpl_out)<0) - goto error; - if (H5Sclose(f_space_id)<0) - goto error; - if (H5Dclose(dset_in)<0) - goto error; - - } - /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead - *------------------------------------------------------------------------- - */ - else - { - hid_t pid; - - /* create property to pass copy options */ - if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - goto error; - - /* set options for object copy */ - if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - goto error; - - /*------------------------------------------------------------------------- - * do the copy - *------------------------------------------------------------------------- - */ - - if (H5Ocopy(fidin, /* Source file or group identifier */ - travt->objs[i].name, /* Name of the source object to be copied */ - fidout, /* Destination file or group identifier */ - travt->objs[i].name, /* Name of the destination object */ - pid, /* Properties which apply to the copy */ - H5P_DEFAULT)<0) /* Properties which apply to the new hard link */ - goto error; - - /* close property */ - if (H5Pclose(pid)<0) - goto error; - - - /*------------------------------------------------------------------------- - * copy attrs manually - *------------------------------------------------------------------------- - */ - if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) - goto error; - if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0) - goto error; - if (copy_attr(dset_in,dset_out,options)<0) - goto error; - if (H5Dclose(dset_in)<0) - goto error; - if (H5Dclose(dset_out)<0) - goto error; - - - } /* end do we have request for filter/chunking */ - - - break; - -/*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ - case H5G_TYPE: - - if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) - goto error; - - if ((type_out = H5Tcopy(type_in))<0) - goto error; - - if ((H5Tcommit(fidout,travt->objs[i].name,type_out))<0) - goto error; - -/*------------------------------------------------------------------------- - * copy attrs - *------------------------------------------------------------------------- - */ - if (copy_attr(type_in,type_out,options)<0) - goto error; - - if (H5Tclose(type_in)<0) - goto error; - if (H5Tclose(type_out)<0) - goto error; - - if (options->verbose) - printf(FORMAT_OBJ,"type",travt->objs[i].name ); - break; - - -/*------------------------------------------------------------------------- - * H5G_LINK - * H5G_UDLINK - * - * Only handles external links; H5Lcopy will fail for other UD link types - * since we don't have creation or copy callbacks for them. - *------------------------------------------------------------------------- - */ - - case H5G_LINK: - case H5G_UDLINK: - { - if(H5Lcopy(fidin, travt->objs[i].name,fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) + if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) goto error; - if (options->verbose) - printf(FORMAT_OBJ,"link",travt->objs[i].name ); - - } - break; - - default: - goto error; - } /* switch */ - - /* free */ - if (buf!=NULL) - { - HDfree(buf); - buf=NULL; - } - - } /* i */ - -/*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group - * and copy its attributes using that ID - *------------------------------------------------------------------------- - */ - - if ((grp_out = H5Gopen(fidout,"/"))<0) - goto error; - - if ((grp_in = H5Gopen(fidin,"/"))<0) - goto error; + if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0) + goto error; - if (copy_attr(grp_in,grp_out,options)<0) - goto error; + if (copy_attr(grp_in,grp_out,options)<0) + goto error; - if (H5Gclose(grp_out)<0) - goto error; - if (H5Gclose(grp_in)<0) - goto error; + if (H5Gclose(grp_out)<0) + goto error; + if (H5Gclose(grp_in)<0) + goto error; - return 0; + return 0; error: - H5E_BEGIN_TRY { - H5Gclose(grp_in); - H5Gclose(grp_out); - H5Pclose(dcpl_id); - H5Pclose(gcpl_id); - H5Sclose(f_space_id); - H5Dclose(dset_in); - H5Dclose(dset_out); - H5Tclose(ftype_id); - H5Tclose(wtype_id); - H5Tclose(type_in); - H5Tclose(type_out); - /* free */ - if (buf!=NULL) - { - HDfree(buf); - buf=NULL; - } - if (sm_buf!=NULL) - { - HDfree(sm_buf); - sm_buf=NULL; - } - } H5E_END_TRY; - return -1; - + H5E_BEGIN_TRY { + H5Gclose(grp_in); + H5Gclose(grp_out); + H5Pclose(dcpl_id); + H5Pclose(gcpl_id); + H5Sclose(f_space_id); + H5Dclose(dset_in); + H5Dclose(dset_out); + H5Tclose(ftype_id); + H5Tclose(wtype_id); + H5Tclose(type_in); + H5Tclose(type_out); + } H5E_END_TRY; + /* free */ + if (buf!=NULL) + HDfree(buf); + if (sm_buf!=NULL) + HDfree(sm_buf); + return -1; } @@ -848,9 +829,9 @@ error: * Function: copy_attr * * Purpose: copy attributes located in LOC_IN, which is obtained either from - * loc_id = H5Gopen( fid, name); - * loc_id = H5Dopen( fid, name); - * loc_id = H5Topen( fid, name); + * loc_id = H5Gopen2( fid, name); + * loc_id = H5Dopen2( fid, name); + * loc_id = H5Topen2( fid, name); * * Return: 0, ok, -1 no * diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 3de8101..78b8858 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -165,52 +165,3 @@ out: return -1; } - - -/*------------------------------------------------------------------------- - * Function: print_objlist - * - * Purpose: print list of objects in file - * - * Return: void - * - * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu - * - * Date: October 23, 2003 - * - *------------------------------------------------------------------------- - */ -void print_objlist(const char *filename, - int nobjects, - trav_info_t *info ) -{ - int i; - - printf("File <%s>: # of entries = %d\n", filename, nobjects ); - for ( i = 0; i < nobjects; i++) - { - switch ( info[i].type ) - { - case H5G_GROUP: - printf(" %-10s %s\n", "group", info[i].name ); - break; - case H5G_DATASET: - printf(" %-10s %s\n", "dataset", info[i].name ); - break; - case H5G_TYPE: - printf(" %-10s %s\n", "datatype", info[i].name ); - break; - case H5G_LINK: - printf(" %-10s %s\n", "link", info[i].name ); - break; - case H5G_UDLINK: - printf(" %-10s %s\n", "User defined link", info[i].name ); - break; - default: - printf(" %-10s %s\n", "User defined object", info[i].name ); - break; - } - } - -} - diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 538c99f..71e42bb 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -53,406 +53,390 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in=(-1); /* read group ID */ - hid_t grp_out=(-1); /* write group ID */ - hid_t dset_in=(-1); /* read dataset ID */ - hid_t dset_out=(-1); /* write dataset ID */ - hid_t type_in=(-1); /* named type ID */ - hid_t dcpl_id=(-1); /* dataset creation property list ID */ - hid_t space_id=(-1); /* space ID */ - hid_t ftype_id=(-1); /* file data type ID */ - hid_t mtype_id=(-1); /* memory data type ID */ - size_t msize; /* memory size of memory type */ - hsize_t nelmts; /* number of elements in dataset */ - int rank; /* rank of dataset */ - hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */ - unsigned int i, j; - int k; + hid_t grp_in=(-1); /* read group ID */ + hid_t grp_out=(-1); /* write group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ + hid_t mtype_id=(-1); /* memory data type ID */ + size_t msize; /* memory size of memory type */ + hsize_t nelmts; /* number of elements in dataset */ + int rank; /* rank of dataset */ + hsize_t dims[H5S_MAX_RANK]; /* dimensions of dataset */ + unsigned int i, j; + int k; -/*------------------------------------------------------------------------- - * browse - *------------------------------------------------------------------------- - */ - - for ( i = 0; i < travt->nobjs; i++) - { - switch ( travt->objs[i].type ) - { - /*------------------------------------------------------------------------- - * H5G_GROUP - *------------------------------------------------------------------------- - */ - case H5G_GROUP: - - /*------------------------------------------------------------------------- - * copy referenced objects in attributes - *------------------------------------------------------------------------- - */ - - if ((grp_out=H5Gopen(fidout,travt->objs[i].name))<0) - goto error; - - if((grp_in = H5Gopen (fidin,travt->objs[i].name))<0) - goto error; - - if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0) - goto error; - - if (H5Gclose(grp_out)<0) - goto error; - if (H5Gclose(grp_in)<0) - goto error; - - - - - /*------------------------------------------------------------------------- - * check for hard links + /*------------------------------------------------------------------------- + * browse *------------------------------------------------------------------------- */ - if (travt->objs[i].nlinks) - { - for ( j=0; j<travt->objs[i].nlinks; j++) + for ( i = 0; i < travt->nobjs; i++) { - H5Glink(fidout, - H5G_LINK_HARD, - travt->objs[i].name, - travt->objs[i].links[j].new_name); + switch ( travt->objs[i].type ) + { + /*------------------------------------------------------------------------- + * H5G_GROUP + *------------------------------------------------------------------------- + */ + case H5G_GROUP: + + /*------------------------------------------------------------------------- + * copy referenced objects in attributes + *------------------------------------------------------------------------- + */ + + if ((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + + if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) + goto error; + + if (copy_refs_attr(grp_in,grp_out,options,travt,fidout) < 0) + goto error; + + if (H5Gclose(grp_out) < 0) + goto error; + if (H5Gclose(grp_in) < 0) + goto error; + + + /*------------------------------------------------------------------------- + * check for hard links + *------------------------------------------------------------------------- + */ + + if(travt->objs[i].nlinks) + for(j = 0; j < travt->objs[i].nlinks; j++) + H5Glink(fidout, H5G_LINK_HARD, travt->objs[i].name, travt->objs[i].links[j].new_name); + + break; + + /*------------------------------------------------------------------------- + * H5G_DATASET + *------------------------------------------------------------------------- + */ + case H5G_DATASET: + + if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) + goto error; + if ((space_id=H5Dget_space(dset_in))<0) + goto error; + if ((ftype_id=H5Dget_type (dset_in))<0) + goto error; + if ((dcpl_id=H5Dget_create_plist(dset_in))<0) + goto error; + if ( (rank=H5Sget_simple_extent_ndims(space_id))<0) + goto error; + if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0) + goto error; + nelmts=1; + for (k=0; k<rank; k++) + nelmts*=dims[k]; + + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) + goto error; + + if ((msize=H5Tget_size(mtype_id))==0) + goto error; + /*------------------------------------------------------------------------- + * check if the dataset creation property list has filters that + * are not registered in the current configuration + * 1) the external filters GZIP and SZIP might not be available + * 2) the internal filters might be turned off + *------------------------------------------------------------------------- + */ + if (h5tools_canreadf((NULL),dcpl_id)==1) + { + /*------------------------------------------------------------------------- + * test for a valid output dataset + *------------------------------------------------------------------------- + */ + dset_out = FAIL; + + /*------------------------------------------------------------------------- + * object references are a special case + * we cannot just copy the buffers, but instead we recreate the reference + *------------------------------------------------------------------------- + */ + if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) + { + H5G_obj_t1 obj_type; + hid_t refobj_id; + hobj_ref_t *refbuf=NULL; /* buffer for object references */ + hobj_ref_t *buf=NULL; + const char* refname; + unsigned u; + + /*------------------------------------------------------------------------- + * read to memory + *------------------------------------------------------------------------- + */ + + if (nelmts) + { + buf=(void *) HDmalloc((unsigned)(nelmts*msize)); + if ( buf==NULL){ + printf( "cannot read into memory\n" ); + goto error; + } + if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + goto error; + + if ((obj_type = H5Rget_obj_type(dset_in,H5R_OBJECT,buf))<0) + goto error; + refbuf=HDcalloc((unsigned)nelmts,msize); + if ( refbuf==NULL){ + printf( "cannot allocate memory\n" ); + goto error; + } + for ( u=0; u<nelmts; u++) + { + H5E_BEGIN_TRY { + if ((refobj_id = H5Rdereference(dset_in,H5R_OBJECT,&buf[u]))<0) + continue; + } H5E_END_TRY; + /* get the name. a valid name could only occur in the + second traversal of the file */ + if ((refname=MapIdToName(refobj_id,travt))!=NULL) + { + /* create the reference, -1 parameter for objects */ + if (H5Rcreate(&refbuf[u],fidout,refname,H5R_OBJECT,-1)<0) + goto error; + if (options->verbose) + printf("object <%s> object reference created to <%s>\n", + travt->objs[i].name, + refname); + }/*refname*/ + close_obj(obj_type,refobj_id); + }/* u */ + }/*nelmts*/ + + /*------------------------------------------------------------------------- + * create/write dataset/close + *------------------------------------------------------------------------- + */ + if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) + goto error; + if (nelmts) { + if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0) + goto error; + } + + if (buf) + free(buf); + if (refbuf) + free(refbuf); + + }/*H5T_STD_REF_OBJ*/ + + /*------------------------------------------------------------------------- + * dataset region references + *------------------------------------------------------------------------- + */ + else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) + { + H5G_obj_t1 obj_type; + hid_t refobj_id; + hdset_reg_ref_t *refbuf=NULL; /* input buffer for region references */ + hdset_reg_ref_t *buf=NULL; /* output buffer */ + const char* refname; + unsigned u; + + /*------------------------------------------------------------------------- + * read input to memory + *------------------------------------------------------------------------- + */ + if (nelmts) + { + buf=(void *) HDmalloc((unsigned)(nelmts*msize)); + if ( buf==NULL){ + printf( "cannot read into memory\n" ); + goto error; + } + if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) + goto error; + if ((obj_type = H5Rget_obj_type(dset_in,H5R_DATASET_REGION,buf))<0) + goto error; + + /*------------------------------------------------------------------------- + * create output + *------------------------------------------------------------------------- + */ + + refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */ + if ( refbuf==NULL){ + printf( "cannot allocate memory\n" ); + goto error; + } + for ( u=0; u<nelmts; u++) + { + H5E_BEGIN_TRY { + if ((refobj_id = H5Rdereference(dset_in,H5R_DATASET_REGION,&buf[u]))<0) + continue; + } H5E_END_TRY; + + /* get the name. a valid name could only occur in the + second traversal of the file */ + if ((refname=MapIdToName(refobj_id,travt))!=NULL) + { + hid_t region_id; /* region id of the referenced dataset */ + if ((region_id = H5Rget_region(dset_in,H5R_DATASET_REGION,&buf[u]))<0) + goto error; + /* create the reference, we need the space_id */ + if (H5Rcreate(&refbuf[u],fidout,refname,H5R_DATASET_REGION,region_id)<0) + goto error; + if (H5Sclose(region_id)<0) + goto error; + if (options->verbose) + printf("object <%s> region reference created to <%s>\n", + travt->objs[i].name, + refname); + }/*refname*/ + close_obj(obj_type,refobj_id); + }/* u */ + }/*nelmts*/ + + /*------------------------------------------------------------------------- + * create/write dataset/close + *------------------------------------------------------------------------- + */ + if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) + goto error; + if (nelmts) { + if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0) + goto error; + } + + if (buf) + free(buf); + if (refbuf) + free(refbuf); + } /* H5T_STD_REF_DSETREG */ + + + /*------------------------------------------------------------------------- + * not references, open previously created object in 1st traversal + *------------------------------------------------------------------------- + */ + else + { + if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0) + goto error; + } + + assert(dset_out!=FAIL); + + /*------------------------------------------------------------------------- + * copy referenced objects in attributes + *------------------------------------------------------------------------- + */ + if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0) + goto error; + + /*------------------------------------------------------------------------- + * check for hard links + *------------------------------------------------------------------------- + */ + if(travt->objs[i].nlinks) + for(j = 0; j < travt->objs[i].nlinks; j++) + H5Glink(fidout, H5G_LINK_HARD, travt->objs[i].name, travt->objs[i].links[j].new_name); + + if(H5Dclose(dset_out)<0) + goto error; + + }/*can_read*/ + + /*------------------------------------------------------------------------- + * close + *------------------------------------------------------------------------- + */ + + if (H5Tclose(ftype_id)<0) + goto error; + if (H5Tclose(mtype_id)<0) + goto error; + if (H5Pclose(dcpl_id)<0) + goto error; + if (H5Sclose(space_id)<0) + goto error; + if (H5Dclose(dset_in)<0) + goto error; + + break; + + /*------------------------------------------------------------------------- + * H5G_TYPE + *------------------------------------------------------------------------- + */ + case H5G_TYPE: + + if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) + goto error; + + if (H5Tclose(type_in)<0) + goto error; + + break; + + /*------------------------------------------------------------------------- + * H5G_LINK + *------------------------------------------------------------------------- + */ + + case H5G_LINK: + + /*nothing to do */ + break; + + default: + + break; + } } - } - - break; - - /*------------------------------------------------------------------------- - * H5G_DATASET - *------------------------------------------------------------------------- - */ - case H5G_DATASET: - if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) - goto error; - if ((space_id=H5Dget_space(dset_in))<0) - goto error; - if ((ftype_id=H5Dget_type (dset_in))<0) - goto error; - if ((dcpl_id=H5Dget_create_plist(dset_in))<0) - goto error; - if ( (rank=H5Sget_simple_extent_ndims(space_id))<0) - goto error; - if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0) - goto error; - nelmts=1; - for (k=0; k<rank; k++) - nelmts*=dims[k]; - - if ((mtype_id=h5tools_get_native_type(ftype_id))<0) - goto error; - - if ((msize=H5Tget_size(mtype_id))==0) - goto error; -/*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration - * 1) the external filters GZIP and SZIP might not be available - * 2) the internal filters might be turned off - *------------------------------------------------------------------------- - */ - if (h5tools_canreadf((NULL),dcpl_id)==1) - { -/*------------------------------------------------------------------------- - * test for a valid output dataset - *------------------------------------------------------------------------- - */ - dset_out = FAIL; - -/*------------------------------------------------------------------------- - * object references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - *------------------------------------------------------------------------- - */ - if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) - { - H5G_obj_t1 obj_type; - hid_t refobj_id; - hobj_ref_t *refbuf=NULL; /* buffer for object references */ - hobj_ref_t *buf=NULL; - const char* refname; - unsigned u; - - /*------------------------------------------------------------------------- - * read to memory - *------------------------------------------------------------------------- - */ - - if (nelmts) - { - buf=(void *) HDmalloc((unsigned)(nelmts*msize)); - if ( buf==NULL){ - printf( "cannot read into memory\n" ); - goto error; - } - if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) - goto error; - if ((obj_type = H5Rget_obj_type(dset_in,H5R_OBJECT,buf))<0) - goto error; - refbuf=HDcalloc((unsigned)nelmts,msize); - if ( refbuf==NULL){ - printf( "cannot allocate memory\n" ); - goto error; - } - for ( u=0; u<nelmts; u++) - { - H5E_BEGIN_TRY { - if ((refobj_id = H5Rdereference(dset_in,H5R_OBJECT,&buf[u]))<0) - continue; - } H5E_END_TRY; - /* get the name. a valid name could only occur in the - second traversal of the file */ - if ((refname=MapIdToName(refobj_id,travt))!=NULL) - { - /* create the reference, -1 parameter for objects */ - if (H5Rcreate(&refbuf[u],fidout,refname,H5R_OBJECT,-1)<0) - goto error; - if (options->verbose) - printf("object <%s> object reference created to <%s>\n", - travt->objs[i].name, - refname); - }/*refname*/ - close_obj(obj_type,refobj_id); - }/* u */ - }/*nelmts*/ /*------------------------------------------------------------------------- - * create/write dataset/close - *------------------------------------------------------------------------- - */ - if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) - goto error; - if (nelmts) { - if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0) - goto error; - } - - if (buf) - free(buf); - if (refbuf) - free(refbuf); - - }/*H5T_STD_REF_OBJ*/ - -/*------------------------------------------------------------------------- - * dataset region references - *------------------------------------------------------------------------- - */ - else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) - { - H5G_obj_t1 obj_type; - hid_t refobj_id; - hdset_reg_ref_t *refbuf=NULL; /* input buffer for region references */ - hdset_reg_ref_t *buf=NULL; /* output buffer */ - const char* refname; - unsigned u; - - /*------------------------------------------------------------------------- - * read input to memory + * the root is a special case, we get an ID for the root group + * and copy its attributes using that ID + * it must be done last, because the attributes might contain references to + * objects in the object list *------------------------------------------------------------------------- */ - if (nelmts) - { - buf=(void *) HDmalloc((unsigned)(nelmts*msize)); - if ( buf==NULL){ - printf( "cannot read into memory\n" ); - goto error; - } - if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) - goto error; - if ((obj_type = H5Rget_obj_type(dset_in,H5R_DATASET_REGION,buf))<0) - goto error; - /*------------------------------------------------------------------------- - * create output - *------------------------------------------------------------------------- - */ + if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) + goto error; - refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */ - if ( refbuf==NULL){ - printf( "cannot allocate memory\n" ); - goto error; - } - for ( u=0; u<nelmts; u++) - { - H5E_BEGIN_TRY { - if ((refobj_id = H5Rdereference(dset_in,H5R_DATASET_REGION,&buf[u]))<0) - continue; - } H5E_END_TRY; + if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0) + goto error; - /* get the name. a valid name could only occur in the - second traversal of the file */ - if ((refname=MapIdToName(refobj_id,travt))!=NULL) - { - hid_t region_id; /* region id of the referenced dataset */ - if ((region_id = H5Rget_region(dset_in,H5R_DATASET_REGION,&buf[u]))<0) + if (copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0) goto error; - /* create the reference, we need the space_id */ - if (H5Rcreate(&refbuf[u],fidout,refname,H5R_DATASET_REGION,region_id)<0) + + if (H5Gclose(grp_out) < 0) goto error; - if (H5Sclose(region_id)<0) + if (H5Gclose(grp_in) < 0) goto error; - if (options->verbose) - printf("object <%s> region reference created to <%s>\n", - travt->objs[i].name, - refname); - }/*refname*/ - close_obj(obj_type,refobj_id); - }/* u */ - }/*nelmts*/ - - /*------------------------------------------------------------------------- - * create/write dataset/close - *------------------------------------------------------------------------- - */ - if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) - goto error; - if (nelmts) { - if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0) - goto error; - } - - if (buf) - free(buf); - if (refbuf) - free(refbuf); - } /* H5T_STD_REF_DSETREG */ - - -/*------------------------------------------------------------------------- - * not references, open previously created object in 1st traversal - *------------------------------------------------------------------------- - */ - else - { - if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0) - goto error; - } - assert(dset_out!=FAIL); - -/*------------------------------------------------------------------------- - * copy referenced objects in attributes - *------------------------------------------------------------------------- - */ - if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0) - goto error; - -/*------------------------------------------------------------------------- - * check for hard links - *------------------------------------------------------------------------- - */ - if (travt->objs[i].nlinks) - { - for ( j=0; j<travt->objs[i].nlinks; j++){ - H5Glink(fidout, - H5G_LINK_HARD, - travt->objs[i].name, - travt->objs[i].links[j].new_name); - } - } - - if (H5Dclose(dset_out)<0) - goto error; - - }/*can_read*/ - - /*------------------------------------------------------------------------- - * close - *------------------------------------------------------------------------- - */ - - if (H5Tclose(ftype_id)<0) - goto error; - if (H5Tclose(mtype_id)<0) - goto error; - if (H5Pclose(dcpl_id)<0) - goto error; - if (H5Sclose(space_id)<0) - goto error; - if (H5Dclose(dset_in)<0) - goto error; - - break; - - /*------------------------------------------------------------------------- - * H5G_TYPE - *------------------------------------------------------------------------- - */ - case H5G_TYPE: - - if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) - goto error; - - if (H5Tclose(type_in)<0) - goto error; - - break; - - /*------------------------------------------------------------------------- - * H5G_LINK - *------------------------------------------------------------------------- - */ - - case H5G_LINK: - - /*nothing to do */ - break; - - default: - - break; - } - } - - - -/*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group - * and copy its attributes using that ID - * it must be done last, because the attributes might contain references to - * objects in the object list - *------------------------------------------------------------------------- - */ - - if ((grp_out = H5Gopen(fidout,"/"))<0) - goto error; - - if ((grp_in = H5Gopen(fidin,"/"))<0) - goto error; - - if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0) - goto error; - - if (H5Gclose(grp_out)<0) - goto error; - if (H5Gclose(grp_in)<0) - goto error; - - return 0; + return 0; error: - H5E_BEGIN_TRY { - H5Gclose(grp_in); - H5Gclose(grp_out); - H5Pclose(dcpl_id); - H5Sclose(space_id); - H5Dclose(dset_in); - H5Dclose(dset_out); - H5Tclose(ftype_id); - H5Tclose(mtype_id); - H5Tclose(type_in); - } H5E_END_TRY; - return -1; - + H5E_BEGIN_TRY { + H5Gclose(grp_in); + H5Gclose(grp_out); + H5Pclose(dcpl_id); + H5Sclose(space_id); + H5Dclose(dset_in); + H5Dclose(dset_out); + H5Tclose(ftype_id); + H5Tclose(mtype_id); + H5Tclose(type_in); + } H5E_END_TRY; + return -1; } @@ -461,7 +445,7 @@ error: * * Purpose: duplicate all referenced HDF5 located in attributes * relative to LOC_IN, which is obtained either from - * loc_id = H5Gopen( fid, name); + * loc_id = H5Gopen2( fid, name, H5P_DEFAULT); * loc_id = H5Dopen( fid, name); * loc_id = H5Topen( fid, name); * diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 049e059..6c02e92 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -34,8 +34,8 @@ extern char *progname; *------------------------------------------------------------------------- */ -int has_filter(hid_t dcpl_id, - H5Z_filter_t filtnin) +static int +has_filter(hid_t dcpl_id, H5Z_filter_t filtnin) { int nfilters; /* number of filters */ diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 3328c70..b8c7948 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -1570,7 +1570,7 @@ int make_all_objects(hid_t loc_id) *------------------------------------------------------------------------- */ group_id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen(loc_id, "/"); + root_id = H5Gopen2(loc_id, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- * H5G_TYPE @@ -1645,7 +1645,7 @@ int make_attributes(hid_t loc_id) *------------------------------------------------------------------------- */ group_id = H5Gcreate2(loc_id, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - root_id = H5Gopen(loc_id, "/"); + root_id = H5Gopen2(loc_id, "/", H5P_DEFAULT); /*------------------------------------------------------------------------- * write a series of attributes on the dataset, group, and root group diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 8f29519..280023e 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -476,7 +476,7 @@ group_stats(hid_t group, const char *name, const char *fullname, iter->group_ohdr_info.total_size += oi->hdr.space.total; iter->group_ohdr_info.free_size += oi->hdr.space.free; - gid = H5Gopen(group, name); + gid = H5Gopen2(group, name, H5P_DEFAULT); assert(gid > 0); /* Get number of links in this group */ diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 4b354b6..dc32b9e 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1010,33 +1010,34 @@ hsize_t diff (hid_t file1_id, */ case H5G_GROUP: - ret = HDstrcmp(path1,path2); + ret = HDstrcmp(path1, path2); /* if "path1" != "path2" then the groups are "different" */ - nfound = (ret!=0) ? 1 : 0; + nfound = (ret != 0) ? 1 : 0; - if (print_objname(options,nfound)) - do_print_objname ("group", path1, path2); + if(print_objname(options, nfound)) + do_print_objname("group", path1, path2); /* always print the number of differences found in verbose mode */ - if (options->m_verbose) + if(options->m_verbose) print_found(nfound); - if ((grp1_id = H5Gopen(file1_id, path1))<0) + if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0) goto out; - if ((grp2_id = H5Gopen(file2_id, path2))<0) + if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0) goto out; + /*------------------------------------------------------------------------- * compare attributes * the if condition refers to cases when the dataset is a referenced object *------------------------------------------------------------------------- */ - if (path1) - nfound += diff_attr(grp1_id,grp2_id,path1,path2,options); + if(path1) + nfound += diff_attr(grp1_id, grp2_id, path1, path2, options); - if ( H5Gclose(grp1_id)<0) + if(H5Gclose(grp1_id) < 0) goto out; - if ( H5Gclose(grp2_id)<0) + if(H5Gclose(grp2_id) < 0) goto out; break; diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 37bef3e..ab089cb 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -22,7 +22,7 @@ * * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are * obtained either from - * loc_id = H5Gopen( fid, name); + * loc_id = H5Gopen2( fid, name, H5P_DEFAULT); * loc_id = H5Dopen( fid, name); * loc_id = H5Topen( fid, name); * diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index c714d45..b5a2872 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -25,7 +25,7 @@ * *------------------------------------------------------------------------- */ -void +static void print_size (int rank, hsize_t *dims) { int i; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 456b56b..c824b3d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -340,7 +340,7 @@ static hssize_t get_nnames( hid_t loc_id, const char *group_name ) hsize_t nobjs = 0; /* Open the group */ - if((gid = H5Gopen(loc_id, group_name)) < 0) + if((gid = H5Gopen2(loc_id, group_name, H5P_DEFAULT)) < 0) return(-1); /* Retrieve the number of objects in it */ |