diff options
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5trav.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index d0a4a76..90e6d3d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -50,6 +50,10 @@ typedef struct { hid_t fid; /* File ID being traversed */ } trav_print_udata_t; +typedef struct trav_path_op_data_t { + const char *path; +} trav_path_op_data_t; + /* format for hsize_t */ #ifdef H5TRAV_PRINT_SPACE #define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u" @@ -899,11 +903,11 @@ trav_attr(hid_t #ifndef H5TRAV_PRINT_SPACE UNUSED #endif /* H5TRAV_PRINT_SPACE */ -obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, void *op_data) +obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, void *_op_data) { - char *buf; + trav_path_op_data_t *op_data = (trav_path_op_data_t *)_op_data; + const char *buf = op_data->path; - buf = (char*)op_data; if((strlen(buf)==1) && (*buf=='/')) printf(" %-10s %s%s", "attribute", buf, attr_name); else @@ -1009,10 +1013,14 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, /* Check if we've already seen this object */ if(NULL == already_visited) { + trav_path_op_data_t op_data; + + op_data.path = path; /* Finish printing line about object */ printf("\n"); if(trav_verbosity > 0) - H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, NULL, trav_attr, (void *)path, H5P_DEFAULT); + H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, + NULL, trav_attr, &op_data, H5P_DEFAULT); } else /* Print the link's original name */ |