summaryrefslogtreecommitdiffstats
path: root/test/links.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/links.c')
-rw-r--r--test/links.c4579
1 files changed, 1793 insertions, 2786 deletions
diff --git a/test/links.c b/test/links.c
index 2658101..4eb4126 100644
--- a/test/links.c
+++ b/test/links.c
@@ -12,38 +12,35 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Friday, April 10, 1998
- *
- * Purpose: Tests hard, soft (symbolic) & external links.
+ * Purpose: Tests hard, soft (symbolic) & external links.
*/
/*
* This file needs to access private information from the H5FD package.
* This file also needs to access the file driver testing code.
*/
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
/*
* This file needs to access private information from the H5G package.
* This file also needs to access the group testing code.
*/
-#define H5G_FRIEND /*suppress error about including H5Gpkg */
+#define H5G_FRIEND /*suppress error about including H5Gpkg */
#define H5G_TESTING
#include "h5test.h"
#include "H5srcdir.h"
-#include "H5FDpkg.h" /* File drivers */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
+#include "H5FDpkg.h" /* File drivers */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
-#define TMPDIR "tmp/"
-#define TMPDIR2 "tmp2/"
+#define TMPDIR "tmp_links/"
+#define TMPDIR2 "tmp2_links/"
/* Symlinks for external link symlink test */
#define SYMLINK1 TMPDIR "sym1.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
+/* do not do check_all_closed() for "ext*" files and "tmp_links/ext*" */
+#define EXTSTOP 12
#define LINK_BUF_SIZE 1024
#define NAME_BUF_SIZE 1024
@@ -318,7 +315,7 @@ typedef struct {
static hid_t dcpl_g; /* for [un]minimized dataset object headers */
-
+
/*-------------------------------------------------------------------------
* Function: fix_ext_filename
*
@@ -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
- *
- * Purpose: Build a file with assorted links.
+ * Function: mklinks
*
- * Return: Success: 0
- *
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Friday, August 14, 1998
- *
- * Modifications:
+ * Purpose: Build a file with assorted links.
*
+ * 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];
+ hid_t file, scalar, grp, d1;
+ hsize_t size[1] = {1};
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("link creation (w/new group format)")
@@ -399,38 +385,31 @@ mklinks(hid_t fapl, hbool_t new_format)
if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: new_links
*
* 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
new_links(hid_t fapl, hbool_t new_format)
{
- hid_t file_a, file_b=(-1);
- 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};
+ hid_t file_a, file_b=(-1);
+ 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};
if(new_format)
TESTING("H5Lcreate functions (w/new group format)")
@@ -488,50 +467,43 @@ 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 {
- H5Sclose(scalar);
- H5Dclose(dset1);
- H5Dclose(dset2);
- H5Gclose(grp1_a);
- H5Gclose(grp2_a);
- H5Gclose(grp1_b);
- H5Gclose(grp2_b);
- H5Fclose(file_a);
- H5Fclose(file_b);
- } H5E_END_TRY;
- return -1;
+ H5Sclose(scalar);
+ H5Dclose(dset1);
+ H5Dclose(dset2);
+ H5Gclose(grp1_a);
+ H5Gclose(grp2_a);
+ H5Gclose(grp1_b);
+ H5Gclose(grp2_b);
+ H5Fclose(file_a);
+ H5Fclose(file_b);
+ } H5E_END_TRY;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
- * Function: cklinks
- *
- * Purpose: Open the file created in the first step and check that the
- * links look correct.
- *
- * Return: Success: 0
+ * Function: cklinks
*
- * Failure: -1
- *
- * Programmer: Robb Matzke
- * Friday, August 14, 1998
- *
- * Modifications:
+ * Purpose: Open the file created in the first step and check that the
+ * 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;
+ 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;
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
@@ -565,91 +537,91 @@ 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 */
H5E_BEGIN_TRY {
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,13 +631,13 @@ 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;
}
-
+
/*-------------------------------------------------------------------------
* Function: ck_new_links
*
@@ -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];
+ hid_t file;
+ 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,62 +665,52 @@ 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;
}
-
+
/*-------------------------------------------------------------------------
* Function: long_links
*
* 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,42 +749,35 @@ long_links(hid_t fapl, hbool_t new_format)
HDfree(objname);
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose (gid2);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
HDfree(objname);
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: toomany
*
* 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,18 +890,18 @@ toomany(hid_t fapl, hbool_t new_format)
if(H5Fclose(fid) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end toomany() */
-
+
/*-------------------------------------------------------------------------
* Function: test_lcpl
*
@@ -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 {
@@ -1111,29 +1055,22 @@ error:
return 1;
} /* end test_lcpl() */
-
+
/*-------------------------------------------------------------------------
* Function: test_move
*
* 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
+ FAIL_STACK_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,44 +1167,37 @@ 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;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_copy
*
* 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);
- 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("H5Lcopy (w/new group 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,22 +1294,22 @@ 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;
}
-
+
/*-------------------------------------------------------------------------
* Function: test_move_preserves
*
@@ -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,20 +1465,20 @@ 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;
return 1;
} /* end test_move_preserves() */
-
+
/*-------------------------------------------------------------------------
* Function: test_deprec
*
@@ -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
@@ -1640,7 +1495,7 @@ test_deprec(hid_t fapl, hbool_t new_format)
hid_t file_id = -1;
hid_t group1_id = -1;
hid_t group2_id = -1;
- H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2;
+ H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2;
H5G_obj_t obj_type; /* Object type */
hsize_t num_objs; /* Number of objects in a group */
char filename[1024];
@@ -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 {
@@ -1768,34 +1623,27 @@ error:
} /* end test_deprec() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_root
*
* 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];
- const char *file; /* File from external link */
- const char *path; /* Path from external link */
+ 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 */
if(new_format)
TESTING("external link to root (w/new group format)")
@@ -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,18 +1788,18 @@ 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);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_root() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_path
*
@@ -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,18 +1889,18 @@ 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);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_path() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_mult
*
@@ -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,44 +2046,37 @@ 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);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_mult() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_self
*
* 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,19 +2186,19 @@ 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);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Pclose(lcpl_id);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_self() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_pingpong
*
@@ -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 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("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,18 +2308,18 @@ 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);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_pingpong() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_toomany
*
@@ -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,18 +2445,18 @@ 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);
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_toomany() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_dangling
*
@@ -2647,25 +2464,18 @@ 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 */
- 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; /* 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 */
if(new_format)
TESTING("dangling external links (w/new group format)")
@@ -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,47 +2546,41 @@ external_link_dangling(hid_t fapl, hbool_t new_format)
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_dangling() */
-
+
/*-------------------------------------------------------------------------
* 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_links/extlinks2"
+ * 4. Set up external link prefix via H5Pset_elink_prefix() to be "tmp_links"
+ * Should be able to access the target file in tmp_links 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)")
@@ -2788,16 +2592,16 @@ external_link_prefix(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file: "extlinks2" */
h5_fixname(FILENAME[16], fapl, filename2, sizeof filename2);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ TEST_ERROR
- /* set up name for target file: "tmp/extlinks2" */
+ /* set up name for target file: "tmp_links/extlinks2" */
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_links directory.");
+ goto error;
}
/* closing for main file */
@@ -2831,45 +2635,39 @@ 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);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_prefix() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_abs_mainpath: test 3
*
* Purpose: 1. target link: "extlinks3"
- * 2. main file: Linux:"/CWD/tmp/extlinks0"; Windows: "<cur drive>:/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_links/extlinks0"; Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
+ * 3. target file: "tmp_links/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 */
- 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 absolute path (w/new group format)")
@@ -2878,17 +2676,17 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file: "extlinks3" */
h5_fixname(FILENAME[18], fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks3" */
+ /* set up name for target file: "tmp_links/extlinks3" */
h5_fixname(FILENAME[19], fapl, filename3, sizeof filename3);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Window: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Window: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -2915,9 +2713,9 @@ external_link_abs_mainpath(hid_t fapl, hbool_t new_format)
/* should be able to find the target file from absolute path set for main file */
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_links directory.");
+ goto error;
}
/* closing for main file */
@@ -2925,43 +2723,37 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* 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
+ * Purpose: 1. target link: "extlinks4"
+ * 2. main file: "tmp_links/extlinks0"
+ * 3. target file: "tmp_links/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 */
- 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 */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's CWD + relative path(w/new group format)")
@@ -2974,14 +2766,14 @@ external_link_rel_mainpath(hid_t fapl, hbool_t new_format)
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- /* set up name for main file: "tmp/extlinks0" */
+ /* set up name for main file: "tmp_links/extlinks0" */
h5_fixname(FILENAME[13], fapl, filename1, sizeof filename1);
- /* set up name for target file: "tmp/extlinks4" */
+ /* set up name for target file: "tmp_links/extlinks4" */
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: "<cur drive>:/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_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/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 */
- char filename1[NAME_BUF_SIZE],
- filename2[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],
+ tmpname[NAME_BUF_SIZE],
+ cwdpath[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via current working directory(w/new group format)")
@@ -3065,8 +2849,8 @@ external_link_cwd(hid_t fapl, hbool_t new_format)
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Windows: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -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:"<cur drive>:/CWD/tmp/extlinks6"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks6"
- * Should be able to access the target file's absolute path
+ * Purpose: 1. target link: Linux:"/CWD/tmp_links/extlinks6"; Windows:"<cur drive>:/CWD/tmp_links/extlinks6"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp_links/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 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 target's absolute path (w/new group format)")
@@ -3152,19 +2929,19 @@ external_link_abstar(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
* set up name for external linked target file:
- * Linux: "/CWD/tmp/extlinks6"
- * Windows: "<cur drive>:/CWD/tmp/extlinks6"
+ * Linux: "/CWD/tmp_links/extlinks6"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks6"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[23]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks6" */
+ /* set up name for target file: "tmp_links/extlinks6" */
h5_fixname(FILENAME[23], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -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_links directory.");
+ goto error;
}
/* closing for main file */
@@ -3199,44 +2975,38 @@ 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: "<cur drive>:/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.
+ * Purpose: 1. target link: Linux: "/CWD/tmp_links/extlinks7"; Windows: "<cur drive>:/CWD/tmp_links/extlinks7"
+ * 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 */
- 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 CWD (w/new group format)")
@@ -3249,14 +3019,14 @@ external_link_abstar_cur(hid_t fapl, hbool_t new_format)
/* set up name for target file name: "extlinks7" */
h5_fixname(FILENAME[24], fapl, filename3, sizeof filename3);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
/*
* set up name for external linked target file:
- * Linux: "/CWD/tmp/extlinks7"
- * Windows: "<cur drive>:/CWD/tmp/extlinks7"
+ * Linux: "/CWD/tmp_links/extlinks7"
+ * Windows: "<cur drive>:/CWD/tmp_links/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,42 +3062,36 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* 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
+ * Purpose: 1. target link: Linux:"tmp_links/extlinks8"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp_links/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 */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE];
+ hid_t fid = (-1); /* File ID */
+ hid_t gid = (-1); /* Group IDs */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via main file's CWD + target's relative path(w/new group format)")
@@ -3338,12 +3101,11 @@ external_link_reltar(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ /* create tmp_links directory */
+ 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" */
+ /* set up name for target file name: "tmp_links/extlinks8" */
+ /* set up name for external linked target file: "tmp_links/extlinks8" */
h5_fixname(FILENAME[26], fapl, filename2, sizeof filename2);
/* Create the target file */
@@ -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_links directory.");
+ goto error;
} /* end if */
/* closing for main file */
@@ -3373,45 +3135,39 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_chdir: test 9
*
* Purpose:
- * 1. target link: "extlinks9"
- * 2. main file: "extlinks0"
- * 3. target file" "tmp/extlinks9"
- * 3. chdir "tmp"
- * Should be able to access the target file in current working directory
+ * 1. target link: "extlinks9"
+ * 2. main file: "extlinks0"
+ * 3. target file" "tmp_links/extlinks9"
+ * 3. chdir "tmp_links"
+ * Should be able to access the target file in current working directory
*
* 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 */
- 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 */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE];
if(new_format)
TESTING("external links via chdir and found in current working directory (w/new group format)")
@@ -3423,11 +3179,10 @@ external_link_chdir(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file ("extlinks9") */
h5_fixname(FILENAME[27], fapl, filename2, sizeof filename2);
- /* create tmp directory */
- if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
+ /* create tmp_links directory */
+ if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for target file name ("tmp/extlinks9") */
+ /* set up name for target file name ("tmp_links/extlinks9") */
h5_fixname(FILENAME[28], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -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_links directory.");
+ goto error;
}
/* closing for main file */
@@ -3470,62 +3224,56 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* 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.
- *
- * 1. target link: "extlinks16"
- * 2. target file: "extlinks16"
- * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/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
- * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A
- * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B
- * 6. Should succeed in opening the target object: ext_extA
- * 6. Should succeed in opening the target object: ext_extB
+ * different from the parent can be successfully opened.
+ *
+ * 1. target link: "extlinks16"
+ * 2. target file: "extlinks16"
+ * 3. main file: Linux:"/CWD/tmp_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/extlinks0"
+ * 4. Create target file A to be a "family" file: extlinks16A
+ * 4. Create target file B to be a "multi" file: extlinks16B
+ * 5. Create external link from main file to target file A: ext_linkA->extlinks16A:/A
+ * 5. Create external link from main file to target file B: ext_linkB->extlinks16B:/B
+ * 6. Should succeed in opening the target object: ext_extA
+ * 6. Should succeed in opening the target object: ext_extB
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Vailin Choi
- * Sept. 12, 2008
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
{
- hid_t fid=(-1);
- 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;
- 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];
+ hid_t fid=(-1);
+ 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;
+ hid_t lapl_idA=-1, lapl_idB=-1;
+ hid_t memb_fapl[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,20 +3281,19 @@ 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:
- * Linux: "/CWD/tmp/extlinks0"
- * Windows: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* 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,67 +3408,61 @@ 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);
- } H5E_END_TRY;
- return -1;
+ 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 FAIL;
} /* end external_set_elink_fapl1() */
-
+
/*-------------------------------------------------------------------------
* 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.
- *
- * 1. target link: "extlinks17"
- * 2. target file: "extlinks17"
- * 3. main file: Linux:"/CWD/tmp/extlinks0"; Window: "<cur drive>:/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.
+ * 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_links/extlinks0"; Window: "<cur drive>:/CWD/tmp_links/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];
- h5_stat_size_t filesize, new_filesize;
- int i, j, n;
+ 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];
+ int i, j, n;
+ h5_stat_size_t filesize, new_filesize;
if(new_format)
TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)")
@@ -3736,16 +3474,15 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
/*
* set up name for main file:
- * Linux: "/CWD/tmp/extlinks0"
- * Windows: "<cur drive>:/CWD/tmp/extlinks0"
+ * Linux: "/CWD/tmp_links/extlinks0"
+ * Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
/* 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,59 +3558,53 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* 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
- * 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
- * 13. H5Pclose() fapl set in the copied link access should fail since the
- * removal in #12 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
+ * 13. H5Pclose() fapl set in the copied link access should fail since the
+ * removal in #12 should also close its fapl
*
* 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 lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl;
+ 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)
TESTING("H5Pset/get_fapl() (w/new group 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,10 +3667,10 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_set_elink_acc_flags
*
@@ -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,10 +3882,10 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_set_elink_cb
*
@@ -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];
@@ -4242,7 +3955,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format)
op_data.target_file = filename2;
/* Core file driver has issues when used as the member file driver for a family file */
/* Family file driver cannot be used with family or multi drivers for member files */
- /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI)
+ /* Also disable parallel member drivers, because H5F_HAS_FEATURE(H5FD_FEAT_HAS_MPI)
would report FALSE, causing problems */
base_driver = H5Pget_driver(fapl);
op_data.base_fapl = (base_driver == H5FD_FAMILY || base_driver == H5FD_MULTI
@@ -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,10 +4043,10 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_reset_register
*
@@ -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,47 +4092,41 @@ 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() */
-
+
#ifdef H5_HAVE_WINDOW_PATH
/*-------------------------------------------------------------------------
* 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_links/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)")
@@ -4438,7 +4139,7 @@ external_link_win1(hid_t fapl, hbool_t new_format)
if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
- /* set up name for target link: "/CWD/tmp/extlinks10" */
+ /* set up name for target link: "/CWD/tmp_links/extlinks10" */
HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[30]);
@@ -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,46 +4179,40 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win2
*
* 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)
+ * 1. target link: "/CWD/tmp_links/extlinks11"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp_links/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 */
- 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 target's rel drive/abs path directly(windows)(w/new group format)")
@@ -4528,17 +4222,17 @@ external_link_win2(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
- /* set up name for target link: "/CWD/tmp/extlinks11" */
+ /* set up name for target link: "/CWD/tmp_links/extlinks11" */
HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it relative drive but absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[31]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks11" */
+ /* set up name for target file: "tmp_links/extlinks11" */
h5_fixname(FILENAME[31], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -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_links.");
+ goto error;
}
/* closing for main file */
@@ -4573,46 +4267,40 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win3
*
* Purpose:
- * 1. target link: "<cur drive>:tmp/extlinks12"
- * 2. main file: "extlinks0"
- * 3. target file: "tmp/extlinks12"
- * Should be able to access the target file directly (abs drive/rel path)
+ * 1. target link: "<cur drive>:tmp_links/extlinks12"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp_links/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)")
@@ -4622,16 +4310,16 @@ external_link_win3(hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* create tmp directory */
+ /* create tmp_links directory */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
- /* set up name for target link: "<drive-letter>:tmp/extlinks12" */
+ /* set up name for target link: "<drive-letter>:tmp_links/extlinks12" */
drive = HDgetdrive();
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[32]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks12" */
+ /* set up name for target file: "tmp_links/extlinks12" */
h5_fixname(FILENAME[32], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -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_links.");
+ goto error;
}
/* closing for main file */
@@ -4666,52 +4354,46 @@ 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: "<cur drive>:extlinks13"
- * 2. main file: "<cur-drive>:tmp/extlinks0"
- * 3. target file: tmp/extlinks13
- * Should be able to access the target file via main file's abs drive/rel path
+ * 1. target link: "<cur drive>:extlinks13"
+ * 2. main file: "<cur-drive>:tmp_links/extlinks0"
+ * 3. target file: tmp_links/extlinks13
+ * 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)")
else
TESTING("external links via main file's abs drive/rel path (windows)")
- /* set up name for main file: "<drive-letter>:tmp/extlinks0" */
+ /* set up name for main file: "<drive-letter>:tmp_links/extlinks0" */
drive = HDgetdrive();
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[13]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
@@ -4720,20 +4402,19 @@ external_link_win4(hid_t fapl, hbool_t new_format)
HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[33]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks13" */
+ /* set up name for target file: "tmp_links/extlinks13" */
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,47 +4436,41 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win5
*
* Purpose:
- * 1. target link: "<cur drive+1>: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
+ * 1. target link: "<cur drive+1>:tmp_links/extlinks14"
+ * 2. main file: "/CWD/extlinks0"
+ * 3. target file: "tmp_links/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)")
@@ -4805,6 +4480,10 @@ external_link_win5(hid_t fapl, hbool_t new_format)
if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
drive = HDgetdrive();
+ if (drive >= 26)
+ drive -= 1; /* account for drive Z */
+ else
+ drive += 1;
/* set up name for main file: "/CWD/extlinks0" */
HDstrcpy(tmpname, &cwdpath[2]); /* stripped the drive letter to make it rel drive but absolute path */
@@ -4812,11 +4491,11 @@ external_link_win5(hid_t fapl, hbool_t new_format)
HDstrcat(tmpname, FILENAME[12]);
h5_fixname(tmpname, fapl, filename1, sizeof filename1);
- /* set up name for target link: "<drive-letter+1>:tmp/extlinks14" */
- HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[35]);
+ /* set up name for target link: "<drive-letter+1>:tmp_links/extlinks14" */
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[35]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
- /* set up name for target file: "tmp/extlinks14" */
+ /* set up name for target file: "tmp_links/extlinks14" */
h5_fixname(FILENAME[35], fapl, filename3, sizeof filename3);
/* Create the target file */
@@ -4827,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
@@ -4841,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 */
@@ -4851,78 +4529,75 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win6
*
* Purpose:
- * 1. target link: "<cur drive+1>: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
+ * 1. target link: "<cur drive+1>:tmp_links/extlinks15"
+ * 2. main file: "extlinks0"
+ * 3. target file: "tmp_links/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)")
else
TESTING("external links via target's current drive/rel path (windows)")
- /* create tmp directory */
+ /* create tmp_links directory */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
drive = HDgetdrive();
+ if (drive >= 26)
+ drive -= 1; /* account for drive Z */
+ else
+ drive += 1;
/* set up name for main file: "extlinks0" */
h5_fixname(FILENAME[12], fapl, filename1, sizeof filename1);
- /* set up name for target link: "<drive-letter+1>:tmp/extlinks15" */
- HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", ((drive+1)+'A'-1), FILENAME[36]);
+ /* set up name for target link: "<drive-letter+1>:tmp_links/extlinks15" */
+ HDsnprintf(tmpname, sizeof(tmpname), "%c:%s", (drive+'A'-1), FILENAME[36]);
h5_fixname(tmpname, fapl, filename2, sizeof filename2);
/* set up name for target file: "tmp/extlinks15" */
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
@@ -4934,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_links.");
+ goto error;
}
/* closing for main file */
@@ -4944,25 +4619,25 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win7
*
* Purpose:
- * 1. UNC target link: "\\127.0.01\c$/tmp/extlinks10"
+ * 1. UNC target link: "\\127.0.01\c$/tmp_links/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
@@ -4971,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],
@@ -4990,7 +4665,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
TEST_ERROR
- /* set up name for target link: "\\127.0.0.1\c$/tmp/extlinks10" */
+ /* set up name for target link: "\\127.0.0.1\c$/tmp_links/extlinks10" */
HDstrcpy(tmpname, "\\\\127.0.0.1\\c$"); /* absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[30]);
@@ -5007,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
@@ -5031,17 +4705,17 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win8
*
@@ -5049,7 +4723,7 @@ external_link_win7(hid_t fapl, hbool_t new_format)
* 1. Long UNC target link: "\\?\<cur drive>:\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
@@ -5059,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],
@@ -5076,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
+ /* create tmp_links directory */
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) TEST_ERROR
/* set up name for target link: "<drive-letter>:\CWD\extlinks10" */
drive = HDgetdrive();
@@ -5099,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
@@ -5114,7 +4785,7 @@ external_link_win8(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.");
+ HDputs(" Should have found the file in tmp_links.");
goto error;
}
@@ -5123,25 +4794,25 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_win9
*
* Purpose:
- * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp/extlinks10"
+ * 1. Long UNC target link: "\\?\UNC\127.0.01\c$/tmp_links/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
@@ -5150,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)")
@@ -5166,10 +4837,9 @@ 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" */
+ /* set up name for target link: "\\?\UNC\127.0.0.1\c$/tmp_links/extlinks10" */
HDstrcpy(tmpname, "\\\\?\\UNC\127.0.0.1\\c$"); /* absolute path */
HDstrcat(tmpname, "/");
HDstrcat(tmpname, FILENAME[30]);
@@ -5186,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
@@ -5210,19 +4879,19 @@ 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 */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_recursive
*
@@ -5230,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)")
@@ -5254,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
@@ -5262,36 +4925,34 @@ 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);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_recursive() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_query
*
@@ -5300,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)
@@ -5331,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) */
@@ -5341,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
@@ -5359,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
@@ -5367,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 */
@@ -5385,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 */
@@ -5398,30 +5052,30 @@ 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);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_query() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_unlink_compact
*
@@ -5429,19 +5083,15 @@ 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 */
- 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 filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE]; /* Names of files to externally link across */
if(new_format)
TESTING("unlinking external link in compact group (w/new group format)")
@@ -5471,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
@@ -5496,18 +5143,18 @@ 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 {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_unlink_compact() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_unlink_dense
*
@@ -5515,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 */
- 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 */
+ 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 */
if(new_format)
TESTING("unlinking external link in dense group (w/new group format)")
@@ -5598,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
@@ -5642,18 +5282,18 @@ 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 {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_unlink_dense() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_move
*
@@ -5661,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 */
+ 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)")
@@ -5704,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
@@ -5790,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
@@ -5833,18 +5466,18 @@ 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 {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_move() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_ride
*
@@ -5853,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 */
- 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 */
+ 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 */
if(new_format)
TESTING("external link along for the ride (w/new group format)")
@@ -6018,19 +5647,19 @@ 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 {
H5Pclose(gcpl);
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_ride() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_closing
*
@@ -6039,10 +5668,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Wednesday, August 16, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -6052,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;
@@ -6246,7 +5871,7 @@ external_link_closing(hid_t fapl, hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -6260,10 +5885,10 @@ error:
H5Fclose(fid2);
H5Fclose(fid1);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* external_link_closing() */
-
+
/*-------------------------------------------------------------------------
* Function: ext_link_endian
*
@@ -6273,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)
@@ -6327,18 +5948,18 @@ external_link_endian(hbool_t new_format)
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Fclose(fid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
}
-
+
/*-------------------------------------------------------------------------
* Function: external_link_strong
*
@@ -6347,10 +5968,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, March 5, 2007
- *
*-------------------------------------------------------------------------
*/
static int
@@ -6360,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)
@@ -6409,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 {
@@ -6420,10 +6037,10 @@ error:
H5Fclose(fid2);
H5Fclose(fid1);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end external_link_strong() */
-
+
/*-------------------------------------------------------------------------
* Function: external_symlink
*
@@ -6432,10 +6049,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Nov. 23, 2009
- *
*-------------------------------------------------------------------------
*/
static int
@@ -6444,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 */
@@ -6474,7 +6087,7 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* set up name for main file: "extlinks21A" */
h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1));
- /* create tmp directory and get current working directory path */
+ /* create tmp_links directory and get current working directory path */
if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
TEST_ERROR
if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
@@ -6484,33 +6097,32 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
/* Set up names for files in the subdirectories */
- /* set up names for file #2 in temporary directory #2: "tmp2/extlinks21B" */
+ /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */
h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a));
fix_ext_filename(tmpname, cwdpath, FILENAME[46]);
h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b));
/* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */
- /* (i.e. tmp/sym1.h5 -> <full path to>/tmp2/extlinks21B.h5) */
+ /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */
if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for file #3 in temporary directory #2: "tmp2/extlinks21C" */
+ /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */
h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a));
h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b));
- /* set up name for file #4 in temporary directory #1: "tmp/extlinks21D" */
+ /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */
h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a));
fix_ext_filename(tmpname, cwdpath, FILENAME[49]);
h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b));
/* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */
- /* (i.e. tmp2/sym2.h5 -> <full path to>/tmp/extlinks21D.h5) */
+ /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */
if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for file #5 in temporary directory #1: "tmp/extlinks21E" */
+ /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */
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
@@ -6520,12 +6132,11 @@ 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 */
+ /* Create file #2 in tmp_links directory #2 */
if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
if(H5Fclose(file2) < 0) TEST_ERROR
- /* Re-open file #2 in tmp directory through symlink */
+ /* Re-open file #2 in tmp_links directory through symlink */
if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
/* Create group in file #2 in temporary directory */
@@ -6540,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
@@ -6556,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
@@ -6572,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
@@ -6583,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 */
@@ -6608,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);
@@ -6630,16 +6236,16 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: external_copy_invalid_object
*
@@ -6650,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)
@@ -6700,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 {
@@ -6709,10 +6311,10 @@ error:
H5Pclose(ocpyplid);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_copy_invalid_object */
-
+
/*-------------------------------------------------------------------------
* Function: external_dont_fail_to_source
*
@@ -6722,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)
@@ -6764,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 {
@@ -6773,10 +6371,10 @@ error:
H5Fclose(fid);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_dont_fail_to_source */
-
+
/*-------------------------------------------------------------------------
* Function: external_file_cache
*
@@ -6786,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];
@@ -6819,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);
@@ -7154,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 {
@@ -7166,10 +6656,10 @@ error:
H5Pclose(my_fapl);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_file_cache */
-
+
/*-------------------------------------------------------------------------
* Function: external_open_twice
*
@@ -7178,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];
@@ -7205,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
+ 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((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 {
@@ -7402,10 +6819,10 @@ error:
H5Sclose(space);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_open_twice() */
-
+
/*-------------------------------------------------------------------------
* Function: external_link_with_committed_datatype
*
@@ -7428,24 +6845,24 @@ error:
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 */
- 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 */
+ 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 */
+ 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 */
if(new_format)
TESTING("attach committed datatype to external group's attribute/dataset(w/new group format)")
@@ -7456,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 {
@@ -7677,13 +7042,13 @@ error:
H5Aclose(atid);
H5Aclose(dtid);
- H5Pclose(dcpl);
+ H5Pclose(dcpl);
} H5E_END_TRY
- return -1;
+ return FAIL;
} /* end external_link_with_committed_datatype() */
-
+
/*-------------------------------------------------------------------------
* Function: ud_hard_links
*
@@ -7692,10 +7057,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
/* Callback functions for UD hard links. */
@@ -7747,6 +7108,9 @@ done:
ret_value = -1;
break;
+ case H5I_MAP:
+ /* TODO: Not supported in native file format yet */
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
@@ -7762,7 +7126,7 @@ done:
case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
- return -1;
+ return FAIL;
} /* end switch */
} /* end if */
@@ -7779,7 +7143,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);
@@ -7836,6 +7200,9 @@ done:
ret_value = -1;
break;
+ case H5I_MAP:
+ /* TODO: Not supported in native file format yet */
+
case H5I_UNINIT:
case H5I_BADID:
case H5I_FILE:
@@ -7851,7 +7218,7 @@ done:
case H5I_SPACE_SEL_ITER:
case H5I_NTYPES:
default:
- return -1;
+ return FAIL;
} /* end switch */
} /* end if */
@@ -7873,12 +7240,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)")
@@ -7912,7 +7279,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
@@ -7950,9 +7316,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
@@ -7979,18 +7345,18 @@ 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);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_hard_links() */
-
+
/*-------------------------------------------------------------------------
* Function: UD_rereg_traverse
*
@@ -7999,10 +7365,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
@@ -8020,7 +7382,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
@@ -8040,23 +7402,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
@@ -8095,9 +7457,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 */
@@ -8165,18 +7527,18 @@ 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);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_link_reregister() */
-
+
/*-------------------------------------------------------------------------
* Function: ud_callbacks
*
@@ -8185,10 +7547,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. */
@@ -8206,10 +7564,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
@@ -8233,7 +7591,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 */
@@ -8249,10 +7607,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 */
@@ -8268,10 +7626,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 */
@@ -8295,7 +7653,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] = {{
@@ -8313,12 +7671,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)
@@ -8341,8 +7699,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 */
@@ -8384,7 +7741,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
@@ -8422,18 +7778,18 @@ 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 {
- H5Pclose (lcpl);
- H5Gclose (gid);
- H5Fclose (fid);
+ H5Pclose (lcpl);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_callbacks() */
-
+
/*-------------------------------------------------------------------------
* Function: lapl_udata
*
@@ -8442,10 +7798,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Tuesday, June 6, 2006
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -8461,13 +7813,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] = {{
@@ -8485,12 +7836,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)")
@@ -8561,19 +7912,19 @@ 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);
+ H5Pclose (plist_id);
+ H5Gclose (gid);
+ H5Gclose (gid2);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end lapl_udata() */
-
+
/*-------------------------------------------------------------------------
* Function: ud_link_errors
*
@@ -8582,10 +7933,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
@@ -8593,10 +7940,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
@@ -8614,7 +7960,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 */
@@ -8623,7 +7969,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 */
@@ -8632,7 +7978,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 */
@@ -8641,7 +7987,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 */
@@ -8651,7 +7997,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 */
@@ -8660,7 +8006,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 */
@@ -8673,10 +8019,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 */
@@ -8783,12 +8128,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)")
@@ -8801,10 +8146,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. */
@@ -8819,16 +8164,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. */
@@ -8896,17 +8238,17 @@ 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);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end ud_link_errors() */
-
+
/*-------------------------------------------------------------------------
* Function: lapl_nlinks
*
@@ -8914,28 +8256,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)")
@@ -8950,7 +8285,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
@@ -8979,7 +8314,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 */
@@ -9033,7 +8368,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
@@ -9066,7 +8400,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
@@ -9125,25 +8458,25 @@ 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);
- H5Pclose(tapl);
- H5Dclose(did);
- H5Sclose(sid);
- H5Tclose(tid);
- H5Gclose(gid2);
- H5Gclose(gid);
- H5Pclose(plist);
- H5Fclose(fid);
- } H5E_END_TRY;
- return -1;
+ H5Pclose(gapl);
+ H5Pclose(dapl);
+ H5Pclose(tapl);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Tclose(tid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Pclose(plist);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return FAIL;
} /* end lapl_nlinks() */
-
+
/*-------------------------------------------------------------------------
* Function: linkinfo
*
@@ -9151,21 +8484,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)")
@@ -9218,19 +8547,19 @@ 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);
+ H5Tclose (tid);
+ H5Dclose (did);
+ H5Gclose (gid);
+ H5Fclose (fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end linkinfo() */
-
+
/*-------------------------------------------------------------------------
* Function: check_all_closed
*
@@ -9243,10 +8572,6 @@ linkinfo(hid_t fapl, hbool_t new_format)
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: James Laird
- * Thursday, August 17, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9266,8 +8591,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
@@ -9275,17 +8599,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
*
@@ -9293,10 +8615,6 @@ error:
*
* Return: Success: >0, File ID for file built
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, November 24, 2007
- *
*-------------------------------------------------------------------------
*/
static hid_t
@@ -9304,9 +8622,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 */
@@ -9325,7 +8643,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
@@ -9333,7 +8650,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
@@ -9382,10 +8698,10 @@ error:
H5E_BEGIN_TRY {
H5Fclose(fid);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end build_visit_file() */
-
+
/*-------------------------------------------------------------------------
* Function: visit_link_cb
*
@@ -9393,15 +8709,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;
@@ -9415,7 +8726,7 @@ visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t
return(H5_ITER_CONT);
} /* end visit_link_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: link_visit
*
@@ -9423,10 +8734,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
@@ -9456,7 +8763,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;
@@ -9470,22 +8776,21 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: link_visit_by_name
*
@@ -9493,10 +8798,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Saturday, November 24, 2007
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9526,7 +8827,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;
@@ -9548,22 +8848,21 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: visit_obj_cb
*
@@ -9571,15 +8870,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;
@@ -9593,7 +8887,7 @@ visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *
return(H5_ITER_CONT);
} /* end visit_obj_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_visit
*
@@ -9601,10 +8895,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
@@ -9634,7 +8924,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;
@@ -9648,22 +8937,21 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_visit_by_name
*
@@ -9671,10 +8959,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 25, 2007
- *
*-------------------------------------------------------------------------
*/
static int
@@ -9704,7 +8988,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;
@@ -9716,7 +8999,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
@@ -9727,37 +9009,31 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: visit_obj_stop_cb
*
* 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;
@@ -9767,7 +9043,7 @@ visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name
return(H5_ITER_STOP);
} /* end visit_obj_stop_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_visit_stop
*
@@ -9776,10 +9052,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
@@ -9809,7 +9081,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
@@ -9817,16 +9089,16 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: link_filters
*
@@ -9835,10 +9107,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Neil Fortner
- * Tuesday, June 16, 2009
- *
*-------------------------------------------------------------------------
*/
static enum {
@@ -9851,14 +9119,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;
@@ -9867,14 +9132,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;
@@ -9885,19 +9147,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 */
@@ -9918,7 +9177,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;
@@ -9936,8 +9195,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
@@ -9965,8 +9223,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 */
@@ -9974,14 +9231,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
@@ -10005,12 +9258,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 */
@@ -10039,10 +9290,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
@@ -10053,34 +9302,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
@@ -10106,8 +9348,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
@@ -10135,7 +9376,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 */
@@ -10149,8 +9389,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)
@@ -10168,8 +9407,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)
@@ -10182,16 +9420,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 {
@@ -10203,10 +9439,10 @@ error:
H5Pclose(gcpl2);
H5Pclose(fcpl);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end link_filters() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_exists
*
@@ -10214,19 +9450,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)")
@@ -10236,8 +9468,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 */
@@ -10247,13 +9478,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 {
@@ -10261,240 +9490,205 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_create_empty
*
@@ -10502,19 +9696,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 */
@@ -10536,9 +9726,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 */
@@ -10563,7 +9753,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
@@ -10590,7 +9779,7 @@ corder_create_empty(hid_t fapl)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10598,10 +9787,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_create_empty() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_create_compact
*
@@ -10610,21 +9799,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 */
@@ -10674,7 +9859,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
@@ -10708,7 +9892,7 @@ corder_create_compact(hid_t fapl)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10716,10 +9900,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_create_compact() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_create_dense
*
@@ -10728,21 +9912,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 */
@@ -10808,7 +9988,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
@@ -10841,7 +10020,7 @@ corder_create_dense(hid_t fapl)
if(H5Fclose(file_id) < 0) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -10849,10 +10028,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_create_dense() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_transition
*
@@ -10861,25 +10040,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 */
@@ -10919,7 +10094,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
@@ -10994,7 +10168,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
@@ -11070,7 +10243,7 @@ corder_transition(hid_t fapl)
if(file_size != empty_size) TEST_ERROR
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -11078,10 +10251,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_transition() */
-
+
/*-------------------------------------------------------------------------
* Function: corder_delete
*
@@ -11091,25 +10264,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 */
@@ -11122,7 +10291,7 @@ corder_delete(hid_t fapl)
/* Create file */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Creating file with latest format will enable paged aggregation with persistent fs */
+ /* Creating file with latest format will enable paged aggregation with persistent fs */
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
/* Close file */
@@ -11199,7 +10368,7 @@ corder_delete(hid_t fapl)
} /* end for */
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -11207,25 +10376,21 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end corder_delete() */
-
+
/*-------------------------------------------------------------------------
* Function: link_info_by_idx_check
*
* 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
@@ -11369,7 +10534,7 @@ error:
return(-1);
} /* end link_info_by_idx_check() */
-
+
/*-------------------------------------------------------------------------
* Function: link_info_by_idx
*
@@ -11378,18 +10543,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 */
@@ -11453,7 +10614,7 @@ link_info_by_idx(hid_t fapl)
/* Check for creating hard or soft link */
if(hard_link) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11495,7 +10656,7 @@ link_info_by_idx(hid_t fapl)
/* Check for creating hard or soft link */
if(hard_link) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Create hard link, with group object */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11543,7 +10704,7 @@ link_info_by_idx(hid_t fapl)
} /* end for */
} /* end for */
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -11551,10 +10712,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end link_info_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: link_info_by_idx_old
*
@@ -11563,17 +10724,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 */
@@ -11711,17 +10868,17 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: delete_by_idx
*
@@ -11730,19 +10887,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 */
@@ -11806,10 +10959,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);
@@ -11824,7 +10975,7 @@ delete_by_idx(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -11879,7 +11030,7 @@ delete_by_idx(hid_t fapl)
/* Create more links, to push group into dense form */
for(u = 0; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -11940,13 +11091,11 @@ 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 */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -12020,8 +11169,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
@@ -12036,7 +11183,7 @@ delete_by_idx(hid_t fapl)
} /* end for */
} /* end for */
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -12044,10 +11191,10 @@ error:
H5Gclose(group_id);
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end delete_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: delete_by_idx_old
*
@@ -12056,17 +11203,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 */
@@ -12091,10 +11234,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);
@@ -12170,10 +11311,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 */
@@ -12261,7 +11400,7 @@ delete_by_idx_old(hid_t fapl)
PASSED();
} /* end for */
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -12269,10 +11408,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end delete_by_idx_old() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_cb
*
@@ -12280,10 +11419,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Monday, November 20, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -12292,14 +11427,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) {
@@ -12307,31 +11442,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 */
@@ -12343,13 +11478,13 @@ 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
-
+
/*-------------------------------------------------------------------------
* Function: group_iterate_cb
*
@@ -12358,20 +11493,16 @@ 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 */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_fail_cb
*
@@ -12380,20 +11511,16 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_check
*
@@ -12401,10 +11528,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
@@ -12432,7 +11555,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);
@@ -12449,7 +11571,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;
@@ -12480,7 +11601,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));
@@ -12513,7 +11633,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;
@@ -12525,7 +11644,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);
@@ -12539,7 +11657,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 {
@@ -12548,13 +11665,13 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate
*
@@ -12572,9 +11689,9 @@ error:
static int
link_iterate(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 */
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 */
@@ -12659,14 +11776,13 @@ 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
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -12689,10 +11805,9 @@ 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 */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -12734,7 +11849,7 @@ link_iterate(hid_t fapl)
if(visited)
HDfree(visited);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -12747,10 +11862,10 @@ error:
if(visited)
HDfree(visited);
- return -1;
+ return FAIL;
} /* end link_iterate() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_old_cb
*
@@ -12758,52 +11873,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 */
@@ -12815,13 +11925,13 @@ 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
-
+
/*-------------------------------------------------------------------------
* Function: group_iterate_old_cb
*
@@ -12830,20 +11940,16 @@ 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 */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_old_check
*
@@ -12851,15 +11957,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 */
@@ -12882,7 +11983,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);
@@ -12899,7 +11999,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;
@@ -12930,7 +12029,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));
@@ -12963,7 +12061,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;
@@ -12975,7 +12072,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);
@@ -12989,7 +12085,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 {
@@ -13012,13 +12107,13 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: link_iterate_old
*
@@ -13026,17 +12121,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 */
@@ -13072,14 +12163,13 @@ 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
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -13110,7 +12200,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
@@ -13124,7 +12213,7 @@ link_iterate_old(hid_t fapl)
if(visited)
HDfree(visited);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13136,10 +12225,10 @@ error:
if(visited)
HDfree(visited);
- return -1;
+ return FAIL;
} /* end link_iterate_old() */
-
+
/*-------------------------------------------------------------------------
* Function: open_by_idx_check
*
@@ -13147,19 +12236,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 */
@@ -13200,10 +12284,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
@@ -13230,15 +12311,14 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: open_by_idx
*
@@ -13247,21 +12327,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 */
@@ -13350,17 +12426,15 @@ 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 */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -13392,10 +12466,9 @@ 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 */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -13427,7 +12500,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
@@ -13450,7 +12522,7 @@ open_by_idx(hid_t fapl)
if(objno)
HDfree(objno);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13465,10 +12537,10 @@ error:
if(objno)
HDfree(objno);
- return -1;
+ return FAIL;
} /* end open_by_idx() */
-
+
/*-------------------------------------------------------------------------
* Function: open_by_idx_old
*
@@ -13477,19 +12549,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 */
@@ -13534,10 +12602,9 @@ 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 */
+ hid_t group_id2; /* Group ID */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -13575,7 +12642,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
@@ -13589,7 +12655,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 */
@@ -13600,10 +12666,10 @@ error:
H5Fclose(mount_file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end open_by_idx_old() */
-
+
/*-------------------------------------------------------------------------
* Function: object_info_check
*
@@ -13611,10 +12677,6 @@ error:
*
* Return: Success: 0
* Failure: -1
- *
- * Programmer: Quincey Koziol
- * Sunday, November 26, 2006
- *
*-------------------------------------------------------------------------
*/
static int
@@ -13622,7 +12684,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 */
@@ -13668,13 +12730,13 @@ 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() */
-
+
/*-------------------------------------------------------------------------
* Function: object_info
*
@@ -13683,21 +12745,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 */
@@ -13795,7 +12853,7 @@ object_info(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
hid_t attr_id; /* Attribute ID */
/* Make name for link */
@@ -13843,7 +12901,7 @@ object_info(hid_t fapl)
/* Create more links, to push group into dense form */
for(; u < (max_compact * 2); u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
hid_t attr_id; /* Attribute ID */
/* Make name for link */
@@ -13907,7 +12965,7 @@ object_info(hid_t fapl)
if(objno)
HDfree(objno);
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -13922,10 +12980,10 @@ error:
if(objno)
HDfree(objno);
- return -1;
+ return FAIL;
} /* end object_info() */
-
+
/*-------------------------------------------------------------------------
* Function: object_info_old
*
@@ -13933,19 +12991,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 */
@@ -13983,7 +13037,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);
@@ -13992,7 +13045,7 @@ object_info_old(hid_t fapl)
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2; /* Group ID */
+ hid_t group_id2; /* Group ID */
hid_t attr_id; /* Attribute ID */
/* Make name for link */
@@ -14043,7 +13096,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
@@ -14057,7 +13109,7 @@ object_info_old(hid_t fapl)
/* Free resources */
if(H5Sclose(space_id) < 0) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -14068,10 +13120,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end object_info_old() */
-
+
/*-------------------------------------------------------------------------
* Function: group_info
*
@@ -14080,20 +13132,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 */
@@ -14175,7 +13223,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);
@@ -14184,7 +13231,7 @@ group_info(hid_t fapl)
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -14192,7 +13239,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
@@ -14217,7 +13263,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 */
@@ -14230,7 +13275,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
@@ -14255,7 +13299,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) {
@@ -14274,7 +13317,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
@@ -14299,7 +13341,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
@@ -14322,10 +13363,9 @@ 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 */
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -14333,7 +13373,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
@@ -14358,7 +13397,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 */
@@ -14371,7 +13409,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
@@ -14396,7 +13433,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) {
@@ -14415,7 +13451,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
@@ -14440,7 +13475,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
@@ -14463,7 +13497,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
@@ -14479,7 +13512,7 @@ group_info(hid_t fapl)
/* Free resources */
if(H5Pclose(gcpl_id) < 0) TEST_ERROR
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -14490,10 +13523,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end group_info() */
-
+
/*-------------------------------------------------------------------------
* Function: group_info_old
*
@@ -14502,18 +13535,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 */
@@ -14546,7 +13575,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);
@@ -14555,7 +13583,7 @@ group_info_old(hid_t fapl)
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- hid_t group_id2, group_id3; /* Group IDs */
+ hid_t group_id2, group_id3; /* Group IDs */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -14563,7 +13591,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
@@ -14588,7 +13615,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 */
@@ -14601,7 +13627,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
@@ -14626,7 +13651,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) {
@@ -14645,7 +13669,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
@@ -14670,7 +13693,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
@@ -14699,7 +13721,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
@@ -14710,7 +13731,7 @@ group_info_old(hid_t fapl)
PASSED();
} /* end for */
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -14720,10 +13741,10 @@ error:
H5Fclose(file_id);
} H5E_END_TRY;
- return -1;
+ return FAIL;
} /* end group_info_old() */
-
+
/*-------------------------------------------------------------------------
* Function: timestamps
*
@@ -14732,20 +13753,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 */
@@ -14771,7 +13788,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
@@ -14824,7 +13840,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
@@ -14873,7 +13888,7 @@ timestamps(hid_t fapl)
PASSED();
- return 0;
+ return SUCCEED;
error:
/* Free resources */
@@ -14883,32 +13898,26 @@ 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)
+ * Function: main
*
- * Programmer: Robb Matzke
- * Friday, August 14, 1998
+ * Purpose: Test links
*
+ * Return: EXIT_SUCCESS/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");
@@ -14927,7 +13936,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;
}
@@ -14939,14 +13949,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;
@@ -14966,29 +13976,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 */
@@ -15035,7 +14044,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,
@@ -15070,9 +14079,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;
@@ -15094,8 +14103,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 */
@@ -15115,8 +14123,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");
@@ -15125,14 +14132,14 @@ main(void)
HDremove(SYMLINK1);
HDremove(SYMLINK2);
- /* clean up tmp directory created by external link tests */
+ /* clean up tmp_links and tmp2_links directory created by external link tests */
HDrmdir(TMPDIR);
HDrmdir(TMPDIR2);
- return 0;
+ HDexit(EXIT_SUCCESS);
error:
HDputs("*** TESTS FAILED ***");
- return 1;
+ HDexit(EXIT_FAILURE);
}