diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2009-01-09 16:00:37 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2009-01-09 16:00:37 (GMT) |
commit | aa12e27206fda57e81bb3dc7760aebec7d584ee9 (patch) | |
tree | c9f502cd21d4ba67d0e7b9b6c820a51f77a1f53b /test/links.c | |
parent | 17a2d2179111981dcf2395b9d21339cbf05d6120 (diff) | |
download | hdf5-aa12e27206fda57e81bb3dc7760aebec7d584ee9.zip hdf5-aa12e27206fda57e81bb3dc7760aebec7d584ee9.tar.gz hdf5-aa12e27206fda57e81bb3dc7760aebec7d584ee9.tar.bz2 |
[svn-r16288] Fix one of the new tests in links.c. external_set_elink_cb no longer copies the
driver information from property list to property list.
Tested: jam
Diffstat (limited to 'test/links.c')
-rw-r--r-- | test/links.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/test/links.c b/test/links.c index 8a4274c..07373fc 100644 --- a/test/links.c +++ b/test/links.c @@ -116,6 +116,8 @@ const char *FILENAME[] = { #define LE_FILENAME "le_extlink1.h5" #define BE_FILENAME "be_extlink1.h5" +#define ELINK_CB_FAM_SIZE (hsize_t) 100 + #define H5L_DIM1 100 #define H5L_DIM2 100 @@ -4077,10 +4079,13 @@ external_set_elink_acc_flags(hid_t fapl, hbool_t new_format) * *------------------------------------------------------------------------- */ + /* User data structure for callback function */ typedef struct { - const char *parent_file; - const char *target_file; - hid_t fapl; + const char *parent_file; /* Expected parent file name */ + const char *target_file; /* Expected target file name */ + hid_t base_fapl; /* Base fapl for family driver */ + hsize_t fam_size; /* Size of family files */ + int code; /* Code to control the actions taken by the callback */ } set_elink_cb_t; /* Callback function */ @@ -4090,15 +4095,6 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group, hid_t fapl, void *_op_data) { set_elink_cb_t *op_data = (set_elink_cb_t *)_op_data; - hid_t driver; - const void *driver_info; - - /* Codes to cause an invalid condition (and verify that an error is issued */ - if (op_data->fapl == -1) return FAIL; - if (op_data->fapl == -2) { - *flags = H5F_ACC_DEFAULT; - return 0; - } /* end if */ /* Verify file and object names are correct */ if (HDstrcmp(parent_file, op_data->parent_file)) return FAIL; @@ -4109,10 +4105,14 @@ external_set_elink_cb_cb(const char *parent_file, const char *parent_group, /* Set flags to be read-write */ *flags = (*flags & ~H5F_ACC_RDONLY) | H5F_ACC_RDWR; - /* Copy driver info from op_data->fapl to fapl */ - driver = H5Pget_driver(op_data->fapl); - driver_info = H5Pget_driver_info(op_data->fapl); - if (H5Pset_driver(fapl, driver, driver_info) < 0) return FAIL; + /* Set family file driver on fapl */ + if (H5Pset_fapl_family(fapl, op_data->fam_size, op_data->base_fapl) < 0) return FAIL; + + /* Codes to cause an invalid condition (and verify that an error is issued */ + if (op_data->code == 1) + return FAIL; + if (op_data->code == 2) + *flags = H5F_ACC_DEFAULT; return 0; } @@ -4136,7 +4136,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) /* Create family fapl */ if ((fam_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR - if (H5Pset_fapl_family(fam_fapl, (hsize_t) 100, fapl) < 0) TEST_ERROR + if (H5Pset_fapl_family(fam_fapl, ELINK_CB_FAM_SIZE, fapl) < 0) TEST_ERROR /* Create parent and target files, group, and external link */ h5_fixname(FILENAME[40], fapl, filename1, sizeof filename1); @@ -4154,7 +4154,9 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) /* Build user data for callback */ op_data.parent_file = filename1; op_data.target_file = filename2; - op_data.fapl = fam_fapl; + op_data.base_fapl = fapl; + op_data.fam_size = ELINK_CB_FAM_SIZE; + op_data.code = 0; /* Create new gapl, and set elink callback */ if ((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR @@ -4186,7 +4188,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) if (H5Pclose(fam_fapl) < 0) TEST_ERROR /* Modify the user data structure to cause the callback to fail next time */ - op_data.fapl = -1; + op_data.code = 1; /* Attempt to reopen group2 (should fail) */ H5E_BEGIN_TRY { @@ -4195,7 +4197,7 @@ external_set_elink_cb(hid_t fapl, hbool_t new_format) if (group != FAIL) TEST_ERROR /* Modify the user data structure to cause the callback to return invalid flags */ - op_data.fapl = -2; + op_data.code = 2; /* Attempt to reopen group2 (should fail) */ H5E_BEGIN_TRY { |