diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-01-16 21:29:34 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-01-16 21:29:34 (GMT) |
commit | a92c735c9b57049e8c4037d3490f7e10f8eef4d6 (patch) | |
tree | 74da25151de6d1e32329dfcd62e17c863e2e3de1 /examples | |
parent | 024f7ba09250110c19b070c9699cfbc0f9dc2b96 (diff) | |
download | hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.zip hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.gz hdf5-a92c735c9b57049e8c4037d3490f7e10f8eef4d6.tar.bz2 |
Squashed commit of the token_refactoring branch:
Diffstat (limited to 'examples')
-rw-r--r-- | examples/h5_attribute.c | 4 | ||||
-rw-r--r-- | examples/h5_extlink.c | 48 | ||||
-rw-r--r-- | examples/h5_group.c | 14 | ||||
-rw-r--r-- | examples/testh5cc.sh.in | 5 |
4 files changed, 35 insertions, 36 deletions
diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index e3b5759..0e275c7 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -60,7 +60,7 @@ main (void) float matrix[ADIM1][ADIM2]; /* Attribute data */ herr_t ret; /* Return value */ - H5O_info_t oinfo; /* Object info */ + H5O_info2_t oinfo; /* Object info */ unsigned i, j; /* Counters */ char string_out[80]; /* Buffer to read string attribute back */ int point_out; /* Buffer to read scalar attribute back */ @@ -189,7 +189,7 @@ main (void) /* * Find string attribute by iterating through all attributes */ - ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_ALL); + ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS); for(i = 0; i < (unsigned)oinfo.num_attrs; i++) { attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT); atype = H5Aget_type(attr); diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 229e465..fea1fa2 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -316,7 +316,7 @@ static void hard_link_example(void) { hid_t file_id; hid_t group_id; - H5L_info_t li; + H5L_info2_t li; /* Define the link class that we'll use to register "user-defined hard * links" using the callbacks we defined above. * A link class can have NULL for any callback except its traverse @@ -361,13 +361,13 @@ static void hard_link_example(void) * the target group's address. We do this by calling H5Lget_info * on a hard link to the object. */ - H5Lget_info(file_id, TARGET_GROUP, &li, H5P_DEFAULT); + H5Lget_info2(file_id, TARGET_GROUP, &li, H5P_DEFAULT); /* Now create a user-defined link. We give it the group's address * as its udata. */ - H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.address), - sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT); + H5Lcreate_ud(file_id, UD_HARD_LINK_NAME, (H5L_type_t)UD_HARD_CLASS, &(li.u.token), + sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT); /* The UD hard link has now incremented the group's reference count * like a normal hard link would. This means that we can unlink the @@ -404,23 +404,23 @@ static void hard_link_example(void) static herr_t UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size, hid_t lcpl_id) { - haddr_t addr; - hid_t target_obj = -1; + H5O_token_t token; + hid_t target_obj = H5I_INVALID_HID; herr_t ret_value = 0; /* Make sure that the address passed in looks valid */ - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); /* Open the object this link points to so that we can increment - * its reference count. This also ensures that the address passed + * its reference count. This also ensures that the token passed * in points to a real object (although this check is not perfect!) */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; @@ -448,23 +448,23 @@ done: static herr_t UD_hard_delete(const char *link_name, hid_t loc_group, const void *udata, size_t udata_size) { - haddr_t addr; - hid_t target_obj = -1; + H5O_token_t token; + hid_t target_obj = H5I_INVALID_HID; herr_t ret_value = 0; /* Sanity check; we have already verified the udata's size in the creation * callback. */ - if(udata_size != sizeof(haddr_t)) + if(udata_size != sizeof(H5O_token_t)) { ret_value = -1; goto done; } - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); /* Open the object this link points to */ - target_obj= H5Oopen_by_addr(loc_group, addr); + target_obj = H5Oopen_by_token(loc_group, token); if(target_obj < 0) { ret_value = -1; @@ -492,21 +492,21 @@ done: static hid_t UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { - haddr_t addr; - hid_t ret_value = -1; + H5O_token_t token; + hid_t ret_value = H5I_INVALID_HID; /* Sanity check; we have already verified the udata's size in the creation * callback. */ - if(udata_size != sizeof(haddr_t)) - return -1; + if(udata_size != sizeof(H5O_token_t)) + return H5I_INVALID_HID; - addr = *((const haddr_t *) udata); + token = *((H5O_token_t *) udata); - /* Open the object by address. If H5Oopen_by_addr fails, ret_value will + /* Open the object by token. If H5Oopen_by_token fails, ret_value will * be negative to indicate that the traversal function failed. */ - ret_value = H5Oopen_by_addr(cur_group, addr); + ret_value = H5Oopen_by_token(cur_group, token); return ret_value; } @@ -621,7 +621,7 @@ static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t udata_size, hid_t lapl_id, hid_t dxpl_id) { char * path; - hid_t ret_value = -1; + hid_t ret_value = H5I_INVALID_HID; /* If the link property isn't set or can't be found, traversal fails. */ if(H5Pexist(lapl_id, PLIST_LINK_PROP) < 0) @@ -638,7 +638,7 @@ static hid_t UD_plist_traverse(const char *link_name, hid_t cur_group, return ret_value; error: - return -1; + return H5I_INVALID_HID; } diff --git a/examples/h5_group.c b/examples/h5_group.c index 8e89165..75bed91 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -26,9 +26,9 @@ #define H5FILE_NAME "group.h5" #define RANK 2 -static herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +static herr_t file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); /* Link iteration operator function */ -static herr_t group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, +static herr_t group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata); /* Link iteration operator function */ int main(void) @@ -135,7 +135,7 @@ main(void) /* * Use iterator to see the names of the objects in the root group. */ - idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx_f = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Unlink name "Data" and use iterator to see the names @@ -146,13 +146,13 @@ main(void) else printf("\"Data\" is unlinked \n"); - idx_f = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); + idx_f = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL); /* * Use iterator to see the names of the objects in the group * /Data_new. */ - idx_g = H5Literate_by_name(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); + idx_g = H5Literate_by_name2(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); /* * Close the file. @@ -168,7 +168,7 @@ main(void) * Operator function. */ static herr_t -file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +file_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { /* avoid compiler warnings */ loc_id = loc_id; @@ -189,7 +189,7 @@ file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) * Operator function. */ static herr_t -group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) +group_info(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *opdata) { hid_t did; /* dataset identifier */ hid_t tid; /* datatype identifier */ diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 800d4d4..40ca466 100644 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -308,8 +308,8 @@ echo "***"Version compatibility tests. # If H5_NO_DEPRECATED_SYMBOLS; # then only v18main works. # else if H5_USE_16_API_DEFAULT; -# then v16main works and -DH5_NO_DEPRECATED_SYMBOLS v18main also works. -# else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. +# then v16main works. +# else v18main works and -DH5_USE_16_API_DEFAULT v16main also works. # if [ -n "$H5_USE_16_API_DEFAULT" ]; then echo "H5_USE_16_API_DEFAULT is defined." @@ -326,7 +326,6 @@ if [ -n "$H5_NO_DEPRECATED_SYMBOLS" ]; then TOOLTEST $v18main elif [ -n "$H5_USE_16_API_DEFAULT" ]; then TOOLTEST $v16main - TOOLTEST -DH5_NO_DEPRECATED_SYMBOLS $v18main else TOOLTEST -DH5_USE_16_API_DEFAULT $v16main TOOLTEST $v18main |