diff options
-rw-r--r-- | tools/lib/h5tools_utils.c | 118 |
1 files changed, 60 insertions, 58 deletions
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 764d8b2..3e63c56 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -485,80 +485,82 @@ find_objs_cb(hid_t group, const char *name, void *op_data) find_objs_t *info = (find_objs_t*)op_data; herr_t ret_value = 0; - H5Gget_objinfo(group, name, TRUE, &statbuf); + if(H5Gget_objinfo(group, name, FALSE, &statbuf) < 0) + ret_value = FAIL; + else { + switch (statbuf.type) { + char *tmp; - switch (statbuf.type) { - char *tmp; + case H5G_GROUP: + if (search_obj(info->group_table, statbuf.u.obj.objno) == NULL) { + char *old_prefix; - case H5G_GROUP: - if (search_obj(info->group_table, statbuf.u.obj.objno) == NULL) { - char *old_prefix; + tmp = build_obj_path_name(info->prefix, name); + add_obj(info->group_table, statbuf.u.obj.objno, tmp, TRUE); - tmp = build_obj_path_name(info->prefix, name); - add_obj(info->group_table, statbuf.u.obj.objno, tmp, TRUE); + old_prefix = info->prefix; + info->prefix = tmp; - old_prefix = info->prefix; - info->prefix = tmp; + if(H5Giterate(group, name, NULL, find_objs_cb, (void *)info) < 0) + ret_value = FAIL; - if(H5Giterate(group, name, NULL, find_objs_cb, (void *)info) < 0) - ret_value = FAIL; + info->prefix = old_prefix; + } /* end if */ + break; - info->prefix = old_prefix; - } /* end if */ - break; + case H5G_DATASET: + if (search_obj(info->dset_table, statbuf.u.obj.objno) == NULL) { + hid_t dset; - case H5G_DATASET: - if (search_obj(info->dset_table, statbuf.u.obj.objno) == NULL) { - hid_t dset; + tmp = build_obj_path_name(info->prefix, name); + add_obj(info->dset_table, statbuf.u.obj.objno, tmp, TRUE); - tmp = build_obj_path_name(info->prefix, name); - add_obj(info->dset_table, statbuf.u.obj.objno, tmp, TRUE); + if ((dset = H5Dopen (group, name)) >= 0) { + hid_t type; - if ((dset = H5Dopen (group, name)) >= 0) { - hid_t type; + type = H5Dget_type(dset); - type = H5Dget_type(dset); + if (H5Tcommitted(type) > 0) { + H5Gget_objinfo(type, ".", TRUE, &statbuf); - if (H5Tcommitted(type) > 0) { - H5Gget_objinfo(type, ".", TRUE, &statbuf); + if (search_obj(info->type_table, statbuf.u.obj.objno) == NULL) { + char *type_name = HDstrdup(tmp); - if (search_obj(info->type_table, statbuf.u.obj.objno) == NULL) { - char *type_name = HDstrdup(tmp); + add_obj(info->type_table, statbuf.u.obj.objno, type_name, FALSE); + } /* end if */ + } - add_obj(info->type_table, statbuf.u.obj.objno, type_name, FALSE); - } /* end if */ + H5Tclose(type); + H5Dclose(dset); + } else { + ret_value = FAIL; } + } /* end if */ + break; - H5Tclose(type); - H5Dclose(dset); - } else { - ret_value = FAIL; - } - } /* end if */ - break; - - case H5G_TYPE: - { - obj_t *found_obj; - - tmp = build_obj_path_name(info->prefix, name); - if ((found_obj = search_obj(info->type_table, statbuf.u.obj.objno)) == NULL) - add_obj(info->type_table, statbuf.u.obj.objno, tmp, TRUE); - else { - /* Use latest version of name */ - HDfree(found_obj->objname); - found_obj->objname = HDstrdup(tmp); - - /* Mark named datatype as having valid name */ - found_obj->recorded = TRUE; - } /* end else */ - break; - } + case H5G_TYPE: + { + obj_t *found_obj; - default: - /* Ignore links, etc. */ - break; - } + tmp = build_obj_path_name(info->prefix, name); + if ((found_obj = search_obj(info->type_table, statbuf.u.obj.objno)) == NULL) + add_obj(info->type_table, statbuf.u.obj.objno, tmp, TRUE); + else { + /* Use latest version of name */ + HDfree(found_obj->objname); + found_obj->objname = HDstrdup(tmp); + + /* Mark named datatype as having valid name */ + found_obj->recorded = TRUE; + } /* end else */ + break; + } + + default: + /* Ignore links, etc. */ + break; + } + } /* end else */ return ret_value; } |