diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-08-30 20:03:37 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-08-30 20:03:37 (GMT) |
commit | a4069db8f48121ca11d0465b260d9cd81152581b (patch) | |
tree | 37348ad7d71058a6f449255073d631db8c33794a | |
parent | 1374654210854d005546459e48c482c5ea01cba2 (diff) | |
download | hdf5-a4069db8f48121ca11d0465b260d9cd81152581b.zip hdf5-a4069db8f48121ca11d0465b260d9cd81152581b.tar.gz hdf5-a4069db8f48121ca11d0465b260d9cd81152581b.tar.bz2 |
[svn-r14131] Description:
Move H5Giterate() and H5G_iterate_t to deprecated symbols section,
replacing them with H5Literate and H5L_iterate_t respectively.
Tested on:
FreeBSD/32 6.2 (duty)
FreeBSD/64 6.2 (liberty)
Linux/32 2.6 (kagiso)
Linux/64 2.6 (smirom)
AIX/32 5.3 (copper)
Solaris/32 5.10 (linew)
Mac OS X/32 10.4.10 (amazon)
-rw-r--r-- | c++/examples/h5group.cpp | 10 | ||||
-rw-r--r-- | c++/src/H5CommonFG.cpp | 6 | ||||
-rw-r--r-- | c++/src/H5CommonFG.h | 6 | ||||
-rw-r--r-- | examples/h5_group.c | 155 | ||||
-rw-r--r-- | fortran/src/H5Gf.c | 4 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 4 | ||||
-rw-r--r-- | hl/src/H5LT.c | 47 | ||||
-rw-r--r-- | src/H5Gdense.c | 2 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 6 | ||||
-rw-r--r-- | src/H5Glink.c | 2 | ||||
-rw-r--r-- | src/H5Gnode.c | 2 | ||||
-rw-r--r-- | src/H5Gpkg.h | 4 | ||||
-rw-r--r-- | src/H5Gpublic.h | 31 | ||||
-rw-r--r-- | src/H5Gstab.c | 2 | ||||
-rw-r--r-- | test/cmpd_dset.c | 25 | ||||
-rw-r--r-- | test/links.c | 24 | ||||
-rwxr-xr-x | test/objcopy.c | 4 | ||||
-rw-r--r-- | test/titerate.c | 88 | ||||
-rw-r--r-- | test/trefer.c | 7 | ||||
-rw-r--r-- | test/tunicode.c | 2 | ||||
-rw-r--r-- | test/unlink.c | 12 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 168 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 25 | ||||
-rw-r--r-- | tools/h5stat/h5stat.c | 8 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 3 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.c | 5 | ||||
-rw-r--r-- | tools/lib/h5tools_ref.h | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 6 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 9 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 34 |
31 files changed, 365 insertions, 340 deletions
diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index f7dc733..bcaf2c0 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -46,7 +46,8 @@ const H5std_string FILE_NAME( "Group.h5" ); const int RANK = 2; // Operator function -extern "C" herr_t file_info(hid_t loc_id, const char *name, void *opdata); +extern "C" herr_t file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, + void *opdata); int main(void) { @@ -166,7 +167,7 @@ int main(void) * root directory. */ cout << endl << "Iterating over elements in the file" << endl; - herr_t idx = H5Giterate(file->getId(), "/", NULL, file_info, NULL); + herr_t idx = H5Literate(file->getId(), "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); cout << endl; /* @@ -184,7 +185,7 @@ int main(void) cout << "\"Data\" is unlinked" << endl; cout << endl << "Iterating over elements in the file again" << endl; - idx = H5Giterate(file->getId(), "/", NULL, file_info, NULL); + idx = H5Literate(file->getId(), "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); cout << endl; /* @@ -228,9 +229,10 @@ int main(void) * Operator function. */ herr_t -file_info(hid_t loc_id, const char *name, void *opdata) +file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) { hid_t group; + /* * Open the group using its name. */ diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 251131d..7b8c5ac 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -243,7 +243,7 @@ DataSet CommonFG::openDataSet( const H5std_string& name ) const /// specified location. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void CommonFG::link( H5G_link_t link_type, const char* curr_name, const char* new_name ) const +void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* new_name ) const { herr_t ret_value; @@ -274,7 +274,7 @@ void CommonFG::link( H5G_link_t link_type, const char* curr_name, const char* ne /// \c std::string for \a curr_name and \a new_name. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void CommonFG::link( H5G_link_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const +void CommonFG::link( H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name ) const { link( link_type, curr_name.c_str(), new_name.c_str() ); } @@ -935,6 +935,7 @@ VarLenType CommonFG::openVarLenType( const H5std_string& name ) const return( openVarLenType( name.c_str()) ); } +#ifndef H5_NO_DEPRECATED_SYMBOLS //-------------------------------------------------------------------------- // Function: CommonFG::iterateElems ///\brief Iterates a user's function over the entries of a group. @@ -969,6 +970,7 @@ int CommonFG::iterateElems( const H5std_string& name, int *idx, H5G_iterate_t op { return( iterateElems( name.c_str(), idx, op, op_data )); } +#endif /* H5_NO_DEPRECATED_SYMBOLS */ //-------------------------------------------------------------------------- // Function: CommonFG::getNumObjs diff --git a/c++/src/H5CommonFG.h b/c++/src/H5CommonFG.h index 5c75989..ed1c132 100644 --- a/c++/src/H5CommonFG.h +++ b/c++/src/H5CommonFG.h @@ -86,15 +86,17 @@ class H5_DLLCPP CommonFG { H5G_obj_t getObjTypeByIdx(hsize_t idx) const; H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const; +#ifndef H5_NO_DEPRECATED_SYMBOLS // Iterates over the elements of this group - not implemented in // C++ style yet. int iterateElems(const char* name, int *idx, H5G_iterate_t op, void *op_data); int iterateElems(const H5std_string& name, int *idx, H5G_iterate_t op, void *op_data); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ // Creates a link of the specified type from new_name to current_name; // both names are interpreted relative to the specified location id. - void link(H5G_link_t link_type, const char* curr_name, const char* new_name) const; - void link(H5G_link_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const; + void link(H5L_type_t link_type, const char* curr_name, const char* new_name) const; + void link(H5L_type_t link_type, const H5std_string& curr_name, const H5std_string& new_name) const; // Removes the specified name at this location. void unlink(const char* name) const; diff --git a/examples/h5_group.c b/examples/h5_group.c index 4bad2ea..744f7b8 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -28,10 +28,10 @@ #define H5FILE_NAME "group.h5" #define RANK 2 -herr_t file_info(hid_t loc_id, const char *name, void *opdata); - /* Operator function */ -herr_t group_info(hid_t loc_id, const char *name, void *opdata); - /* Operator function */ +static herr_t file_info(hid_t loc_id, const char *name, const H5L_info_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, + void *opdata); /* Link iteration operator function */ int main(void) { @@ -137,7 +137,7 @@ main(void) /* * Use iterator to see the names of the objects in the root group. */ - idx_f = H5Giterate(file, "/", NULL, file_info, NULL); + idx_f = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); /* * Unlink name "Data" and use iterator to see the names @@ -148,13 +148,13 @@ main(void) else printf("\"Data\" is unlinked \n"); - idx_f = H5Giterate(file, "/", NULL, file_info, NULL); + idx_f = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, file_info, NULL, H5P_DEFAULT); /* * Use iterator to see the names of the objects in the group * /Data_new. */ - idx_g = H5Giterate(grp, "/Data_new", NULL, group_info, NULL); + idx_g = H5Literate(grp, "/Data_new", H5_INDEX_NAME, H5_ITER_INC, NULL, group_info, NULL, H5P_DEFAULT); /* * Close the file. @@ -169,100 +169,93 @@ main(void) /* * Operator function. */ -herr_t file_info(hid_t loc_id, const char *name, void *opdata) +static herr_t +file_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) { - /* avoid warnings */ + /* avoid compiler warnings */ loc_id = loc_id; opdata = opdata; + linfo = linfo; /* * Display group name. The name is passed to the function by * the Library. Some magic :-) */ - printf("\n"); - printf("Name : "); - puts(name); + printf("\nName : %s\n", name); return 0; - } +} /* * Operator function. */ -herr_t group_info(hid_t loc_id, const char *name, void *opdata) +static herr_t +group_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *opdata) { - hid_t did; /* dataset identifier */ - hid_t tid; /* datatype identifier */ - H5T_class_t t_class; - hid_t pid; /* data_property identifier */ - hsize_t chunk_dims_out[2]; - - int rank_chunk; - - /* avoid warnings */ - opdata = opdata; - - /* - * Open the datasets using their names. - */ - did = H5Dopen(loc_id, name); - - /* - * Display dataset name. - */ - printf("\n"); - printf("Name : "); - puts(name); - - /* - * Display dataset information. - */ - tid = H5Dget_type(did); /* get datatype*/ - pid = H5Dget_create_plist(did); /* get creation property list */ - - /* - * Check if dataset is chunked. - */ - if(H5D_CHUNKED == H5Pget_layout(pid)){ - /* - * get chunking information: rank and dimensions. - */ - rank_chunk = H5Pget_chunk(pid, 2, chunk_dims_out); - printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk, - (unsigned long)(chunk_dims_out[0]), - (unsigned long)(chunk_dims_out[1])); - } - else{ - t_class = H5Tget_class(tid); - if(t_class < 0){ - puts(" Invalid datatype.\n"); - } - else { - if(t_class == H5T_INTEGER) - puts(" Datatype is 'H5T_NATIVE_INTEGER'.\n"); - if(t_class == H5T_FLOAT) - puts(" Datatype is 'H5T_NATIVE_FLOAT'.\n"); - if(t_class == H5T_STRING) - puts(" Datatype is 'H5T_NATIVE_STRING'.\n"); - if(t_class == H5T_BITFIELD) - puts(" Datatype is 'H5T_NATIVE_BITFIELD'.\n"); - if(t_class == H5T_OPAQUE) - puts(" Datatype is 'H5T_NATIVE_OPAQUE'.\n"); - if(t_class == H5T_COMPOUND) - puts(" Datatype is 'H5T_NATIVE_COMPOUND'.\n"); - } - } - + hid_t did; /* dataset identifier */ + hid_t tid; /* datatype identifier */ + H5T_class_t t_class; + hid_t pid; /* data_property identifier */ + hsize_t chunk_dims_out[2]; + int rank_chunk; - H5Dclose(did); - H5Pclose(pid); - H5Tclose(tid); - return 0; - } + /* avoid warnings */ + opdata = opdata; + linfo = linfo; + /* + * Open the datasets using their names. + */ + did = H5Dopen(loc_id, name); + /* + * Display dataset name. + */ + printf("\nName : %s\n", name); + /* + * Display dataset information. + */ + tid = H5Dget_type(did); /* get datatype*/ + pid = H5Dget_create_plist(did); /* get creation property list */ + /* + * Check if dataset is chunked. + */ + if(H5D_CHUNKED == H5Pget_layout(pid)) { + /* + * get chunking information: rank and dimensions. + */ + rank_chunk = H5Pget_chunk(pid, 2, chunk_dims_out); + printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk, + (unsigned long)(chunk_dims_out[0]), + (unsigned long)(chunk_dims_out[1])); + } + else { + t_class = H5Tget_class(tid); + if(t_class < 0) { + puts(" Invalid datatype.\n"); + } + else { + if(t_class == H5T_INTEGER) + puts(" Datatype is 'H5T_NATIVE_INTEGER'.\n"); + if(t_class == H5T_FLOAT) + puts(" Datatype is 'H5T_NATIVE_FLOAT'.\n"); + if(t_class == H5T_STRING) + puts(" Datatype is 'H5T_NATIVE_STRING'.\n"); + if(t_class == H5T_BITFIELD) + puts(" Datatype is 'H5T_NATIVE_BITFIELD'.\n"); + if(t_class == H5T_OPAQUE) + puts(" Datatype is 'H5T_NATIVE_OPAQUE'.\n"); + if(t_class == H5T_COMPOUND) + puts(" Datatype is 'H5T_NATIVE_COMPOUND'.\n"); + } + } + H5Dclose(did); + H5Pclose(pid); + H5Tclose(tid); + return 0; +} diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c index 1543fd6..3796b73 100644 --- a/fortran/src/H5Gf.c +++ b/fortran/src/H5Gf.c @@ -297,7 +297,7 @@ nh5glink_c(hid_t_f *loc_id, int_f *link_type, _fcd current_name, /* * Call appropriate link creation function */ - switch((H5G_link_t)*link_type) { + switch((H5L_type_t)*link_type) { case H5L_TYPE_HARD: if(H5Lcreate_hard((hid_t)*loc_id, c_current_name, H5L_SAME_LOC, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) goto DONE; @@ -359,7 +359,7 @@ nh5glink2_c(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, /* * Call appropriate link creation function */ - switch((H5G_link_t)*link_type) { + switch((H5L_type_t)*link_type) { case H5L_TYPE_HARD: if(H5Lcreate_hard((hid_t)*cur_loc_id, c_cur_name, (hid_t)*new_loc_id, c_new_name, H5P_DEFAULT, H5P_DEFAULT) < 0) goto DONE; diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index b05d1b3..b4cfbd1 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -304,8 +304,8 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, h5g_flags[3] = H5G_TYPE; h5g_flags[4] = H5G_LINK; h5g_flags[5] = H5G_LINK_ERROR; - h5g_flags[6] = H5G_LINK_HARD; - h5g_flags[7] = H5G_LINK_SOFT; + h5g_flags[6] = H5L_TYPE_HARD; + h5g_flags[7] = H5L_TYPE_SOFT; /* * H5I flags diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 717352f..10977a7 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1032,34 +1032,29 @@ out: *------------------------------------------------------------------------- */ -static herr_t find_dataset( hid_t loc_id, const char *name, void *op_data) +static herr_t +find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_data) { + /* Define a default zero value for return. This will cause the iterator to continue if + * the dataset is not found yet. + */ + int ret = 0; - /* Define a default zero value for return. This will cause the iterator to continue if - * the dataset is not found yet. - */ - - int ret = 0; - - char *dset_name = (char*)op_data; - - /* Shut the compiler up */ - loc_id=loc_id; - - /* Define a positive value for return value if the dataset was found. This will - * cause the iterator to immediately return that positive value, - * indicating short-circuit success - */ - - if( strcmp( name, dset_name ) == 0 ) - ret = 1; + /* Shut the compiler up */ + loc_id = loc_id; + linfo = linfo; + /* Define a positive value for return value if the dataset was found. This will + * cause the iterator to immediately return that positive value, + * indicating short-circuit success + */ + if(strcmp(name, (char *)op_data) == 0) + ret = 1; - return ret; + return ret; } - /*------------------------------------------------------------------------- * Function: H5LTfind_dataset * @@ -1082,14 +1077,10 @@ static herr_t find_dataset( hid_t loc_id, const char *name, void *op_data) *------------------------------------------------------------------------- */ -herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) +herr_t +H5LTfind_dataset( hid_t loc_id, const char *dset_name ) { - - herr_t ret; - - ret = H5Giterate( loc_id, ".", 0, find_dataset, (void *)dset_name ); - - return ret; + return H5Literate(loc_id, ".", H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name, H5P_DEFAULT ); } diff --git a/src/H5Gdense.c b/src/H5Gdense.c index 070d551..98e216c 100644 --- a/src/H5Gdense.c +++ b/src/H5Gdense.c @@ -906,10 +906,12 @@ H5G_dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) /* Check which type of callback to make */ switch(bt2_udata->lnk_op->op_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS case H5G_LINK_OP_OLD: /* Make the old-type application callback */ ret_value = (bt2_udata->lnk_op->u.old_op)(bt2_udata->gid, fh_udata.lnk->name, bt2_udata->op_data); break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ case H5G_LINK_OP_APP: { diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 2ce8aa3..9145b3b 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -273,7 +273,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, const char *new_name) +H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name) { herr_t ret_value = SUCCEED; /* Return value */ @@ -318,7 +318,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type, +H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name) { herr_t ret_value = SUCCEED; /* Return value */ @@ -719,7 +719,6 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_comment() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -788,6 +787,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, done: FUNC_LEAVE_API(ret_value) } /* end H5Giterate() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- diff --git a/src/H5Glink.c b/src/H5Glink.c index fef0514..608cef2 100644 --- a/src/H5Glink.c +++ b/src/H5Glink.c @@ -623,10 +623,12 @@ H5G_link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, for(; u < ltable->nlinks && !ret_value; u++) { /* Check which kind of callback to make */ switch(lnk_op->op_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS case H5G_LINK_OP_OLD: /* Make the old-type application callback */ ret_value = (lnk_op->u.old_op)(gid, ltable->lnks[u].name, op_data); break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ case H5G_LINK_OP_APP: { diff --git a/src/H5Gnode.c b/src/H5Gnode.c index a1884ac..eaa426f 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -1437,10 +1437,12 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad /* Check which type of callback to make */ switch(udata->lnk_op->op_type) { +#ifndef H5_NO_DEPRECATED_SYMBOLS case H5G_LINK_OP_OLD: /* Make the old-type application callback */ ret_value = (udata->lnk_op->u.old_op)(udata->group_id, name, udata->op_data); break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ case H5G_LINK_OP_APP: { diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b17a54d..427dec4 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -133,12 +133,16 @@ typedef herr_t (*H5G_lib_iterate_t)(const H5O_link_t *lnk, void *op_data); /* Describe kind of callback to make for each link */ typedef struct { enum { +#ifndef H5_NO_DEPRECATED_SYMBOLS H5G_LINK_OP_OLD, /* Old application callback */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ H5G_LINK_OP_APP, /* Application callback */ H5G_LINK_OP_LIB /* Library internal callback */ } op_type; union { +#ifndef H5_NO_DEPRECATED_SYMBOLS H5G_iterate_t old_op; /* Old application callback for each link */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ H5L_iterate_t app_op; /* Application callback for each link */ H5G_lib_iterate_t lib_op; /* Library internal callback for each link */ } u; diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 26baf8b..6e6560c 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -47,12 +47,6 @@ #define H5G_NUSERTYPES (H5G_NTYPES-H5G_NLIBTYPES) #define H5G_USERTYPE(X) (8+(X)) /* User defined types */ -#define H5G_LINK_ERROR H5L_TYPE_ERROR -#define H5G_LINK_HARD H5L_TYPE_HARD -#define H5G_LINK_SOFT H5L_TYPE_SOFT -#define H5G_link_t H5L_type_t -#define H5G_SAME_LOC H5L_SAME_LOC - #ifdef __cplusplus extern "C" { #endif @@ -109,9 +103,6 @@ typedef struct H5G_stat_t { H5O_stat_t ohdr; /* Object header information */ } H5G_stat_t; -/* Prototype for H5Giterate() operator */ -typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data); - /********************/ /* Public Variables */ /********************/ @@ -139,8 +130,6 @@ H5_DLL herr_t H5Gclose(hid_t group_id); */ H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, size_t size); -H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, - H5G_iterate_t op, void *op_data); H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx); H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/); @@ -151,14 +140,28 @@ H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); */ #ifndef H5_NO_DEPRECATED_SYMBOLS +/* Macros */ + +/* Link definitions */ +#define H5G_SAME_LOC H5L_SAME_LOC +#define H5G_LINK_ERROR H5L_TYPE_ERROR +#define H5G_LINK_HARD H5L_TYPE_HARD +#define H5G_LINK_SOFT H5L_TYPE_SOFT +#define H5G_link_t H5L_type_t + + /* Typedefs */ +/* Prototype for H5Giterate() operator */ +typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data); + + /* Function prototypes */ H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); H5_DLL hid_t H5Gopen1(hid_t loc_id, const char *name); -H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5L_type_t type, const char *cur_name, +H5_DLL herr_t H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name); -H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5L_type_t type, +H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name); H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name); @@ -170,6 +173,8 @@ H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment); H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf); +H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, + H5G_iterate_t op, void *op_data); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 2bc525c..269c224 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -494,7 +494,7 @@ H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, /* Sanity check */ HDassert(oloc); - HDassert(lnk_op && lnk_op->u.old_op); + HDassert(lnk_op && lnk_op->u.app_op); /* Get the B-tree info */ if(NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab, dxpl_id)) diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 0902cd3..53f9746 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -118,13 +118,8 @@ typedef struct { long_long r, s, t; } stype4; -#if 1 -# define NX 100u -# define NY 2000u -#else -# define NX 12u -# define NY 9u -#endif +#define NX 100u +#define NY 2000u /*------------------------------------------------------------------------- @@ -1254,19 +1249,19 @@ error: *------------------------------------------------------------------------- */ static int -compare_data(unsigned char *src_data, unsigned char *dst_data, hbool_t src_subset) +compare_data(void *src_data, void *dst_data, hbool_t src_subset) { stype1 *s_ptr; stype2 *d_ptr; int i; - for (i=0; i<(int)NX*NY; i++) { + for(i = 0; i < (int)(NX * NY); i++) { if(src_subset) { s_ptr = ((stype1*)src_data) + i; - d_ptr = ((stype2*)dst_data) + i; + d_ptr = ((stype2*)dst_data) + i; } else { s_ptr = ((stype2*)src_data) + i; - d_ptr = ((stype1*)dst_data) + i; + d_ptr = ((stype1*)dst_data) + i; } if (s_ptr->a != d_ptr->a || @@ -1469,7 +1464,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) goto error; - if(compare_data(orig, rbuf, TRUE)<0) + if(compare_data(orig, rbuf, TRUE) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1482,7 +1477,7 @@ test_hdf5_src_subset(char *filename, hid_t fapl) if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) goto error; - if(compare_data(orig, rbuf, TRUE)<0) + if(compare_data(orig, rbuf, TRUE) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1673,7 +1668,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) goto error; - if(compare_data(orig, rbuf, FALSE)<0) + if(compare_data(orig, rbuf, FALSE) < 0) goto error; if(H5Dclose(dataset) < 0) @@ -1686,7 +1681,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) if(H5Dread(dataset, dst_tid, H5S_ALL, H5S_ALL, dxpl, rbuf)<0) goto error; - if(compare_data(orig, rbuf, FALSE)<0) + if(compare_data(orig, rbuf, FALSE) < 0) goto error; if(H5Dclose(dataset) < 0) diff --git a/test/links.c b/test/links.c index fe3ea79..96aa255 100644 --- a/test/links.c +++ b/test/links.c @@ -55,7 +55,7 @@ const char *FILENAME[] = { #define UD_PLIST_TYPE 128 #define UD_CBFAIL_TYPE UD_PLIST_TYPE #define UD_ERROR_TYPE 189 -#define UD_BAD_TYPE1 H5G_LINK_HARD +#define UD_BAD_TYPE1 H5L_TYPE_HARD #define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5) #define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1) @@ -5209,7 +5209,7 @@ linkinfo(hid_t fapl, hbool_t new_format) if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR - if(li.type != H5G_LINK_SOFT) TEST_ERROR + if(li.type != H5L_TYPE_SOFT) TEST_ERROR if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR if(li.type != UD_PLIST_TYPE) TEST_ERROR @@ -7148,6 +7148,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); return(H5_ITER_CONT); } /* end link_iterate_cb() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: group_iterate_cb @@ -7168,6 +7169,7 @@ 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)); } /* end group_iterate_cb() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -7211,7 +7213,9 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ +#ifndef H5_NO_DEPRECATED_SYMBOLS int gskip; /* # of links to skip in group, with H5Giterate */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ herr_t ret; /* Generic return value */ /* Iterate over links in group */ @@ -7229,6 +7233,7 @@ 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 +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = gskip = 0; iter_info->order = order; @@ -7242,6 +7247,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if(gskip != (int)max_links) TEST_ERROR for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Skip over some links in group */ @@ -7275,6 +7281,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, } /* end else */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = gskip = max_links / 2; iter_info->order = order; @@ -7304,6 +7311,7 @@ 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 */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Iterate over links in group, stopping in the middle */ @@ -7318,6 +7326,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, 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 = gskip = 0; iter_info->order = order; @@ -7328,6 +7337,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Check for iteration routine indicating failure */ @@ -7617,6 +7627,7 @@ HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr); return(H5_ITER_CONT); } /* end link_iterate_old_cb() */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /*------------------------------------------------------------------------- * Function: group_iterate_old_cb @@ -7637,6 +7648,7 @@ 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)); } /* end group_iterate_old_cb() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*------------------------------------------------------------------------- @@ -7658,7 +7670,9 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, { unsigned v; /* Local index variable */ hsize_t skip; /* # of links to skip in group */ +#ifndef H5_NO_DEPRECATED_SYMBOLS int gskip; /* # of links to skip in group, with H5Giterate */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ herr_t ret; /* Generic return value */ /* Iterate over links in group */ @@ -7676,6 +7690,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(iter_info->visited[v] == FALSE) TEST_ERROR +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ iter_info->nskipped = gskip = 0; iter_info->order = order; @@ -7689,6 +7704,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(gskip != (int)max_links) TEST_ERROR for(v = 0; v < max_links; v++) if(iter_info->visited[v] == FALSE) TEST_ERROR +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Skip over some links in group */ @@ -7722,6 +7738,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, } /* end else */ +#ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ iter_info->nskipped = gskip = max_links / 2; iter_info->order = order; @@ -7751,6 +7768,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if(nvisit != (max_links / 2)) TEST_ERROR } /* end else */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Iterate over links in group, stopping in the middle */ @@ -7765,6 +7783,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, 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 = gskip = 0; iter_info->order = order; @@ -7775,6 +7794,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info)) < 0) TEST_ERROR if(ret != CORDER_ITER_STOP) TEST_ERROR if(iter_info->ncalled != 3) TEST_ERROR +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /* Check for iteration routine indicating failure */ diff --git a/test/objcopy.c b/test/objcopy.c index 148eea4..3c6e03f 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -4979,7 +4979,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl) if(H5Dclose(did) < 0) TEST_ERROR /* make a hard link to the dataset */ - if(H5Lcreate_hard(fid_src, NAME_LINK_DATASET, H5G_SAME_LOC, NAME_LINK_HARD, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(fid_src, NAME_LINK_DATASET, H5L_SAME_LOC, NAME_LINK_HARD, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* make a soft link to the dataset */ if(H5Lcreate_soft(NAME_LINK_DATASET, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -7019,7 +7019,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t fapl, unsigned flag, hboo /* Create group to compare with */ if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if(H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5G_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR if(H5Gclose(gid) < 0) FAIL_STACK_ERROR } /* end if */ diff --git a/test/titerate.c b/test/titerate.c index 8f19c6c..c2a3b94 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -61,8 +61,10 @@ typedef struct { /* Local functions */ int iter_strcmp(const void *s1, const void *s2); int iter_strcmp2(const void *s1, const void *s2); -herr_t giter_cb(hid_t group, const char *name, void *op_data); -herr_t giter_cb2(hid_t group, const char *name, void *op_data); +static herr_t liter_cb(hid_t group, const char *name, const H5L_info_t *info, + void *op_data); +static herr_t liter_cb2(hid_t group, const char *name, const H5L_info_t *info, + void *op_data); herr_t aiter_cb(hid_t loc_id, const char *name, void *op_data); /**************************************************************** @@ -77,10 +79,12 @@ int iter_strcmp(const void *s1, const void *s2) /**************************************************************** ** -** giter_cb(): Custom group iteration callback routine. +** liter_cb(): Custom link iteration callback routine. ** ****************************************************************/ -herr_t giter_cb(hid_t UNUSED group, const char *name, void *op_data) +static herr_t +liter_cb(hid_t UNUSED group, const char *name, const H5L_info_t UNUSED *link_info, + void *op_data) { iter_info *info = (iter_info *)op_data; static int count = 0; @@ -107,14 +111,15 @@ herr_t giter_cb(hid_t UNUSED group, const char *name, void *op_data) printf("invalid iteration command"); return(-1); } /* end switch */ -} /* end giter_cb() */ +} /* end liter_cb() */ /**************************************************************** ** ** test_iter_group(): Test group iteration functionality ** ****************************************************************/ -static void test_iter_group(hid_t fapl, hbool_t new_format) +static void +test_iter_group(hid_t fapl, hbool_t new_format) { hid_t file; /* File ID */ hid_t dataset; /* Dataset ID */ @@ -122,7 +127,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) hid_t filespace; /* Common dataspace ID */ hid_t root_group,grp; /* Root group ID */ int i; /* counting variable */ - int idx; /* Index in the group */ + hsize_t idx; /* Index in the group */ char name[NAMELEN]; /* temporary name buffer */ char *lnames[NDATASETS + 2];/* Names of the links created */ char dataset_name[NAMELEN]; /* dataset name */ @@ -138,10 +143,10 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) CHECK(file, FAIL, "H5Fcreate"); /* Test iterating over empty group */ - info.command=RET_ZERO; - idx=0; - ret=H5Giterate(file,"/",&idx,giter_cb,&info); - VERIFY(ret, SUCCEED, "H5Giterate"); + info.command = RET_ZERO; + idx = 0; + ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); + VERIFY(ret, SUCCEED, "H5Literate"); datatype = H5Tcopy(H5T_NATIVE_INT); CHECK(datatype, FAIL, "H5Tcopy"); @@ -255,45 +260,45 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) /* Test invalid indices for starting iteration */ info.command = RET_ZERO; - idx = -1; + idx = (hsize_t)-1; H5E_BEGIN_TRY { - ret = H5Giterate(file, "/", &idx, giter_cb, &info); + ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Giterate"); + VERIFY(ret, FAIL, "H5Literate"); /* Test skipping exactly as many entries as in the group */ idx = NDATASETS + 2; H5E_BEGIN_TRY { - ret = H5Giterate(file, "/", &idx, giter_cb, &info); + ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Giterate"); + VERIFY(ret, FAIL, "H5Literate"); /* Test skipping more entries than are in the group */ idx = NDATASETS + 3; H5E_BEGIN_TRY { - ret = H5Giterate(file, "/", &idx, giter_cb, &info); + ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT); } H5E_END_TRY; - VERIFY(ret, FAIL, "H5Giterate"); + VERIFY(ret, FAIL, "H5Literate"); /* Test all objects in group, when callback always returns 0 */ info.command = RET_ZERO; idx = 0; - if((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) > 0) + if((ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT)) > 0) TestErrPrintf("Group iteration function didn't return zero correctly!\n"); /* Test all objects in group, when callback always returns 1 */ /* This also tests the "restarting" ability, because the index changes */ info.command = RET_TWO; idx = i = 0; - while((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) > 0) { + while((ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT)) > 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 2, "H5Giterate"); + VERIFY(ret, 2, "H5Literate"); /* Increment the number of times "2" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, i, "H5Giterate"); + VERIFY(idx, (hsize_t)i, "H5Literate"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -301,7 +306,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[idx - 1]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (idx - 1), lnames[idx - 1]); } /* end while */ - VERIFY(ret, -1, "H5Giterate"); + VERIFY(ret, -1, "H5Literate"); if(i != (NDATASETS + 2)) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -310,15 +315,15 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) /* This also tests the "restarting" ability, because the index changes */ info.command = new_format ? RET_CHANGE2 : RET_CHANGE; idx = i = 0; - while((ret = H5Giterate(file, "/", &idx, giter_cb, &info)) >= 0) { + while((ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info, H5P_DEFAULT)) >= 0) { /* Verify return value from iterator gets propagated correctly */ - VERIFY(ret, 1, "H5Giterate"); + VERIFY(ret, 1, "H5Literate"); /* Increment the number of times "1" is returned */ i++; /* Verify that the index is the correct value */ - VERIFY(idx, (i + 10), "H5Giterate"); + VERIFY(idx, (hsize_t)(i + 10), "H5Literate"); if(idx > (NDATASETS + 2)) TestErrPrintf("Group iteration function walked too far!\n"); @@ -326,7 +331,7 @@ static void test_iter_group(hid_t fapl, hbool_t new_format) if(HDstrcmp(info.name, lnames[idx - 1]) != 0) TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (idx - 1), lnames[idx - 1]); } /* end while */ - VERIFY(ret, -1, "H5Giterate"); + VERIFY(ret, -1, "H5Literate"); if(i != 42 || idx != 52) TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__); @@ -534,10 +539,12 @@ int iter_strcmp2(const void *s1, const void *s2) /**************************************************************** ** -** giter_cb2(): Custom group iteration callback routine. +** liter_cb2(): Custom link iteration callback routine. ** ****************************************************************/ -herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata) +static herr_t +liter_cb2(hid_t loc_id, const char *name, const H5L_info_t UNUSED *link_info, + void *opdata) { const iter_info *test_info = (const iter_info *)opdata; H5G_stat_t statbuf; @@ -545,7 +552,7 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata) if(HDstrcmp(name, test_info->name)) { TestErrPrintf("name = '%s', test_info = '%s'\n", name, test_info->name); - return(-1); + return(H5_ITER_ERROR); } /* end if */ /* @@ -556,11 +563,11 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata) if(test_info->type != statbuf.type) { TestErrPrintf("test_info->type = %d, statbuf.type = %d\n", test_info->type, statbuf.type); - return(-1); + return(H5_ITER_ERROR); } /* end if */ - return(1); -} /* giter_cb2() */ + return(H5_ITER_STOP); +} /* liter_cb2() */ /**************************************************************** ** @@ -568,7 +575,8 @@ herr_t giter_cb2(hid_t loc_id, const char *name, void *opdata) ** for groups with large #'s of objects ** ****************************************************************/ -static void test_iter_group_large(hid_t fapl) +static void +test_iter_group_large(hid_t fapl) { hid_t file; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ @@ -666,12 +674,14 @@ static void test_iter_group_large(hid_t fapl) /* Iterate through the file to see members of the root group */ curr_name = &names[0]; - ret = H5Giterate(file, "/", NULL, giter_cb2, curr_name); - CHECK(ret, FAIL, "H5Giterate"); - for(i = 1; i < 100; ) { + ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Literate"); + for(i = 1; i < 100; i++) { + hsize_t idx = i; + curr_name = &names[i]; - ret = H5Giterate(file, "/", &i, giter_cb2, curr_name); - CHECK(ret, FAIL, "H5Giterate"); + ret = H5Literate(file, "/", H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Literate"); } /* end for */ /* Close file */ diff --git a/test/trefer.c b/test/trefer.c index 6ea69fd..318858e 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -937,7 +937,8 @@ test_reference_obj_deleted(void) ** ****************************************************************/ static herr_t -test_deref_iter_op(hid_t UNUSED group, const char *name, void *op_data) +test_deref_iter_op(hid_t UNUSED group, const char *name, const H5L_info_t *info, + void *op_data) { int *count = (int *)op_data; /* Pointer to name counter */ herr_t ret_value; @@ -1060,8 +1061,8 @@ test_reference_group(void) CHECK(gid, FAIL, "H5Rdereference"); /* Iterate through objects in dereferenced group */ - ret = H5Giterate(gid, ".", NULL, test_deref_iter_op, &count); - CHECK(ret, FAIL, "H5Giterate"); + ret = H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Literate"); /* Various queries on the group opened */ ret = H5Gget_num_objs(gid, &nobjs); diff --git a/test/tunicode.c b/test/tunicode.c index 788c8a3..66432a3 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -491,7 +491,7 @@ void test_objnames(hid_t fid, const char* string) HDstrcpy(path_buf, GROUP2_NAME); HDstrcat(path_buf, "/"); HDstrcat(path_buf, string); - ret = H5Lcreate_hard(grp3_id, path_buf, H5G_SAME_LOC, string, H5P_DEFAULT, H5P_DEFAULT); + ret = H5Lcreate_hard(grp3_id, path_buf, H5L_SAME_LOC, string, H5P_DEFAULT, H5P_DEFAULT); CHECK(ret, FAIL, "H5Lcreate_hard"); /* Open named datatype using soft link */ diff --git a/test/unlink.c b/test/unlink.c index 170c87d..a3a4213 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -181,7 +181,7 @@ test_many(hid_t file) TESTING("forward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); @@ -193,7 +193,7 @@ test_many(hid_t file) TESTING("backward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = (how_many - 1); i >= 0; --i) { sprintf(name, "obj_%05d", i); @@ -205,7 +205,7 @@ test_many(hid_t file) TESTING("inward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = 0; i < how_many; i++) { if(i % 2) @@ -220,7 +220,7 @@ test_many(hid_t file) TESTING("outward unlink"); for(i = 0; i < how_many; i++) { sprintf(name, "obj_%05d", i); - if(H5Lcreate_hard(work, "/test_many_foo", H5G_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Lcreate_hard(work, "/test_many_foo", H5L_SAME_LOC, name, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR } /* end for */ for(i = (how_many - 1); i >= 0; --i) { if(i % 2) @@ -380,9 +380,9 @@ test_new_move(hid_t fapl) if(H5Lcreate_soft("/group1/group_move", grp_2, "soft", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR /* Move a group within the file. Both of source and destination use - * H5G_SAME_LOC. Should fail. */ + * H5L_SAME_LOC. Should fail. */ H5E_BEGIN_TRY { - if(H5Lmove(H5G_SAME_LOC, "group_move", H5G_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. */ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index d8fe56b..6f77ba3 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -96,7 +96,7 @@ static int indent; /*how far in to indent the line static hid_t h5_fileaccess(void); static void dump_oid(hid_t oid); static void print_enum(hid_t type); -static herr_t dump_all(hid_t group, const char *name, void *op_data); +static herr_t dump_all(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data); static int xml_name_to_XID(const char *, char *, int , int ); static void init_prefix(char **prfx, size_t prfx_len); static void add_prefix(char **prfx, size_t *prfx_len, const char *name); @@ -1411,12 +1411,11 @@ dump_selected_attr(hid_t loc_id, const char *name) *------------------------------------------------------------------------- */ static herr_t -dump_all(hid_t group, const char *name, void * op_data) +dump_all(hid_t group, const char *name, const H5L_info_t *linfo, void * op_data) { hid_t obj; char *obj_path = NULL; /* Full path of object */ H5G_stat_t statbuf; - H5L_info_t linfo; /* Link information */ herr_t ret = SUCCEED; /* Stat the object */ @@ -1426,12 +1425,6 @@ dump_all(hid_t group, const char *name, void * op_data) ret = FAIL; goto done; } /* end if */ - if(H5Lget_info(group, name, &linfo, H5P_DEFAULT) < 0) { - error_msg(progname, "unable to get object information\n"); - d_status = EXIT_FAILURE; - ret = FAIL; - goto done; - } /* end if */ if (*(int *)op_data != H5G_UNKNOWN && statbuf.type != *(int *) op_data) goto done; @@ -1541,9 +1534,10 @@ dump_all(hid_t group, const char *name, void * op_data) HDfree(targbuf); break; } + case H5G_UDLINK: indentation(indent); - switch(linfo.type) { + switch(linfo->type) { case H5L_TYPE_EXTERNAL: { char *targbuf; @@ -1568,7 +1562,7 @@ dump_all(hid_t group, const char *name, void * op_data) } else { if (!doxml) { indentation(indent + COL); - printf("LINKCLASS %d\n", linfo.type); + printf("LINKCLASS %d\n", linfo->type); indentation(indent + COL); printf("TARGETFILE \"%s\"\n", filename); indentation(indent + COL); @@ -1622,7 +1616,7 @@ dump_all(hid_t group, const char *name, void * op_data) indentation(indent + COL); } if (!doxml) - printf("LINKCLASS %d\n", linfo.type); + printf("LINKCLASS %d\n", linfo->type); else /* XML */ { char linkxid[100]; @@ -1644,7 +1638,7 @@ dump_all(hid_t group, const char *name, void * op_data) t_name, /* LinkName */ linkxid, /* OBJ-XID */ t_obj_path, /* H5SourcePath */ - linfo.type, /* LinkClass */ + linfo->type, /* LinkClass */ parentxid, /* Parents */ t_prefix); /* H5ParentPaths */ HDfree(t_prefix); @@ -1879,12 +1873,12 @@ dump_group(hid_t gid, const char *name) /* dump unamed type in root group */ for (u = 0; u < type_table->nobjs; u++) if (!type_table->objs[u].recorded) { - dset = H5Dopen(gid, type_table->objs[u].objname); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); + dset = H5Dopen(gid, type_table->objs[u].objname); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); } } /* end if */ @@ -1896,22 +1890,22 @@ dump_group(hid_t gid, const char *name) found_obj = search_obj(group_table, objno); - if (found_obj == NULL) { - indentation(indent); - error_msg(progname, "internal error (file %s:line %d)\n", - __FILE__, __LINE__); - d_status = EXIT_FAILURE; - } else if (found_obj->displayed) { - indentation(indent); - printf("%s \"%s\"\n", HARDLINK, found_obj->objname); + if (found_obj == NULL) { + indentation(indent); + error_msg(progname, "internal error (file %s:line %d)\n", + __FILE__, __LINE__); + d_status = EXIT_FAILURE; + } else if (found_obj->displayed) { + indentation(indent); + printf("%s \"%s\"\n", HARDLINK, found_obj->objname); + } else { + found_obj->displayed = TRUE; + H5Aiterate(gid, NULL, dump_attr, NULL); + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); + } } else { - found_obj->displayed = TRUE; H5Aiterate(gid, NULL, dump_attr, NULL); - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); - } - } else { - H5Aiterate(gid, NULL, dump_attr, NULL); - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); } indent -= COL; @@ -3786,7 +3780,7 @@ main(int argc, const char *argv[]) /* find all objects that might be targets of a refernce */ init_ref_path_table(fid); /* Insert the root group into the ref. path table */ - H5Giterate(fid, (const char *)"/", NULL, fill_ref_path_table, (void *)""); + H5Literate(fid, (const char *)"/", H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table, (void *)"", H5P_DEFAULT); if(doxml) { /* initialize XML */ @@ -5247,15 +5241,15 @@ xml_dump_group(hid_t gid, const char *name) /* iterate through all the members */ xtype = H5G_TYPE; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); xtype = H5G_DATASET; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); xtype = H5G_GROUP; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); xtype = H5G_LINK; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); xtype = H5G_UDLINK; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); } free(t_name); free(grpxid); @@ -5263,60 +5257,60 @@ xml_dump_group(hid_t gid, const char *name) } } else { - /* only link -- must be first time! */ - char *t_name = xml_escape_the_name(name); - char *grpxid = malloc(100); - char *parentxid = malloc(100); - if (isRoot) { - xml_name_to_XID("/",grpxid,100,1); - printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", - xmlnsprefix,grpxid,"/"); - } else { - char *t_tmp = xml_escape_the_name(tmp); - par_name = xml_escape_the_name(par); - xml_name_to_XID(tmp,grpxid,100,1); - xml_name_to_XID(par,parentxid,100,1); - printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " - "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", - xmlnsprefix,t_name, grpxid, t_tmp, - parentxid, par_name); - free(t_tmp); - free(par_name); - } - free(t_name); - free(grpxid); - free(parentxid); + /* only link -- must be first time! */ + char *t_name = xml_escape_the_name(name); + char *grpxid = malloc(100); + char *parentxid = malloc(100); + if (isRoot) { + xml_name_to_XID("/",grpxid,100,1); + printf("<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">\n", + xmlnsprefix,grpxid,"/"); + } else { + char *t_tmp = xml_escape_the_name(tmp); + par_name = xml_escape_the_name(par); + xml_name_to_XID(tmp,grpxid,100,1); + xml_name_to_XID(par,parentxid,100,1); + printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " + "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", + xmlnsprefix,t_name, grpxid, t_tmp, + parentxid, par_name); + free(t_tmp); + free(par_name); + } + free(t_name); + free(grpxid); + free(parentxid); - /* 1. do all the attributes of the group */ - H5Aiterate(gid, NULL, dump_function_table->dump_attribute_function, NULL); + /* 1. do all the attributes of the group */ + H5Aiterate(gid, NULL, dump_function_table->dump_attribute_function, NULL); - if (!strcmp(name, "/") && unamedtype) { + if (!strcmp(name, "/") && unamedtype) { unsigned u; - /* Very special case: dump unamed type in root group */ - for (u = 0; u < type_table->nobjs; u++) { - if (!type_table->objs[u].recorded) { - dset = H5Dopen(gid, type_table->objs[u].objname); - type = H5Dget_type(dset); - sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); - dump_function_table->dump_named_datatype_function(type, type_name); - H5Tclose(type); - H5Dclose(dset); - } + /* Very special case: dump unamed type in root group */ + for (u = 0; u < type_table->nobjs; u++) { + if (!type_table->objs[u].recorded) { + dset = H5Dopen(gid, type_table->objs[u].objname); + type = H5Dget_type(dset); + sprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno); + dump_function_table->dump_named_datatype_function(type, type_name); + H5Tclose(type); + H5Dclose(dset); + } + } } - } - /* iterate through all the members */ - xtype = H5G_TYPE; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); - xtype = H5G_DATASET; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); - xtype = H5G_GROUP; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); - xtype = H5G_LINK; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); - xtype = H5G_UDLINK; - H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); + /* iterate through all the members */ + xtype = H5G_TYPE; + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); + xtype = H5G_DATASET; + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); + xtype = H5G_GROUP; + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); + xtype = H5G_LINK; + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); + xtype = H5G_UDLINK; + H5Literate(gid, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, dump_all, (void *) &xtype, H5P_DEFAULT); } indent -= COL; diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 9dce3f9..c3c89a3 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -76,7 +76,7 @@ static struct dispatch_t { dispatch_g[TYPE].list2 = (LIST2); \ } -static herr_t list (hid_t group, const char *name, void *cd); +static herr_t list (hid_t group, const char *name, const H5L_info_t *linfo, void *cd); static void display_type(hid_t type, int ind); static char *fix_name(const char *path, const char *base); @@ -1673,7 +1673,7 @@ group_list2(hid_t grp, const char *name) if (recursive_g) { iter.container = name; - H5Giterate(grp, ".", NULL, list, &iter); + H5Literate(grp, ".", H5_INDEX_NAME, H5_ITER_INC, NULL, list, &iter, H5P_DEFAULT); } return 0; } @@ -1830,10 +1830,10 @@ error: *------------------------------------------------------------------------- */ static herr_t -list (hid_t group, const char *name, void *_iter) +list(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void *_iter) { - hid_t obj=-1; - char buf[512], comment[50], *fullname=NULL, *s=NULL; + hid_t obj = -1; + char buf[512], comment[50], *fullname = NULL, *s = NULL; H5G_stat_t sb; haddr_t objno; /* Compact form of object's location */ struct tm *tm; @@ -1855,21 +1855,20 @@ list (hid_t group, const char *name, void *_iter) H5E_BEGIN_TRY { status = H5Gget_objinfo(group, name, FALSE, &sb); } H5E_END_TRY; - if (status<0) { + if(status < 0) { puts("**NOT FOUND**"); return 0; - } else if (sb.type<0 || sb.type>=H5G_NTYPES) { + } else if(sb.type < 0 || sb.type >= H5G_NTYPES) { printf("Unknown type(%d)", sb.type); sb.type = H5G_UNKNOWN; } - if (sb.type>=0 && dispatch_g[sb.type].name) { + if(sb.type >= 0 && dispatch_g[sb.type].name) fputs(dispatch_g[sb.type].name, stdout); - } objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long))); /* If the object has already been printed then just show the object ID * and return. */ - if ((s=sym_lookup(&sb))) { + if((s = sym_lookup(&sb))) { printf(", same as "); display_string(stdout, s, TRUE); printf("\n"); @@ -1918,7 +1917,7 @@ list (hid_t group, const char *name, void *_iter) puts("\""); } /* end if */ } /* end if */ - if(sb.type>=0 && dispatch_g[sb.type].list2) + if(sb.type >= 0 && dispatch_g[sb.type].list2) (dispatch_g[sb.type].list2)(obj, fullname); done: @@ -2340,7 +2339,7 @@ main (int argc, const char *argv[]) } /* end if */ /* list */ - H5Giterate(file, oname, NULL, list, &iter); + H5Literate(file, oname, H5_INDEX_NAME, H5_ITER_INC, NULL, list, &iter, H5P_DEFAULT); free(container); } else if((root = H5Gopen2(file, "/", H5P_DEFAULT)) < 0) { @@ -2350,7 +2349,7 @@ main (int argc, const char *argv[]) /* Specified name is a non-group object -- list that object. The * container for the object is everything up to the base name. */ iter.container = show_file_name_g ? fname : "/"; - list(root, oname, &iter); + list(root, oname, NULL, &iter); if(H5Gclose(root) < 0) leave(1); } diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index 280023e..6c4f1af 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -459,7 +459,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) */ static herr_t group_stats(hid_t group, const char *name, const char *fullname, - const H5O_info_t *oi, H5G_iterate_t walk, iter_t *iter) + const H5O_info_t *oi, H5L_iterate_t walk, iter_t *iter) { hid_t gid; /* Group ID */ const char *last_container; @@ -525,7 +525,7 @@ group_stats(hid_t group, const char *name, const char *fullname, iter->curr_depth++; /* Recursively descend into current group's objects */ - H5Giterate(group, name, NULL, walk, iter); + H5Literate(group, name, H5_INDEX_NAME, H5_ITER_INC, NULL, walk, iter, H5P_DEFAULT); /* Revert current container info */ iter->container = last_container; @@ -742,7 +742,7 @@ dataset_stats(hid_t group, const char *name, const H5O_info_t *oi, iter_t *iter) *------------------------------------------------------------------------- */ static herr_t -walk(hid_t group, const char *name, void *_iter) +walk(hid_t group, const char *name, const H5L_info_t *linfo, void *_iter) { iter_t *iter = (iter_t *)_iter; H5O_info_t oi; @@ -1359,7 +1359,7 @@ main(int argc, const char *argv[]) for(i = 0; i < argc; i++) { if(hand[i].obj) { if(hand[i].flag) { - walk(fid, hand[i].obj, &iter); + walk(fid, hand[i].obj, NULL, &iter); print_statistics(hand[i].obj, &iter); } } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 5334a51..50bc6cd 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -894,9 +894,8 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset if (count == 1) flags |= END_OF_DATA; - for (i = 0; i < ctx.ndims; i++) { + for (i = 0; i < ctx.ndims; i++) ctx.p_max_idx[i] = ctx.p_min_idx[i] + MIN(total_size[i], sm_size[i]); - } /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 6313992..dad73e7 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -348,7 +348,7 @@ typedef struct h5tools_context_t { size_t cur_column; /*current column for output */ size_t cur_elmt; /*current element/output line */ int need_prefix; /*is line prefix needed? */ - int ndims; /*dimensionality */ + unsigned ndims; /*dimensionality */ hsize_t p_min_idx[H5S_MAX_RANK]; /*min selected index */ hsize_t p_max_idx[H5S_MAX_RANK]; /*max selected index */ int prev_multiline; /*was prev datum multiline? */ diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 2a7a4ff..0b17b41 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -339,7 +339,8 @@ lookup_ref_path(haddr_t ref) *------------------------------------------------------------------------- */ herr_t -fill_ref_path_table(hid_t group, const char *obj_name, void *op_data) +fill_ref_path_table(hid_t group, const char *obj_name, const H5L_info_t UNUSED *linfo, + void *op_data) { const char *obj_prefix = (const char *)op_data; H5G_stat_t statbuf; @@ -372,7 +373,7 @@ fill_ref_path_table(hid_t group, const char *obj_name, void *op_data) /* Iterate over objects in this group, using this group's * name as their prefix */ - if(H5Giterate(group, obj_name, NULL, fill_ref_path_table, thepath) < 0) { + if(H5Literate(group, obj_name, H5_INDEX_NAME, H5_ITER_INC, NULL, fill_ref_path_table, thepath, H5P_DEFAULT) < 0) { error_msg(progname, "unable to dump group \"%s\"\n", obj_name); d_status = EXIT_FAILURE; } diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h index 1922e02..d996114 100644 --- a/tools/lib/h5tools_ref.h +++ b/tools/lib/h5tools_ref.h @@ -24,7 +24,7 @@ extern "C" { int init_ref_path_table(hid_t fid); const char *lookup_ref_path(haddr_t ref); -herr_t fill_ref_path_table(hid_t, const char *, void *); +herr_t fill_ref_path_table(hid_t, const char *, const H5L_info_t *, void *); int get_next_xid(void); haddr_t get_fake_xid (void); haddr_t ref_path_table_lookup(const char *); diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index d00d0e7..737c68a 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -845,15 +845,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (h5tools_is_zero(vp, H5Tget_size(type))) { h5tools_str_append(str, "NULL"); } else { - char name[1024]; + char ref_name[1024]; obj = H5Rdereference(container, H5R_DATASET_REGION, vp); region = H5Rget_region(container, H5R_DATASET_REGION, vp); H5Gget_objinfo(obj, ".", FALSE, &sb); /* get name of the dataset the region reference points to using H5Rget_name */ - H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*)name, 1024); - h5tools_str_append(str, info->dset_format, name); + H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*)ref_name, 1024); + h5tools_str_append(str, info->dset_format, ref_name); h5tools_str_dump_region(str, region, info); H5Sclose(region); diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index bba2973..b04f3c6 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -46,7 +46,8 @@ static void dump_table(char* tablename, table_t *table); #endif /* H5DUMP_DEBUG */ static void add_obj(table_t *table, haddr_t objno, char *objname, hbool_t recorded); static char * build_obj_path_name(const char *prefix, const char *name); -static herr_t find_objs_cb(hid_t group, const char *name, void *op_data); +static herr_t find_objs_cb(hid_t group, const char *name, const H5L_info_t *info, + void *op_data); /*------------------------------------------------------------------------- @@ -480,7 +481,7 @@ build_obj_path_name(const char *prefix, const char *name) *------------------------------------------------------------------------- */ static herr_t -find_objs_cb(hid_t group, const char *name, void *op_data) +find_objs_cb(hid_t group, const char *name, const H5L_info_t UNUSED *linfo, void *op_data) { H5G_stat_t statbuf; find_objs_t *info = (find_objs_t*)op_data; @@ -508,7 +509,7 @@ find_objs_cb(hid_t group, const char *name, void *op_data) info->prefix = HDmalloc(tmp_len+1); HDstrcpy(info->prefix, tmp); - if(H5Giterate(group, name, NULL, find_objs_cb, (void *)info) < 0) + if(H5Literate(group, name, H5_INDEX_NAME, H5_ITER_INC, NULL, find_objs_cb, (void *)info, H5P_DEFAULT) < 0) ret_value = FAIL; info->prefix = old_prefix; @@ -625,7 +626,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, /* Find all shared objects */ - return(H5Giterate(fid, "/", NULL, find_objs_cb, (void *)info)); + return(H5Literate(fid, "/", H5_INDEX_NAME, H5_ITER_INC, NULL, find_objs_cb, (void *)info, H5P_DEFAULT)); } diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 7ba2cc3..37fa9a1 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -371,19 +371,19 @@ static hssize_t get_nnames( hid_t loc_id, const char *group_name ) *------------------------------------------------------------------------- */ -static herr_t opget_info( hid_t loc_id, const char *name, void *op_data) +static herr_t +opget_info(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_data) { + H5G_stat_t statbuf; - H5G_stat_t statbuf; + if(H5Gget_objinfo(loc_id, name, FALSE, &statbuf) < 0) + return -1; - if (H5Gget_objinfo( loc_id, name, FALSE, &statbuf) < 0 ) - return -1; - - ((trav_info_t *)op_data)->type = statbuf.type; - ((trav_info_t *)op_data)->name = (char *)HDstrdup(name); + ((trav_info_t *)op_data)->type = statbuf.type; + ((trav_info_t *)op_data)->name = (char *)HDstrdup(name); - /* Define 1 for return. This will cause the iterator to stop */ - return 1; + /* Define 1 for return. This will cause the iterator to stop */ + return 1; } @@ -410,20 +410,20 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data) static herr_t get_name_type( hid_t loc_id, const char *group_name, - int idx, + int _idx, char **name, H5G_obj_t *type ) { + trav_info_t info; + hsize_t idx = (hsize_t)_idx; - trav_info_t info; + if(H5Literate(loc_id, group_name, H5_INDEX_NAME, H5_ITER_INC, &idx, opget_info, (void *)&info, H5P_DEFAULT) < 0) + return -1; - if (H5Giterate( loc_id, group_name, &idx, opget_info, (void *)&info) < 0 ) - return -1; - - *name = info.name; - *type = info.type; + *name = info.name; + *type = info.type; - return 0; + return 0; } /*------------------------------------------------------------------------- |