[svn-r14126] Description:

Move H5Gunlink to deprecated symbol section, replacing internal calls
with H5Ldelete.

Tested on:
	FreeBSD/32 6.2 (duty)
	FreeBSD/64 6.2 (liberty)
	Linux/32 2.6 (kagiso)
	Linux/64 2.6 (smirom)
	Solaris/32 5.10 (linew)
	Mac OS X/32 10.4.10 (amazon)
This commit is contained in:
Quincey Koziol 2007-08-29 15:44:19 -05:00
parent a4c8e8fd56
commit db3c155bf2
21 changed files with 1318 additions and 1301 deletions

View File

@ -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");
}
}

View File

@ -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");

View File

@ -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;
}
/*----------------------------------------------------------------------------

View File

@ -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;
/*-------------------------------------------------------------------------

View File

@ -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();

View File

@ -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 */
/*-------------------------------------------------------------------------

View File

@ -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 */

View File

@ -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");

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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);

View File

@ -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);

File diff suppressed because it is too large Load Diff

View File

@ -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);
dset4[i].a = i;
dset4[i].b = (float)(i+3);
dset5[i].a = i;
dset5[i].b = (float)(i*0.1);
}
dset5[i].a = i;
dset5[i].b = (float)(i*0.1);
}
fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
fid = H5Fcreate(FILE6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
space = H5Screate_simple(1, &sdim, NULL);
space = H5Screate_simple(1, &sdim, NULL);
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);
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);
/* 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);
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));
/* shared data type 2 */
type = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset3_t));
ndims = 1; dim[0] = 4;
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);
array_dt = H5Tarray_create(H5T_STD_I32BE, ndims, dim, NULL);
H5Tinsert(type, "int_array", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
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_NATIVE_INT, ndims, dim, NULL);
H5Tinsert(type2, "int_array", HOFFSET(dset3_t, a), array_dt);
H5Tclose(array_dt);
ndims = 2; dim[0] = 5; dim[1] = 6;
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);
array_dt = H5Tarray_create(H5T_IEEE_F32BE, ndims, dim, NULL);
H5Tinsert(type, "float_array", HOFFSET(dset3_t, b), array_dt);
H5Tclose(array_dt);
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_NATIVE_FLOAT, ndims, dim, NULL);
H5Tinsert(type2, "float_array", HOFFSET(dset3_t, b), array_dt);
H5Tclose(array_dt);
H5Tcommit(fid, "type2", type);
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);
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);
/* 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);
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);
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);
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);
H5Gunlink(group,"type4");
H5Ldelete(group, "type4", H5P_DEFAULT);
H5Tclose(type);
H5Tclose(type2);
H5Dclose(dataset);
H5Sclose(space);
H5Gclose(group);
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);
/*-------------------------------------------------------------------------

View File

@ -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;
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((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;
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;
}
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;
}
/*-------------------------------------------------------------------------
* do the same without close/opening the file and creating the dataset
*-------------------------------------------------------------------------
*/
/*-------------------------------------------------------------------------
* do the same without close/opening the file and creating the dataset
*-------------------------------------------------------------------------
*/
if ((fid = H5Fcreate(FNAME6,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0)
return -1;
if((fid = H5Fcreate(FNAME6, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
return -1;
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;
}
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;
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
*

View File

@ -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);