From 519dfe549a4b8ffb4bd5d4c72a3f5fb61b80143f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 31 Jul 2019 15:06:33 -0500 Subject: Mostly whitespace cleanup and consistent test format --- test/links.c | 3832 ++++++++++++++++++++++------------------------------------ 1 file changed, 1413 insertions(+), 2419 deletions(-) diff --git a/test/links.c b/test/links.c index b7eb6af..f8be2b5 100644 --- a/test/links.c +++ b/test/links.c @@ -12,9 +12,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Friday, April 10, 1998 - * * Purpose: Tests hard, soft (symbolic) & external links. */ @@ -34,10 +31,10 @@ #include "h5test.h" #include "H5srcdir.h" -#include "H5FDpkg.h" /* File drivers */ -#include "H5Gpkg.h" /* Groups */ +#include "H5FDpkg.h" /* File drivers */ +#include "H5Gpkg.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ +#include "H5Lprivate.h" /* Links */ /* File for external link test. Created with gen_udlinks.c */ #define LINKED_FILE "be_extlink2.h5" @@ -62,55 +59,55 @@ const char *FILENAME[] = { "links6", /* 9 */ "links7", /* 10 */ "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", /* 29: */ /* TESTS for windows */ - TMPDIR "extlinks10",/* 30: */ - TMPDIR "extlinks11",/* 31: */ - TMPDIR "extlinks12",/* 32: */ - "extlinks13", /* 33: */ - TMPDIR "extlinks13",/* 34: */ - TMPDIR "extlinks14",/* 35: */ - TMPDIR "extlinks15",/* 36: */ - "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ - TMPDIR2 "extlinks21B",/* 46: */ - TMPDIR2 "extlinks21C",/* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ - TMPDIR "extlinks21D",/* 49: */ - TMPDIR "extlinks21E",/* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", /* 29: */ /* TESTS for windows */ + TMPDIR "extlinks10", /* 30: */ + TMPDIR "extlinks11", /* 31: */ + TMPDIR "extlinks12", /* 32: */ + "extlinks13", /* 33: */ + TMPDIR "extlinks13", /* 34: */ + TMPDIR "extlinks14", /* 35: */ + TMPDIR "extlinks15", /* 36: */ + "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ + TMPDIR2 "extlinks21B", /* 46: */ + TMPDIR2 "extlinks21C", /* 47: */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + TMPDIR "extlinks21D", /* 49: */ + TMPDIR "extlinks21E", /* 50: */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ NULL }; -#define FAMILY_SIZE 1024 +#define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 -#define NUM40 40 +#define NUM40 40 /* do not do check_all_closed() for "ext*" files and "tmp/ext*" */ -#define EXTSTOP 12 +#define EXTSTOP 12 #define LINK_BUF_SIZE 1024 #define NAME_BUF_SIZE 1024 @@ -326,43 +323,32 @@ static hid_t dcpl_g; /* for [un]minimized dataset object headers */ * path name of Unix and Windows. * * Return: void - * - * Programmer: Raymond Lu - * 14 Jan. 2009 *------------------------------------------------------------------------- */ static void fix_ext_filename(char *path_name, char *cwd, const char *file_name) { HDstrcpy(path_name, cwd); - HDstrcat(path_name, "/"); HDstrcat(path_name, file_name); } /*------------------------------------------------------------------------- - * Function: mklinks + * Function: mklinks * * Purpose: Build a file with assorted links. * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 - * - * Modifications: - * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int mklinks(hid_t fapl, hbool_t new_format) { hid_t file, scalar, grp, d1; - hsize_t size[1] = {1}; - char filename[NAME_BUF_SIZE]; + hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link creation (w/new group format)") @@ -399,10 +385,10 @@ mklinks(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -412,14 +398,7 @@ mklinks(hid_t fapl, hbool_t new_format) * Purpose: Build a file with assorted links for different locations. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Raymond Lu - * Friday, April 19, 2002 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -429,8 +408,8 @@ new_links(hid_t fapl, hbool_t new_format) hid_t grp1_a=(-1), grp1_b=(-1), grp2_a=(-1), grp2_b=(-1); hid_t scalar=(-1); hid_t dset1=(-1), dset2=(-1); - char filename[NAME_BUF_SIZE]; - hsize_t size[1] = {1}; + char filename[NAME_BUF_SIZE]; + hsize_t size[1] = {1}; if(new_format) TESTING("H5Lcreate functions (w/new group format)") @@ -488,7 +467,7 @@ new_links(hid_t fapl, hbool_t new_format) if(H5Fclose(file_b) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -502,36 +481,29 @@ new_links(hid_t fapl, hbool_t new_format) H5Fclose(file_a); H5Fclose(file_b); } H5E_END_TRY; - return -1; + return FAIL; } /*------------------------------------------------------------------------- - * Function: cklinks + * Function: cklinks * * Purpose: Open the file created in the first step and check that the - * links look correct. - * - * Return: Success: 0 - * - * Failure: -1 - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 - * - * Modifications: + * links look correct. * + * Return: Success: 0 + * Failure: -1 *------------------------------------------------------------------------- */ static int cklinks(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oinfo1, oinfo2; - H5L_info_t linfo2; - char linkval[LINK_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - herr_t status; + H5O_info_t oinfo1, oinfo2; + H5L_info_t linfo2; + char linkval[LINK_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + herr_t status; if(new_format) TESTING("link queries (w/new group format)") @@ -546,15 +518,15 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR @@ -573,83 +545,83 @@ cklinks(hid_t fapl, hbool_t new_format) status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Lexists() should have failed for a path with missing components."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_DATASET != oinfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } /* end if */ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) { - H5_FAILED(); - HDputs(" Soft link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(HDstrcmp(linkval, "/d1")) { - H5_FAILED(); - HDputs(" Soft link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Soft link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Dangling link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a dangling link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "foobar")) { - H5_FAILED(); - HDputs(" Dangling link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Dangling link test failed. Wrong link value"); + TEST_ERROR } /* end if */ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR /* Recursive link */ H5E_BEGIN_TRY { - status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); + status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT); } H5E_END_TRY; if(status >= 0) { - H5_FAILED(); - HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Oget_info_by_name() should have failed for a recursive link."); + TEST_ERROR } /* end if */ if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5L_TYPE_SOFT != linfo2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__); + TEST_ERROR } /* end if */ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) { - H5_FAILED(); - HDprintf(" %d: Can't retrieve link value\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Can't retrieve link value\n", __LINE__); + TEST_ERROR } /* end if */ if(HDstrcmp(linkval, "/grp1/recursive")) { - H5_FAILED(); - HDputs(" Recursive link test failed. Wrong link value"); - TEST_ERROR + H5_FAILED(); + HDputs(" Recursive link test failed. Wrong link value"); + TEST_ERROR } /* end if */ /* Non-existent link */ @@ -659,10 +631,10 @@ cklinks(hid_t fapl, hbool_t new_format) if(H5Fclose(file) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -673,20 +645,15 @@ error: * links look correct. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Raymond Lu - * Thursday, April 25, 2002 - * *------------------------------------------------------------------------- */ static int ck_new_links(hid_t fapl, hbool_t new_format) { hid_t file; - H5O_info_t oi_dset, oi_hard1, oi_hard2; - char filename[NAME_BUF_SIZE]; + H5O_info_t oi_dset, oi_hard1, oi_hard2; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("new link queries (w/new group format)") @@ -698,34 +665,31 @@ ck_new_links(hid_t fapl, hbool_t new_format) if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Get hard link info */ - if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR /* Check hard links */ if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) { - H5_FAILED(); - HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); - TEST_ERROR + H5_FAILED(); + HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__); + TEST_ERROR } if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) { - H5_FAILED(); - HDputs(" Hard link test failed. Link seems not to point to the "); - HDputs(" expected file location."); - TEST_ERROR + H5_FAILED(); + HDputs(" Hard link test failed. Link seems not to point to the "); + HDputs(" expected file location."); + TEST_ERROR } /* Cleanup */ if(H5Fclose(file) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: - return -1; + return FAIL; } @@ -735,25 +699,18 @@ error: * Purpose: Build a file with long names * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, April 16, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int long_links(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t gid2 = (-1); /* Datatype ID */ - char *objname = NULL; /* Name of object [Long] */ - size_t u; /* Local index variable */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t gid2 = -1; /* Datatype ID */ + char *objname = NULL; /* Name of object [Long] */ + size_t u; /* Local index variable */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("long names for objects & links (w/new group format)") @@ -792,7 +749,7 @@ long_links(hid_t fapl, hbool_t new_format) HDfree(objname); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -801,7 +758,7 @@ long_links(hid_t fapl, hbool_t new_format) H5Fclose (fid); } H5E_END_TRY; HDfree(objname); - return -1; + return FAIL; } @@ -811,23 +768,16 @@ long_links(hid_t fapl, hbool_t new_format) * Purpose: Build a file with too many symbolic links * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("too many links (w/new group format)") @@ -917,9 +867,9 @@ toomany(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "soft17", H5P_DEFAULT); } H5E_END_TRY; if(gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - TEST_ERROR + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + TEST_ERROR } /* end if */ /* Open object through lesser soft link */ @@ -940,7 +890,7 @@ toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -948,7 +898,7 @@ toomany(hid_t fapl, hbool_t new_format) H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end toomany() */ @@ -959,26 +909,20 @@ toomany(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Monday, January 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_lcpl(hid_t fapl, hbool_t new_format) { - hid_t file_id=-1; - hid_t group_id=-1; - hid_t space_id=-1; - hid_t dset_id=-1; - hid_t type_id=-1; - hid_t lcpl_id=-1; - H5L_info_t linfo; - char filename[1024]; - hsize_t dims[2]; + hid_t file_id = -1; + hid_t group_id = -1; + hid_t space_id = -1; + hid_t dset_id = -1; + hid_t type_id = -1; + hid_t lcpl_id = -1; + H5L_info_t linfo; + char filename[1024]; + hsize_t dims[2]; if(new_format) TESTING("link creation property lists (w/new group format)") @@ -1097,7 +1041,7 @@ test_lcpl(hid_t fapl, hbool_t new_format) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1118,22 +1062,15 @@ error: * Purpose: Tests H5Lmove() * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: James Laird - * Friday, March 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_move(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); - char filename[1024]; + hid_t file_a = -1, file_b = -1; + hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1; + char filename[1024]; if(new_format) TESTING("H5Lmove (w/new group format)") @@ -1142,11 +1079,9 @@ test_move(hid_t fapl, hbool_t new_format) /* Create two new files */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create groups in first file */ if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1154,99 +1089,75 @@ test_move(hid_t fapl, hbool_t new_format) if((grp_move = H5Gcreate2(grp_1, "group_move", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_hard(grp_1, "group_move", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Move a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ H5E_BEGIN_TRY { - if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lmove(H5L_SAME_LOC, "group_move", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT)!=FAIL) TEST_ERROR } H5E_END_TRY; /* Move a group across files. Should fail. */ H5E_BEGIN_TRY { - if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lmove(grp_1, "group_move", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Move a soft link across files. Should succeed. */ - if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lmove(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move an external link across files. Should succeed. */ - if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lmove(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move a group across groups in the same file while renaming it. */ - if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_1, "group_move", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if( H5Gclose(moved_grp) < 0) - TEST_ERROR + if( H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is no longer in the original location */ H5E_BEGIN_TRY { moved_grp = H5Gopen2(grp_1, "group_move", H5P_DEFAULT); } H5E_END_TRY; if(moved_grp >= 0) { - H5_FAILED(); - HDputs(" Group still in original location?"); - TEST_ERROR + H5_FAILED(); + HDputs(" Group still in original location?"); + TEST_ERROR } /* end if */ /* Use H5Lmove to rename a group without moving it. */ - if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lmove to move a group without renaming it. */ - if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Move the group while giving long paths. */ - if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lmove(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is in no previous locations */ H5E_BEGIN_TRY { - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) - FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR } H5E_END_TRY; H5Gclose(grp_1); @@ -1256,17 +1167,17 @@ test_move(hid_t fapl, hbool_t new_format) H5Fclose(file_b); PASSED(); - return 0; + return SUCCEED; - error: +error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } @@ -1278,21 +1189,14 @@ test_move(hid_t fapl, hbool_t new_format) * Purpose: Tests H5Lcopy() * * Return: Success: 0 - * * Failure: number of errors - * - * Programmer: James Laird - * Friday, March 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_copy(hid_t fapl, hbool_t new_format) { - hid_t file_a, file_b=(-1); - hid_t grp_1=(-1), grp_2=(-1), grp_move=(-1), moved_grp=(-1); + hid_t file_a = -1, file_b = -1; + hid_t grp_1 = -1, grp_2 = -1, grp_move = -1, moved_grp = -1; char filename[1024]; if(new_format) @@ -1302,11 +1206,9 @@ test_copy(hid_t fapl, hbool_t new_format) /* Create two new files */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_a=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if ((file_b=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create groups in first file */ if((grp_1 = H5Gcreate2(file_a, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -1314,111 +1216,76 @@ test_copy(hid_t fapl, hbool_t new_format) if((grp_move = H5Gcreate2(grp_1, "group_copy", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Create hard, soft and external links. */ - if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_hard(grp_1, "group_copy", H5L_SAME_LOC, "hard", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/group1/group_copy", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external("filename", "pathname", grp_2, "ext", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Copy a group within the file. Both of source and destination use * H5L_SAME_LOC. Should fail. */ H5E_BEGIN_TRY { - if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lcopy(H5L_SAME_LOC, "group_copy", H5L_SAME_LOC, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Copy a group across files. Should fail. */ H5E_BEGIN_TRY { - if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) - !=FAIL) TEST_ERROR + if(H5Lcopy(grp_1, "group_copy", file_b, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) !=FAIL) TEST_ERROR } H5E_END_TRY; /* Copy a soft link across files. Should succeed. */ - if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lcopy(grp_2, "soft", file_b, "soft_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "soft_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Copy an external link across files. Should succeed. */ - if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) - TEST_ERROR + if(H5Lcopy(grp_2, "ext", file_b, "ext_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lexists(file_b, "ext_new_name", H5P_DEFAULT) != TRUE) TEST_ERROR /* Move a group across groups in the same file while renaming it. */ - if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_1, "group_copy", grp_2, "group_new_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to create a group in the same location with a different name. */ - if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_2, "group_new_name", H5L_SAME_LOC, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group. */ - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is also in the original location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Use H5Lcopy to copy to a different location with the same name. */ - if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(grp_2, "group_newer_name", grp_1, "group_newer_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group . */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in the previous location */ - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Copy the group while giving long paths. */ - if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcopy(file_a, "/group1/group_newer_name", grp_2, "/group2/group_newest_name", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Open the group just moved to the new location. */ - if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newest_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR /* Verify that the group is still in all previous original locations */ - if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR - if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - if(H5Gclose(moved_grp) < 0) - TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_newer_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_2, "group_new_name", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR + if((moved_grp = H5Gopen2(grp_1, "group_copy", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + if(H5Gclose(moved_grp) < 0) TEST_ERROR H5Gclose(grp_1); H5Gclose(grp_2); @@ -1427,17 +1294,17 @@ test_copy(hid_t fapl, hbool_t new_format) H5Fclose(file_b); PASSED(); - return 0; + return SUCCEED; - error: +error: H5_FAILED(); H5E_BEGIN_TRY { - H5Gclose(grp_1); - H5Gclose(grp_2); - H5Gclose(grp_move); + H5Gclose(grp_1); + H5Gclose(grp_2); + H5Gclose(grp_move); H5Gclose(moved_grp); - H5Fclose(file_a); - H5Fclose(file_b); + H5Fclose(file_a); + H5Fclose(file_b); } H5E_END_TRY; return 1; } @@ -1451,12 +1318,6 @@ test_copy(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Monday, January 30, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -1604,13 +1465,13 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Pclose(fcpl_id); - H5Pclose(lcpl_id); - H5Pclose(lcpl2_id); + H5Pclose(fcpl_id); + H5Pclose(lcpl_id); + H5Pclose(lcpl2_id); H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; @@ -1625,12 +1486,6 @@ error: * * Return: Success: 0 * Failure: number of errors - * - * Programmer: James Laird - * Wednesday, April 26 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -1756,7 +1611,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if(H5Fclose(file_id) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -1775,25 +1630,18 @@ error: * Purpose: Build a file with external link to root group in external file * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, May 25, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_root(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t linfo; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t linfo; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; const char *file; /* File from external link */ const char *path; /* Path from external link */ @@ -1824,21 +1672,21 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; - } + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; + } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Create external link to object in first file */ @@ -1848,28 +1696,27 @@ external_link_root(hid_t fapl, hbool_t new_format) /* Check information for external link */ if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error; if(H5L_TYPE_EXTERNAL != linfo.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been an external link"); + goto error; } if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR if(HDstrcmp(file, filename1)) { - H5_FAILED(); - HDputs(" External link file name incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link file name incorrect"); + goto error; } if(HDstrcmp(path, "/")) { - H5_FAILED(); - HDputs(" External link path incorrect"); - goto error; + H5_FAILED(); + HDputs(" External link path incorrect"); + goto error; } /* Close and re-open file to ensure that data is written to disk */ if(H5Fclose(fid) < 0) TEST_ERROR if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR - /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1941,15 +1788,15 @@ external_link_root(hid_t fapl, hbool_t new_format) H5F_sfile_assert_num(0); PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_root() */ @@ -1960,24 +1807,17 @@ external_link_root(hid_t fapl, hbool_t new_format) * external file * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, July 26, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_path(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; if(new_format) TESTING("external link to object on path (w/new group format)") @@ -2049,15 +1889,15 @@ external_link_path(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_path() */ @@ -2068,26 +1908,19 @@ external_link_path(hid_t fapl, hbool_t new_format) * external file links * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, July 26, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_mult(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1), fid2 = (-1); /* File IDs */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1, fid2 = -1; /* File IDs */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links across multiple files (w/new group format)") @@ -2213,15 +2046,15 @@ external_link_mult(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_mult() */ @@ -2231,26 +2064,19 @@ external_link_mult(hid_t fapl, hbool_t new_format) * Purpose: Build a file with external link to itself * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: James Laird - * Wednesday, July 12, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_self(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lcpl_id = (-1); /* Link Creation Property List ID */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE]; - char filename2[NAME_BUF_SIZE]; - char filename3[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t lcpl_id = -1; /* Link Creation Property List ID */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE]; + char filename2[NAME_BUF_SIZE]; + char filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external link to self (w/new group format)") @@ -2311,8 +2137,8 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Complicate things. Use this file as an intermediate file in a chain - * of external links that will go: file2 -> file1 -> file1 -> file3 - */ + * of external links that will go: file2 -> file1 -> file1 -> file3 + */ /* Create file2 with an external link to file1 */ if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -2336,7 +2162,6 @@ external_link_self(hid_t fapl, hbool_t new_format) /* Close file1 */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Re-open file2 and traverse through file1 (with its recursive extlink) to file3 */ if((fid=H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR @@ -2361,16 +2186,16 @@ external_link_self(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Pclose(lcpl_id); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_self() */ @@ -2401,11 +2226,11 @@ external_link_self(hid_t fapl, hbool_t new_format) static int external_link_pingpong(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ + hid_t fid = (-1); /* File ID */ hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("external links back and forth (w/new group format)") @@ -2417,7 +2242,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename2, "/link2", fid, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2432,7 +2257,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2444,7 +2269,7 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ if((gid = H5Gopen2(fid, "link1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -2465,7 +2290,6 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file again and check on object created */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -2484,15 +2308,15 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_pingpong() */ @@ -2523,24 +2347,17 @@ external_link_pingpong(hid_t fapl, hbool_t new_format) * file1:/link17 -> file2: /final * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 8, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_toomany(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("too many external links (w/new group format)") @@ -2575,7 +2392,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external links for chain */ if(H5Lcreate_external(filename1, "/link3", fid, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2596,16 +2413,16 @@ external_link_toomany(hid_t fapl, hbool_t new_format) /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Open object through external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "link1", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); - goto error; + H5_FAILED(); + HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__); + goto error; } /* Open object through external link */ @@ -2628,15 +2445,15 @@ external_link_toomany(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid2); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_toomany() */ @@ -2647,23 +2464,16 @@ external_link_toomany(hid_t fapl, hbool_t new_format) * missing files and missing objects. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_dangling(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t rid = (-1); /* Root Group ID */ - hid_t status = (-1); /* Status */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + hid_t rid = -1; /* Root Group ID */ + hid_t status = -1; /* Status */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ @@ -2677,7 +2487,7 @@ external_link_dangling(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create dangling external links */ if(H5Lcreate_external("missing", "/missing", fid, "no_file", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2687,26 +2497,26 @@ external_link_dangling(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file (for dangling object test) */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR /* Open first file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Get root group ID */ - if((rid=H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; + if((rid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) TEST_ERROR; /* Open object through dangling file external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "no_file", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Open object through dangling object external link */ @@ -2714,9 +2524,9 @@ external_link_dangling(hid_t fapl, hbool_t new_format) gid = H5Gopen2(fid, "no_object", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for sequence of too many nested links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for sequence of too many nested links."); + goto error; } /* Try to get name of object by index through dangling file external link */ @@ -2736,14 +2546,14 @@ external_link_dangling(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_dangling() */ @@ -2751,32 +2561,26 @@ external_link_dangling(hid_t fapl, hbool_t new_format) * Function: external_link_prefix * * Purpose: 1. target link: "extlinks2" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks2" - * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" - * Should be able to access the target file in tmp directory via the prefix set - * by H5Pset_elink_prefix() + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks2" + * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp" + * Should be able to access the target file in tmp directory via the prefix set + * by H5Pset_elink_prefix() * * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_prefix(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t gapl_id = (-1); - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + hid_t gapl_id = -1; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE]; if(new_format) TESTING("external links via H5Pset_elink_prefix()(w/new group format)") @@ -2796,8 +2600,8 @@ external_link_prefix(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[17], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2805,7 +2609,7 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file (without the absolute path) */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -2821,9 +2625,9 @@ external_link_prefix(hid_t fapl, hbool_t new_format) /* should be able to find the target file from pathnames set via H5Pset_elink_prefix() */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -2831,14 +2635,14 @@ external_link_prefix(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_prefix() */ @@ -2846,25 +2650,19 @@ external_link_prefix(hid_t fapl, hbool_t new_format) * Function: external_link_abs_mainpath: test 3 * * Purpose: 1. target link: "extlinks3" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" - * 3. target file: "tmp/extlinks3" - * Should be able to access the target file via the main file's absolute path + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: ":/CWD/tmp/extlinks0" + * 3. target file: "tmp/extlinks3" + * Should be able to access the target file via the main file's absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abs_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -2925,14 +2723,14 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abs_mainpath() */ @@ -2940,25 +2738,19 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format) * Function: external_link_rel_mainpath: test 4 * * Purpose: 1. target link: "extlinks4" - * 2. main file: "tmp/extlinks0" - * 3. target file: "tmp/extlinks4" - * Should be able to access the target file via the main file's CWD+relative path + * 2. main file: "tmp/extlinks0" + * 3. target file: "tmp/extlinks4" + * Should be able to access the target file via the main file's CWD+relative path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_rel_mainpath(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; @@ -2980,8 +2772,8 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[21], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR @@ -2989,7 +2781,7 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -3001,9 +2793,9 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the main file's relative pathname */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3011,45 +2803,37 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_rel_mainpath() */ /*------------------------------------------------------------------------- * Function: external_link_cwd: test 5 * * Purpose: 1. target link: "extlinks5" - * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 2. target file: "extlinks5" - * Should be able to access the target file in the current working directory - * + * 2. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 3. target file: "extlinks5" + * Should be able to access the target file in the current working directory * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb 19, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_cwd(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via current working directory(w/new group format)") @@ -3093,9 +2877,9 @@ external_link_cwd(hid_t fapl, hbool_t new_format) /* should be able to find the target file from the current working directory */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory"); + goto error; } /* closing for main file */ @@ -3103,46 +2887,39 @@ external_link_cwd(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_cwd() */ - /*------------------------------------------------------------------------- * Function: external_link_abstar: test 6 * * Purpose: 1. target link: Linux:"/CWD/tmp/extlinks6"; Windows:":/CWD/tmp/extlinks6" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks6" - * Should be able to access the target file's absolute path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks6" + * Should be able to access the target file's absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abstar(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t gid = (-1); /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's absolute path (w/new group format)") @@ -3175,7 +2952,6 @@ external_link_abstar(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -3189,9 +2965,9 @@ external_link_abstar(hid_t fapl, hbool_t new_format) /* should be able to find the target file with abolute path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3199,39 +2975,33 @@ external_link_abstar(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abstar() */ /*------------------------------------------------------------------------- * Function: external_link_abstar_cur: test 7 * * Purpose: 1. target link: Linux: "/CWD/tmp/extlinks7"; Windows: ":/CWD/tmp/extlinks7" - * 2. main file: "extlinks0" - * 3. target file: "extlinks7" - * Should be able to access the target file via the main file's CWD. + * 2. main file: "extlinks0" + * 3. target file: "extlinks7" + * Should be able to access the target file via the main file's CWD. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_abstar_cur(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -3256,7 +3026,7 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* * set up name for external linked target file: * Linux: "/CWD/tmp/extlinks7" - * Windows: ":/CWD/tmp/extlinks7" + * Windows: ":/CWD/tmp/extlinks7" */ fix_ext_filename(tmpname, cwdpath, FILENAME[25]); h5_fixname(tmpname, fapl, filename2, sizeof filename2); @@ -3269,7 +3039,6 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -3283,9 +3052,9 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) /* should be able to find the target file from main file's current working directory */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in current working directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in current working directory."); + goto error; } /* closing for main file */ @@ -3293,14 +3062,14 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_abstar_cur() */ @@ -3308,25 +3077,19 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format) * Function: external_link_reltar: test 8 * * Purpose: 1. target link: Linux:"tmp/extlinks8" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks8" - * Should be able to access the target file via the main file's CWD+ target's relative path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks8" + * Should be able to access the target file via the main file's CWD+ target's relative path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_reltar(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = (-1); /* File ID */ + hid_t gid = (-1); /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; @@ -3339,8 +3102,7 @@ external_link_reltar(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target file name: "tmp/extlinks8" */ /* set up name for external linked target file: "tmp/extlinks8" */ @@ -3363,9 +3125,9 @@ external_link_reltar(hid_t fapl, hbool_t new_format) /* Open object through external link */ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* end if */ /* closing for main file */ @@ -3373,14 +3135,14 @@ external_link_reltar(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_reltar() */ @@ -3396,19 +3158,13 @@ external_link_reltar(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Feb. 20, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_chdir(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE]; @@ -3424,8 +3180,7 @@ external_link_chdir(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2); /* create tmp directory */ - if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target file name ("tmp/extlinks9") */ h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3); @@ -3438,9 +3193,8 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -3460,9 +3214,9 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * main file's current working directory + pathname of external linked targetfile */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp directory."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp directory."); + goto error; } /* closing for main file */ @@ -3470,14 +3224,14 @@ external_link_chdir(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_chdir() */ @@ -3485,10 +3239,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl1: test 10 * * Purpose: To verify that the external linked target file with physical layout - * different from the parent can be successfully opened. + * different from the parent can be successfully opened. * * 1. target link: "extlinks16" - * 2. target file: "extlinks16" + * 2. target file: "extlinks16" * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" * 4. Create target file A to be a "family" file: extlinks16A * 4. Create target file B to be a "multi" file: extlinks16B @@ -3499,12 +3253,6 @@ external_link_chdir(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -3514,18 +3262,18 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) hid_t fidA=(-1), fidB=(-1); hid_t gidA=(-1), gidB=(-1); hid_t oidA=(-1), oidB=(-1); - char filename1[NAME_BUF_SIZE], - filename2A[NAME_BUF_SIZE], - filename2B[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hid_t fam_fapl=-1, multi_fapl=-1; + char filename1[NAME_BUF_SIZE], + filename2A[NAME_BUF_SIZE], + filename2B[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hid_t fam_fapl=-1, multi_fapl=-1; hid_t lapl_idA=-1, lapl_idB=-1; - H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; hid_t memb_fapl[H5FD_MEM_NTYPES]; - char sv[H5FD_MEM_NTYPES][64]; - const char *memb_name[H5FD_MEM_NTYPES]; - haddr_t memb_addr[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][64]; + H5FD_mem_t mt, memb_map[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; if(new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts (w/new group format)") @@ -3533,7 +3281,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) TESTING("H5Pset/get_elink_fapl() with different physical layouts") if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))) - TEST_ERROR + TEST_ERROR /* * set up name for main file: @@ -3545,8 +3293,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* create "family" fapl */ fam_fapl = h5_fileaccess(); - if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) - TEST_ERROR; + if(H5Pset_fapl_family(fam_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0) TEST_ERROR; /* set up name for external linked target file A: "extlinks16A" */ /* set up name for target file A: "extlinks16A" */ @@ -3560,8 +3307,8 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(sv, 0, sizeof sv); for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { - memb_map[mt] = H5FD_MEM_SUPER; - memb_fapl[mt] = H5P_DEFAULT; + memb_map[mt] = H5FD_MEM_SUPER; + memb_fapl[mt] = H5P_DEFAULT; } /* end for */ memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW; @@ -3595,8 +3342,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* create "multi" fapl */ multi_fapl = h5_fileaccess(); - if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) - TEST_ERROR; + if(H5Pset_fapl_multi(multi_fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) TEST_ERROR; /* set up name for external linked target file B: "extlinks16B" */ /* set up name for target file B: "extlinks16B" */ @@ -3620,11 +3366,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file A:/A */ - if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2A, "/A", fid, "ext_linkA", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Create external link to target file B:/B */ - if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2B, "/B", fid, "ext_linkB", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Set file access property list for link access to use the family driver */ if((lapl_idA = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3635,9 +3379,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object A in the current working directory */ if (oidA < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening family target file A in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening family target file A in current working directory"); + goto error; } /* Set file access property list for link access to use the multi driver */ @@ -3649,9 +3393,9 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) /* should succeed in opening the target object B in the current working directory */ if (oidB < 0) { - H5_FAILED(); - HDputs(" Should succeed in opening multi target file B in current working directory"); - goto error; + H5_FAILED(); + HDputs(" Should succeed in opening multi target file B in current working directory"); + goto error; } /* closing */ @@ -3664,21 +3408,21 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Pclose (lapl_idA); - H5Pclose (lapl_idB); - H5Pclose (fam_fapl); - H5Pclose (multi_fapl); - H5Gclose (gidA); - H5Gclose (gidB); - H5Oclose (oidA); - H5Oclose (oidB); - H5Fclose (fid); + H5Pclose (lapl_idA); + H5Pclose (lapl_idB); + H5Pclose (fam_fapl); + H5Pclose (multi_fapl); + H5Gclose (gidA); + H5Gclose (gidB); + H5Oclose (oidA); + H5Oclose (oidB); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl1() */ @@ -3686,45 +3430,39 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl2: test 11 * * Purpose: To verify that processing done to the external linked target object is - * correctly handled when the parent and target files have the same - * physical layout but different access methods. + * correctly handled when the parent and target files have the same + * physical layout but different access methods. * * 1. target link: "extlinks17" * 2. target file: "extlinks17" - * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" - * 4. Create target file to be a "core" file:/A/Dataset - * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset - * 6. Set the file access property list of the link access to use "core" file without - * backing store - * 6. Should succeed in opening the target dataset: ext_link - * 7. Write data to the target dataset - * 8. On closing, the file size of target should be the same as before since - * it is opened without backing store. + * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: ":/CWD/tmp/extlinks0" + * 4. Create target file to be a "core" file:/A/Dataset + * 5. Create external link from main file to target file:ext_link->target file:/A/Dataset + * 6. Set the file access property list of the link access to use "core" file without + * backing store + * 7. Should succeed in opening the target dataset: ext_link + * 8. Write data to the target dataset + * 9. On closing, the file size of target should be the same as before since + * it is opened without backing store. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_set_elink_fapl2(hid_t fapl, hbool_t new_format) { hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; - hsize_t dims[2]; - int points[NUM40][NUM40]; + hid_t gid = (-1); /* Group IDs */ + hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; + hsize_t dims[2]; + int points[NUM40][NUM40]; + int i, j, n; h5_stat_size_t filesize, new_filesize; - int i, j, n; if(new_format) TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)") @@ -3736,7 +3474,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* * set up name for main file: - * Linux: "/CWD/tmp/extlinks0" + * Linux: "/CWD/tmp/extlinks0" * Windows: ":/CWD/tmp/extlinks0" */ fix_ext_filename(tmpname, cwdpath, FILENAME[13]); @@ -3744,8 +3482,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR /* set up name for external linked target file: "extlinks17" */ /* set up name for target file: "extlinks17" */ @@ -3768,8 +3505,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR; /* create "Dataset" in group "A" of target file */ - if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - TEST_ERROR + if((dset = H5Dcreate2(gid, "Dataset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Pclose(dcpl) < 0) TEST_ERROR @@ -3785,12 +3521,10 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file: ext_link->extlinks17:/A/Dataset */ - if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/A/Dataset", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* create fapl to be a "core" file without backing store */ - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, FALSE) < 0) TEST_ERROR /* Set file access property list for link access to use the "core" driver */ if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR @@ -3810,8 +3544,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) points[i][j] = n++; /* Write the data to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) - TEST_ERROR + if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR if(H5Pclose(dapl_id) < 0) TEST_ERROR if(H5Dclose(did) < 0) TEST_ERROR @@ -3825,20 +3558,20 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) if(H5Pclose(core_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); - H5Pclose(core_fapl); - H5Pclose(dapl_id); - H5Dclose(did); - H5Gclose(gid); - H5Fclose(fid); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); + H5Pclose(core_fapl); + H5Pclose(dapl_id); + H5Dclose(did); + H5Gclose(gid); + H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl2() */ @@ -3846,17 +3579,17 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) * Function: external_set_elink_fapl3: test 12 * * Purpose: To verify that the file access property list for link access is - * set and closed correctly. - * - * 1. Create fapl for core driver - * 2. Create fapl for stdio driver - * 3. Set link access's fapl to use stdio driver - * 4. Verify that link access's fapl is the stdio driver - * 5. Reset the link access' fapl to use core driver - * 6. H5Pcopy() the link access - * 7. Get the fapl property value of the original link access - * 8. Close the original link access - * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl + * set and closed correctly. + * + * 1. Create fapl for core driver + * 2. Create fapl for stdio driver + * 3. Set link access's fapl to use stdio driver + * 4. Verify that link access's fapl is the stdio driver + * 5. Reset the link access' fapl to use core driver + * 6. H5Pcopy() the link access + * 7. Get the fapl property value of the original link access + * 8. Close the original link access + * 9. H5Pclose() fapl should fail since closing in step #8 should also close its fapl * 10. Verify that the copied link access's fapl is the core driver * 11. Get the fapl property value of the copied link access * 12. H5Premove() the fapl property from the copied link access @@ -3865,18 +3598,12 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * Sept. 12, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_set_elink_fapl3(hbool_t new_format) { - hid_t core_fapl = -1, stdio_fapl = -1; + hid_t core_fapl = -1, stdio_fapl = -1; hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl; if(new_format) @@ -3886,12 +3613,10 @@ external_set_elink_fapl3(hbool_t new_format) /* create fapl for the target file to be a "core" file */ core_fapl = h5_fileaccess(); - if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) - TEST_ERROR + if(H5Pset_fapl_core(core_fapl, (size_t)CORE_INCREMENT, TRUE) < 0) TEST_ERROR stdio_fapl = h5_fileaccess(); - if(H5Pset_fapl_stdio(stdio_fapl) < 0) - TEST_ERROR + if(H5Pset_fapl_stdio(stdio_fapl) < 0) TEST_ERROR /* Set file access property list for link access to use the "stdio" driver */ if((lapl_id = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR @@ -3932,9 +3657,9 @@ external_set_elink_fapl3(hbool_t new_format) if(H5Pclose(stdio_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose(l_fapl); H5Pclose(lapl_id); @@ -3942,7 +3667,7 @@ external_set_elink_fapl3(hbool_t new_format) H5Pclose(core_fapl); H5Pclose(stdio_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_fapl3() */ @@ -3953,12 +3678,6 @@ external_set_elink_fapl3(hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Jan. 5, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4153,9 +3872,9 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo if(H5Pclose(gapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group); H5Gclose(subgroup); @@ -4163,7 +3882,7 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo H5Fclose(file2); H5Pclose(gapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_acc_flags() */ @@ -4174,12 +3893,6 @@ external_set_elink_acc_flags(const char *env_h5_drvr, hid_t fapl, hbool_t new_fo * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Jan. 5, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ /* User data structure for callback function */ @@ -4217,7 +3930,7 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group, if (op_data->code == 2) *flags = H5F_ACC_DEFAULT; - return 0; + return SUCCEED; } /* Main test function */ @@ -4226,7 +3939,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) { hid_t file1 = -1, file2 = -1, group = -1, gapl = -1, fam_fapl = -1, ret_fapl = -1, base_driver; set_elink_cb_t op_data, - *op_data_p; + *op_data_p; H5L_elink_traverse_t cb; char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; @@ -4319,9 +4032,9 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) if(H5Pclose(gapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group); H5Fclose(file1); @@ -4330,7 +4043,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) H5Pclose(ret_fapl); H5Pclose(fam_fapl); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_set_elink_cb() */ @@ -4342,12 +4055,6 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Apr. 9, 2009 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int @@ -4385,13 +4092,13 @@ external_reset_register(void) if(HDremove(filename) != 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_reset_register() */ @@ -4401,31 +4108,25 @@ external_reset_register(void) * Function: external_link_win1 * * Purpose: - * 1. target link: "/CWD/tmp/extlinks10" - * 2. main file: "extlinks0" - * 3. target file: "extlinks10" - * Should be able to find the target file via main file's current drive/rel path + * 1. target link: "/CWD/tmp/extlinks10" + * 2. main file: "extlinks0" + * 3. target file: "extlinks10" + * Should be able to find the target file via main file's current drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win1(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's current drive/rel path(windows)(w/new group format)") @@ -4455,7 +4156,6 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -4469,9 +4169,9 @@ external_link_win1(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's CWD*/ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4479,14 +4179,14 @@ external_link_win1(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win1() */ @@ -4495,30 +4195,24 @@ external_link_win1(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: "/CWD/tmp/extlinks11" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks11" - * Should be able to access the target file directly (rel drive/abs path) + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks11" + * Should be able to access the target file directly (rel drive/abs path) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win2(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's rel drive/abs path directly(windows)(w/new group format)") @@ -4563,9 +4257,9 @@ external_link_win2(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4573,14 +4267,14 @@ external_link_win2(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win2() */ @@ -4589,30 +4283,24 @@ external_link_win2(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks12" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks12" - * Should be able to access the target file directly (abs drive/rel path) + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks12" + * Should be able to access the target file directly (abs drive/rel path) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April i15 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win3(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive = 0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's abs drive/rel path directly (windows)(w/new group format)") @@ -4656,9 +4344,9 @@ external_link_win3(hid_t fapl, hbool_t new_format) /* should be able to find the target file directly */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4666,45 +4354,39 @@ external_link_win3(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win3() */ /*------------------------------------------------------------------------- * Function: external_link_win4 * * Purpose: - * 1. target link: ":extlinks13" + * 1. target link: ":extlinks13" * 2. main file: ":tmp/extlinks0" * 3. target file: tmp/extlinks13 - * Should be able to access the target file via main file's abs drive/rel path + * Should be able to access the target file via main file's abs drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win4(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's abs drive/rel path (windows)(w/new group format)") @@ -4724,16 +4406,15 @@ external_link_win4(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[34], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -4745,9 +4426,9 @@ external_link_win4(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's absolute drive/relative path */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4755,14 +4436,14 @@ external_link_win4(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win4() */ @@ -4771,31 +4452,25 @@ external_link_win4(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks14" - * 2. main file: "/CWD/extlinks0" - * 3. target file: "tmp/extlinks14" - * Should be able to access the target file via main file's relative drive/absolute path + * 2. main file: "/CWD/extlinks0" + * 3. target file: "tmp/extlinks14" + * Should be able to access the target file via main file's relative drive/absolute path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win5(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's rel drive/abs path (windows)(w/new group format)") @@ -4831,7 +4506,6 @@ external_link_win5(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -4845,9 +4519,9 @@ external_link_win5(hid_t fapl, hbool_t new_format) /* should be able to find the target file via main file's rel drive/abs path */ if(gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in CWD."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in CWD."); + goto error; } /* closing for main file */ @@ -4855,14 +4529,14 @@ external_link_win5(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win5() */ @@ -4871,30 +4545,24 @@ external_link_win5(hid_t fapl, hbool_t new_format) * * Purpose: * 1. target link: ":tmp/extlinks15" - * 2. main file: "extlinks0" - * 3. target file: "tmp/extlinks15" - * Should be able to access the target file via target's current drive/rel path + * 2. main file: "extlinks0" + * 3. target file: "tmp/extlinks15" + * Should be able to access the target file via target's current drive/rel path * * Return: Success: 0 * Failure: -1 - * - * Programmer: Vailin Choi - * April 15, 2008 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_win6(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive=0; + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], + filename3[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE]; if(new_format) TESTING("external links via target's current drive/rel path (windows)(w/new group format)") @@ -4921,16 +4589,15 @@ external_link_win6(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[36], fapl, filename3, sizeof filename3); /* Create the target file */ - if((fid=H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if((gid=H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((gid = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* closing for target file */ if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link to target file */ if(H5Lcreate_external(filename2, "/A", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -4942,9 +4609,9 @@ external_link_win6(hid_t fapl, hbool_t new_format) /* should be able to find the target file via target file's rel path in current drive */ if (gid < 0) { - H5_FAILED(); - HDputs(" Should have found the file in tmp."); - goto error; + H5_FAILED(); + HDputs(" Should have found the file in tmp."); + goto error; } /* closing for main file */ @@ -4952,14 +4619,14 @@ external_link_win6(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win6() */ @@ -4970,7 +4637,7 @@ external_link_win6(hid_t fapl, hbool_t new_format) * 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" - * Should be able to find the target file via main file's local host/main drive/rel path + * Should be able to find the target file via main file's local host/main drive/rel path * * Return: Success: 0 * Failure: -1 @@ -4979,8 +4646,8 @@ external_link_win6(hid_t fapl, hbool_t new_format) static int external_link_win7(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -5015,7 +4682,6 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5039,14 +4705,14 @@ external_link_win7(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win7() */ @@ -5057,7 +4723,7 @@ external_link_win7(hid_t fapl, hbool_t new_format) * 1. Long UNC target link: "\\?\:\CWD\extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks10" - * Should be able to access the target file directly (abs drive/abs path) + * Should be able to access the target file directly (abs drive/abs path) * * Return: Success: 0 * Failure: -1 @@ -5067,9 +4733,9 @@ external_link_win7(hid_t fapl, hbool_t new_format) static int external_link_win8(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - int drive=0; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + int drive = 0; char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], @@ -5084,12 +4750,10 @@ external_link_win8(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR /* create tmp directory */ - if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR + if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR /* set up name for target link: ":\CWD\extlinks10" */ drive = HDgetdrive(); @@ -5107,7 +4771,6 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5131,14 +4794,14 @@ external_link_win8(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win8() */ @@ -5149,7 +4812,7 @@ external_link_win8(hid_t fapl, hbool_t new_format) * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10" * 2. main file: "extlinks0" * 3. target file: "extlinks15" - * Should be able to find the target file via main file's local host/main drive/rel path + * Should be able to find the target file via main file's local host/main drive/rel path * * Return: Success: 0 * Failure: -1 @@ -5158,13 +4821,13 @@ external_link_win8(hid_t fapl, hbool_t new_format) static int external_link_win9(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], filename3[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; if(new_format) TESTING("external links via main file's Long UNC local host/main drive/rel path(windows)(w/new group format)") @@ -5174,8 +4837,7 @@ external_link_win9(hid_t fapl, hbool_t new_format) /* set up name for main file: "extlinks0" */ h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1); - if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) - TEST_ERROR + if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)) TEST_ERROR /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp/extlinks10" */ HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */ @@ -5194,7 +4856,6 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(H5Gclose(gid) < 0) TEST_ERROR if(H5Fclose(fid) < 0) TEST_ERROR - /* Create the main file */ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -5218,14 +4879,14 @@ external_link_win9(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { - H5Gclose (gid); - H5Fclose (fid); + H5Gclose (gid); + H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_win9() */ #endif /* H5_HAVE_WINDOW_PATH */ @@ -5238,20 +4899,14 @@ external_link_win9(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 15, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_recursive(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char filename1[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("recursive external links (w/new group format)") @@ -5262,7 +4917,7 @@ external_link_recursive(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1); /* Create first file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create recursive external links */ if(H5Lcreate_external(filename1, "/recursive", fid, "recursive", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -5270,33 +4925,31 @@ external_link_recursive(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open file */ - if((fid=H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Open object through dangling file external link */ H5E_BEGIN_TRY { gid = H5Gopen2(fid, "recursive", H5P_DEFAULT); } H5E_END_TRY; if (gid >= 0) { - H5_FAILED(); - HDputs(" Should have failed for recursive external links."); - goto error; + H5_FAILED(); + HDputs(" Should have failed for recursive external links."); + goto error; } /* Close first file */ if(H5Fclose(fid) < 0) TEST_ERROR - PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_recursive() */ @@ -5308,25 +4961,19 @@ external_link_recursive(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, August 15, 2005 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int external_link_query(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ const char *file_name; /* Name of the file the external link points to */ const char *object_name; /* Name of the object the external link points to */ - H5O_info_t oi; /* Object information */ + H5O_info_t oi; /* Object information */ H5L_info_t li; /* Link information */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE], /* Names of files to externally link across */ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */ if(new_format) @@ -5339,7 +4986,7 @@ external_link_query(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2); /* Create first file, with external link to object in second file */ - if((fid=H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create external link */ /* (add a few extra '/'s to make certain library normalizes external link object names) */ @@ -5349,16 +4996,16 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if (H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR /* Create second file to point to */ - if((fid=H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create object to link to */ if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -5367,7 +5014,6 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -5375,9 +5021,9 @@ external_link_query(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR if(H5L_TYPE_EXTERNAL != li.type) { - H5_FAILED(); - HDputs(" Unexpected link class - should have been an external link"); - goto error; + H5_FAILED(); + HDputs(" Unexpected link class - should have been an external link"); + goto error; } /* Get information for external link. It should be two strings right after each other */ @@ -5393,9 +5039,9 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Query information about object that external link points to */ if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5O_TYPE_GROUP != oi.type) { - H5_FAILED(); - HDputs(" Unexpected object type - should have been a group"); - goto error; + H5_FAILED(); + HDputs(" Unexpected object type - should have been a group"); + goto error; } /* Close first file */ @@ -5406,27 +5052,27 @@ external_link_query(hid_t fapl, hbool_t new_format) /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */ H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY H5E_BEGIN_TRY { - if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR + if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR } H5E_END_TRY PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_query() */ @@ -5437,17 +5083,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_unlink_compact(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ @@ -5479,9 +5121,6 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - -/* Unlink external link */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5504,7 +5143,7 @@ external_link_unlink_compact(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5512,7 +5151,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_unlink_compact() */ @@ -5523,25 +5162,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_unlink_dense(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gcpl = -1; /* Group creation property list ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ unsigned nmsgs; /* Number of messages in group's header */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned u; /* Local index variable */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned u; /* Local index variable */ if(new_format) TESTING("unlinking external link in dense group (w/new group format)") @@ -5606,9 +5241,6 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - -/* Unlink external link */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5650,7 +5282,7 @@ external_link_unlink_dense(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5658,7 +5290,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_unlink_dense() */ @@ -5669,20 +5301,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, December 5, 2005 - * *------------------------------------------------------------------------- */ -static int -external_link_move(hid_t fapl, hbool_t new_format) -{ - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ +static int +external_link_move(hid_t fapl, hbool_t new_format) +{ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ if(new_format) TESTING("move external link (w/new group format)") @@ -5712,9 +5340,7 @@ external_link_move(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Move external link to different name within same group */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5798,7 +5424,6 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR /* Move external link back to original group */ - /* Open first file */ if((fid = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -5841,7 +5466,7 @@ external_link_move(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -5849,7 +5474,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_move() */ @@ -5861,25 +5486,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, January 18, 2006 - * *------------------------------------------------------------------------- */ static int external_link_ride(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gcpl = (-1); /* Group creation property list ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], - filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ + hid_t fid = -1; /* File ID */ + hid_t gcpl = -1; /* Group creation property list ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename1[NAME_BUF_SIZE], + filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */ unsigned nmsgs; /* Number of messages in group's header */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned u; /* Local index variable */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + unsigned u; /* Local index variable */ if(new_format) TESTING("external link along for the ride (w/new group format)") @@ -6026,7 +5647,7 @@ external_link_ride(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6035,7 +5656,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_ride() */ @@ -6047,10 +5668,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Wednesday, August 16, 2006 - * *------------------------------------------------------------------------- */ static int @@ -6060,11 +5677,11 @@ external_link_closing(hid_t fapl, hbool_t new_format) hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1); hid_t lcpl_id=(-1); hsize_t dims[2]; - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE], - filename3[NAME_BUF_SIZE], - filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ - buf[NAME_BUF_SIZE]; /* misc. buffer */ + filename3[NAME_BUF_SIZE], + filename4[NAME_BUF_SIZE], /* Names of files to externally link across */ + buf[NAME_BUF_SIZE]; /* misc. buffer */ H5L_info_t li; H5O_info_t oi; hobj_ref_t obj_ref; @@ -6254,7 +5871,7 @@ external_link_closing(hid_t fapl, hbool_t new_format) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6268,7 +5885,7 @@ error: H5Fclose(fid2); H5Fclose(fid1); } H5E_END_TRY; - return -1; + return FAIL; } /* external_link_closing() */ @@ -6281,19 +5898,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static int external_link_endian(hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t lapl_id = (-1); /* Prop List ID */ - const char *pathbuf = H5_get_srcdir(); /* Path to the files */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t lapl_id = -1; /* Prop List ID */ + const char *pathbuf = H5_get_srcdir(); /* Path to the files */ const char *namebuf; if(new_format) @@ -6335,7 +5948,7 @@ external_link_endian(hbool_t new_format) PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6343,7 +5956,7 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } @@ -6355,10 +5968,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, March 5, 2007 - * *------------------------------------------------------------------------- */ static int @@ -6368,7 +5977,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) hid_t fid1 = (-1), fid2 = (-1); /* File ID */ hid_t gid1 = (-1), gid2 = (-1); /* Group IDs */ char objname[NAME_BUF_SIZE]; /* Object name */ - char filename1[NAME_BUF_SIZE], + char filename1[NAME_BUF_SIZE], filename2[NAME_BUF_SIZE]; if(new_format) @@ -6417,7 +6026,7 @@ external_link_strong(hid_t fapl, hbool_t new_format) if(H5Pclose(my_fapl) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6428,7 +6037,7 @@ error: H5Fclose(fid2); H5Fclose(fid1); } H5E_END_TRY; - return -1; + return FAIL; } /* end external_link_strong() */ @@ -6440,10 +6049,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Nov. 23, 2009 - * *------------------------------------------------------------------------- */ static int @@ -6452,17 +6057,17 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) #ifdef H5_HAVE_SYMLINK hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1; hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1; - char filename1[NAME_BUF_SIZE], - filename2a[NAME_BUF_SIZE], - filename2b[NAME_BUF_SIZE], - filename3a[NAME_BUF_SIZE], - filename3b[NAME_BUF_SIZE], - filename4a[NAME_BUF_SIZE], - filename4b[NAME_BUF_SIZE], - filename5a[NAME_BUF_SIZE], - filename5b[NAME_BUF_SIZE], - tmpname[NAME_BUF_SIZE], - cwdpath[NAME_BUF_SIZE]; + char filename1[NAME_BUF_SIZE], + filename2a[NAME_BUF_SIZE], + filename2b[NAME_BUF_SIZE], + filename3a[NAME_BUF_SIZE], + filename3b[NAME_BUF_SIZE], + filename4a[NAME_BUF_SIZE], + filename4b[NAME_BUF_SIZE], + filename5a[NAME_BUF_SIZE], + filename5b[NAME_BUF_SIZE], + tmpname[NAME_BUF_SIZE], + cwdpath[NAME_BUF_SIZE]; hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */ #endif /* H5_HAVE_SYMLINK */ @@ -6518,7 +6123,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a)); h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b)); - /* Create file #1 in current directory */ if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6528,7 +6132,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - /* Create file #2 in tmp directory #2 */ if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR if(H5Fclose(file2) < 0) TEST_ERROR @@ -6548,7 +6151,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #2 */ if(H5Fclose(file2) < 0) TEST_ERROR - /* Create file #3 in temp. directory #2 */ if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6564,7 +6166,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #3 */ if(H5Fclose(file3) < 0) TEST_ERROR - /* Create file #4 in temporary directory #1 */ if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6580,7 +6181,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #4 */ if(H5Fclose(file4) < 0) TEST_ERROR - /* Create file #5 in temporary directory #1 */ if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -6591,7 +6191,6 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #5 */ if(H5Fclose(file5) < 0) TEST_ERROR - /* Actual tests... */ /* Reopen file #1 */ @@ -6616,17 +6215,16 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) /* Close file #1 */ if(H5Fclose(file1) < 0) TEST_ERROR - PASSED(); } /* end if */ else { - SKIPPED(); - HDputs(" Current VFD doesn't support POSIX I/O calls"); + SKIPPED(); + HDputs(" Current VFD doesn't support POSIX I/O calls"); } /* end else */ - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(group5); H5Gclose(group4); @@ -6638,12 +6236,12 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) H5Fclose(file2); H5Fclose(file1); } H5E_END_TRY; - return -1; + return FAIL; #else /* H5_HAVE_SYMLINK */ SKIPPED(); HDputs(" Current file system or operating system doesn't support symbolic links"); - return 0; + return SUCCEED; #endif /* H5_HAVE_SYMLINK */ } /* end external_symlink() */ @@ -6658,18 +6256,14 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Wednesday, March 3, 2010 - * *------------------------------------------------------------------------- */ static int external_copy_invalid_object(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t ocpyplid = (-1); /* Object copy plist ID */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t ocpyplid = -1; /* Object copy plist ID */ char filename[NAME_BUF_SIZE]; if(new_format) @@ -6708,7 +6302,7 @@ external_copy_invalid_object(hid_t fapl, hbool_t new_format) if(H5Pclose(ocpyplid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6717,7 +6311,7 @@ error: H5Pclose(ocpyplid); } H5E_END_TRY - return -1; + return FAIL; } /* end external_copy_invalid_object */ @@ -6730,18 +6324,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Wednesday, March 3, 2010 - * *------------------------------------------------------------------------- */ static int external_dont_fail_to_source(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t oid = (-1); /* Object ID */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t oid = -1; /* Object ID */ char filename[NAME_BUF_SIZE]; if(new_format) @@ -6772,7 +6362,7 @@ external_dont_fail_to_source(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -6781,7 +6371,7 @@ error: H5Fclose(fid); } H5E_END_TRY - return -1; + return FAIL; } /* end external_dont_fail_to_source */ @@ -6794,21 +6384,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Thursday, January 13, 2011 - * *------------------------------------------------------------------------- */ static int external_file_cache(hid_t fapl, hbool_t new_format) { - hid_t my_fapl = (-1); /* Temporary FAPL */ - hid_t fid1 = (-1); /* File ID */ - hid_t fid2 = (-1); /* File ID */ - hid_t fid3 = (-1); /* File ID */ - hid_t fid4 = (-1); /* File ID */ - hid_t oid = (-1); /* Object ID */ + hid_t my_fapl = -1; /* Temporary FAPL */ + hid_t fid1 = -1; /* File ID */ + hid_t fid2 = -1; /* File ID */ + hid_t fid3 = -1; /* File ID */ + hid_t fid4 = -1; /* File ID */ + hid_t oid = -1; /* Object ID */ unsigned efc_size; char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -6827,333 +6413,229 @@ external_file_cache(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[3], fapl, filename4, sizeof filename4); /* Verify that the default EFC size is 0 */ - if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) - TEST_ERROR + if(H5Pget_elink_file_cache_size(fapl, &efc_size) < 0) TEST_ERROR if(efc_size != 0) FAIL_PUTS_ERROR("default external file cache size is not 0") /* Copy FAPL and enable external file caching */ - if((my_fapl = H5Pcopy(fapl)) < 0) - TEST_ERROR - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR /* Verify that the external file cache size has been set */ - if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) - TEST_ERROR + if(H5Pget_elink_file_cache_size(my_fapl, &efc_size) < 0) TEST_ERROR if(efc_size != 8) FAIL_PUTS_ERROR("external file cache size different from expected") - - /* - * Test 1: One file caches another - */ + /* Test 1: One file caches another */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close the target of the external link */ - if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that both files are now open */ H5F_sfile_assert_num(2); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 2: One file caches another, release parent's EFC - */ + /* Test 2: One file caches another, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close the target of the external link */ - if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that both files are now open */ H5F_sfile_assert_num(2); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only the parent file is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 3: "Y" shaped tree - */ + /* Test 3: "Y" shaped tree */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that files 2 and 3 are now open */ H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(4); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 4: "Y" shaped tree, release parent's EFC - */ + /* Test 4: "Y" shaped tree, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename4, "/", fid2, "link_to_4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-4 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR - if(H5Fclose(fid4) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR + if(H5Fclose(fid4) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that files 2 and 3 are now open */ H5F_sfile_assert_num(3); /* Open and close the other branch of the tree */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_4", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(4); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - /* - * Test 5: 3 file cycle - */ + /* Test 5: 3 file cycle */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one complete cycle */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(3); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 6: 3 file cycle, release parent's EFC - */ + /* Test 6: 3 file cycle, release parent's EFC */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR - if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR + if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Create links */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename3, "/", fid2, "link_to_3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_external(filename1, "/", fid3, "link_to_1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close files 2-3 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR - if(H5Fclose(fid3) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR + if(H5Fclose(fid3) < 0) TEST_ERROR /* Verify that only 1 file is open */ H5F_sfile_assert_num(1); /* Open and close one complete cycle */ - if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Oclose(oid) < 0) - TEST_ERROR + if((oid = H5Oopen(fid1, "link_to_2/link_to_3/link_to_1", H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Oclose(oid) < 0) TEST_ERROR /* Verify that all files are now open */ H5F_sfile_assert_num(3); /* Release file 1's EFC */ - if(H5Fclear_elink_file_cache(fid1) < 0) - TEST_ERROR + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ H5F_sfile_assert_num(1); /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that all files are now closed */ H5F_sfile_assert_num(0); @@ -7162,7 +6644,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) H5Pclose(my_fapl); PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7174,7 +6656,7 @@ error: H5Pclose(my_fapl); } H5E_END_TRY - return -1; + return FAIL; } /* end external_file_cache */ @@ -7186,21 +6668,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Saturday, April 30, 2011 - * *------------------------------------------------------------------------- */ static int external_open_twice(hid_t fapl, hbool_t new_format) { - hid_t fid1 = (-1); /* File ID */ - hid_t fid2 = (-1); /* File ID */ - hid_t oid1 = (-1); /* Object ID */ - hid_t oid2 = (-1); /* Object ID */ - hid_t type = (-1); /* Datatype ID */ - hid_t space = (-1); /* Dataspace ID */ + hid_t fid1 = -1; /* File ID */ + hid_t fid2 = -1; /* File ID */ + hid_t oid1 = -1; /* Object ID */ + hid_t oid2 = -1; /* Object ID */ + hid_t type = -1; /* Datatype ID */ + hid_t space = -1; /* Dataspace ID */ char filename1[NAME_BUF_SIZE]; char filename2[NAME_BUF_SIZE]; @@ -7213,192 +6691,123 @@ external_open_twice(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - - /* - * Test 1: Open root group twice - */ + /* Test 1: Open root group twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 2: Open group twice - */ + /* Test 2: Open group twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create target group */ - if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) - < 0) - TEST_ERROR - if(H5Gclose(oid1) < 0) - TEST_ERROR + if((oid1 = H5Gcreate2(fid2, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Gclose(oid1) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 3: Open dataset twice - */ + /* Test 3: Open dataset twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create target dataset */ - if((space = H5Screate(H5S_SCALAR)) < 0) - TEST_ERROR - if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, - dcpl_g, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Dclose(oid1) < 0) - TEST_ERROR - if(H5Sclose(space) < 0) - TEST_ERROR + if((space = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR + if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Dclose(oid1) < 0) TEST_ERROR + if(H5Sclose(space) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/dset", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - - /* - * Test 4: Open datatype twice - */ + /* Test 4: Open datatype twice */ /* Create files */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR - - /* Create target datatype */ - if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) - TEST_ERROR - if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) - < 0) - TEST_ERROR - if(H5Tclose(type) < 0) - TEST_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + + /* Create target datatype */ + if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR + if(H5Tcommit2(fid2, "dtype", type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Tclose(type) < 0) TEST_ERROR /* Create link */ - if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, - H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_external(filename2, "/dtype", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file 2 */ - if(H5Fclose(fid2) < 0) - TEST_ERROR + if(H5Fclose(fid2) < 0) TEST_ERROR /* Open the target of the external link twice */ - if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR - if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) - TEST_ERROR + if((oid1 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR + if((oid2 = H5Oopen(fid1, "link_to_2", H5P_DEFAULT)) < 0) TEST_ERROR - /* Close both objects, in the reverse opening order (necessary to duplicate - * bug */ - if(H5Oclose(oid2) < 0) - TEST_ERROR - if(H5Oclose(oid1) < 0) - TEST_ERROR + /* Close both objects, in the reverse opening order (necessary to duplicate bug */ + if(H5Oclose(oid2) < 0) TEST_ERROR + if(H5Oclose(oid1) < 0) TEST_ERROR /* Close file 1 */ - if(H5Fclose(fid1) < 0) - TEST_ERROR + if(H5Fclose(fid1) < 0) TEST_ERROR /* Verify that both files are now closed */ H5F_sfile_assert_num(0); - PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7410,7 +6819,7 @@ error: H5Sclose(space); } H5E_END_TRY - return -1; + return FAIL; } /* end external_open_twice() */ @@ -7437,23 +6846,23 @@ static int external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) { hid_t fid1 = -1, fid2 = -1; /* File IDs */ - hid_t gid1 = -1, gid2 = -1; /* Group IDs */ - hid_t tid = -1; /* Datatype ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t sid2 = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t atid = -1; /* Attribute's datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dtid = -1; /* Dataset's datatype ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - int wdata = 99; /* Attribute data written */ - int wbuf[60]; /* Data buffer for writing */ - int rbuf[60]; /* Data buffer for reading */ - int i; /* Local index variable */ + hid_t gid1 = -1, gid2 = -1; /* Group IDs */ + hid_t tid = -1; /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t sid2 = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t atid = -1; /* Attribute's datatype ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dtid = -1; /* Dataset's datatype ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + int wdata = 99; /* Attribute data written */ + int wbuf[60]; /* Data buffer for writing */ + int rbuf[60]; /* Data buffer for reading */ + int i; /* Local index variable */ char filename1[NAME_BUF_SIZE]; /* File name for main file */ char filename2[NAME_BUF_SIZE]; /* File name for target file */ - hsize_t dims[2] = {5, 12}; /* Dimension sizes */ - hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ + hsize_t dims[2] = {5, 12}; /* Dimension sizes */ + hsize_t chunks[2] = {3, 7}; /* Chunk sizes */ if(new_format) TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)") @@ -7464,209 +6873,157 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format) h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1); h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2); - /* Main file */ - if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create external link from main file to target file */ - if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - + if(H5Lcreate_external(filename2, "target_group", fid1, "link_to_2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create target file */ - if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Create group in target file */ - if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid2 = H5Gcreate2(fid2, "target_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid2) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid2) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid2) < 0) - FAIL_STACK_ERROR + if(H5Fclose(fid2) < 0) FAIL_STACK_ERROR /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Create a copy of integer datatype */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) - FAIL_STACK_ERROR + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR /* Commit the datatype to the main file root group */ - if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR + if(H5Tcommit2(fid1, "myDatatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Create dataspace */ - if((sid = H5Screate(H5S_SCALAR)) < 0) - FAIL_STACK_ERROR + if((sid = H5Screate(H5S_SCALAR)) < 0) FAIL_STACK_ERROR /* Attach an attribute with the committed datatype to the group */ - if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((aid = H5Acreate2(gid1, "myAttribute", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Write data to the attribute */ - if(H5Awrite(aid, tid, &wdata) < 0) - FAIL_STACK_ERROR + if(H5Awrite(aid, tid, &wdata) < 0) FAIL_STACK_ERROR /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR + if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR /* Verify the datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR + if(H5Aclose(aid) < 0) FAIL_STACK_ERROR /* Create a chunked dataset */ - if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) - FAIL_STACK_ERROR + if((sid2 = H5Screate_simple(2, dims, NULL)) < 0) FAIL_STACK_ERROR if (dcpl_g == H5P_DEFAULT) dcpl = H5Pcreate(H5P_DATASET_CREATE); else dcpl = H5Pcopy(dcpl_g); if (0 > dcpl) FAIL_STACK_ERROR - if(H5Pset_chunk(dcpl, 2, chunks) < 0) - FAIL_STACK_ERROR + if(H5Pset_chunk(dcpl, 2, chunks) < 0) FAIL_STACK_ERROR /* Initialize data buffers */ for(i = 0; i < 60; i++) { - wbuf[i] = i; - rbuf[i] = 0; + wbuf[i] = i; + rbuf[i] = 0; } /* Create a dataset with the committed datatype in the group */ - if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((did = H5Dcreate2(gid1, "myDataset", tid, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Write to the dataset */ - if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) - FAIL_STACK_ERROR + if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) FAIL_STACK_ERROR /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR + if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR /* Verify the datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR /* Close the dataset creation property list */ - if(H5Pclose(dcpl) < 0) - FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR /* Close the dataspaces */ - if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR - if(H5Sclose(sid2) < 0) - FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid2) < 0) FAIL_STACK_ERROR /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR /* Close the file */ - if(H5Fclose(fid1) < 0) - FAIL_STACK_ERROR - + if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR /* Open the mainfile */ - if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR + if((fid1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR /* Open the committed datatype in the mainfile */ - if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((tid = H5Topen2(fid1, "myDatatype", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Verify the datatype is committed */ - if(H5Tcommitted(tid) == FALSE) - FAIL_STACK_ERROR + if(H5Tcommitted(tid) == FALSE) FAIL_STACK_ERROR /* Open the group which is externally linked to target file */ - if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid1 = H5Gopen2(fid1, "link_to_2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Open the attribute attached to the group */ - if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((aid = H5Aopen(gid1, "myAttribute", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get the attribute's datatype */ - if((atid = H5Aget_type(aid)) < 0) - FAIL_STACK_ERROR + if((atid = H5Aget_type(aid)) < 0) FAIL_STACK_ERROR /* Verify the attribute's datatype is not committed */ - if(H5Tcommitted(atid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(atid) == TRUE) FAIL_STACK_ERROR /* Close the attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR + if(H5Aclose(aid) < 0) FAIL_STACK_ERROR /* Delete the attribute */ - if(H5Adelete(gid1, "myAttribute") < 0) - FAIL_STACK_ERROR + if(H5Adelete(gid1, "myAttribute") < 0) FAIL_STACK_ERROR /* Open the dataset in the group */ - if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((did = H5Dopen2(gid1, "myDataset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR /* Get the dataset's datatype */ - if((dtid = H5Dget_type(did)) < 0) - FAIL_STACK_ERROR + if((dtid = H5Dget_type(did)) < 0) FAIL_STACK_ERROR /* Verify the dataset's datatype is not committed */ - if(H5Tcommitted(dtid) == TRUE) - FAIL_STACK_ERROR + if(H5Tcommitted(dtid) == TRUE) FAIL_STACK_ERROR /* Read the dataset */ - if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) - FAIL_STACK_ERROR + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) FAIL_STACK_ERROR /* Compare the data read should be the same as wbuf */ - if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) - FAIL_STACK_ERROR + if(HDmemcmp(wbuf, rbuf, sizeof(wbuf)) != 0) FAIL_STACK_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) - FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR /* Close the group */ - if(H5Gclose(gid1) < 0) - FAIL_STACK_ERROR + if(H5Gclose(gid1) < 0) FAIL_STACK_ERROR /* Close the datatypes */ - if(H5Tclose(tid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(atid) < 0) - FAIL_STACK_ERROR - if(H5Tclose(dtid) < 0) - FAIL_STACK_ERROR + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Tclose(atid) < 0) FAIL_STACK_ERROR + if(H5Tclose(dtid) < 0) FAIL_STACK_ERROR /* Close the file */ if(H5Fclose(fid1) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -7685,10 +7042,10 @@ error: H5Aclose(atid); H5Aclose(dtid); - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY - return -1; + return FAIL; } /* end external_link_with_committed_datatype() */ @@ -7700,10 +7057,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* Callback functions for UD hard links. */ @@ -7770,7 +7123,7 @@ done: case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: - return -1; + return FAIL; } /* end switch */ } /* end if */ @@ -7787,7 +7140,7 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, hid_t ret_value = -1; if(udata_size != sizeof(haddr_t)) - return -1; + return FAIL; addr = *((const haddr_t *) udata); @@ -7859,7 +7212,7 @@ done: case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: - return -1; + return FAIL; } /* end switch */ } /* end if */ @@ -7881,12 +7234,12 @@ const H5L_class_t UD_hard_class[1] = {{ static int ud_hard_links(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ h5_stat_size_t empty_size; /* Size of an empty file */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; TESTING("user-defined hard link (w/new group format)") @@ -7920,7 +7273,6 @@ ud_hard_links(hid_t fapl) if(H5Gclose(gid) < 0) TEST_ERROR - /* Create a user-defined "hard link" to the group using the address we got * from H5Lget_info */ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -7958,9 +7310,9 @@ ud_hard_links(hid_t fapl) /* 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(); - HDputs(" Unexpected link class - should have been a UD hard link"); - goto error; + H5_FAILED(); + HDputs(" 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 @@ -7987,15 +7339,15 @@ ud_hard_links(hid_t fapl) if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_hard_links() */ @@ -8007,10 +7359,6 @@ ud_hard_links(hid_t fapl) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* A traversal function that ignores any udata and simply opens an object @@ -8028,7 +7376,7 @@ UD_rereg_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, return ret_value; error: - return -1; + return FAIL; } /* end UD_rereg_traverse() */ /* This link class has the same ID number as the UD hard links but @@ -8048,23 +7396,23 @@ const H5L_class_t UD_rereg_class[1] = {{ static int ud_link_reregister(hid_t fapl) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - H5L_info_t li; /* Link information */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; - h5_stat_size_t empty_size; /* Size of an empty file */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + H5L_info_t li; /* Link information */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + h5_stat_size_t empty_size; /* Size of an empty file */ TESTING("registering a new class for existing UD links (w/new group format)") /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Get the size of the empty file for reference */ if(H5Fclose(fid) < 0) TEST_ERROR - if((empty_size=h5_get_file_size(filename, fapl))<0) TEST_ERROR + if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -8103,9 +7451,9 @@ ud_link_reregister(hid_t fapl) /* Verify that we can't create any new links of this type */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), + if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + TEST_ERROR } H5E_END_TRY /* Register a new kind of link with the same ID number */ @@ -8173,15 +7521,15 @@ ud_link_reregister(hid_t fapl) if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Gclose(gid2); H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_link_reregister() */ @@ -8193,10 +7541,6 @@ ud_link_reregister(hid_t fapl) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ /* Callback functions for UD "callback" links. */ @@ -8214,10 +7558,10 @@ UD_cb_create(const char * link_name, hid_t loc_group, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_create() */ static hid_t @@ -8241,7 +7585,7 @@ UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata, return ret_value; error: - return -1; + return FAIL; } /* end UD_cb_traverse() */ /* Callback for when the link is moved or renamed */ @@ -8257,10 +7601,10 @@ UD_cb_move(const char *new_name, hid_t new_loc, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_move() */ /* Callback for when the link is deleted. Also called during move */ @@ -8276,10 +7620,10 @@ UD_cb_delete(const char *link_name, hid_t file, const void *udata, if(HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR if(udata_size != UD_CB_TARGET_LEN) TEST_ERROR - return 0; + return SUCCEED; error: - return -1; + return FAIL; } /* end UD_cb_delete() */ /* Callback for when the link is queried */ @@ -8303,7 +7647,7 @@ UD_cb_query(const char * link_name, const void *udata, size_t udata_size, return 16; error: - return -1; + return FAIL; } /* end UD_cb_query() */ const H5L_class_t UD_cb_class[1] = {{ @@ -8321,12 +7665,12 @@ const H5L_class_t UD_cb_class[1] = {{ static int ud_callbacks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t lcpl = (-1); /* Link Creation PL */ - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t lcpl = -1; /* Link Creation PL */ + H5L_info_t li; /* Link information */ char ud_target_name[] = UD_CB_TARGET; /* Link target name */ - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; char query_buf[NAME_BUF_SIZE]; if(new_format) @@ -8349,8 +7693,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) * no problems. */ if(H5Lregister(UD_hard_class) < 0) TEST_ERROR - /* Register user-defined link class. This is the one we'll actually - * be using. */ + /* Register user-defined link class. This is the one we'll actually be using. */ if(H5Lregister(UD_cb_class) < 0) TEST_ERROR /* Check that registered link classes are, and unregistered ones aren't */ @@ -8392,7 +7735,6 @@ ud_callbacks(hid_t fapl, hbool_t new_format) /* Remove UD link */ 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 */ /* Create a new link. Just for fun, give it a non-default character @@ -8430,7 +7772,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -8438,7 +7780,7 @@ error: H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_callbacks() */ @@ -8450,10 +7792,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static hid_t @@ -8469,13 +7807,12 @@ UD_plist_traverse(const char H5_ATTR_UNUSED * link_name, hid_t cur_group, /* Get the name of the target from the property list. */ if(H5Pget(lapl_id, DEST_PROP_NAME, target) < 0) TEST_ERROR - if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) - TEST_ERROR + if((ret_value = H5Oopen(cur_group, target, lapl_id)) < 0) TEST_ERROR return ret_value; error: - return -1; + return FAIL; } /* end UD_plist_traverse() */ const H5L_class_t UD_plist_class[1] = {{ @@ -8493,12 +7830,12 @@ const H5L_class_t UD_plist_class[1] = {{ static int lapl_udata(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist_id = (-1); /* Property List ID */ - char group_a_name[NAME_BUF_SIZE]; - char group_b_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist_id = -1; /* Property List ID */ + char group_a_name[NAME_BUF_SIZE]; + char group_b_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("user data passed through lapl (w/new group format)") @@ -8569,16 +7906,16 @@ lapl_udata(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose (plist_id); H5Gclose (gid); H5Gclose (gid2); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end lapl_udata() */ @@ -8590,10 +7927,6 @@ lapl_udata(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -8601,10 +7934,9 @@ UD_cbsucc_create(const char H5_ATTR_UNUSED * link_name, hid_t H5_ATTR_UNUSED loc const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id) { /* Check to make sure that this "soft link" has a target */ - if(udata_size < 1 || !udata) - return -1; + if(udata_size < 1 || !udata) return FAIL; - return 0; + return SUCCEED; } /* end UD_cbsucc_create() */ static hid_t @@ -8622,7 +7954,7 @@ UD_cbsucc_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, return ret_value; error: - return -1; + return FAIL; } /* end UD_cbsucc_traverse() */ /* Failure callback for when the link is moved or renamed */ @@ -8631,7 +7963,7 @@ UD_cbfail_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always fail. */ - return -1; + return FAIL; } /* end UD_cbfail_move() */ /* SuccessCallback for when the link is moved or renamed */ @@ -8640,7 +7972,7 @@ UD_cbsucc_move(const char H5_ATTR_UNUSED *new_name, hid_t H5_ATTR_UNUSED new_loc const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This traversal function will always succeed. */ - return 0; + return SUCCEED; } /* end UD_cbsucc_move() */ /* Callback for when the link is deleted. Also called during move */ @@ -8649,7 +7981,7 @@ UD_cbsucc_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file const void H5_ATTR_UNUSED *udata, size_t H5_ATTR_UNUSED udata_size) { /* This callback will always succeed */ - return 0; + return SUCCEED; } /* end UD_cbsucc_delete() */ /* Callback for when the link is deleted. Also called during move */ @@ -8659,7 +7991,7 @@ UD_cbfail_delete(const char H5_ATTR_UNUSED *link_name, hid_t H5_ATTR_UNUSED file { /* This traversal function will always fail. */ /* Note: un-deletable links are in general a very bad idea! */ - return -1; + return FAIL; } /* end UD_cbfail_delete() */ /* Callback for when the link is queried */ @@ -8668,7 +8000,7 @@ UD_cbfail_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATTR_UNUSED size_t H5_ATTR_UNUSED udata_size, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNUSED buf_size) { /* This traversal function will always fail. */ - return -1; + return FAIL; } /* end UD_cbfail_query() */ /* Callback for when the link is queried */ @@ -8681,10 +8013,9 @@ UD_cbfail_on_write_query(const char H5_ATTR_UNUSED *link_name, const void H5_ATT * fails */ - if(buf != NULL) - return -1; + if(buf != NULL) return FAIL; - return 0; + return SUCCEED; } /* end UD_cbfail_on_write_query() */ /* Callback for when the link is queried */ @@ -8791,12 +8122,12 @@ const H5L_class_t UD_error4_class[1] = {{ static int ud_link_errors(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group IDs */ - char group_name[NAME_BUF_SIZE]; - char filename[NAME_BUF_SIZE]; - char query_buf[NAME_BUF_SIZE]; - H5L_info_t li; /* Link information */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group IDs */ + char group_name[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; + char query_buf[NAME_BUF_SIZE]; + H5L_info_t li; /* Link information */ if(new_format) TESTING("user-defined link error conditions (w/new group format)") @@ -8809,10 +8140,10 @@ ud_link_errors(hid_t fapl, hbool_t new_format) /* Try to register some invalid link classes */ H5E_BEGIN_TRY { - if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR - if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error1_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error2_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error3_class) >= 0) TEST_ERROR + if(H5Lregister(UD_error4_class) >= 0) TEST_ERROR } H5E_END_TRY /* Register the UD plist class. */ @@ -8827,16 +8158,13 @@ ud_link_errors(hid_t fapl, hbool_t new_format) /* Try to create internally defined links with H5Lcreate_ud */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR - if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_HARD, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", H5L_TYPE_SOFT, "str", (size_t)4, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY /* Try to create a link with H5Lcreate_ud that has a NULL udata pointer, but a non-zero udata_size value */ H5E_BEGIN_TRY { - if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) - TEST_ERROR + if(H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, NULL, 1, H5P_DEFAULT, H5P_DEFAULT) >= 0) TEST_ERROR } H5E_END_TRY; /* Create a user-defined link to the group. */ @@ -8904,14 +8232,14 @@ ud_link_errors(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end ud_link_errors() */ @@ -8922,28 +8250,21 @@ error: * by the user using the Link Access Property List. * * Return: Success: 0 - * * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * - * Modifications: - * *------------------------------------------------------------------------- */ static int lapl_nlinks(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1), gid2 = (-1); /* Group IDs */ - hid_t plist = (-1); /* lapl ID */ - hid_t tid = (-1), sid = (-1), did = (-1); /* Other IDs */ - hid_t gapl = (-1), dapl = (-1), tapl = (-1); /* Other property lists */ - char objname[NAME_BUF_SIZE]; /* Object name */ - char filename[NAME_BUF_SIZE]; - size_t nlinks; /* nlinks for H5Pset_nlinks */ - hsize_t dims[2]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1, gid2 = -1; /* Group IDs */ + hid_t plist = -1; /* lapl ID */ + hid_t tid = -1, sid = -1, did = -1; /* Other IDs */ + hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */ + char objname[NAME_BUF_SIZE]; /* Object name */ + char filename[NAME_BUF_SIZE]; + size_t nlinks; /* nlinks for H5Pset_nlinks */ + hsize_t dims[2]; if(new_format) TESTING("adjusting nlinks with LAPL (w/new group format)") @@ -8958,7 +8279,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Create file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create group with short name in file (used as target for links) */ if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR @@ -8987,7 +8308,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR /* Open file */ - if((fid=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR /* Create LAPL with higher-than-usual nlinks value */ /* Create a non-default lapl with udata set to point to the first group */ @@ -9041,7 +8362,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR if(HDstrcmp(objname, "/soft4")) TEST_ERROR - /* Test other functions that should use a LAPL */ nlinks = 20; if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR @@ -9074,7 +8394,6 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) /* Close plist */ if(H5Pclose(plist) < 0) TEST_ERROR - /* Create a datatype and dataset as targets inside the group */ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9133,9 +8452,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Pclose(gapl); H5Pclose(dapl); @@ -9148,7 +8467,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) H5Pclose(plist); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end lapl_nlinks() */ @@ -9159,21 +8478,17 @@ lapl_nlinks(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Tuesday, June 6, 2006 - * *------------------------------------------------------------------------- */ static int linkinfo(hid_t fapl, hbool_t new_format) { - hid_t fid = (-1); /* File ID */ - hid_t gid = (-1); /* Group ID */ - hid_t tid = (-1); /* Type ID */ - hid_t sid = (-1), did = -(1); /* Dataspace and dataset IDs */ - H5L_info_t li; /* Link information */ - char filename[NAME_BUF_SIZE]; + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + hid_t tid = -1; /* Type ID */ + hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */ + H5L_info_t li; /* Link information */ + char filename[NAME_BUF_SIZE]; if(new_format) TESTING("link type field in H5Lget_info (w/new group format)") @@ -9226,16 +8541,16 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; - error: +error: H5E_BEGIN_TRY { H5Tclose (tid); H5Dclose (did); H5Gclose (gid); H5Fclose (fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end linkinfo() */ @@ -9251,10 +8566,6 @@ linkinfo(hid_t fapl, hbool_t new_format) * * Return: Success: 0 * Failure: -1 - * - * Programmer: James Laird - * Thursday, August 17, 2006 - * *------------------------------------------------------------------------- */ static int @@ -9274,8 +8585,7 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) * To check this, try to create every file used in this test. If * a file is already open, creating it will fail. */ - for(x=0; FILENAME[x] != NULL && x < stopat; x++) - { + for(x=0; FILENAME[x] != NULL && x < stopat; x++) { h5_fixname(FILENAME[x], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -9283,17 +8593,15 @@ check_all_closed(hid_t fapl, hbool_t new_format, int stopat) } PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end check_all_closed() */ - - /*------------------------------------------------------------------------- * Function: build_visit_file * @@ -9301,10 +8609,6 @@ error: * * Return: Success: >0, File ID for file built * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static hid_t @@ -9312,9 +8616,9 @@ build_visit_file(hid_t fapl) { hid_t fid = -1; /* File ID */ hid_t gid = -1, gid2 = -1; /* Group IDs */ - hid_t sid = (-1); /* Dataspace ID */ - hid_t did = (-1); /* Dataset ID */ - hid_t tid = (-1); /* Datatype ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t did = -1; /* Dataset ID */ + hid_t tid = -1; /* Datatype ID */ char filename[NAME_BUF_SIZE]; const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */ @@ -9333,7 +8637,6 @@ build_visit_file(hid_t fapl) if(H5Gclose(gid2) < 0) TEST_ERROR if(H5Gclose(gid) < 0) TEST_ERROR - /* Create soft links to groups created */ if(H5Lcreate_soft("/Group1", fid, "/soft_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/Group1/Group2", fid, "/soft_two", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9341,7 +8644,6 @@ build_visit_file(hid_t fapl) /* Create dangling soft link */ if(H5Lcreate_soft("nowhere", fid, "/soft_dangle", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR - /* Create hard links to all groups */ if(H5Lcreate_hard(fid, "/", fid, "hard_zero", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_hard(fid, "/Group1", fid, "hard_one", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -9390,7 +8692,7 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end build_visit_file() */ @@ -9401,15 +8703,10 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int -visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, - void *_op_data) +visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data) { lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data; @@ -9431,10 +8728,6 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9464,7 +8757,6 @@ link_visit(hid_t fapl, hbool_t new_format) if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; @@ -9478,19 +8770,18 @@ link_visit(hid_t fapl, hbool_t new_format) if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_visit() */ @@ -9501,10 +8792,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, November 24, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9534,7 +8821,6 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the links reachable from each internal group */ udata.idx = 0; udata.info = lvisit1; @@ -9556,19 +8842,18 @@ link_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_visit_by_name() */ @@ -9579,15 +8864,10 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int -visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, - void *_op_data) +visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data) { ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data; @@ -9609,10 +8889,6 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t * * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9642,7 +8918,6 @@ obj_visit(hid_t fapl, hbool_t new_format) if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR udata.idx = 0; @@ -9656,19 +8931,18 @@ obj_visit(hid_t fapl, hbool_t new_format) if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit() */ @@ -9679,10 +8953,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 25, 2007 - * *------------------------------------------------------------------------- */ static int @@ -9712,7 +8982,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Visit all the objects reachable from each internal group */ udata.idx = 0; udata.info = new_format ? ovisit1_new : ovisit1_old; @@ -9724,7 +8993,6 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - udata.idx = 0; udata.info = new_format ? ovisit2_new : ovisit2_old; if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -9735,19 +9003,18 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format) if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* Close file created */ if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit_by_name() */ @@ -9757,15 +9024,10 @@ error: * Purpose: Callback routine for visiting objects in a file * * Return: 1 (H5_ITER_STOP) - * - * Programmer: Neil Fortner - * Sunday, November 2, 2008 - * *------------------------------------------------------------------------- */ static int -visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, - void *_op_data) +visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data) { unsigned *op_data = (unsigned *)_op_data; @@ -9784,10 +9046,6 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Sunday, November 2, 2008 - * *------------------------------------------------------------------------- */ static int @@ -9817,7 +9075,7 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) /* Same test with H5Ovisit_by_name */ nvisited = 0; if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, - &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + &nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(ret != H5_ITER_STOP) TEST_ERROR if(nvisited != 1) TEST_ERROR @@ -9825,13 +9083,13 @@ obj_visit_stop(hid_t fapl, hbool_t new_format) if(H5Fclose(fid) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_visit_stop() */ @@ -9843,10 +9101,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Neil Fortner - * Tuesday, June 16, 2009 - * *------------------------------------------------------------------------- */ static enum { @@ -9859,14 +9113,11 @@ static enum { static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id) { - if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) - return -1; + if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1; - if(link_filter_state >= LFS_ENCODED) - return 1; + if(link_filter_state >= LFS_ENCODED) return 1; - if(link_filter_state != LFS_INIT) - return -1; + if(link_filter_state != LFS_INIT) return -1; link_filter_state = LFS_CAN_APPLY_CALLED; @@ -9875,14 +9126,11 @@ static htri_t link_filter_can_apply(hid_t dcpl_id, hid_t type_id, hid_t space_id static herr_t link_filter_set_local(hid_t dcpl_id, hid_t type_id, hid_t space_id) { - if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) - return -1; + if(dcpl_id >= 0 || type_id >= 0 || space_id >= 0) return -1; - if(link_filter_state >= LFS_ENCODED) - return 0; + if(link_filter_state >= LFS_ENCODED) return 0; - if(link_filter_state != LFS_CAN_APPLY_CALLED) - return -1; + if(link_filter_state != LFS_CAN_APPLY_CALLED) return -1; link_filter_state = LFS_SET_LOCAL_CALLED; @@ -9893,19 +9141,16 @@ static size_t link_filter_filter(unsigned int flags, size_t cd_nelmts, const unsigned int cd_values[], size_t nbytes, size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) { - if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) - return 0; + if(flags & H5Z_FLAG_OPTIONAL || cd_nelmts != 1 || cd_values[0] != 2112) return 0; - if(link_filter_state == LFS_DECODED) - return nbytes; + if(link_filter_state == LFS_DECODED) return nbytes; if(flags & H5Z_FLAG_REVERSE) { - if(link_filter_state != LFS_ENCODED) - return 0; + if(link_filter_state != LFS_ENCODED) return 0; link_filter_state = LFS_DECODED; - } else { - if(link_filter_state < LFS_SET_LOCAL_CALLED) - return 0; + } + else { + if(link_filter_state < LFS_SET_LOCAL_CALLED) return 0; link_filter_state = LFS_ENCODED; } /* end else */ @@ -9926,7 +9171,7 @@ link_filters(hid_t fapl, hbool_t new_format) int nfilters = 0; H5Z_class2_t filter_class; char name_out[24]; - char filename[NAME_BUF_SIZE]; + char filename[NAME_BUF_SIZE]; htri_t tri_ret; herr_t status; @@ -9944,8 +9189,7 @@ link_filters(hid_t fapl, hbool_t new_format) /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Create gcpl, force use of dense storage */ if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR @@ -9973,8 +9217,7 @@ link_filters(hid_t fapl, hbool_t new_format) filter_class.set_local = link_filter_set_local; filter_class.filter = link_filter_filter; if(H5Zregister(&filter_class) < 0) TEST_ERROR - if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR + if(H5Pset_filter(gcpl1, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR nfilters++; /* Test various other filter functions for use on gcpl's */ @@ -9982,14 +9225,10 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pall_filters_avail(gcpl1) != TRUE) TEST_ERROR /* Create a group using this filter, add some soft links to it */ - if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, gcpl1, H5P_DEFAULT)) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file and group */ if(H5Gclose(gid1) < 0) TEST_ERROR @@ -10013,12 +9252,10 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pclose(gcpl2) < 0) TEST_ERROR /* Add another soft link */ - if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Copy the group */ - if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Ocopy(fid, "group1", fid, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if((gid2 = H5Gopen2(fid, "group2", H5P_DEFAULT)) <0) TEST_ERROR /* Verify that all links have been copied */ @@ -10047,10 +9284,8 @@ link_filters(hid_t fapl, hbool_t new_format) /* Reopen file and group, add 2 links */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR if((gid1 = H5Gopen2(fid, "group1", H5P_DEFAULT)) < 0) TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR + if(H5Lcreate_soft("/", gid1, "link3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Close file and group */ if(H5Gclose(gid1) < 0) TEST_ERROR @@ -10061,34 +9296,27 @@ link_filters(hid_t fapl, hbool_t new_format) /* Test H5Pget_filter_by_id2 and H5Pget_filter2 */ if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR if(H5Pget_filter2(gcpl2, (unsigned)(nfilters - 1), &flags_out, &cd_nelmts, - &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR /* Test H5Pmodify_filter */ cd_value++; - if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) - TEST_ERROR + if(H5Pmodify_filter(gcpl2, H5Z_FILTER_RESERVED + 42, 0, (size_t)1, &cd_value) < 0) TEST_ERROR if(H5Pget_filter_by_id2(gcpl2, H5Z_FILTER_RESERVED + 42, &flags_out, - &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) - TEST_ERROR + &cd_nelmts, &cd_value_out, (size_t)24, name_out, &filter_config_out) < 0) TEST_ERROR if(flags_out != 0 || cd_value_out != cd_value || HDstrcmp(filter_class.name, name_out) || filter_config_out != (H5Z_FILTER_CONFIG_ENCODE_ENABLED - | H5Z_FILTER_CONFIG_DECODE_ENABLED)) - TEST_ERROR + | H5Z_FILTER_CONFIG_DECODE_ENABLED)) TEST_ERROR /* Test H5Premove_filter */ if(H5Premove_filter(gcpl2, H5Z_FILTER_RESERVED + 42) < 0) TEST_ERROR @@ -10114,8 +9342,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_create_intermediate_group(lcpl, (unsigned)TRUE) < 0) TEST_ERROR /* Create new group, with missing intermediate groups, in compressed group */ - if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) - TEST_ERROR + if((gid1 = H5Gcreate2(fid, "group1/group2/group3/group4", lcpl, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR /* Close LCPL ID */ if(H5Pclose(lcpl) < 0) TEST_ERROR @@ -10143,7 +9370,6 @@ link_filters(hid_t fapl, hbool_t new_format) /* Close file */ if(H5Fclose(fid) < 0) TEST_ERROR - /* Now create the same file with and without deflate, and verify that the * file size is smaller with deflate */ /* But only if the deflate filter is available */ @@ -10157,8 +9383,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_link_phase_change(fcpl, 2, 2) < 0) TEST_ERROR /* Create file */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR /* Create links in file */ if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -10176,8 +9401,7 @@ link_filters(hid_t fapl, hbool_t new_format) if(H5Pset_deflate(fcpl, 6) < 0) TEST_ERROR /* Recreate the same file with the deflate filter */ - if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - TEST_ERROR + if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR if(H5Lcreate_soft("/", fid, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR if(H5Lcreate_soft("/", fid, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", H5P_DEFAULT, H5P_DEFAULT) < 0) @@ -10190,16 +9414,14 @@ link_filters(hid_t fapl, hbool_t new_format) filesize_filtered = h5_get_file_size(filename, fapl); /* Check that the file size is smaller with the filter */ - if((double)filesize_filtered - > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) - TEST_ERROR + if((double)filesize_filtered > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) TEST_ERROR /* Close */ if(H5Pclose(fcpl) < 0) TEST_ERROR } /* end if */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10211,7 +9433,7 @@ error: H5Pclose(gcpl2); H5Pclose(fcpl); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_filters() */ @@ -10222,19 +9444,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, February 2, 2010 - * *------------------------------------------------------------------------- */ static int obj_exists(hid_t fapl, hbool_t new_format) { - char filename[NAME_BUF_SIZE]; /* Buffer for file name */ - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - herr_t status; /* Generic return value */ + char filename[NAME_BUF_SIZE]; /* Buffer for file name */ + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + herr_t status; /* Generic return value */ if(new_format) TESTING("object exists (w/new group format)") @@ -10244,8 +9462,7 @@ obj_exists(hid_t fapl, hbool_t new_format) /* Set up filename and create file*/ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR /* Hard links */ /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ @@ -10255,13 +9472,11 @@ obj_exists(hid_t fapl, hbool_t new_format) if(status >= 0) TEST_ERROR /* Create a group, as a destination for testing */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() succeeds for hard linked object */ - if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) TEST_ERROR /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ H5E_BEGIN_TRY { @@ -10269,237 +9484,202 @@ obj_exists(hid_t fapl, hbool_t new_format) } H5E_END_TRY if(status >= 0) TEST_ERROR - /* Soft links */ /* Create dangling soft-link in root group */ if(H5Lcreate_soft("dangle", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in root group */ - if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to object */ if(H5Lcreate_soft("/group", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE for soft-link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft2", H5P_DEFAULT)) TEST_ERROR /* Create dangling soft-link in non-root group */ if(H5Lcreate_soft("dangle", fid, "group/soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling soft-link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to object */ if(H5Lcreate_soft("/group", fid, "group/soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE for soft-link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/soft2", H5P_DEFAULT)) TEST_ERROR /* External links */ /* Create dangling (file doesn't exist) external link in root group */ if(H5Lcreate_external("nofile", "dangle", fid, "external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "external1", H5P_DEFAULT)) TEST_ERROR /* Create dangling (object doesn't exist) external link in root group */ if(H5Lcreate_external(filename, "dangle", fid, "external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in root group */ - if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "external2", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to object */ if(H5Lcreate_external(filename, "group", fid, "external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE for external link in root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "external3", H5P_DEFAULT)) TEST_ERROR /* Create dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_external("nofile", "dangle", fid, "group/external1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (file doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/external1", H5P_DEFAULT)) TEST_ERROR /* Create dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_external(filename, "dangle", fid, "group/external2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE for dangling (object doesn't exist) external link in non-root group */ - if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/external2", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to object */ if(H5Lcreate_external(filename, "group", fid, "group/external3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE for external link in non-root group that points to object */ - if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/external3", H5P_DEFAULT)) TEST_ERROR /* Soft->External links */ /* Create soft-link in root group that points to dangling (file doesn't exist) external link */ if(H5Lcreate_soft("external1", fid, "soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (object doesn't exist) external link */ if(H5Lcreate_soft("external2", fid, "soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink2", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to external link that points to object */ if(H5Lcreate_soft("external3", fid, "soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft-elink3", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_soft("group/external1", fid, "soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink4", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_soft("group/external2", fid, "soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "soft-elink5", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in root group that points to external link in non-root group that points to object */ if(H5Lcreate_soft("group/external3", fid, "soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "soft-elink6", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link */ if(H5Lcreate_soft("/external1", fid, "group/soft-elink1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink1", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link */ if(H5Lcreate_soft("/external2", fid, "group/soft-elink2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink2", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to external link that points to object */ if(H5Lcreate_soft("/external3", fid, "group/soft-elink3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink3", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (file doesn't exist) external link in non-root group */ if(H5Lcreate_soft("/group/external1", fid, "group/soft-elink4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink4", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to dangling (object doesn't exist) external link in non-root group */ if(H5Lcreate_soft("/group/external2", fid, "group/soft-elink5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/soft-elink5", H5P_DEFAULT)) TEST_ERROR /* Create soft-link in non-root group that points to external link in non-root group that points to object */ if(H5Lcreate_soft("/group/external3", fid, "group/soft-elink6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/soft-elink6", H5P_DEFAULT)) TEST_ERROR /* External->Soft links */ /* Create external link in root group that points to dangling soft link in root group */ if(H5Lcreate_external(filename, "soft1", fid, "elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "elink-soft1", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "soft2", fid, "elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "elink-soft2", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to dangling soft link in non-root group */ if(H5Lcreate_external(filename, "group/soft1", fid, "elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "elink-soft3", H5P_DEFAULT)) TEST_ERROR /* Create external link in root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "group/soft2", fid, "elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "elink-soft4", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to dangling soft link in root group */ if(H5Lcreate_external(filename, "soft1", fid, "group/elink-soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft1", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to soft link in root group that points to object */ if(H5Lcreate_external(filename, "soft2", fid, "group/elink-soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) - TEST_ERROR + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft2", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to dangling soft link in non-root group */ if(H5Lcreate_external(filename, "group/soft1", fid, "group/elink-soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns FALSE */ - if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) - TEST_ERROR + if(FALSE != H5Oexists_by_name(fid, "group/elink-soft3", H5P_DEFAULT)) TEST_ERROR /* Create external link in non-root group that points to soft link in non-root group that points to object */ if(H5Lcreate_external(filename, "group/soft2", fid, "group/elink-soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR /* Verify that H5Oexists_by_name() returns TRUE */ - if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) - TEST_ERROR - + if(TRUE != H5Oexists_by_name(fid, "group/elink-soft4", H5P_DEFAULT)) TEST_ERROR /* Close file created */ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - return -1; + return FAIL; } /* end obj_exists() */ @@ -10510,19 +9690,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_empty(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - unsigned crt_order_flags; /* Status of creation order info for GCPL */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + unsigned crt_order_flags; /* Status of creation order info for GCPL */ herr_t ret; /* Generic return value */ char filename[NAME_BUF_SIZE];/* File name */ @@ -10544,9 +9720,9 @@ corder_create_empty(hid_t fapl) ret = H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_INDEXED); } H5E_END_TRY; if(ret > 0) { - H5_FAILED(); - HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); - TEST_ERROR + H5_FAILED(); + HDputs(" H5Pset_link_create_order() should have failed for a creation order index with no tracking."); + TEST_ERROR } /* end if */ /* Set creation order tracking & indexing on group */ @@ -10571,7 +9747,6 @@ corder_create_empty(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10598,7 +9773,7 @@ corder_create_empty(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10606,7 +9781,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_empty() */ @@ -10618,21 +9793,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_compact(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10682,7 +9853,6 @@ corder_create_compact(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10716,7 +9886,7 @@ corder_create_compact(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10724,7 +9894,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_compact() */ @@ -10736,21 +9906,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_create_dense(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -10816,7 +9982,6 @@ corder_create_dense(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -10849,7 +10014,7 @@ corder_create_dense(hid_t fapl) if(H5Fclose(file_id) < 0) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -10857,7 +10022,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_create_dense() */ @@ -10869,25 +10034,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_transition(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ - unsigned nlinks; /* Number of link messages in group's header */ + unsigned nlinks; /* Number of link messages in group's header */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ - h5_stat_size_t empty_size; /* Size of empty file */ - h5_stat_size_t file_size; /* Size of file after operating on it */ + h5_stat_size_t empty_size; /* Size of empty file */ + h5_stat_size_t file_size; /* Size of file after operating on it */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -10927,7 +10088,6 @@ corder_transition(hid_t fapl) /* Get the size of the file with an empty group */ if((empty_size = h5_get_file_size(filename, fapl)) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR @@ -11002,7 +10162,6 @@ corder_transition(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR @@ -11078,7 +10237,7 @@ corder_transition(hid_t fapl) if(file_size != empty_size) TEST_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11086,7 +10245,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_transition() */ @@ -11099,25 +10258,21 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static int corder_delete(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned max_compact; /* Maximum # of links to store in group compactly */ unsigned min_dense; /* Minimum # of links to store in group "densely" */ hsize_t name_count; /* # of records in name index */ hsize_t corder_count; /* # of records in creation order index */ unsigned reopen_file; /* Whether to re-open the file before deleting group */ - h5_stat_size_t empty_size; /* Size of empty file */ - h5_stat_size_t file_size; /* Size of file after operating on it */ + h5_stat_size_t empty_size; /* Size of empty file */ + h5_stat_size_t file_size; /* Size of file after operating on it */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ unsigned u; /* Local index variable */ @@ -11207,7 +10362,7 @@ corder_delete(hid_t fapl) } /* end for */ PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11215,7 +10370,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end corder_delete() */ @@ -11225,15 +10380,11 @@ error: * Purpose: Support routine for link_info_by_idx, to verify the link * info is correct for a link * - * Note: This routine assumes that the links have been inserted in the + * Note: This routine assumes that the links have been inserted in the * group in alphabetical order. * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 7, 2006 - * *------------------------------------------------------------------------- */ static int @@ -11386,18 +10537,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static int link_info_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ unsigned hard_link; /* Create hard or soft link? */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11551,7 +10698,7 @@ link_info_by_idx(hid_t fapl) } /* end for */ } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -11559,7 +10706,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_info_by_idx() */ @@ -11571,17 +10718,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 7, 2006 - * *------------------------------------------------------------------------- */ static int link_info_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ unsigned hard_link; /* Create hard or soft link? */ H5L_info_t linfo; /* Link info struct */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -11719,14 +10862,14 @@ link_info_by_idx_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end link_info_by_idx_old() */ @@ -11738,19 +10881,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * *------------------------------------------------------------------------- */ static int delete_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -11814,10 +10953,8 @@ delete_by_idx(hid_t fapl) /* Query the group creation properties */ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR - /* Delete links from one end */ - /* Check for deletion on empty group */ H5E_BEGIN_TRY { ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); @@ -11948,10 +11085,8 @@ delete_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Delete links in middle */ - /* Create more links, to push group into dense form */ for(u = 0; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -12028,8 +11163,6 @@ delete_by_idx(hid_t fapl) if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR - - /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -12044,7 +11177,7 @@ delete_by_idx(hid_t fapl) } /* end for */ } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12052,7 +11185,7 @@ error: H5Gclose(group_id); H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end delete_by_idx() */ @@ -12064,17 +11197,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Wednesday, November 15, 2006 - * *------------------------------------------------------------------------- */ static int delete_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1), group_id2 = (-1); /* Group IDs */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1, group_id2 = -1; /* Group IDs */ H5L_info_t linfo; /* Link info struct */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ @@ -12099,10 +11228,8 @@ delete_by_idx_old(hid_t fapl) /* Create group to operate on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Delete links from one end */ - /* Check for deletion in empty group */ H5E_BEGIN_TRY { ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT); @@ -12178,10 +11305,8 @@ delete_by_idx_old(hid_t fapl) /* Verify state of group */ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR - /* Delete links in middle */ - /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { H5O_info_t oi; /* Buffer for querying object's info */ @@ -12269,7 +11394,7 @@ delete_by_idx_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -12277,7 +11402,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end delete_by_idx_old() */ @@ -12288,10 +11413,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int @@ -12300,14 +11421,14 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { @@ -12315,31 +11436,31 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, /* (if we are operating in increasing or decreasing order) */ if(op_data->order != H5_ITER_NATIVE) if(info->corder != op_data->curr) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Compare link info structs */ if(info->type != my_info.type) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder_valid != my_info.corder_valid) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder != my_info.corder) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->cset != my_info.cset) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(H5F_addr_ne(info->u.address, my_info.u.address)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end if */ /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder); if(HDstrcmp(link_name, objname)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check if we've visited this link before */ if((size_t)op_data->curr >= op_data->max_visit) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(op_data->visited[op_data->curr]) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; op_data->visited[op_data->curr] = TRUE; /* Advance to next value, in correct direction */ @@ -12351,9 +11472,9 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, /* Check for stopping in the middle of iterating */ if(op_data->stop > 0) if(--op_data->stop == 0) - return(CORDER_ITER_STOP); + return CORDER_ITER_STOP; - return(H5_ITER_CONT); + return H5_ITER_CONT; } /* end link_iterate_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12366,16 +11487,12 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) { - return(link_iterate_cb(group_id, link_name, NULL, _op_data)); + return link_iterate_cb(group_id, link_name, NULL, _op_data); } /* end group_iterate_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12388,17 +11505,13 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name, const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data) { - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end link_iterate_fail_cb() */ @@ -12409,10 +11522,6 @@ link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *l * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int @@ -12440,7 +11549,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12457,7 +11565,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; @@ -12488,7 +11595,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(nvisit != (max_links / 2)) TEST_ERROR } /* end else */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); @@ -12521,7 +11627,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Iterate over links in group, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); iter_info->order = order; @@ -12533,7 +11638,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12547,7 +11651,6 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { @@ -12556,10 +11659,10 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(ret >= 0) TEST_ERROR /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end link_iterate_check() */ @@ -12667,7 +11770,6 @@ link_iterate(hid_t fapl) /* Create group with creation order tracking on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ /* (should be OK) */ if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR @@ -12697,7 +11799,6 @@ link_iterate(hid_t fapl) /* Test iteration over links in compact group */ if(link_iterate_check(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -12742,7 +11843,7 @@ link_iterate(hid_t fapl) if(visited) HDfree(visited); - return 0; + return SUCCEED; error: /* Free resources */ @@ -12755,7 +11856,7 @@ error: if(visited) HDfree(visited); - return -1; + return FAIL; } /* end link_iterate() */ @@ -12766,52 +11867,47 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int -link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, - void *_op_data) +link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data) { link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */ char objname[NAME_BUF_SIZE]; /* Object name */ - H5L_info_t my_info; /* Local link info */ + H5L_info_t my_info; /* Local link info */ /* Increment # of times the callback was called */ op_data->ncalled++; /* Get the link information directly to compare */ if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check more things for link iteration (vs. group iteration) */ if(info) { /* Compare link info structs */ if(info->type != my_info.type) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder_valid != my_info.corder_valid) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->corder != my_info.corder) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(info->cset != my_info.cset) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(H5F_addr_ne(info->u.address, my_info.u.address)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; } /* end if */ /* Verify name of link */ HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped))); if(HDstrcmp(link_name, objname)) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; /* Check if we've visited this link before */ if((size_t)op_data->curr >= op_data->max_visit) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; if(op_data->visited[op_data->curr]) - return(H5_ITER_ERROR); + return H5_ITER_ERROR; op_data->visited[op_data->curr] = TRUE; /* Advance to next value, in correct direction */ @@ -12823,9 +11919,9 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf /* Check for stopping in the middle of iterating */ if(op_data->stop > 0) if(--op_data->stop == 0) - return(CORDER_ITER_STOP); + return CORDER_ITER_STOP; - return(H5_ITER_CONT); + return H5_ITER_CONT; } /* end link_iterate_old_cb() */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -12838,16 +11934,12 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) { - return(link_iterate_old_cb(group_id, link_name, NULL, _op_data)); + return link_iterate_old_cb(group_id, link_name, NULL, _op_data); } /* end group_iterate_old_cb() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -12859,15 +11951,10 @@ group_iterate_old_cb(hid_t group_id, const char *link_name, void *_op_data) * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static int -link_iterate_old_check(hid_t group_id, H5_iter_order_t order, - unsigned max_links, link_iter_info_t *iter_info) +link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info) { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ @@ -12890,7 +11977,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12907,7 +11993,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(iter_info->visited[v] == FALSE) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Skip over some links in group */ iter_info->nskipped = (unsigned)(skip = max_links / 2); iter_info->order = order; @@ -12938,7 +12023,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(nvisit != (max_links / 2)) TEST_ERROR } /* end else */ - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); @@ -12971,7 +12055,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, } /* end else */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Iterate over links in group, stopping in the middle */ iter_info->nskipped = (unsigned)(skip = 0); iter_info->order = order; @@ -12983,7 +12066,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR - #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ iter_info->nskipped = (unsigned)(gskip = 0); @@ -12997,7 +12079,6 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(iter_info->ncalled != 3) TEST_ERROR #endif /* H5_NO_DEPRECATED_SYMBOLS */ - /* Check for iteration routine indicating failure */ skip = 0; H5E_BEGIN_TRY { @@ -13020,10 +12101,10 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end link_iterate_old_check() */ @@ -13034,17 +12115,13 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * *------------------------------------------------------------------------- */ static int link_iterate_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ H5_iter_order_t order; /* Order within in the index */ char objname[NAME_BUF_SIZE]; /* Object name */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13080,7 +12157,6 @@ link_iterate_old(hid_t fapl) /* Create group with creation order tracking on */ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for iteration on empty group */ /* (should be OK) */ if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR @@ -13118,7 +12194,6 @@ link_iterate_old(hid_t fapl) /* Test iteration over links in group */ if(link_iterate_old_check(group_id, order, u, &iter_info) < 0) TEST_ERROR - /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -13132,7 +12207,7 @@ link_iterate_old(hid_t fapl) if(visited) HDfree(visited); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13144,7 +12219,7 @@ error: if(visited) HDfree(visited); - return -1; + return FAIL; } /* end link_iterate_old() */ @@ -13155,19 +12230,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, - H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, - haddr_t *objno) + H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char mntname[NAME_BUF_SIZE]; /* Link value */ - hid_t group_id = (-1); /* ID of group to test */ + hid_t group_id = -1; /* ID of group to test */ H5O_info_t oi; /* Buffer for querying object's info */ haddr_t mnt_root_addr; /* Address of root group in file to mount */ hid_t obj_id; /* ID of object opened */ @@ -13208,10 +12278,7 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, } /* end for */ } /* end for */ - - /* - * Verify opening correct object by index when file mounting is present - */ + /* Verify opening correct object by index when file mounting is present */ /* Get the address of the root group in the file to mount */ if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR @@ -13238,12 +12305,11 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id, /* Unmount the file */ if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR - /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end open_by_idx_check() */ @@ -13255,21 +12321,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t mount_file_id = -1; /* File ID for file to mount */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -13358,14 +12420,12 @@ open_by_idx(hid_t fapl) /* Create group with creation order tracking on for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Try to open on object in an empty group */ H5E_BEGIN_TRY { ret = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { hid_t group_id2; /* Group ID */ @@ -13400,7 +12460,6 @@ open_by_idx(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2; /* Group ID */ @@ -13435,7 +12494,6 @@ open_by_idx(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, idx_type, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -13458,7 +12516,7 @@ open_by_idx(hid_t fapl) if(objno) HDfree(objno); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13473,7 +12531,7 @@ error: if(objno) HDfree(objno); - return -1; + return FAIL; } /* end open_by_idx() */ @@ -13485,19 +12543,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ static int open_by_idx_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t mount_file_id = (-1); /* File ID for file to mount */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = -1; /* File ID */ + hid_t mount_file_id = -1; /* File ID for file to mount */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oi; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13542,7 +12596,6 @@ open_by_idx_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create several links */ for(u = 0; u < CORDER_NLINKS; u++) { hid_t group_id2; /* Group ID */ @@ -13583,7 +12636,6 @@ open_by_idx_old(hid_t fapl) /* Verify opening objects by index */ if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -13597,7 +12649,7 @@ open_by_idx_old(hid_t fapl) /* Close the file for mounting */ if(H5Fclose(mount_file_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -13608,7 +12660,7 @@ error: H5Fclose(mount_file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end open_by_idx_old() */ @@ -13619,10 +12671,6 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int @@ -13630,7 +12678,7 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno) { char objname[NAME_BUF_SIZE]; /* Object name */ - hid_t group_id = (-1); /* ID of group to test */ + hid_t group_id = -1; /* ID of group to test */ H5O_info_t oinfo; /* Buffer for querying object's info */ unsigned u, v; /* Local index variables */ @@ -13676,10 +12724,10 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type, } /* end for */ /* Success */ - return(0); + return SUCCEED; error: - return(-1); + return FAIL; } /* end object_info_check() */ @@ -13691,21 +12739,17 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int object_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t space_id = (-1); /* Dataspace ID (for attributes) */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + hid_t space_id = -1; /* Dataspace ID (for attributes) */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -13915,7 +12959,7 @@ object_info(hid_t fapl) if(objno) HDfree(objno); - return 0; + return SUCCEED; error: /* Free resources */ @@ -13930,7 +12974,7 @@ error: if(objno) HDfree(objno); - return -1; + return FAIL; } /* end object_info() */ @@ -13941,19 +12985,15 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Sunday, November 26, 2006 - * *------------------------------------------------------------------------- */ static int object_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t space_id = (-1); /* Dataspace ID (for attributes) */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t space_id = -1; /* Dataspace ID (for attributes) */ H5_iter_order_t order; /* Order within in the index */ H5O_info_t oinfo; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -13991,7 +13031,6 @@ object_info_old(hid_t fapl) /* Create old-style group for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); @@ -14051,7 +13090,6 @@ object_info_old(hid_t fapl) /* Verify querying objects by name */ if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14065,7 +13103,7 @@ object_info_old(hid_t fapl) /* Free resources */ if(H5Sclose(space_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -14076,7 +13114,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end object_info_old() */ @@ -14088,20 +13126,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * *------------------------------------------------------------------------- */ static int group_info(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - H5_index_t idx_type; /* Type of index to operate on */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + H5_index_t idx_type; /* Type of index to operate on */ H5_iter_order_t order; /* Order within in the index */ unsigned use_index; /* Use index on creation order values */ unsigned max_compact; /* Maximum # of links to store in group compactly */ @@ -14183,7 +13217,6 @@ group_info(hid_t fapl) /* Create group with creation order tracking on for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); @@ -14200,7 +13233,6 @@ group_info(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14225,7 +13257,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14238,7 +13269,6 @@ group_info(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14263,7 +13293,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14282,7 +13311,6 @@ group_info(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14307,7 +13335,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14330,7 +13357,6 @@ group_info(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { hid_t group_id2, group_id3; /* Group IDs */ @@ -14341,7 +13367,6 @@ group_info(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14366,7 +13391,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14379,7 +13403,6 @@ group_info(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14404,7 +13427,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14423,7 +13445,6 @@ group_info(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14448,7 +13469,6 @@ group_info(hid_t fapl) if(grp_info.max_corder != (int64_t)(u + 1)) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14471,7 +13491,6 @@ group_info(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14487,7 +13506,7 @@ group_info(hid_t fapl) /* Free resources */ if(H5Pclose(gcpl_id) < 0) TEST_ERROR - return 0; + return SUCCEED; error: /* Free resources */ @@ -14498,7 +13517,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end group_info() */ @@ -14510,18 +13529,14 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Monday, November 27, 2006 - * *------------------------------------------------------------------------- */ static int group_info_old(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t soft_group_id = (-1); /* Group ID for soft links */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t soft_group_id = -1; /* Group ID for soft links */ H5_iter_order_t order; /* Order within in the index */ H5G_info_t grp_info; /* Buffer for querying object's info */ char filename[NAME_BUF_SIZE];/* File name */ @@ -14554,7 +13569,6 @@ group_info_old(hid_t fapl) /* Create old-style group for soft links */ if((soft_group_id = H5Gcreate2(file_id, CORDER_SOFT_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Check for out of bound query by index on empty group */ H5E_BEGIN_TRY { ret = H5Gget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &grp_info, H5P_DEFAULT); @@ -14571,7 +13585,6 @@ group_info_old(hid_t fapl) /* Create hard link, with group object */ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14596,7 +13609,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != 0) TEST_ERROR - /* Create objects in new group created */ for(v = 0; v <= u; v++) { /* Make name for link */ @@ -14609,7 +13621,6 @@ group_info_old(hid_t fapl) if(H5Gclose(group_id3) < 0) TEST_ERROR } /* end for */ - /* Retrieve group's information */ if(H5Gget_info(group_id2, &grp_info) < 0) TEST_ERROR @@ -14634,7 +13645,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Retrieve group's information */ if(order != H5_ITER_NATIVE) { if(order == H5_ITER_INC) { @@ -14653,7 +13663,6 @@ group_info_old(hid_t fapl) /* Close group created */ if(H5Gclose(group_id2) < 0) TEST_ERROR - /* Retrieve main group's information */ if(H5Gget_info(group_id, &grp_info) < 0) TEST_ERROR @@ -14678,7 +13687,6 @@ group_info_old(hid_t fapl) if(grp_info.max_corder != 0) TEST_ERROR if(grp_info.nlinks != (hsize_t)(u + 1)) TEST_ERROR - /* Create soft link in another group, to objects in main group */ HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname); if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR @@ -14707,7 +13715,6 @@ group_info_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR - /* Close the groups */ if(H5Gclose(group_id) < 0) TEST_ERROR if(H5Gclose(soft_group_id) < 0) TEST_ERROR @@ -14718,7 +13725,7 @@ group_info_old(hid_t fapl) PASSED(); } /* end for */ - return 0; + return SUCCEED; error: /* Free resources */ @@ -14728,7 +13735,7 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end group_info_old() */ @@ -14740,20 +13747,16 @@ error: * * Return: Success: 0 * Failure: -1 - * - * Programmer: Quincey Koziol - * Saturday, March 3, 2007 - * *------------------------------------------------------------------------- */ static int timestamps(hid_t fapl) { - hid_t file_id = (-1); /* File ID */ - hid_t group_id = (-1); /* Group ID */ - hid_t group_id2 = (-1); /* Group ID */ - hid_t gcpl_id = (-1); /* Group creation property list ID */ - hid_t gcpl_id2 = (-1); /* Group creation property list ID */ + hid_t file_id = -1; /* File ID */ + hid_t group_id = -1; /* Group ID */ + hid_t group_id2 = -1; /* Group ID */ + hid_t gcpl_id = -1; /* Group creation property list ID */ + hid_t gcpl_id2 = -1; /* Group creation property list ID */ H5O_info_t oinfo, oinfo2; /* Object info for groups created */ char filename[NAME_BUF_SIZE];/* File name */ hbool_t track_times; /* The object timestamp setting */ @@ -14779,7 +13782,6 @@ timestamps(hid_t fapl) /* Check default timestamp information */ if(track_times != FALSE) TEST_ERROR - /* Create file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR @@ -14832,7 +13834,6 @@ timestamps(hid_t fapl) /* Close the file */ if(H5Fclose(file_id) < 0) TEST_ERROR - /* Re-open the file */ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR @@ -14881,7 +13882,7 @@ timestamps(hid_t fapl) PASSED(); - return 0; + return SUCCEED; error: /* Free resources */ @@ -14891,32 +13892,27 @@ error: H5Fclose(file_id); } H5E_END_TRY; - return -1; + return FAIL; } /* end timestamps() */ /*------------------------------------------------------------------------- * Function: main * - * Purpose: Test links - * - * Return: Success: exit(EXIT_SUCCESS) - * - * Failure: exit(EXIT_FAILURE) - * - * Programmer: Robb Matzke - * Friday, August 14, 1998 + * Purpose: Test links * + * Return: Success: exit(EXIT_SUCCESS) + * Failure: exit(EXIT_FAILURE) *------------------------------------------------------------------------- */ int main(void) { - hid_t fapl, fapl2; /* File access property lists */ - int nerrors = 0; - unsigned new_format; /* Whether to use the new format or not */ - unsigned minimize_dset_oh; - unsigned efc; /* Whether to use the external file cache */ + hid_t fapl = -1, fapl2 = -1; /* File access property lists */ + int nerrors = 0; + unsigned new_format; /* Whether to use the new format or not */ + unsigned minimize_dset_oh; + unsigned efc; /* Whether to use the external file cache */ const char *env_h5_drvr; /* File Driver value from environment */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); @@ -14935,7 +13931,8 @@ main(void) HDprintf("\n-Testing with minimzed dataset object headers-\n"); dcpl_g = H5Pcreate(H5P_DATASET_CREATE); if (0 > dcpl_g) TEST_ERROR - } else { + } + else { HDprintf("\n-Testing with unminimzed dataset object headers-\n"); dcpl_g = H5P_DEFAULT; } @@ -14947,14 +13944,14 @@ main(void) if(new_format) { my_fapl = fapl2; HDprintf("\n--Testing with 'new format'--\n"); - } else { + } + else { my_fapl = fapl; HDprintf("\n--Testing with 'old format'--\n"); } /* always enter tests without external cache */ - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR /* General tests... (on both old & new format groups */ nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0; @@ -14974,29 +13971,28 @@ main(void) #endif /* H5_NO_DEPRECATED_SYMBOLS */ /* tests for external link */ - /* Test external file cache first, so it sees the default efc setting on - * the fapl */ + /* Test external file cache first, so it sees the default efc setting on the fapl + */ nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0; /* This test cannot run with the EFC because it assumes that an - * intermediate file is not held open */ + * intermediate file is not held open + */ nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0; /* This test cannot run with the EFC because the EFC cannot currently - * reopen a cached file with a different intent */ + * reopen a cached file with a different intent + */ nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0; - /* Try external link tests both with and without the external file cache - */ + /* Try external link tests both with and without the external file cache */ for(efc = FALSE; efc <= TRUE; efc++) { if(efc) { - if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0) TEST_ERROR HDprintf("\n---Testing with external file cache---\n"); } /* end if */ else { - if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) - TEST_ERROR + if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0) TEST_ERROR HDprintf("\n---Testing without external file cache---\n"); } /* end else */ @@ -15043,7 +14039,7 @@ main(void) nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0; nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0; - nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; + nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0; } /* with/without external file cache */ /* These tests assume that external links are a form of UD links, @@ -15078,9 +14074,9 @@ main(void) nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0; /* XXX: when creation order indexing is fully working, go back and add checks -* to these tests to make certain that the creation order values are -* correct. -*/ + * to these tests to make certain that the creation order values are + * correct. + */ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0; nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0; nerrors += corder_transition(fapl2) < 0 ? 1 : 0; @@ -15102,8 +14098,7 @@ main(void) nerrors += group_info_old(fapl) < 0 ? 1 : 0; if (minimize_dset_oh) { - if (H5Pclose(dcpl_g) < 0) - TEST_ERROR; + if (H5Pclose(dcpl_g) < 0) TEST_ERROR; dcpl_g = -1; } } /* [un]minimized dataset object headers */ @@ -15123,8 +14118,7 @@ main(void) /* Results */ if(nerrors) { - HDprintf("***** %d LINK TEST%s FAILED! *****\n", - nerrors, 1 == nerrors ? "" : "S"); + HDprintf("***** %d LINK TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); HDexit(EXIT_FAILURE); } HDprintf("All link tests passed.\n"); @@ -15137,7 +14131,7 @@ main(void) HDrmdir(TMPDIR); HDrmdir(TMPDIR2); - return 0; + return SUCCEED; error: HDputs("*** TESTS FAILED ***"); -- cgit v0.12