diff options
-rw-r--r-- | c++/src/H5CommonFG.cpp | 4 | ||||
-rw-r--r-- | examples/h5_group.c | 4 | ||||
-rw-r--r-- | fortran/src/H5Gf.c | 38 | ||||
-rw-r--r-- | hl/src/H5TB.c | 4 | ||||
-rw-r--r-- | hl/test/test_ds.c | 8 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 2 | ||||
-rw-r--r-- | src/H5Gpublic.h | 2 | ||||
-rw-r--r-- | test/getname.c | 273 | ||||
-rw-r--r-- | test/links.c | 152 | ||||
-rw-r--r-- | test/mount.c | 2 | ||||
-rwxr-xr-x | test/objcopy.c | 2 | ||||
-rw-r--r-- | test/stab.c | 22 | ||||
-rw-r--r-- | test/tattr.c | 92 | ||||
-rw-r--r-- | test/tfile.c | 4 | ||||
-rw-r--r-- | test/tmisc.c | 56 | ||||
-rw-r--r-- | test/trefer.c | 12 | ||||
-rw-r--r-- | test/tvlstr.c | 16 | ||||
-rw-r--r-- | test/unlink.c | 911 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 423 | ||||
-rw-r--r-- | tools/h5repack/h5repacktst.c | 154 | ||||
-rw-r--r-- | tools/lib/talign.c | 6 |
21 files changed, 1102 insertions, 1085 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 0b782cb..34398e7 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -288,10 +288,10 @@ void CommonFG::link( H5G_link_t link_type, const H5std_string& curr_name, const //-------------------------------------------------------------------------- void CommonFG::unlink( const char* name ) const { - herr_t ret_value = H5Gunlink( getLocId(), name ); + herr_t ret_value = H5Ldelete( getLocId(), name, H5P_DEFAULT ); if( ret_value < 0 ) { - throwException("unlink", "H5Gunlink failed"); + throwException("unlink", "H5Ldelete failed"); } } diff --git a/examples/h5_group.c b/examples/h5_group.c index 63331e3..4bad2ea 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -143,8 +143,8 @@ main(void) * Unlink name "Data" and use iterator to see the names * of the objects in the file root direvtory. */ - if (H5Gunlink(file, "Data") < 0) - printf(" H5Gunlink failed \n"); + if(H5Ldelete(file, "Data", H5P_DEFAULT) < 0) + printf(" H5Ldelete failed \n"); else printf("\"Data\" is unlinked \n"); diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 0ca7e38..5dd00b0 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -397,28 +397,26 @@ DONE: int_f nh5gunlink_c(hid_t_f *loc_id, _fcd name, int_f *namelen) { - int ret_value = -1; - hid_t c_loc_id; - char *c_name; - size_t c_namelen; - herr_t c_ret_value; - /* - * Convert Fortran name to C name - */ - c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); - if(c_name == NULL) return ret_value; - /* - * Call H5Gunlink function - */ - c_loc_id = (hid_t)*loc_id; - c_ret_value = H5Gunlink(c_loc_id, c_name); - if(c_ret_value < 0) goto DONE; - ret_value = 0; + char *c_name = NULL; + int ret_value = -1; + + /* + * Convert Fortran name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + goto DONE; + + /* + * Call H5Gunlink function + */ + if(H5Ldelete((hid_t)*loc_id, c_name, H5P_DEFAULT) < 0) + goto DONE; + ret_value = 0; DONE: - HDfree(c_name); - return ret_value ; + if(c_name) + HDfree(c_name); + return ret_value; } /*---------------------------------------------------------------------------- diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index a2510ff..23bf569 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -2508,7 +2508,7 @@ herr_t H5TBinsert_field( hid_t loc_id, * Delete 1st table *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Ldelete( loc_id, dset_name, H5P_DEFAULT ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -2993,7 +2993,7 @@ herr_t H5TBdelete_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Ldelete( loc_id, dset_name, H5P_DEFAULT ) < 0 ) return -1; /*------------------------------------------------------------------------- diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index c4bd1ab..43e9424 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -2233,19 +2233,19 @@ static int test_iterators(void) TESTING2("iterate in deleted scales "); - if (H5Gunlink(fid,"ds_0")<0) + if(H5Ldelete(fid, "ds_0", H5P_DEFAULT) < 0) goto out; /* open the previously written "dset_a" */ - if ((did = H5Dopen(fid,"dset_a"))<0) + if((did = H5Dopen(fid, "dset_a")) < 0) goto out; /* iterate */ - if (H5DSiterate_scales(did,0,NULL,op_bogus,NULL)==SUCCEED) + if(H5DSiterate_scales(did, 0, NULL, op_bogus, NULL) == SUCCEED) goto out; /* close */ - if (H5Dclose(did)<0) + if(H5Dclose(did) < 0) goto out; PASSED(); diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 34baef3..4e16430 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -522,7 +522,6 @@ H5G_move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_move() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -554,6 +553,7 @@ H5Gunlink(hid_t loc_id, const char *name) done: FUNC_LEAVE_API(ret_value) } /* end H5Gunlink() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 5a40f97..4e2e262 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 herr_t H5Gunlink(hid_t loc_id, const char *name); H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/); H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, @@ -170,6 +169,7 @@ H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); +H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/test/getname.c b/test/getname.c index 2012d57..e3be2de 100644 --- a/test/getname.c +++ b/test/getname.c @@ -534,32 +534,33 @@ test_main(hid_t file_id, hid_t fapl) /*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gunlink + * Test H5Iget_name with H5Ldelete *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gunlink"); + TESTING("H5Iget_name with H5Ldelete"); /* Create a new group. */ 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(H5Ldelete(file_id, "/g8", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gunlink and a long path + + /*------------------------------------------------------------------------- + * Test H5Iget_name with H5Ldelete and a long path *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gunlink and a long path"); + TESTING("H5Iget_name with H5Ldelete and a long path"); /* Create group "g9/a/b" */ if((group_id = H5Gcreate2(file_id, "g9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -567,7 +568,7 @@ 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(H5Ldelete(file_id, "/g9/a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "", "") < 0) TEST_ERROR @@ -576,15 +577,15 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group3_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 /* 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(H5Ldelete(group_id, "a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "", "") < 0) TEST_ERROR @@ -593,11 +594,11 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group3_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 /* Close */ - H5Gclose(group_id); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR /* Create group "g10/a/b" */ if((group_id = H5Gcreate2(file_id, "g10", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -605,51 +606,51 @@ 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(H5Ldelete(file_id, "/g10/a/b", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group3_id); + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* 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(H5Ldelete(group_id, "a/b", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close */ - H5Gclose(group3_id); + if(H5Gclose(group3_id) < 0) FAIL_STACK_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(); -/*------------------------------------------------------------------------- - * Test H5Iget_name with H5Gunlink, same names + + /*------------------------------------------------------------------------- + * Test H5Iget_name with H5Ldelete, same names *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Gunlink, same names"); - + TESTING("H5Iget_name with H5Ldelete, same names"); /* Create group "g11/g" */ if((group_id = H5Gcreate2(file_id, "g11", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR 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) FAIL_STACK_ERROR + if((dataset_id = H5Dcreate(group_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((dataset2_id = H5Dcreate(group2_id , "d", H5T_NATIVE_INT, space_id, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file_id, "/g11/d") < 0) TEST_ERROR + if(H5Ldelete(file_id, "/g11/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "", "") < 0) TEST_ERROR @@ -658,16 +659,16 @@ test_main(hid_t file_id, hid_t fapl) 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); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Test H5Iget_name with H5Fmount; with IDs on the list *------------------------------------------------------------------------- */ @@ -1046,6 +1047,7 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); + /*------------------------------------------------------------------------- * Test H5Iget_name with different files, test1 *------------------------------------------------------------------------- @@ -1054,22 +1056,22 @@ test_main(hid_t file_id, hid_t fapl) 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) FAIL_STACK_ERROR -/* Create a new file using default properties. */ - if((file3_id = H5Fcreate(filename3, 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) FAIL_STACK_ERROR /* Create the dataspace */ - if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR + if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_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) FAIL_STACK_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) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file2_id, "/d") < 0) TEST_ERROR + if(H5Ldelete(file2_id, "/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "", "") < 0) TEST_ERROR @@ -1078,16 +1080,16 @@ test_main(hid_t file_id, hid_t fapl) 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); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Test H5Iget_name with different files, test2 *------------------------------------------------------------------------- */ @@ -1095,22 +1097,22 @@ test_main(hid_t file_id, hid_t fapl) 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) FAIL_STACK_ERROR -/* Create a new file using default properties. */ - if((file3_id = H5Fcreate(filename3, 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) FAIL_STACK_ERROR /* Create the dataspace */ - if((space_id = H5Screate_simple(1, dims, NULL)) < 0) TEST_ERROR + if((space_id = H5Screate_simple(1, dims, NULL)) < 0) FAIL_STACK_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) FAIL_STACK_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) FAIL_STACK_ERROR /* Delete */ - if(H5Gunlink(file3_id, "/d") < 0) TEST_ERROR + if(H5Ldelete(file3_id, "/d", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(dataset_id, "/d", "/d") < 0) TEST_ERROR @@ -1119,15 +1121,16 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(dataset2_id, "", "") < 0) TEST_ERROR /* Close */ - H5Dclose(dataset_id); - H5Dclose(dataset2_id); - H5Sclose(space_id); - H5Fclose(file2_id); - H5Fclose(file3_id); + if(H5Dclose(dataset_id) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset2_id) < 0) FAIL_STACK_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR PASSED(); -/*------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- * Test H5Iget_name with a small buffer for name *------------------------------------------------------------------------- */ @@ -1320,7 +1323,7 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); -/*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * Test H5Iget_name with H5Fclose *------------------------------------------------------------------------- */ @@ -1328,7 +1331,7 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with H5Fclose"); /* Create a file and group "/g1/g2" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1336,27 +1339,27 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group2_id, "/g1/g2", "/g1/g2") < 0) TEST_ERROR /* Close file */ - H5Fclose(file1_id); + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR /* Verify */ 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(); -/*------------------------------------------------------------------------- - * Test H5Iget_name with H5Fmount and H5Gunlink + /*------------------------------------------------------------------------- + * Test H5Iget_name with H5Fmount and H5Ldelete *------------------------------------------------------------------------- */ - TESTING("H5Iget_name with H5Fmount and H5Gunlink"); + TESTING("H5Iget_name with H5Fmount and H5Ldelete"); /* Create a file and group "/g1/g2" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g1/g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1366,7 +1369,7 @@ test_main(hid_t file_id, hid_t fapl) 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) FAIL_STACK_ERROR /* Open the mounted group */ if((group5_id = H5Gopen2(file2_id, "/g3/g4/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1375,7 +1378,7 @@ test_main(hid_t file_id, hid_t fapl) 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(H5Ldelete(file1_id, "/g3/g4/g1/g2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group5_id, "", "") < 0) TEST_ERROR @@ -1384,18 +1387,17 @@ test_main(hid_t file_id, hid_t fapl) 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); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR PASSED(); - /*------------------------------------------------------------------------- * Test H5Iget_name with H5Fmount and H5Lmove *------------------------------------------------------------------------- @@ -1543,7 +1545,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR /* Delete group */ - if(H5Gunlink(file_id, "/g19/g3") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/g19/g3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR @@ -1563,7 +1565,7 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group4_id, "/g19/g3", "/g19/g3") < 0) TEST_ERROR /* Delete group, using relative path */ - if(H5Gunlink(group_id, "g3") < 0) FAIL_STACK_ERROR + if(H5Ldelete(group_id, "g3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group4_id, "/g19/g1", "") < 0) TEST_ERROR @@ -1581,7 +1583,6 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); - /*------------------------------------------------------------------------- * Test H5Iget_name with H5Lcreate_soft *------------------------------------------------------------------------- @@ -1712,7 +1713,7 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gopen2(file_id, "/g23/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete group */ - if(H5Gunlink(file_id, "/g23/g1") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/g23/g1", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "/g23/g2", "/g23/g2") < 0) TEST_ERROR @@ -1724,6 +1725,7 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); + /*------------------------------------------------------------------------- * Test H5Iget_name with H5Lcreate_soft and unlink source *------------------------------------------------------------------------- @@ -1745,7 +1747,7 @@ test_main(hid_t file_id, hid_t fapl) if((group3_id = H5Gopen2(file_id, "/g24/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete symbolic link */ - if(H5Gunlink(file_id, "/g24/g2") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/g24/g2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "/g24/g1", "") < 0) TEST_ERROR @@ -1757,7 +1759,8 @@ test_main(hid_t file_id, hid_t fapl) PASSED(); -/*------------------------------------------------------------------------- + + /*------------------------------------------------------------------------- * Test H5Iget_name with several nested mounted files *------------------------------------------------------------------------- */ @@ -1770,45 +1773,45 @@ test_main(hid_t file_id, hid_t fapl) 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); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create second file and group "/g26/g3/g4" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g26", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g26/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR 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); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create third file and group "/g27/g5/g6" in it */ - file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file2_id, "/g27", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file2_id, "/g27/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR 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); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create fourth file and group "/g28/g5/g6" in it */ - file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file3_id, "/g28", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file3_id, "/g28/g7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR 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); + 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 which will be hidden in the first file */ if((group_id = H5Gopen2(file_id, "/g25/g1/g2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1817,7 +1820,7 @@ test_main(hid_t file_id, hid_t fapl) 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) FAIL_STACK_ERROR /* Verify */ if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR @@ -1829,7 +1832,7 @@ test_main(hid_t file_id, hid_t fapl) 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) FAIL_STACK_ERROR /* Verify */ if(check_name(group2_id, "", "/g25/g1/g26/g3/g4") < 0) TEST_ERROR @@ -1841,7 +1844,7 @@ test_main(hid_t file_id, hid_t fapl) 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) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "", "/g25/g1/g26/g3/g27/g5/g6") < 0) TEST_ERROR @@ -1852,7 +1855,7 @@ test_main(hid_t file_id, hid_t fapl) /* 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(H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g25/g1/g26/g3/g27/g5") < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group4_id, "/g28/g7/g8", "") < 0) TEST_ERROR @@ -1861,10 +1864,10 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose(group4_id); - H5Fclose(file3_id); + if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file3_id) < 0) FAIL_STACK_ERROR - if(H5Funmount(file_id, "/g25/g1/g26/g3") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g25/g1/g26/g3") < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group3_id, "/g27/g5/g6", "") < 0) TEST_ERROR @@ -1872,20 +1875,19 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group_id, "", "/g25/g1/g2") < 0) TEST_ERROR /* Close */ - H5Gclose(group3_id); - H5Fclose(file2_id); + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file2_id) < 0) FAIL_STACK_ERROR - if(H5Funmount(file_id, "/g25/g1") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g25/g1") < 0) FAIL_STACK_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 /* 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(); @@ -2143,12 +2145,12 @@ test_main(hid_t file_id, hid_t fapl) 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); + if(H5Gclose(group_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group3_id) < 0) FAIL_STACK_ERROR /* Create second file and group "/g37/g4" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g37", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g37/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2156,7 +2158,7 @@ test_main(hid_t file_id, hid_t fapl) 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) FAIL_STACK_ERROR /* Open group in mounted file */ if((group5_id = H5Gopen2(file_id, "/g36/g1/g37/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2171,14 +2173,14 @@ test_main(hid_t file_id, hid_t fapl) 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(H5Ldelete(group5_id, "g4/g5a", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group6_id, "", "") < 0) TEST_ERROR if(check_name(group3_id, "", "") < 0) TEST_ERROR /* Close deleted group */ - H5Gclose(group6_id); + if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR /* Open groups to delete in mounted file */ if((group6_id = H5Gopen2(file_id, "/g36/g1/g37/g4", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2189,7 +2191,7 @@ test_main(hid_t file_id, hid_t fapl) 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(H5Ldelete(group5_id, "g4", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify */ if(check_name(group6_id, "", "") < 0) TEST_ERROR @@ -2198,25 +2200,24 @@ test_main(hid_t file_id, hid_t fapl) if(check_name(group4_id, "", "") < 0) TEST_ERROR /* Close deleted groups */ - H5Gclose(group6_id); - H5Gclose(group7_id); + if(H5Gclose(group6_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group7_id) < 0) FAIL_STACK_ERROR /* Close group in mounted file */ - H5Gclose(group5_id); + if(H5Gclose(group5_id) < 0) FAIL_STACK_ERROR - if(H5Funmount(file_id, "/g36/g1") < 0) TEST_ERROR + if(H5Funmount(file_id, "/g36/g1") < 0) FAIL_STACK_ERROR /* Close */ - H5Gclose(group_id); - H5Gclose(group2_id); - H5Gclose(group3_id); - H5Gclose(group4_id); - H5Fclose(file1_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 + if(H5Gclose(group4_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(file1_id) < 0) FAIL_STACK_ERROR PASSED(); - /*------------------------------------------------------------------------- * Test H5Iget_name with mounting already mounted files *------------------------------------------------------------------------- @@ -2225,7 +2226,7 @@ test_main(hid_t file_id, hid_t fapl) TESTING("H5Iget_name with mounting already mounted files"); /* Create file and group "/g38/g1/g2" in it */ - file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file1_id = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file1_id, "/g38", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file1_id, "/g38/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2237,7 +2238,7 @@ test_main(hid_t file_id, hid_t fapl) H5Gclose(group3_id); /* Create second file and group "/g39/g1/g2" in it */ - file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file2_id = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file2_id, "/g39", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file2_id, "/g39/g3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2249,7 +2250,7 @@ test_main(hid_t file_id, hid_t fapl) H5Gclose(group3_id); /* Create third file and group "/g40/g5/g6" in it */ - file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + if((file3_id = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR if((group_id = H5Gcreate2(file3_id, "/g40", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if((group2_id = H5Gcreate2(file3_id, "/g40/g5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2607,7 +2608,7 @@ test_obj_ref(hid_t fapl) /* Now we try unlinking dataset2 from the file and searching for it. It shouldn't be found */ if((dataset2 = H5Rdereference(dataset, H5R_OBJECT, &wbuf[1])) < 0) FAIL_STACK_ERROR - if(H5Gunlink(fid1, "/Group1/Dataset2") < 0) + if(H5Ldelete(fid1, "/Group1/Dataset2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR TESTING("getting path to dataset that has been unlinked"); diff --git a/test/links.c b/test/links.c index 11a5e9e..02ef664 100644 --- a/test/links.c +++ b/test/links.c @@ -1471,9 +1471,9 @@ error: static int test_compat(hid_t fapl, hbool_t new_format) { - hid_t file_id=-1; - hid_t group1_id=-1; - hid_t group2_id=-1; + hid_t file_id = -1; + hid_t group1_id = -1; + hid_t group2_id = -1; H5G_stat_t sb_hard1, sb_hard2, sb_soft1; char filename[1024]; char linkval[1024]; @@ -1489,62 +1489,62 @@ test_compat(hid_t fapl, hbool_t new_format) if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create two groups in the file */ - if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((group1_id = H5Gcreate2(file_id, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2_id = H5Gcreate2(file_id, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create links using H5Glink and H5Glink2 */ - if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) TEST_ERROR - if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) TEST_ERROR - if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) TEST_ERROR + if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR /* Test that H5Glink created hard links properly */ - if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) TEST_ERROR - if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, "/group2", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group1/link_to_group2", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); TEST_ERROR - } + } /* end if */ /* Test for the other hard link created */ - if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) TEST_ERROR - if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, "/group1", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR + if(H5Gget_objinfo(file_id, "/group2/link_to_group1", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR - if (HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { + if(HDmemcmp(&sb_hard1.objno, sb_hard2.objno, sizeof(sb_hard1.objno))) { H5_FAILED(); puts(" Hard link test failed. Link seems not to point to the "); puts(" expected file location."); TEST_ERROR - } + } /* end if */ /* Test the soft link */ - if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) TEST_ERROR + if(H5Gget_objinfo(file_id, "/group2/soft_link_to_group1", FALSE, &sb_soft1) < 0) FAIL_STACK_ERROR if(sb_soft1.type != H5G_LINK) TEST_ERROR if(sb_soft1.linklen != HDstrlen("link_to_group1") + 1) TEST_ERROR - if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, linkval) < 0) TEST_ERROR + if(H5Gget_linkval(group2_id, "soft_link_to_group1", sb_soft1.linklen, linkval) < 0) FAIL_STACK_ERROR if(HDstrcmp("link_to_group1", linkval)) TEST_ERROR /* Test H5Gmove and H5Gmove2 */ - if(H5Gmove(file_id, "group1", "moved_group1") < 0) TEST_ERROR - if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) TEST_ERROR + if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR + if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR /* Ensure that both groups can be opened */ - if(H5Gclose(group2_id) < 0) TEST_ERROR - if(H5Gclose(group1_id) < 0) TEST_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_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 - if(H5Gclose(group1_id) < 0) TEST_ERROR + if(H5Gclose(group2_id) < 0) FAIL_STACK_ERROR + if(H5Gclose(group1_id) < 0) FAIL_STACK_ERROR /* Test H5Gunlink */ - if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) TEST_ERROR + if(H5Gunlink(file_id, "moved_group1/moved_group2") < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { if(H5Gopen2(file_id, "moved_group1/moved_group2", H5P_DEFAULT) >=0) TEST_ERROR @@ -2748,25 +2748,25 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) /* Unlink external link */ /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Unlink external link */ - if(H5Gunlink(fid, "src") < 0) TEST_ERROR + if(H5Ldelete(fid, "src", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Open group for external link */ if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -2875,18 +2875,18 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Unlink external link */ /* Open first file */ - if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Open root group */ if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Unlink external link */ - if(H5Gunlink(fid, "src") < 0) TEST_ERROR + if(H5Ldelete(fid, "src", 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) + 1); u++) { sprintf(objname, "filler %u", u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on root group's status */ @@ -2897,22 +2897,22 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if(H5G_has_stab_test(gid) == TRUE) TEST_ERROR /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Open group for external link (should be unaffected) */ if((gid = H5Gopen2(fid, "dst", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -3242,7 +3242,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) /* Remove enough objects in the root group to change it into a "compact" group */ for(u = 0; u < ((max_compact - min_dense) + 3); u++) { sprintf(objname, "filler %u", u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on root group's status */ @@ -3253,7 +3253,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5G_is_new_dense_test(gid) == TRUE) TEST_ERROR /* Close root group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Open object through external link */ if((gid = H5Gopen2(fid, "src", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -3263,34 +3263,34 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(HDstrcmp(objname, "/dst")) TEST_ERROR /* Create object in external file */ - if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gid2 = H5Gcreate2(gid, "new_group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group in external file */ - if(H5Gclose(gid2) < 0) TEST_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR /* Close external object */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close first file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Open second file */ - if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Open group created through external link */ if((gid = H5Gopen2(fid, "dst/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Open group created through external link */ if((gid = H5Gopen2(fid, "dst/new_group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -3936,40 +3936,40 @@ ud_hard_links(hid_t fapl) if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Check that H5Lget_objinfo works on the hard link */ - if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* UD hard links have no query function, thus return a "link length" of 0 */ if(li.u.val_size != 0) TEST_ERROR if(UD_HARD_TYPE != li.type) { H5_FAILED(); puts(" Unexpected link class - should have been a UD hard link"); goto error; - } + } /* end if */ /* Unlink the group pointed to by the UD link. It shouldn't be * deleted because of the UD link. */ - if(H5Gunlink(fid, "/group") < 0) TEST_ERROR + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Ensure we can open the group through the UD link */ 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 - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Now delete the UD link. This should cause the group to be * deleted, too. */ - if(H5Gunlink(fid, "ud_link") < 0) TEST_ERROR + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* The file should be empty again. */ if(empty_size != h5_get_file_size(filename)) TEST_ERROR - if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR + if(H5Lunregister(UD_HARD_TYPE) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -4123,39 +4123,39 @@ ud_link_reregister(hid_t fapl) if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR /* Close opened object */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Unlink the group pointed to by the UD hard link. It shouldn't be * deleted because the UD link incremented its reference count. */ - if(H5Gunlink(fid, "/group") < 0) TEST_ERROR + if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* What a mess! Re-register user-defined links to clean up the * reference counts. We shouldn't actually need to unregister the * other link type */ - if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - if(H5Lis_registered(UD_HARD_TYPE) != TRUE) TEST_ERROR + if(H5Lregister(UD_hard_class) < 0) FAIL_STACK_ERROR + if(H5Lis_registered(UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR /* Ensure we can open the group through the UD link (now that UD hard * links have been registered) */ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Delete the UD hard link. This should cause the group to be * deleted, too. */ - if(H5Gunlink(fid, "ud_link") < 0) TEST_ERROR + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Unlink the other two groups so that we can make sure the file is empty */ - if(H5Gunlink(fid, "/rereg_target/new_group") < 0) TEST_ERROR - if(H5Gunlink(fid, REREG_TARGET_NAME) < 0) TEST_ERROR + if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(fid) < 0) TEST_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* The file should be empty again. */ - if(empty_size!=h5_get_file_size(filename)) TEST_ERROR + if(empty_size != h5_get_file_size(filename)) TEST_ERROR - if(H5Lunregister(UD_HARD_TYPE) < 0) TEST_ERROR - if(H5Lis_registered(UD_HARD_TYPE) != FALSE) TEST_ERROR + if(H5Lunregister(UD_HARD_TYPE) < 0) FAIL_STACK_ERROR + if(H5Lis_registered(UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR PASSED(); return 0; @@ -4376,7 +4376,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Remove UD link */ - if(H5Gunlink(fid, NEW_UD_CB_LINK_NAME) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Test that the callbacks don't work if the link class is not registered */ @@ -4399,9 +4399,9 @@ ud_callbacks(hid_t fapl, hbool_t new_format) H5E_BEGIN_TRY { 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) FAIL_STACK_ERROR if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR - if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR - if(H5Gunlink(fid, UD_CB_LINK_NAME) >= 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR } H5E_END_TRY /* The query callback should NOT fail, but should be unable to give a linklen */ @@ -4833,11 +4833,11 @@ 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(H5Ldelete(fid, "group", H5P_DEFAULT) < 0) TEST_ERROR if((gid = H5Gopen2(gid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR /* The deletion callback will always fail */ - if(H5Gunlink(fid, "ud_link") >= 0) TEST_ERROR + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR /* The query callback will fail */ if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR @@ -4874,7 +4874,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Lcopy(fid, "ud_link", fid, "copy_succ2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Delete link (this callback should work now) */ - if(H5Gunlink(fid, "ud_link") < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR diff --git a/test/mount.c b/test/mount.c index 101ac66..028f92b 100644 --- a/test/mount.c +++ b/test/mount.c @@ -689,7 +689,7 @@ test_unlink(hid_t fapl) } /* end if */ /* Unlink the mount point */ - if(H5Gunlink(file1, "/mnt_unlink") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file1, "/mnt_unlink", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* * We should still be able to get to "/file2" of file2 by starting at diff --git a/test/objcopy.c b/test/objcopy.c index 4aa4c45..148eea4 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -7091,7 +7091,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo /* Unlink dataset to copy from original location */ /* (So group comparison works properly) */ - if(H5Gunlink(fid_src, NAME_DATASET_SUB_SUB) < 0) TEST_ERROR + if(H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* open the group for copy */ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR diff --git a/test/stab.c b/test/stab.c index d49d3a8..2aed346 100644 --- a/test/stab.c +++ b/test/stab.c @@ -456,7 +456,7 @@ lifecycle(hid_t fapl2) while(u >= LIFECYCLE_MIN_DENSE) { sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; } /* end while */ @@ -468,7 +468,7 @@ lifecycle(hid_t fapl2) /* Unlink one more object from the group, which should transform back to using links */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; /* Check on top group's status */ @@ -478,10 +478,10 @@ lifecycle(hid_t fapl2) /* Unlink last two objects from top group */ sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR u--; sprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR @@ -490,7 +490,7 @@ lifecycle(hid_t fapl2) if(H5Gclose(gid) < 0) TEST_ERROR /* Unlink top group */ - if(H5Gunlink(fid, LIFECYCLE_TOP_GROUP) < 0) TEST_ERROR + if(H5Ldelete(fid, LIFECYCLE_TOP_GROUP, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close GCPL */ if(H5Pclose(gcpl) < 0) TEST_ERROR @@ -603,7 +603,7 @@ long_compact(hid_t fapl2) if(H5G_is_new_dense_test(gid) != TRUE) TEST_ERROR /* Unlink second object from top group */ - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ /* (Should still be dense storage to hold links, since name is too long for object header message) */ @@ -613,7 +613,7 @@ long_compact(hid_t fapl2) /* Unlink first object from top group */ objname[0] = 'a'; - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ /* (Should have deleted the dense storage now) */ @@ -626,7 +626,7 @@ long_compact(hid_t fapl2) if(H5Gclose(gid) < 0) TEST_ERROR /* Unlink top group */ - if(H5Gunlink(fid, "top") < 0) TEST_ERROR + if(H5Ldelete(fid, "top", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -736,7 +736,7 @@ read_old(hid_t fapl2) /* Delete new objects from old group */ for(u = 0; u < READ_OLD_NGROUPS; u++) { sprintf(objname, "Group %u", u); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Check on old group's status */ @@ -844,7 +844,7 @@ no_compact(hid_t fapl2) /* Unlink object from top group */ sprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); - if(H5Gunlink(gid, objname) < 0) TEST_ERROR + if(H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check on top group's status */ if(H5G_is_empty_test(gid) != TRUE) TEST_ERROR @@ -853,7 +853,7 @@ no_compact(hid_t fapl2) if(H5Gclose(gid) < 0) TEST_ERROR /* Unlink top group */ - if(H5Gunlink(fid, NO_COMPACT_TOP_GROUP) < 0) TEST_ERROR + if(H5Ldelete(fid, NO_COMPACT_TOP_GROUP, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR diff --git a/test/tattr.c b/test/tattr.c index b836d98..d987994 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1735,8 +1735,8 @@ test_attr_dtype_shared(hid_t fapl) VERIFY(statbuf.nlink, 3, "H5Gget_objinfo"); /* Unlink the dataset */ - ret=H5Gunlink(file_id,DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Check reference count on named datatype */ ret=H5Gget_objinfo(file_id,TYPE1_NAME,0,&statbuf); @@ -1744,8 +1744,8 @@ test_attr_dtype_shared(hid_t fapl) VERIFY(statbuf.nlink, 1, "H5Gget_objinfo"); /* Unlink the named datatype */ - ret=H5Gunlink(file_id,TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret=H5Fclose(file_id); @@ -1945,8 +1945,8 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2084,8 +2084,8 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2262,8 +2262,8 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2421,8 +2421,8 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2546,8 +2546,8 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl) CHECK(fid, FAIL, "H5Fopen"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Check on dataset's attribute storage status */ ret = H5F_get_sohm_mesg_count_test(fid, H5O_ATTR_ID, &mesg_count); @@ -2716,8 +2716,8 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -2986,8 +2986,8 @@ test_attr_big(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -3196,8 +3196,8 @@ test_attr_null_space(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close file */ ret = H5Fclose(fid); @@ -6868,15 +6868,15 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl) } /* end if */ /* Unlink datasets with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -7310,15 +7310,15 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl) } /* end if */ /* Unlink datasets with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "HLdelete"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -7674,15 +7674,15 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl) } /* end if */ /* Unlink datasets with attributes */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -7983,8 +7983,8 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink second dataset */ - ret = H5Gunlink(fid, DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Check on first dataset's attribute storage status */ @@ -8026,13 +8026,13 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Dclose"); /* Unlink first dataset */ - ret = H5Gunlink(fid, DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Unlink committed datatype */ if(test_shared == 2) { - ret = H5Gunlink(fid, TYPE1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, TYPE1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end if */ /* Check on attribute storage status */ @@ -8150,8 +8150,8 @@ test_attr_bug1(hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Gclose"); /* Unlink second group */ - ret = H5Gunlink(fid, GROUP2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid, GROUP2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Re-open first group */ gid = H5Gopen2(fid, GROUP1_NAME, H5P_DEFAULT); diff --git a/test/tfile.c b/test/tfile.c index e477622..dc971e7 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1254,8 +1254,8 @@ test_file_freespace(void) /* Delete datasets in file */ for(u = 0; u < 10; u++) { sprintf(name, "Dataset %u", u); - ret = H5Gunlink(file, name); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file, name, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); } /* end for */ /* Check that there is the right amount of free space in the file */ diff --git a/test/tmisc.c b/test/tmisc.c index b36a6c4..0fe0434 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -335,8 +335,8 @@ test_misc1(void) CHECK(ret, FAIL, "H5Dclose"); /* Remove the dataset. */ - ret = H5Gunlink(file, MISC1_DSET_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file, MISC1_DSET_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Write the dataset for the second time with a different value. */ dataset = H5Dcreate(file, MISC1_DSET_NAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT); @@ -2476,8 +2476,8 @@ test_misc14(void) TestErrPrintf("Error on line %d: data1!=rdata\n",__LINE__); /* Unlink second dataset */ - ret = H5Gunlink(file_id, MISC14_DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, MISC14_DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close second dataset */ ret = H5Dclose(Dataset2); @@ -2524,8 +2524,8 @@ test_misc14(void) TestErrPrintf("Error on line %d: data2!=rdata\n",__LINE__); /* Unlink first dataset */ - ret = H5Gunlink(file_id, MISC14_DSET1_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, MISC14_DSET1_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close first dataset */ ret = H5Dclose(Dataset1); @@ -2585,8 +2585,8 @@ test_misc14(void) TestErrPrintf("Error on line %d: data3!=rdata\n",__LINE__); /* Unlink second dataset */ - ret = H5Gunlink(file_id, MISC14_DSET2_NAME); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(file_id, MISC14_DSET2_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close second dataset */ ret = H5Dclose(Dataset2); @@ -3683,15 +3683,15 @@ test_misc22(void) MESSAGE(5, ("Testing datatypes with SZIP filter\n")); /* Allocate space for the buffer */ - buf = (char *)HDcalloc(MISC22_SPACE_DIM0*MISC22_SPACE_DIM1,8); + buf = (char *)HDcalloc(MISC22_SPACE_DIM0*MISC22_SPACE_DIM1, 8); CHECK(buf, NULL, "HDcalloc"); /* Create the file */ - fid = H5Fcreate (MISC22_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(MISC22_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fcreate"); /* Create the dataspace for the dataset */ - sid = H5Screate_simple (MISC22_SPACE_RANK, dims, NULL); + sid = H5Screate_simple(MISC22_SPACE_RANK, dims, NULL); CHECK(sid, FAIL, "H5Screate_simple"); for (i = 0; i < 4; i++) { @@ -3704,14 +3704,14 @@ test_misc22(void) MESSAGE(5, (" Testing datatypes size=%d precision=%u offset=%d\n",H5Tget_size(idts[i]),(unsigned)prec[j],(unsigned)offsets[k])); /* Create the DCPL */ - dcpl = H5Pcreate (H5P_DATASET_CREATE); + dcpl = H5Pcreate(H5P_DATASET_CREATE); CHECK(dcpl, FAIL, "H5Pcreate"); /* Set DCPL properties */ - ret = H5Pset_chunk (dcpl, MISC22_SPACE_RANK, chunk_size); + ret = H5Pset_chunk(dcpl, MISC22_SPACE_RANK, chunk_size); CHECK(ret, FAIL, "H5Pset_chunk"); /* Set custom DCPL properties */ - ret = H5Pset_szip (dcpl, H5_SZIP_NN_OPTION_MASK, 32); /* vary the PPB */ + ret = H5Pset_szip(dcpl, H5_SZIP_NN_OPTION_MASK, 32); /* vary the PPB */ CHECK(ret, FAIL, "H5Pset_szip"); /* set up the datatype according to the loop */ @@ -3734,40 +3734,40 @@ test_misc22(void) } /* Create the dataset */ - dsid = H5Dcreate (fid, MISC22_DSET_NAME, dtype, sid, dcpl); + dsid = H5Dcreate(fid, MISC22_DSET_NAME, dtype, sid, dcpl); CHECK(dsid, FAIL, "H5Dwrite"); /* Write out the whole dataset */ - ret = H5Dwrite (dsid, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + ret = H5Dwrite(dsid, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); CHECK(ret, FAIL, "H5Dwrite"); /* Close everything */ - ret = H5Dclose (dsid); + ret = H5Dclose(dsid); CHECK(ret, FAIL, "H5Dclose"); - ret = H5Tclose (dtype); + ret = H5Tclose(dtype); CHECK(ret, FAIL, "H5Tclose"); - ret = H5Pclose (dcpl); + ret = H5Pclose(dcpl); CHECK(ret, FAIL, "H5Pclose"); - dsid = H5Dopen (fid, MISC22_DSET_NAME); + dsid = H5Dopen(fid, MISC22_DSET_NAME); CHECK(dsid, FAIL, "H5Topen"); dcpl2 = H5Dget_create_plist(dsid); CHECK(dcpl2, FAIL, "H5Dget_create_plist"); - ret= H5Pget_filter_by_id( dcpl2, H5Z_FILTER_SZIP, &flags, - &cd_nelmts, cd_values, 0, NULL , NULL ); + ret= H5Pget_filter_by_id(dcpl2, H5Z_FILTER_SZIP, &flags, + &cd_nelmts, cd_values, 0, NULL , NULL); CHECK(ret, FAIL, "H5Pget_filter_by_id"); VERIFY(cd_values[2], correct, "SZIP filter returned value for precision"); - ret = H5Dclose (dsid); + ret = H5Dclose(dsid); CHECK(ret, FAIL, "H5Dclose"); - ret = H5Gunlink (fid, MISC22_DSET_NAME ); - CHECK(ret, FAIL, "H5Dunlink"); + ret = H5Ldelete(fid, MISC22_DSET_NAME, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); - ret = H5Pclose (dcpl2); + ret = H5Pclose(dcpl2); CHECK(ret, FAIL, "H5Pclose"); } } @@ -3780,9 +3780,9 @@ test_misc22(void) CHECK(ret, FAIL, "H5Tclose"); ret = H5Tclose(idts[3]); CHECK(ret, FAIL, "H5Tclose"); - ret = H5Sclose (sid); + ret = H5Sclose(sid); CHECK(ret, FAIL, "H5Sclose"); - ret = H5Fclose (fid); + ret = H5Fclose(fid); CHECK(ret, FAIL, "H5Fclose"); HDfree(buf); diff --git a/test/trefer.c b/test/trefer.c index 6f984f3..14fc184 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -887,8 +887,8 @@ test_reference_obj_deleted(void) CHECK(ret, FAIL, "H5Dclose"); /* Delete referenced dataset */ - ret = H5Gunlink(fid1,"/Dataset1"); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(fid1, "/Dataset1", H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close disk dataspace */ ret = H5Sclose(sid1); @@ -1078,12 +1078,12 @@ test_reference_group(void) VERIFY(objtype, H5G_DATASET, "H5Gget_objtype_by_idx"); /* Unlink one of the objects in the dereferenced group */ - ret = H5Gunlink(gid, GROUPNAME2); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Delete dataset object in dereferenced group (with other dataset still open) */ - ret = H5Gunlink(gid, DSETNAME2); - CHECK(ret, FAIL, "H5Gunlink"); + ret = H5Ldelete(gid, DSETNAME2, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); /* Close objects */ ret = H5Dclose(did); diff --git a/test/tvlstr.c b/test/tvlstr.c index 272186b..f4f77b9 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -808,24 +808,24 @@ static void test_vl_rewrite(void) } /* Read back from file 2 */ - for(i=0; i<REWRITE_NDATASETS; i++) { + for(i = 0; i < REWRITE_NDATASETS; i++) { sprintf(name, "/set_%d", i); read_scalar_dset(file2, type, space, name, name); - } + } /* end for */ /* Remove from file 2. */ - for(i=0; i<REWRITE_NDATASETS; i++) { + for(i = 0; i < REWRITE_NDATASETS; i++) { sprintf(name, "/set_%d", i); - ret = H5Gunlink(file2, name); - CHECK(ret, FAIL, "H5Gunlink"); - } + ret = H5Ldelete(file2, name, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Ldelete"); + } /* end for */ /* Effectively copy from file 1 to file 2 */ - for(i=0; i<REWRITE_NDATASETS; i++) { + for(i = 0; i < REWRITE_NDATASETS; i++) { sprintf(name, "/set_%d", i); read_scalar_dset(file1, type, space, name, name); write_scalar_dset(file2, type, space, name, name); - } + } /* end for */ /* Close everything */ ret = H5Tclose(type); diff --git a/test/unlink.c b/test/unlink.c index c4f1dab..106da0d 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -17,7 +17,7 @@ * Programmer: Robb Matzke <matzke@llnl.gov> * Friday, September 25, 1998 * - * Purpose: Test H5Gunlink(). + * Purpose: Test unlinking operations. */ #define H5G_PACKAGE /*suppress error about including H5Gpkg */ @@ -103,39 +103,40 @@ const char *FILENAME[] = { static int test_one(hid_t file) { - hid_t work=-1, grp=-1; + hid_t work = -1, grp = -1; herr_t status; /* Create a test group */ - if((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + if((work = H5Gcreate2(file, "/test_one", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Delete by absolute name */ TESTING("unlink by absolute name"); - if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(grp) < 0) TEST_ERROR - if(H5Gunlink(file, "/test_one/foo") < 0) TEST_ERROR + if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if(H5Ldelete(file, "/test_one/foo", H5P_DEFAULT) < 0) FAIL_STACK_ERROR PASSED(); /* Delete by local name */ TESTING("unlink by local name"); - if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose(grp) < 0) TEST_ERROR - if(H5Gunlink(work, "foo") < 0) TEST_ERROR + if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, "foo", H5P_DEFAULT) < 0) FAIL_STACK_ERROR PASSED(); /* Delete directly - should fail */ TESTING("unlink without a name"); - if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((grp = H5Gcreate2(work, "foo", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Gunlink(grp, "."); + status = H5Ldelete(grp, ".", H5P_DEFAULT); } H5E_END_TRY; if(status>=0) FAIL_PUTS_ERROR(" Unlinking object w/o a name should have failed.") - if(H5Gclose(grp) < 0) TEST_ERROR - PASSED(); + if(H5Gclose(grp) < 0) FAIL_STACK_ERROR /* Cleanup */ - if(H5Gclose(work) < 0) goto error; + if(H5Gclose(work) < 0) FAIL_STACK_ERROR + + PASSED(); return 0; error: @@ -144,7 +145,7 @@ test_one(hid_t file) H5Gclose(grp); } H5E_END_TRY; return 1; -} +} /* end test_one() */ /*------------------------------------------------------------------------- @@ -184,7 +185,7 @@ test_many(hid_t file) } /* end for */ for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -196,7 +197,7 @@ test_many(hid_t file) } /* end for */ for(i = (how_many - 1); i >= 0; --i) { sprintf(name, "obj_%05d", i); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -211,7 +212,7 @@ test_many(hid_t file) sprintf(name, "obj_%05d", how_many - (1 + i / 2)); else sprintf(name, "obj_%05d", i / 2); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -226,7 +227,7 @@ test_many(hid_t file) sprintf(name, "obj_%05d", how_many - (1 + i / 2)); else sprintf(name, "obj_%05d", i / 2); - if(H5Gunlink(work, name) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, name, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -266,21 +267,22 @@ test_symlink(hid_t file) TESTING("symlink removal"); /* Create a test group and symlink */ - if((work = H5Gcreate2(file, "/test_symlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_soft("link_value", work, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - if(H5Gunlink(work, "link") < 0) TEST_ERROR + if((work = H5Gcreate2(file, "/test_symlink", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Lcreate_soft("link_value", work, "link", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(work, "link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Cleanup */ - if (H5Gclose(work) < 0) TEST_ERROR + if(H5Gclose(work) < 0) FAIL_STACK_ERROR + PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { H5Gclose(work); } H5E_END_TRY; return 1; -} +} /* end test_symlink() */ /*------------------------------------------------------------------------- @@ -598,126 +600,132 @@ test_filespace(hid_t fapl) /* Create buffer for writing dataset */ if((data = HDmalloc(sizeof(int)*FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2))==NULL) TEST_ERROR + /* Create single dataset (with contiguous storage & late allocation), remove it & verify file size */ TESTING(" contiguous dataset with late allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with contiguous storage & early allocation), remove it & verify file size */ TESTING(" contiguous dataset with early allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename))<0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with chunked storage & late allocation), remove it & verify file size */ TESTING(" chunked dataset with late allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, late_chunk_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, late_chunk_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename))<0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with chunked storage & early allocation), remove it & verify file size */ TESTING(" chunked dataset with early allocation"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, early_chunk_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, early_chunk_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with compressed storage & early allocation), remove it & verify file size */ TESTING(" compressed, chunked dataset"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with compressed storage & early allocation), re-write it a bunch of * times (which should re-allocate blocks many times) and remove it & verify * file size. @@ -725,69 +733,71 @@ test_filespace(hid_t fapl) TESTING(" re-writing compressed, chunked dataset"); /* Create file (using FAPL with disabled raw data cache) */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_nocache)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, comp_dcpl)) < 0) FAIL_STACK_ERROR /* Alternate re-writing dataset with compressible & random data */ - for(u=0; u<FILESPACE_REWRITE; u++) { + for(u = 0; u < FILESPACE_REWRITE; u++) { /* Set buffer to some compressible values */ - for (v=0, tmp_data=data; v<(FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2); v++) - *tmp_data++ = v*u; + for(v = 0, tmp_data = data; v < (FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2); v++) + *tmp_data++ = v * u; /* Write the buffer to the dataset */ - if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR /* Set buffer to different random numbers each time */ - for (v=0, tmp_data=data; v<(FILESPACE_DIM0*FILESPACE_DIM1*FILESPACE_DIM2); v++) + for(v = 0, tmp_data = data; v < (FILESPACE_DIM0 * FILESPACE_DIM1 * FILESPACE_DIM2); v++) *tmp_data++ = (int)HDrandom(); /* Write the buffer to the dataset */ - if (H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) TEST_ERROR + if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) FAIL_STACK_ERROR } /* end for */ /* Close dataset */ - if(H5Dclose (dataset) < 0) TEST_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single dataset (with compact storage), remove it & verify file size */ TESTING(" compact dataset"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, compact_dcpl)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, compact_dcpl)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create two datasets (with contiguous storage), alternate adding attributes * to each one (which creates many object header continuations), * remove both & verify file size. @@ -795,14 +805,14 @@ test_filespace(hid_t fapl) TESTING(" object header continuations"); /* Create file */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create datasets to remove */ - if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR - if((dataset2 = H5Dcreate(file, DATASET2NAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) FAIL_STACK_ERROR + if((dataset2 = H5Dcreate(file, DATASET2NAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) FAIL_STACK_ERROR /* Create a dataspace for the attributes */ - if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) TEST_ERROR + if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) FAIL_STACK_ERROR /* Alternate adding attributes to each one */ for(u = 0; u < FILESPACE_NATTR; u++) { @@ -810,120 +820,123 @@ test_filespace(hid_t fapl) sprintf(objname,"%s %u",ATTRNAME,u); /* Create an attribute on the first dataset */ - if((attr = H5Acreate(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) TEST_ERROR + if((attr = H5Acreate(dataset, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Don't worry about writing the attribute - it will have a fill value */ /* Close the attribute on the first dataset */ - if(H5Aclose(attr) < 0) TEST_ERROR + if(H5Aclose(attr) < 0) FAIL_STACK_ERROR /* Create an attribute on the second dataset */ - if((attr = H5Acreate(dataset2, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) TEST_ERROR + if((attr = H5Acreate(dataset2, objname, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Don't worry about writing the attribute - it will have a fill value */ /* Close the attribute on the second dataset */ - if(H5Aclose(attr) < 0) TEST_ERROR + if(H5Aclose(attr) < 0) FAIL_STACK_ERROR /* Flush the file (to fix the sizes of object header buffers, etc) */ - if(H5Fflush(file,H5F_SCOPE_GLOBAL) < 0) TEST_ERROR + if(H5Fflush(file,H5F_SCOPE_GLOBAL) < 0) FAIL_STACK_ERROR } /* end for */ /* Close the dataspace for the attributes */ - if(H5Sclose(attr_space) < 0) TEST_ERROR + if(H5Sclose(attr_space) < 0) FAIL_STACK_ERROR /* Close datasets */ - if(H5Dclose(dataset) < 0) TEST_ERROR - if(H5Dclose(dataset2) < 0) TEST_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset2) < 0) FAIL_STACK_ERROR /* Remove the datasets */ - if(H5Gunlink(file, DATASETNAME) < 0) TEST_ERROR - if(H5Gunlink(file, DATASET2NAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(file, DATASET2NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size = h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single named datatype, remove it & verify file size */ TESTING(" named datatype"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create datatype to commit */ - if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Create a single named datatype to remove */ - if(H5Tcommit (file, TYPENAME, type) < 0) TEST_ERROR - if(H5Tclose (type) < 0) TEST_ERROR + if(H5Tcommit(file, TYPENAME, type) < 0) FAIL_STACK_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR /* Remove the named datatype */ - if(H5Gunlink (file, TYPENAME) < 0) TEST_ERROR + if(H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create single group, remove it & verify file size */ TESTING(" single group"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single group to remove */ - if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose (group) < 0) TEST_ERROR + if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR /* Remove the group */ - if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR + if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create many groups, remove them & verify file size */ TESTING(" multiple groups"); /* Create file */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a many groups to remove */ for(u = 0; u < UNLINK_NGROUPS; u++) { sprintf(objname, "%s %u", GROUPNAME, u); - if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose (group) < 0) TEST_ERROR + if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR } /* end for */ /* Remove the all the groups */ /* (Remove them in reverse order just to make file size calculation easier -QAK) */ for(u = UNLINK_NGROUPS; u > 0; u--) { sprintf(objname, "%s %u", GROUPNAME, (u - 1)); - if(H5Gunlink(file, objname) < 0) TEST_ERROR + if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR @@ -933,35 +946,37 @@ test_filespace(hid_t fapl) PASSED(); + /* Create simple group hiearchy, remove it & verify file size */ TESTING(" simple group hierarchy"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a small group hierarchy to remove */ - if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if((group2 = H5Gcreate2(group, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose (group2) < 0) TEST_ERROR - if(H5Gclose (group) < 0) TEST_ERROR + if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if((group2 = H5Gcreate2(group, GROUP2NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group2) < 0) FAIL_STACK_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR /* Remove the second group */ - if(H5Gunlink (file, GROUPNAME "/" GROUP2NAME) < 0) TEST_ERROR + if(H5Ldelete(file, GROUPNAME "/" GROUP2NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Remove the first group */ - if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR + if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create complex group hiearchy, remove it & verify file size */ TESTING(" complex group hierarchy"); @@ -973,252 +988,257 @@ test_filespace(hid_t fapl) SKIPPED(); } else { - /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - - /* Create a complex group hierarchy to remove */ - for(u=0; u<FILESPACE_TOP_GROUPS; u++) { - /* Create group */ - sprintf(objname,"%s %u",GROUPNAME,u); - if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + /* Create file */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* Create nested groups inside top groups */ - for(v=0; v<FILESPACE_NESTED_GROUPS; v++) { + /* Create a complex group hierarchy to remove */ + for(u = 0; u < FILESPACE_TOP_GROUPS; u++) { /* Create group */ - sprintf(objname,"%s %u",GROUP2NAME,v); - if((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - - /* Create datasets inside nested groups */ - for(w=0; w<FILESPACE_NDATASETS; w++) { - /* Create & close a dataset */ - sprintf(objname,"%s %u",DATASETNAME,w); - if((dataset = H5Dcreate (group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + sprintf(objname,"%s %u",GROUPNAME,u); + if((group = H5Gcreate2(file, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Create nested groups inside top groups */ + for(v = 0; v < FILESPACE_NESTED_GROUPS; v++) { + /* Create group */ + sprintf(objname, "%s %u", GROUP2NAME, v); + if((group2 = H5Gcreate2(group, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Create datasets inside nested groups */ + for(w = 0; w < FILESPACE_NDATASETS; w++) { + /* Create & close a dataset */ + sprintf(objname, "%s %u", DATASETNAME, w); + if((dataset = H5Dcreate(group2, objname, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR + } /* end for */ + + /* Close nested group */ + if(H5Gclose(group2) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close nested group */ - if(H5Gclose (group2) < 0) TEST_ERROR + /* Close top group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close top group */ - if(H5Gclose (group) < 0) TEST_ERROR - } /* end for */ - - /* Remove complex group hierarchy */ - /* (Remove them in reverse order just to make file size calculation easier -QAK) */ - for(u=FILESPACE_TOP_GROUPS; u>0; u--) { - /* Open group */ - sprintf(objname,"%s %u",GROUPNAME,(u-1)); - 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 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - - /* Remove datasets inside nested groups */ - for(w=0; w<FILESPACE_NDATASETS; w++) { - /* Remove dataset */ - sprintf(objname,"%s %u",DATASETNAME,w); - if(H5Gunlink (group2, objname) < 0) TEST_ERROR + /* Remove complex group hierarchy */ + /* (Remove them in reverse order just to make file size calculation easier -QAK) */ + for(u = FILESPACE_TOP_GROUPS; u > 0; u--) { + /* Open group */ + sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + 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 = H5Gopen2(group, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Remove datasets inside nested groups */ + for(w = 0; w < FILESPACE_NDATASETS; w++) { + /* Remove dataset */ + sprintf(objname, "%s %u", DATASETNAME, w); + if(H5Ldelete(group2, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + } /* end for */ + + /* Close nested group */ + if(H5Gclose(group2) < 0) FAIL_STACK_ERROR + + /* Remove nested group */ + sprintf(objname, "%s %u",GROUP2NAME, v); + if(H5Ldelete(group, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close nested group */ - if(H5Gclose (group2) < 0) TEST_ERROR + /* Close top group */ + if(H5Gclose(group) < 0) FAIL_STACK_ERROR - /* Remove nested group */ - sprintf(objname,"%s %u",GROUP2NAME,v); - if(H5Gunlink (group, objname) < 0) TEST_ERROR + /* Remove top group */ + sprintf(objname, "%s %u", GROUPNAME, (u - 1)); + if(H5Ldelete(file, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ - /* Close top group */ - if(H5Gclose (group) < 0) TEST_ERROR - - /* Remove top group */ - sprintf(objname,"%s %u",GROUPNAME,(u-1)); - if(H5Gunlink (file, objname) < 0) TEST_ERROR - } /* end for */ - - /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(file) < 0) FAIL_STACK_ERROR - /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR - /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + /* Verify the file is correct size */ + if(file_size != empty_size) TEST_ERROR - PASSED(); + PASSED(); } + /* Create dataset and duplicate dataset, remove original & verify file size */ TESTING(" duplicate dataset"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single dataset to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Dclose (dataset) < 0) TEST_ERROR + if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Create another dataset with same name */ H5E_BEGIN_TRY { - dataset=H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT); + dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, H5P_DEFAULT); } H5E_END_TRY; - if (dataset>=0) { + if(dataset >= 0) { H5Dclose(dataset); TEST_ERROR } /* end if */ /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename))<0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create group and duplicate group, remove original & verify file size */ TESTING(" duplicate group"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create a single group to remove */ - if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Gclose (group) < 0) TEST_ERROR + if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(group) < 0) FAIL_STACK_ERROR /* Create another group with same name */ H5E_BEGIN_TRY { group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); } H5E_END_TRY; - if (group>=0) { + if(group >= 0) { H5Gclose(group); TEST_ERROR } /* end if */ /* Remove the group */ - if(H5Gunlink (file, GROUPNAME) < 0) TEST_ERROR + if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create named datatype and duplicate named datatype, remove original & verify file size */ TESTING(" duplicate named datatype"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create datatype to commit */ - if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Create a single named datatype to remove */ - if(H5Tcommit (file, TYPENAME, type) < 0) TEST_ERROR - if(H5Tclose (type) < 0) TEST_ERROR + if(H5Tcommit(file, TYPENAME, type) < 0) FAIL_STACK_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR /* Create datatype to commit */ - if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) TEST_ERROR + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Create another named datatype with same name */ H5E_BEGIN_TRY { - status = H5Tcommit (file, TYPENAME, type); + status = H5Tcommit(file, TYPENAME, type); } H5E_END_TRY; - if (status>=0) TEST_ERROR - if(H5Tclose (type) < 0) TEST_ERROR + if(status >= 0) TEST_ERROR + if(H5Tclose(type) < 0) FAIL_STACK_ERROR /* Remove the named datatype */ - if(H5Gunlink (file, TYPENAME) < 0) TEST_ERROR + if(H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Create named datatype and duplicate named datatype, remove original & verify file size */ TESTING(" duplicate attribute"); /* Create file */ - if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create datasets to remove */ - if((dataset = H5Dcreate (file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) TEST_ERROR + if((dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, space, contig_dcpl)) < 0) FAIL_STACK_ERROR /* Create a dataspace for the attributes */ - if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) TEST_ERROR + if((attr_space = H5Screate_simple(FILESPACE_ATTR_NDIMS, attr_dims, NULL)) < 0) FAIL_STACK_ERROR /* Create an attribute on the dataset */ - if((attr = H5Acreate (dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) TEST_ERROR + if((attr = H5Acreate(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Don't worry about writing the attribute - it will have a fill value */ /* Close the attribute on the dataset */ - if(H5Aclose (attr) < 0) TEST_ERROR + if(H5Aclose(attr) < 0) FAIL_STACK_ERROR /* Create another attribute with same name */ H5E_BEGIN_TRY { - attr = H5Acreate (dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT); + attr = H5Acreate(dataset, ATTRNAME, H5T_NATIVE_INT, attr_space, H5P_DEFAULT); } H5E_END_TRY; - if (attr>=0) { + if(attr >= 0) { H5Aclose(attr); TEST_ERROR } /* end if */ /* Close the dataspace for the attributes */ - if(H5Sclose (attr_space) < 0) TEST_ERROR + if(H5Sclose(attr_space) < 0) FAIL_STACK_ERROR /* Close dataset */ - if(H5Dclose (dataset) < 0) TEST_ERROR + if(H5Dclose(dataset) < 0) FAIL_STACK_ERROR /* Remove the dataset */ - if(H5Gunlink (file, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close file */ - if(H5Fclose(file) < 0) TEST_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR /* Get the size of the file */ - if((file_size=h5_get_file_size(filename))<0) TEST_ERROR + if((file_size = h5_get_file_size(filename)) < 0) TEST_ERROR /* Verify the file is correct size */ - if(file_size!=empty_size) TEST_ERROR + if(file_size != empty_size) TEST_ERROR PASSED(); + /* Cleanup common objects */ /* Release dataset buffer */ HDfree(data); /* Close property lists */ - if(H5Pclose(fapl_nocache) < 0) TEST_ERROR - if(H5Pclose(contig_dcpl) < 0) TEST_ERROR - if(H5Pclose(early_chunk_dcpl) < 0) TEST_ERROR - if(H5Pclose(late_chunk_dcpl) < 0) TEST_ERROR - if(H5Pclose(comp_dcpl) < 0) TEST_ERROR - if(H5Pclose(compact_dcpl) < 0) TEST_ERROR + if(H5Pclose(fapl_nocache) < 0) FAIL_STACK_ERROR + if(H5Pclose(contig_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(early_chunk_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(late_chunk_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(comp_dcpl) < 0) FAIL_STACK_ERROR + if(H5Pclose(compact_dcpl) < 0) FAIL_STACK_ERROR /* Close dataspace */ - if(H5Sclose(space) < 0) TEST_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR /* Indicate success */ /* Don't print final "PASSED", since we aren't on the correct line anymore */ @@ -1264,8 +1284,8 @@ test_create_unlink(const char *msg, hid_t fapl) FAIL_PUTS_ERROR(" Creating file failed") /* Create a many groups to remove */ - for(u=0; u<UNLINK_NGROUPS; u++) { - sprintf(groupname,"%s %u",GROUPNAME,u); + for(u = 0; u < UNLINK_NGROUPS; u++) { + sprintf(groupname, "%s %u", GROUPNAME, u); if((group = H5Gcreate2(file, groupname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) { H5_FAILED(); printf("group %s creation failed\n", groupname); @@ -1279,9 +1299,9 @@ test_create_unlink(const char *msg, hid_t fapl) } /* end for */ /* Remove the all the groups */ - for(u=0; u<UNLINK_NGROUPS; u++) { - sprintf(groupname,"%s %u",GROUPNAME,u); - if(H5Gunlink(file, groupname) < 0) { + for(u = 0; u < UNLINK_NGROUPS; u++) { + sprintf(groupname, "%s %u", GROUPNAME, u); + if(H5Ldelete(file, groupname, H5P_DEFAULT) < 0) { H5_FAILED(); printf("Unlinking group %s failed\n", groupname); goto error; @@ -1396,34 +1416,34 @@ test_unlink_slashes(hid_t fapl) h5_fixname(FILENAME[5], fapl, filename, sizeof filename); /* Open the file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open the top level group */ 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 + if(H5Ldelete(gid,SLASHES_ROOTLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Delete the soft link with the full path */ - if(H5Gunlink(gid,SLASHES_SOFTLINK2_NAME) < 0) TEST_ERROR + if(H5Ldelete(gid,SLASHES_SOFTLINK2_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Delete the soft link with the relative path */ - if(H5Gunlink(gid,SLASHES_SOFTLINK_NAME) < 0) TEST_ERROR + if(H5Ldelete(gid,SLASHES_SOFTLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Delete the hard link */ - if(H5Gunlink(gid,SLASHES_HARDLINK_NAME) < 0) TEST_ERROR + if(H5Ldelete(gid,SLASHES_HARDLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Delete the group itself */ - if(H5Gunlink(gid,SLASHES_GROUP_NAME) < 0) TEST_ERROR + if(H5Ldelete(gid,SLASHES_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid) < 0) TEST_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Delete the hard link */ - if(H5Gunlink(fid,SLASHES_HARDLINK_NAME) < 0) TEST_ERROR + if(H5Ldelete(fid,SLASHES_HARDLINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Delete the group itself */ - if(H5Gunlink(fid,SLASHES_GROUP_NAME) < 0) TEST_ERROR + if(H5Ldelete(fid,SLASHES_GROUP_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close the file */ if(H5Fclose(fid) < 0) TEST_ERROR @@ -1438,7 +1458,8 @@ error: /* * Helper routine for test_unlink_rightleaf() */ -static int delete_node (hid_t pid, hid_t id) +static int +delete_node(hid_t pid, hid_t id) { char name[256]; /* Name of object to close */ @@ -1446,13 +1467,13 @@ static int delete_node (hid_t pid, hid_t id) if(H5Iget_name(id, name, sizeof(name)) < 0) return (-1); /* Close the object */ - if(H5Gclose (id) < 0) return(-1); + if(H5Gclose(id) < 0) return(-1); /* Unlink the object */ - if(H5Gunlink (pid, name) < 0) return(-1); + if(H5Ldelete(pid, name, H5P_DEFAULT) < 0) return(-1); /* If this object is the right-most child, try opening the previous object */ - if(HDstrcmp(name,"/Zone81")==0) { + if(HDstrcmp(name,"/Zone81") == 0) { hid_t gid; if((gid = H5Gopen2(pid, "/Zone80", H5P_DEFAULT)) < 0) return(-1); @@ -1562,22 +1583,22 @@ test_unlink_rightnode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { sprintf(name, "ZoneB%d", n + 1); - if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } /* end for */ /* Close all the groups */ for (n = 0; n < ngroups; n++) - if(H5Gclose(gids[n]) < 0) TEST_ERROR + if(H5Gclose(gids[n]) < 0) FAIL_STACK_ERROR /* Unlink specific objects to trigger deletion of right leaf in non-leaf node */ - if(H5Gunlink(fid,"/ZoneB77") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneB78") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneB79") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneB8") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneB80") < 0) TEST_ERROR + if(H5Ldelete(fid, "/ZoneB77", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneB78", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneB79", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneB8", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneB80", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close root group ID */ - if(H5Gclose(rootid) < 0) TEST_ERROR + if(H5Gclose(rootid) < 0) FAIL_STACK_ERROR /* Free memory */ HDfree(gids); @@ -1625,165 +1646,165 @@ test_unlink_middlenode(hid_t fid) /* Create all the groups */ for (n = 0; n < ngroups; n++) { sprintf(name, "ZoneC%d", n + 1); - if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((gids[n] = H5Gcreate2(rootid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR } /* end for */ /* Close all the groups */ for (n = 0; n < ngroups; n++) - if(H5Gclose(gids[n]) < 0) TEST_ERROR + if(H5Gclose(gids[n]) < 0) FAIL_STACK_ERROR /* Unlink specific objects to trigger deletion of all leafs in "interior" non-leaf node */ - if(H5Gunlink(fid,"/ZoneC11") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC110") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC111") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC112") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC113") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC114") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC115") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC116") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC117") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC118") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC119") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC12") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC120") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC121") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC122") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC123") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC124") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC125") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC126") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC127") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC128") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC129") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC13") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC130") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC131") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC132") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC133") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC134") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC135") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC136") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC137") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC138") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC139") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC14") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC140") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC141") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC142") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC143") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC144") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC145") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC146") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC147") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC148") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC149") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC15") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC150") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC151") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC152") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC153") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC154") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC155") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC156") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC157") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC158") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC159") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC16") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC160") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC161") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC162") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC163") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC164") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC165") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC166") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC167") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC168") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC169") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC17") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC170") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC171") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC172") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC173") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC174") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC175") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC176") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC177") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC178") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC179") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC18") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC180") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC19") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC2") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC20") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC21") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC22") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC23") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC24") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC25") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC26") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC27") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC28") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC29") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC3") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC30") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC31") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC32") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC33") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC34") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC35") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC36") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC37") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC38") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC39") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC4") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC40") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC41") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC42") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC43") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC44") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC45") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC46") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC47") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC48") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC49") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC5") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC50") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC51") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC52") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC53") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC54") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC55") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC56") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC57") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC58") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC59") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC6") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC60") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC61") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC62") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC63") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC64") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC65") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC66") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC67") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC68") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC69") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC7") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC70") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC71") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC72") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC73") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC74") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC75") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC76") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC77") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC78") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC79") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC8") < 0) TEST_ERROR - if(H5Gunlink(fid,"/ZoneC80") < 0) TEST_ERROR + if(H5Ldelete(fid, "/ZoneC11", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC110", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC111", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC112", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC113", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC114", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC115", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC116", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC117", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC118", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC119", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC12", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC120", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC121", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC122", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC123", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC124", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC125", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC126", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC127", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC128", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC129", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC13", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC130", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC131", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC132", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC133", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC134", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC135", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC136", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC137", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC138", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC139", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC14", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC140", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC141", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC142", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC143", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC144", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC145", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC146", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC147", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC148", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC149", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC15", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC150", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC151", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC152", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC153", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC154", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC155", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC156", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC157", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC158", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC159", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC16", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC160", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC161", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC162", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC163", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC164", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC165", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC166", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC167", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC168", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC169", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC17", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC170", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC171", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC172", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC173", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC174", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC175", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC176", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC177", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC178", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC179", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC18", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC180", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC19", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC2", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC20", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC21", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC22", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC23", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC24", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC25", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC26", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC27", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC28", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC29", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC3", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC30", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC31", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC32", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC33", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC34", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC35", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC36", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC37", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC38", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC39", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC4", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC40", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC41", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC42", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC43", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC44", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC45", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC46", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC47", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC48", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC49", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC5", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC50", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC51", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC52", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC53", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC54", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC55", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC56", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC57", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC58", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC59", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC6", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC60", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC61", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC62", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC63", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC64", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC65", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC66", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC67", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC68", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC69", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC7", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC70", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC71", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC72", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC73", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC74", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC75", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC76", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC77", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC78", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC79", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC8", H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, "/ZoneC80", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close root group ID */ - if(H5Gclose(rootid) < 0) TEST_ERROR + if(H5Gclose(rootid) < 0) FAIL_STACK_ERROR /* Free memory */ HDfree(gids); @@ -1815,7 +1836,7 @@ error: static int test_resurrect_dataset(hid_t fapl) { - hid_t f=-1, s=-1, d=-1; + hid_t f =-1, s =-1, d =-1; char filename[1024]; TESTING("resurrecting dataset after deletion"); @@ -1832,7 +1853,7 @@ test_resurrect_dataset(hid_t fapl) if(H5Sclose(s) < 0) FAIL_STACK_ERROR /* Unlink the dataset while it's open (will mark it for deletion when closed) */ - if(H5Gunlink(f, DATASETNAME) < 0) FAIL_STACK_ERROR + if(H5Ldelete(f, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that dataset name is NULL */ if(H5Iget_name(d, NULL, (size_t)0) != 0) FAIL_STACK_ERROR @@ -1845,7 +1866,7 @@ test_resurrect_dataset(hid_t fapl) if(H5Fclose(f) < 0) FAIL_STACK_ERROR /* Re-open the file */ - if((f=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR + if((f = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Attempt to open the dataset under the new name */ if((d = H5Dopen(f,DATASET2NAME)) < 0) FAIL_STACK_ERROR @@ -1899,10 +1920,10 @@ test_resurrect_datatype(hid_t fapl) /* Create a named datatype in the file */ if((type = H5Tcopy (H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR - if(H5Tcommit (file, TYPENAME, type) < 0) FAIL_STACK_ERROR + if(H5Tcommit(file, TYPENAME, type) < 0) FAIL_STACK_ERROR /* Unlink the datatype while it's open (will mark it for deletion when closed) */ - if(H5Gunlink(file, TYPENAME) < 0) FAIL_STACK_ERROR + if(H5Ldelete(file, TYPENAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that datatype name is NULL */ if(H5Iget_name(type, NULL, (size_t)0) != 0) FAIL_STACK_ERROR @@ -1970,7 +1991,7 @@ test_resurrect_group(hid_t fapl) if((group = H5Gcreate2(file, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Unlink the group while it's open (will mark it for deletion when closed) */ - if(H5Gunlink(file, GROUPNAME) < 0) FAIL_STACK_ERROR + if(H5Ldelete(file, GROUPNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check that group's name is NULL */ if(H5Iget_name(group, NULL, (size_t)0) != 0) FAIL_STACK_ERROR @@ -2022,13 +2043,13 @@ error: static int test_unlink_chunked_dataset(hid_t fapl) { - hid_t file_id=-1; - hid_t dset_id=-1; - hid_t space_id=-1; - hid_t dcpl_id=-1; - hsize_t dims[FILESPACE_NDIMS]={FILESPACE_DIM0,FILESPACE_DIM1,FILESPACE_DIM2}; - hsize_t max_dims[FILESPACE_NDIMS]={H5S_UNLIMITED,H5S_UNLIMITED,H5S_UNLIMITED}; - hsize_t chunk_dims[FILESPACE_NDIMS]={FILESPACE_CHUNK0,FILESPACE_CHUNK1,FILESPACE_CHUNK2}; + hid_t file_id = -1; + hid_t dset_id = -1; + hid_t space_id = -1; + hid_t dcpl_id = -1; + hsize_t dims[FILESPACE_NDIMS] = {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2}; + hsize_t max_dims[FILESPACE_NDIMS] = {H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED}; + hsize_t chunk_dims[FILESPACE_NDIMS] = {FILESPACE_CHUNK0, FILESPACE_CHUNK1, FILESPACE_CHUNK2}; char filename[1024]; TESTING("unlinking chunked dataset"); @@ -2037,43 +2058,43 @@ test_unlink_chunked_dataset(hid_t fapl) h5_fixname(FILENAME[9], fapl, filename, sizeof filename); /* Create the file */ - if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create the dataspace */ - if((space_id=H5Screate_simple(FILESPACE_NDIMS,dims,max_dims)) < 0) TEST_ERROR + if((space_id = H5Screate_simple(FILESPACE_NDIMS,dims,max_dims)) < 0) FAIL_STACK_ERROR /* Create the dataset creation filter */ - if((dcpl_id=H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR /* Set to chunked storage */ - if(H5Pset_chunk(dcpl_id,FILESPACE_NDIMS,chunk_dims) < 0) TEST_ERROR + if(H5Pset_chunk(dcpl_id,FILESPACE_NDIMS,chunk_dims) < 0) FAIL_STACK_ERROR /* Set to early space allocation */ - if(H5Pset_alloc_time(dcpl_id,H5D_ALLOC_TIME_EARLY) < 0) TEST_ERROR + if(H5Pset_alloc_time(dcpl_id,H5D_ALLOC_TIME_EARLY) < 0) FAIL_STACK_ERROR /* Create the dataset */ - if((dset_id = H5Dcreate(file_id,DATASETNAME,H5T_NATIVE_INT,space_id,dcpl_id)) < 0) TEST_ERROR + if((dset_id = H5Dcreate(file_id,DATASETNAME,H5T_NATIVE_INT,space_id,dcpl_id)) < 0) FAIL_STACK_ERROR /* Close the dataspace */ - if(H5Sclose(space_id) < 0) TEST_ERROR + if(H5Sclose(space_id) < 0) FAIL_STACK_ERROR /* Close the dataset creation property list */ - if(H5Pclose(dcpl_id) < 0) TEST_ERROR + if(H5Pclose(dcpl_id) < 0) FAIL_STACK_ERROR /* Close the dataset */ - if(H5Dclose(dset_id) < 0) TEST_ERROR + if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR /* Re-open the file */ - if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Delete the dataset */ - if(H5Gunlink(file_id, DATASETNAME) < 0) TEST_ERROR + if(H5Ldelete(file_id, DATASETNAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(file_id) < 0) TEST_ERROR + if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR PASSED(); return 0; @@ -2191,7 +2212,7 @@ test_full_group_compact(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Delete the full group */ - if(H5Gunlink(file_id, "/delete") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/delete", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { @@ -2337,7 +2358,7 @@ test_full_group_dense(hid_t fapl) if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Delete the full group */ - if(H5Gunlink(file_id, "/delete") < 0) FAIL_STACK_ERROR + if(H5Ldelete(file_id, "/delete", H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Check reference count on objects to keep */ for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) { @@ -2372,7 +2393,7 @@ error: /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test H5Gunlink() + * Purpose: Test unlinking operations * * Return: Success: zero * diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 2dc39b0..914cfbf 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -564,142 +564,141 @@ static void gent_compound_dt(void) { /* test compound data type */ hsize_t dset3_dim[2]; - for (i = 0; i < (int)sdim; i++) { - dset1[i].a = i; - dset1[i].b = (float)(i*i); - dset1[i].c = (float)(1./(i+1)); + for (i = 0; i < (int)sdim; i++) { + dset1[i].a = i; + dset1[i].b = (float)(i*i); + dset1[i].c = (float)(1./(i+1)); - dset2[i].a = i; - dset2[i].b = (float)(i+ i*0.1); + dset2[i].a = i; + dset2[i].b = (float)(i+ i*0.1); - dset4[i].a = i; - dset4[i].b = (float)(i+3); - - dset5[i].a = i; - dset5[i].b = (float)(i*0.1); - } + dset4[i].a = i; + dset4[i].b = (float)(i+3); + dset5[i].a = i; + dset5[i].b = (float)(i*0.1); + } - fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - space = H5Screate_simple(1, &sdim, NULL); + fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); - type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0])); - H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE); - H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE); - H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE); - H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT); - H5Tinsert(type2, "c_name", HOFFSET(dset1_t, c), H5T_NATIVE_DOUBLE); - dataset = H5Dcreate(fid, "/dset1", type, space, H5P_DEFAULT); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); - H5Tclose(type2); - H5Tclose(type); - H5Dclose(dataset); + space = H5Screate_simple(1, &sdim, NULL); - /* shared data type 1 */ - type = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); - H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE); - H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE); - H5Tcommit(fid, "type1", type); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); - H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT); - group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - - dataset = H5Dcreate(group, "dset2", type, space, H5P_DEFAULT); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); - H5Tclose(type2); - H5Tclose(type); - H5Dclose(dataset); + type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); + type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0])); + H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE); + H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE); + H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE); + H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT); + H5Tinsert(type2, "c_name", HOFFSET(dset1_t, c), H5T_NATIVE_DOUBLE); + dataset = H5Dcreate(fid, "/dset1", type, space, H5P_DEFAULT); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); + H5Tclose(type2); + H5Tclose(type); + H5Dclose(dataset); + /* shared data type 1 */ + type = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); + H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE); + H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE); + H5Tcommit(fid, "type1", type); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); + H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT); + group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + dataset = H5Dcreate(group, "dset2", type, space, H5P_DEFAULT); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); + H5Tclose(type2); + H5Tclose(type); + H5Dclose(dataset); - /* shared data type 2 */ - type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); - ndims = 1; dim[0] = 4; + /* shared data type 2 */ + type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); - array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL); - H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt); - H5Tclose(array_dt); + ndims = 1; dim[0] = 4; - array_dt = H5Tarray_create(H5T_NATIVE_INT, ndims, dim, NULL); - H5Tinsert(type2, "int_array", HOFFSET(dset3_t, a), array_dt); - H5Tclose(array_dt); + array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL); + H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt); + H5Tclose(array_dt); - ndims = 2; dim[0] = 5; dim[1] = 6; + array_dt = H5Tarray_create(H5T_NATIVE_INT, ndims, dim, NULL); + H5Tinsert(type2, "int_array", HOFFSET(dset3_t, a), array_dt); + H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL); - H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt); - H5Tclose(array_dt); + ndims = 2; dim[0] = 5; dim[1] = 6; - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, ndims, dim, NULL); - H5Tinsert(type2, "float_array", HOFFSET(dset3_t, b), array_dt); - H5Tclose(array_dt); + array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL); + H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt); + H5Tclose(array_dt); - H5Tcommit(fid, "type2", type); + array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, ndims, dim, NULL); + H5Tinsert(type2, "float_array", HOFFSET(dset3_t, b), array_dt); + H5Tclose(array_dt); + H5Tcommit(fid, "type2", type); - dset3_dim[0] = 3; dset3_dim[1] = 6; - space3 = H5Screate_simple(2, dset3_dim, NULL); - dataset = H5Dcreate(group, "dset3", type, space3, H5P_DEFAULT); - for (i = 0; i < (int)dset3_dim[0]; i++) { - for (j = 0; j < (int)dset3_dim[1]; j++) { - for (k = 0; k < 4; k++) - dset3[i][j].a[k] = k+j+i; - for (k = 0; k < 5; k++) - for (l = 0; l < 6; l++) - dset3[i][j].b[k][l] = (float)((k+1)+l+j+i); - } - } - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3); - H5Sclose(space3); - H5Tclose(type); - H5Tclose(type2); - H5Dclose(dataset); - /* shared data type 3 */ - type = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); - H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE); - H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE); - H5Tcommit(group, "type3", type); - H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT); - dataset = H5Dcreate(group, "dset4", type, space, H5P_DEFAULT); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4); + dset3_dim[0] = 3; dset3_dim[1] = 6; + space3 = H5Screate_simple(2, dset3_dim, NULL); + dataset = H5Dcreate(group, "dset3", type, space3, H5P_DEFAULT); + for (i = 0; i < (int)dset3_dim[0]; i++) { + for (j = 0; j < (int)dset3_dim[1]; j++) { + for (k = 0; k < 4; k++) + dset3[i][j].a[k] = k+j+i; + for (k = 0; k < 5; k++) + for (l = 0; l < 6; l++) + dset3[i][j].b[k][l] = (float)((k+1)+l+j+i); + } + } + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset3); + H5Sclose(space3); + H5Tclose(type); + H5Tclose(type2); + H5Dclose(dataset); - H5Tclose(type); - H5Tclose(type2); - H5Dclose(dataset); - H5Gclose(group); + /* shared data type 3 */ + type = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); + H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE); + H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE); + H5Tcommit(group, "type3", type); + H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT); + dataset = H5Dcreate(group, "dset4", type, space, H5P_DEFAULT); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4); + H5Tclose(type); + H5Tclose(type2); + H5Dclose(dataset); + H5Gclose(group); - /* unamed data type */ - group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - type = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); - H5Tinsert(type, "int", HOFFSET(dset5_t, a), H5T_STD_I32BE); - H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE); - H5Tcommit(group, "type4", type); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); - H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT); - dataset = H5Dcreate(group, "dset5", type, space, H5P_DEFAULT); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5); + /* unamed data type */ + group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gunlink(group,"type4"); + type = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); + H5Tinsert(type, "int", HOFFSET(dset5_t, a), H5T_STD_I32BE); + H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE); + H5Tcommit(group, "type4", type); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); + H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT); + dataset = H5Dcreate(group, "dset5", type, space, H5P_DEFAULT); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5); - H5Tclose(type); - H5Tclose(type2); - H5Dclose(dataset); - H5Sclose(space); - H5Gclose(group); + H5Ldelete(group, "type4", H5P_DEFAULT); - H5Fclose(fid); + H5Tclose(type); + H5Tclose(type2); + H5Dclose(dataset); + H5Sclose(space); + H5Gclose(group); + H5Fclose(fid); } /* @@ -750,138 +749,138 @@ static void gent_compound_dt2(void) { /* test compound data type */ hsize_t sdim, maxdim; - sdim = 10; - for (i = 0; i < (int)sdim; i++) { - dset1[i].a = i; - dset1[i].b = (float)(i*i); - dset1[i].c = (float)(1./(i+1)); + sdim = 10; + for (i = 0; i < (int)sdim; i++) { + dset1[i].a = i; + dset1[i].b = (float)(i*i); + dset1[i].c = (float)(1./(i+1)); - dset2[i].a = i; - dset2[i].b = (float)(i+ i*0.1); + dset2[i].a = i; + dset2[i].b = (float)(i+ i*0.1); - dset4[i].a = i; - dset4[i].b = (float)(i*1.0); + dset4[i].a = i; + dset4[i].b = (float)(i*1.0); - dset5[i].a = i; - dset5[i].b = (float)(i*1.0); - } + dset5[i].a = i; + dset5[i].b = (float)(i*1.0); + } - fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - create_plist = H5Pcreate(H5P_DATASET_CREATE); + create_plist = H5Pcreate(H5P_DATASET_CREATE); - sdim = 2; - H5Pset_chunk(create_plist, 1, &sdim); + sdim = 2; + H5Pset_chunk(create_plist, 1, &sdim); - sdim = 6; - maxdim = H5S_UNLIMITED; + sdim = 6; + maxdim = H5S_UNLIMITED; - space = H5Screate_simple(1, &sdim, &maxdim); + space = H5Screate_simple(1, &sdim, &maxdim); - type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); + type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); - H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE); - H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE); - H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE); + H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE); + H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE); + H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE); - dataset = H5Dcreate(fid, "/dset1", type, space, create_plist); + dataset = H5Dcreate(fid, "/dset1", type, space, create_plist); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); - H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT); - H5Tinsert(type2, "c_name", HOFFSET(dset1_t, c), H5T_NATIVE_DOUBLE); + H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT); + H5Tinsert(type2, "c_name", HOFFSET(dset1_t, c), H5T_NATIVE_DOUBLE); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); - H5Tclose(type); - H5Tclose(type2); - H5Sclose(space); - H5Dclose(dataset); + H5Tclose(type); + H5Tclose(type2); + H5Sclose(space); + H5Dclose(dataset); - sdim = 6; - maxdim = 10; + sdim = 6; + maxdim = 10; - space = H5Screate_simple(1, &sdim, &maxdim); + space = H5Screate_simple(1, &sdim, &maxdim); - /* shared data type 1 */ - type = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); - H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE); - H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE); - H5Tcommit(fid, "type1", type); + /* shared data type 1 */ + type = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); + H5Tinsert(type, "int_name", HOFFSET(dset2_t, a), H5T_STD_I32BE); + H5Tinsert(type, "float_name", HOFFSET(dset2_t, b), H5T_IEEE_F32BE); + H5Tcommit(fid, "type1", type); - group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + group = H5Gcreate2(fid, "/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - dataset = H5Dcreate(group, "dset2", type, space, create_plist); + dataset = H5Dcreate(group, "dset2", type, space, create_plist); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); - H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); + H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); - H5Tclose(type); - H5Tclose(type2); - H5Dclose(dataset); + H5Tclose(type); + H5Tclose(type2); + H5Dclose(dataset); - /* shared data type 2 */ - type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); + /* shared data type 2 */ + type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t)); - ndims = 1; dim[0] = 4; - array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL); - H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt); - H5Tclose(array_dt); + ndims = 1; dim[0] = 4; + array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL); + H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt); + H5Tclose(array_dt); - ndims = 2; dim[0] = 5; dim[1] = 6; - array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL); - H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt); - H5Tclose(array_dt); + ndims = 2; dim[0] = 5; dim[1] = 6; + array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL); + H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt); + H5Tclose(array_dt); - H5Tcommit(fid, "type2", type); - H5Tclose(type); + H5Tcommit(fid, "type2", type); + H5Tclose(type); - /* shared data type 3 */ - type = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); - H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE); - H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE); - H5Tcommit(group, "type3", type); + /* shared data type 3 */ + type = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); + H5Tinsert(type, "int", HOFFSET(dset4_t, a), H5T_STD_I32BE); + H5Tinsert(type, "float", HOFFSET(dset4_t, b), H5T_IEEE_F32BE); + H5Tcommit(group, "type3", type); - dataset = H5Dcreate(group, "dset4", type, space, create_plist); + dataset = H5Dcreate(group, "dset4", type, space, create_plist); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); - H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset4_t)); + H5Tinsert(type2, "int", HOFFSET(dset4_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "float", HOFFSET(dset4_t, b), H5T_NATIVE_FLOAT); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset4); - H5Tclose(type); - H5Tclose(type2); - H5Dclose(dataset); - H5Gclose(group); + H5Tclose(type); + H5Tclose(type2); + H5Dclose(dataset); + H5Gclose(group); - /* unamed data type */ - group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + /* unamed data type */ + group = H5Gcreate2(fid, "/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - type = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); - H5Tinsert(type, "int", HOFFSET(dset5_t, a), H5T_STD_I32BE); - H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE); - H5Tcommit(group, "type4", type); - dataset = H5Dcreate(group, "dset5", type, space, create_plist); - type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); - H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT); - H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5); + type = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); + H5Tinsert(type, "int", HOFFSET(dset5_t, a), H5T_STD_I32BE); + H5Tinsert(type, "float", HOFFSET(dset5_t, b), H5T_IEEE_F32BE); + H5Tcommit(group, "type4", type); + dataset = H5Dcreate(group, "dset5", type, space, create_plist); + type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset5_t)); + H5Tinsert(type2, "int", HOFFSET(dset5_t, a), H5T_NATIVE_INT); + H5Tinsert(type2, "float", HOFFSET(dset5_t, b), H5T_NATIVE_FLOAT); + H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset5); - H5Gunlink(group,"type4"); + H5Ldelete(group, "type4", H5P_DEFAULT); - H5Tclose(type); - H5Tclose(type2); - H5Dclose(dataset); - H5Sclose(space); - H5Gclose(group); - H5Pclose(create_plist); + H5Tclose(type); + H5Tclose(type2); + H5Dclose(dataset); + H5Sclose(space); + H5Gclose(group); + H5Pclose(create_plist); - H5Fclose(fid); + H5Fclose(fid); } @@ -5064,14 +5063,14 @@ static void gent_fcontents(void) /* no name datatype */ - tid=H5Tcopy(H5T_NATIVE_INT); - ret=H5Tcommit(fid, "mytype2", tid); - assert(ret>=0); - write_dset(fid,1,dims,"dsetmytype2",tid,buf); - ret=H5Gunlink(fid,"mytype2"); - assert(ret>=0); - ret=H5Tclose(tid); - assert(ret>=0); + tid = H5Tcopy(H5T_NATIVE_INT); + ret = H5Tcommit(fid, "mytype2", tid); + assert(ret >= 0); + write_dset(fid, 1, dims, "dsetmytype2", tid, buf); + ret = H5Ldelete(fid, "mytype2", H5P_DEFAULT); + assert(ret >= 0); + ret = H5Tclose(tid); + assert(ret >= 0); /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index c21b858..cc5591d 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -2384,94 +2384,92 @@ out: */ int make_early(void) { - hsize_t dims[1] ={3000}; - hsize_t cdims[1]={30}; - hid_t fid=-1; - hid_t dset_id=-1; - hid_t sid=-1; - hid_t tid=-1; - hid_t dcpl=-1; - int i; - char name[10]; - int iter=100; - - if ((fid = H5Fcreate(FNAME5,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) - return -1; - if (H5Fclose(fid)<0) - goto out; - - if ((sid = H5Screate_simple(1, dims, NULL))<0) - goto out; - if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) - goto out; - if (H5Pset_chunk(dcpl,1,cdims)<0) - goto out; - if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY)<0) - goto out; - - for (i=0; i<iter; i++) - { - if ((fid = H5Fopen(FNAME5,H5F_ACC_RDWR,H5P_DEFAULT))<0) - goto out; - if ((dset_id = H5Dcreate(fid,"early",H5T_NATIVE_DOUBLE,sid,dcpl))<0) - goto out; - if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0) - goto out; - sprintf(name,"%d", i); - if ((H5Tcommit(fid,name,tid))<0) - goto out; - if (H5Tclose(tid)<0) - goto out; - if (H5Dclose(dset_id)<0) - goto out; - if (H5Gunlink(fid,"early")<0) - goto out; - if (H5Fclose(fid)<0) - goto out; - } - -/*------------------------------------------------------------------------- - * do the same without close/opening the file and creating the dataset - *------------------------------------------------------------------------- - */ + hsize_t dims[1] ={3000}; + hsize_t cdims[1]={30}; + hid_t fid=-1; + hid_t dset_id=-1; + hid_t sid=-1; + hid_t tid=-1; + hid_t dcpl=-1; + int i; + char name[10]; + int iter=100; + + if((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; + if(H5Fclose(fid) < 0) + goto out; + + if((sid = H5Screate_simple(1, dims, NULL)) < 0) + goto out; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if(H5Pset_chunk(dcpl, 1, cdims) < 0) + goto out; + if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0) + goto out; + + for(i = 0; i < iter; i++) + { + if((fid = H5Fopen(FNAME5, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + goto out; + if((dset_id = H5Dcreate(fid, "early", H5T_NATIVE_DOUBLE, sid, dcpl)) < 0) + goto out; + if((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) + goto out; + sprintf(name, "%d", i); + if((H5Tcommit(fid, name, tid)) < 0) + goto out; + if(H5Tclose(tid) < 0) + goto out; + if(H5Dclose(dset_id) < 0) + goto out; + if(H5Ldelete(fid, "early", H5P_DEFAULT) < 0) + goto out; + if(H5Fclose(fid) < 0) + goto out; + } - if ((fid = H5Fcreate(FNAME6,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) - return -1; + /*------------------------------------------------------------------------- + * do the same without close/opening the file and creating the dataset + *------------------------------------------------------------------------- + */ - for (i=0; i<iter; i++) - { - if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0) - goto out; - sprintf(name,"%d", i); - if ((H5Tcommit(fid,name,tid))<0) - goto out; - if (H5Tclose(tid)<0) - goto out; - } + if((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; - if (H5Sclose(sid)<0) - goto out; - if (H5Pclose(dcpl)<0) - goto out; - if (H5Fclose(fid)<0) - goto out; + for(i = 0; i < iter; i++) + { + if((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) + goto out; + sprintf(name, "%d", i); + if((H5Tcommit(fid, name, tid)) < 0) + goto out; + if(H5Tclose(tid) < 0) + goto out; + } + if(H5Sclose(sid) < 0) + goto out; + if(H5Pclose(dcpl) < 0) + goto out; + if(H5Fclose(fid) < 0) + goto out; - return 0; + return 0; out: - H5E_BEGIN_TRY { - H5Tclose(tid); - H5Pclose(dcpl); - H5Sclose(sid); - H5Dclose(dset_id); - H5Fclose(fid); - } H5E_END_TRY; - return -1; + H5E_BEGIN_TRY { + H5Tclose(tid); + H5Pclose(dcpl); + H5Sclose(sid); + H5Dclose(dset_id); + H5Fclose(fid); + } H5E_END_TRY; + return -1; } - /*------------------------------------------------------------------------- * Function: make_layout * diff --git a/tools/lib/talign.c b/tools/lib/talign.c index 21613df..b0dbbe9 100644 --- a/tools/lib/talign.c +++ b/tools/lib/talign.c @@ -63,12 +63,12 @@ int main(void) fil = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if (fil < 0) { - puts("*FAILED*"); - return 1; + puts("*FAILED*"); + return 1; } H5E_BEGIN_TRY { - H5Gunlink(fil, setname); + H5Ldelete(fil, setname, H5P_DEFAULT); } H5E_END_TRY; cs6 = H5Tcopy(H5T_C_S1); |