diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-12-28 05:02:26 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2019-12-28 20:08:04 (GMT) |
commit | 2cbf31cb3ad8032fb1915c783dc52a2050aaf7da (patch) | |
tree | d88ce3a7584792894bd073df1f2290f22eb69daa | |
parent | 34a68acc934800d6b8c9a51c2ce91155b3178111 (diff) | |
download | hdf5-2cbf31cb3ad8032fb1915c783dc52a2050aaf7da.zip hdf5-2cbf31cb3ad8032fb1915c783dc52a2050aaf7da.tar.gz hdf5-2cbf31cb3ad8032fb1915c783dc52a2050aaf7da.tar.bz2 |
Refactor tools library error handling macros
-rw-r--r-- | tools/lib/h5diff.c | 261 | ||||
-rw-r--r-- | tools/lib/h5diff.h | 49 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 334 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 130 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 161 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 8 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 168 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 319 | ||||
-rw-r--r-- | tools/lib/h5tools_error.h | 191 | ||||
-rw-r--r-- | tools/lib/h5tools_filters.c | 25 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 79 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 32 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 20 | ||||
-rw-r--r-- | tools/src/h5copy/h5copy.c | 24 | ||||
-rw-r--r-- | tools/src/h5diff/h5diff_common.c | 45 | ||||
-rw-r--r-- | tools/src/h5ls/h5ls.c | 123 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack.c | 103 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_copy.c | 222 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_filters.c | 66 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_opttable.c | 10 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_refs.c | 162 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_verify.c | 114 | ||||
-rw-r--r-- | tools/src/h5stat/h5stat.c | 44 |
23 files changed, 1390 insertions, 1300 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 74bc2f9..d4a2d56 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -143,20 +143,19 @@ is_valid_options(diff_opt_t *opts) * no -q(quiet) with -v (verbose) or -r (report) */ if(opts->m_quiet && (opts->m_verbose || opts->m_report)) { parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); - opts->err_stat = 1; - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_DONE(0); } /* ------------------------------------------------------- * only allow --no-dangling-links along with --follow-symlinks */ if(opts->no_dangle_links && !opts->follow_links) { parallel_print("Error: --no-dangling-links must be used along with --follow-symlinks option.\n"); - opts->err_stat = 1; - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_DONE(0); } done: - return ret_value; } @@ -178,7 +177,7 @@ is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts) /* check if exclude path option is given */ if (!opts->exclude_path) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /* assign to local exclude list pointer */ exclude_path_ptr = opts->exclude; @@ -277,12 +276,11 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 size_t idx; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list start - errstat:%d", opts->err_stat); /* init */ trav_table_init(&table); if (table == NULL) { - H5TOOLS_INFO(H5E_tools_min_info_id_g, "Cannot create traverse table"); - HGOTO_DONE(-1); + H5TOOLS_GOTO_ERROR(-1, "Cannot create traverse table"); } /* * This is necessary for the case that given objects are group and @@ -374,10 +372,10 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2 done: *table_out = table; - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list finish"); + H5TOOLS_DEBUG("build_match_list finish"); } @@ -417,68 +415,68 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) H5TOOLS_PUSH_STACK(); if (!opts->follow_links) { trav_info_visit_lnk(path, linfo, tinfo); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } switch(linfo->type) { case H5L_TYPE_SOFT: if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) { - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } else if (ret_value == 0) { - /* no dangling link option given and detect dangling link */ - tinfo->symlink_visited.dangle_link = TRUE; + /* no dangling link option given and detect dangling link */ + tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dangling link is error */ - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; /* make dangling link is error */ + H5TOOLS_GOTO_DONE(0); } /* check if already visit the target object */ if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path)) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /* add this link as visited link */ if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, NULL, lnk_info.trg_path) < 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(FAIL, "Error: Could not get file contents"); } break; case H5L_TYPE_EXTERNAL: if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) { - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } else if (ret_value == 0) { /* no dangling link option given and detect dangling link */ tinfo->symlink_visited.dangle_link = TRUE; trav_info_visit_lnk(path, linfo, tinfo); if (opts->no_dangle_links) - opts->err_stat = 1; /* make dangling link is error */ - HGOTO_DONE(0); + opts->err_stat = H5DIFF_ERR; /* make dangling link is error */ + H5TOOLS_GOTO_DONE(0); } if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /* check if already visit the target object */ if(symlink_is_visited( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path)) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /* add this link as visited link */ if(symlink_visit_add( &(tinfo->symlink_visited), linfo->type, ext_fname, ext_path) < 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); if(h5trav_visit(tinfo->fid, path, TRUE, TRUE, trav_grp_objs,trav_grp_symlinks, tinfo, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(FAIL, "Error: Could not get file contents\n"); } break; @@ -487,15 +485,15 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) case H5L_TYPE_ERROR: default: parallel_print("Error: Invalid link type\n"); - opts->err_stat = 1; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Invalid link type"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(FAIL, "Error: Invalid link type"); break; } /* end of switch */ done: if (lnk_info.trg_path) HDfree(lnk_info.trg_path); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -550,7 +548,7 @@ h5diff(const char *fname1, trav_table_t *match_list = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff start"); + H5TOOLS_DEBUG("h5diff start"); /* init filenames */ HDmemset(filenames, 0, MAX_FILENAME * 2); /* init link info struct */ @@ -561,10 +559,10 @@ h5diff(const char *fname1, * check invalid combination of options *-----------------------------------------------------------------------*/ if(!is_valid_options(opts)) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); opts->cmn_objs = 1; /* eliminate warning */ - opts->err_stat = 0; /* initialize error status */ + opts->err_stat = H5DIFF_NO_ERR; /* initialize error status */ /*------------------------------------------------------------------------- * open the files first; if they are not valid, no point in continuing @@ -573,16 +571,16 @@ h5diff(const char *fname1, /* open file 1 */ if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname1); + H5TOOLS_GOTO_ERROR(1, "<%s>: unable to open file\n", fname1); } /* end if */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "file1_id = %s", fname1); + H5TOOLS_DEBUG("file1_id = %s", fname1); /* open file 2 */ if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname2); + H5TOOLS_GOTO_ERROR(1, "<%s>: unable to open file\n", fname2); } /* end if */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "file2_id = %s", fname2); + H5TOOLS_DEBUG("file2_id = %s", fname2); /*------------------------------------------------------------------------- * Initialize the info structs @@ -591,7 +589,7 @@ h5diff(const char *fname1, trav_info_init(fname1, file1_id, &info1_obj); trav_info_init(fname2, file2_id, &info2_obj); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "trav_info_init initialized"); + H5TOOLS_DEBUG("trav_info_init initialized"); /* if any object is specified */ if (objname1) { /* make the given object1 fullpath, start with "/" */ @@ -599,11 +597,11 @@ h5diff(const char *fname1, #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj1fullname, "/%s", objname1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(1, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ if ((obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(1, "name buffer allocation failed"); HDstrcpy(obj1fullname, "/"); HDstrcat(obj1fullname, objname1); @@ -617,11 +615,11 @@ h5diff(const char *fname1, #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj2fullname, "/%s", objname2) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(1, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ if ((obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_GOTO_ERROR(1, "name buffer allocation failed"); HDstrcpy(obj2fullname, "/"); HDstrcat(obj2fullname, objname2); #endif /* H5_HAVE_ASPRINTF */ @@ -632,7 +630,7 @@ h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj1 is root, group, single object or symlink */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check if obj1=%s is root, group, single object or symlink", obj1fullname); + H5TOOLS_DEBUG("h5diff check if obj1=%s is root, group, single object or symlink", obj1fullname); if(!HDstrcmp(obj1fullname, "/")) { obj1type = H5TRAV_TYPE_GROUP; } @@ -640,12 +638,12 @@ h5diff(const char *fname1, /* check if link itself exist */ if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found"); + H5TOOLS_GOTO_ERROR(1, "Error: Object could not be found"); } /* get info from link */ if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj1fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed"); + H5TOOLS_GOTO_ERROR(1, "H5Lget_info failed"); } info1_lp = info1_obj; @@ -661,7 +659,7 @@ h5diff(const char *fname1, if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); + H5TOOLS_GOTO_ERROR(1, "Error: Could not get file contents"); } obj1type = (h5trav_type_t)oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); @@ -682,7 +680,7 @@ h5diff(const char *fname1, /*---------------------------------------------------------- * check if obj2 is root, group, single object or symlink */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check if obj2=%s is root, group, single object or symlink", obj2fullname); + H5TOOLS_DEBUG("h5diff check if obj2=%s is root, group, single object or symlink", obj2fullname); if(!HDstrcmp(obj2fullname, "/")) { obj2type = H5TRAV_TYPE_GROUP; } @@ -690,12 +688,12 @@ h5diff(const char *fname1, /* check if link itself exist */ if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found"); + H5TOOLS_GOTO_ERROR(1, "Error: Object could not be found"); } /* get info from link */ if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj2fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed"); + H5TOOLS_GOTO_ERROR(1, "H5Lget_info failed"); } info2_lp = info2_obj; @@ -711,7 +709,7 @@ h5diff(const char *fname1, if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); + H5TOOLS_GOTO_ERROR(1, "Error: Could not get file contents"); } obj2type = (h5trav_type_t)oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); @@ -731,7 +729,7 @@ h5diff(const char *fname1, } /* if no object specified */ else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff no object specified"); + H5TOOLS_DEBUG("h5diff no object specified"); /* set root group */ obj1fullname = (char*)HDstrdup("/"); obj1type = H5TRAV_TYPE_GROUP; @@ -739,7 +737,7 @@ h5diff(const char *fname1, obj2type = H5TRAV_TYPE_GROUP; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "get any symbolic links info - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("get any symbolic links info - errstat:%d", opts->err_stat); /* get any symbolic links info */ l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, opts->follow_links); l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, opts->follow_links); @@ -755,15 +753,15 @@ h5diff(const char *fname1, /*------------------------------- * check symbolic link (object1) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object1)"); + H5TOOLS_DEBUG("h5diff check symbolic link (object1)"); /* dangling link */ if (l_ret1 == 0) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... dangling link"); + H5TOOLS_DEBUG("h5diff ... dangling link"); if (opts->no_dangle_links) { /* treat dangling link as error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error"); + H5TOOLS_GOTO_ERROR(1, "treat dangling link as error"); } else { if(opts->m_verbose) @@ -771,40 +769,40 @@ h5diff(const char *fname1, if (l_ret1 != 0 || l_ret2 != 0) { nfound++; print_found(nfound); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } } } else if(l_ret1 < 0) { /* fail */ parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found"); + H5TOOLS_GOTO_ERROR(1, "Object could not be found"); } else if(l_ret1 != 2) { /* symbolic link */ obj1type = (h5trav_type_t)trg_linfo1.trg_type; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD"); + H5TOOLS_DEBUG("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD"); if (info1_lp != NULL) { size_t idx = info1_lp->nused - 1; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... ... ... info1_obj not null"); + H5TOOLS_DEBUG("h5diff ... ... ... info1_obj not null"); info1_lp->paths[idx].type = (h5trav_type_t)trg_linfo1.trg_type; info1_lp->paths[idx].objno = trg_linfo1.objno; info1_lp->paths[idx].fileno = trg_linfo1.fileno; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object1) finished"); + H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished"); } /*------------------------------- * check symbolic link (object2) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object2)"); + H5TOOLS_DEBUG("h5diff check symbolic link (object2)"); /* dangling link */ if (l_ret2 == 0) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... dangling link"); + H5TOOLS_DEBUG("h5diff ... dangling link"); if (opts->no_dangle_links) { /* treat dangling link as error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error"); + H5TOOLS_GOTO_ERROR(1, "treat dangling link as error"); } else { if(opts->m_verbose) @@ -812,25 +810,25 @@ h5diff(const char *fname1, if (l_ret1 != 0 || l_ret2 != 0) { nfound++; print_found(nfound); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } } } else if(l_ret2 < 0) { /* fail */ parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found"); + H5TOOLS_GOTO_ERROR(1, "Object could not be found"); } else if(l_ret2 != 2) { /* symbolic link */ obj2type = (h5trav_type_t)trg_linfo2.trg_type; if (info2_lp != NULL) { size_t idx = info2_lp->nused - 1; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff ... ... ... info2_obj not null"); + H5TOOLS_DEBUG("h5diff ... ... ... info2_obj not null"); info2_lp->paths[idx].type = (h5trav_type_t)trg_linfo2.trg_type; info2_lp->paths[idx].objno = trg_linfo2.objno; info2_lp->paths[idx].fileno = trg_linfo2.fileno; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff check symbolic link (object1) finished"); + H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished"); } } /* end of if follow symlinks */ @@ -842,16 +840,16 @@ h5diff(const char *fname1, */ if(!(opts->m_verbose || opts->m_report)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff NOT (opts->m_verbose || opts->m_report)"); + H5TOOLS_DEBUG("h5diff NOT (opts->m_verbose || opts->m_report)"); /* if no danglink links */ if (l_ret1 > 0 && l_ret2 > 0) if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP); if (both_objs_grp) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff both_objs_grp TRUE"); + H5TOOLS_DEBUG("h5diff both_objs_grp TRUE"); /* * traverse group1 */ @@ -862,7 +860,7 @@ h5diff(const char *fname1, if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info1_grp, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); + H5TOOLS_GOTO_ERROR(1, "Could not get file contents"); } info1_lp = info1_grp; @@ -876,11 +874,11 @@ h5diff(const char *fname1, if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info2_grp, H5O_INFO_BASIC) < 0) { parallel_print("Error: Could not get file contents\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); + H5TOOLS_GOTO_ERROR(1, "Could not get file contents"); } /* end if */ info2_lp = info2_grp; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "groups traversed - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("groups traversed - errstat:%d", opts->err_stat); #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -900,10 +898,10 @@ h5diff(const char *fname1, } /* end if */ #endif - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list next - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list next - errstat:%d", opts->err_stat); /* process the objects */ build_match_list (obj1fullname, info1_lp, obj2fullname, info2_lp, &match_list, opts); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list finished - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list finished - errstat:%d", opts->err_stat); if (both_objs_grp) { /*------------------------------------------------------ * print the list @@ -927,7 +925,7 @@ h5diff(const char *fname1, parallel_print ("\n"); } /* end if */ } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match next - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_match next - errstat:%d", opts->err_stat); nfound = diff_match(file1_id, obj1fullname, info1_lp, file2_id, obj2fullname, info2_lp, match_list, opts); @@ -970,9 +968,9 @@ done: H5Fclose(file2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5diff finish - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("h5diff finish - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } @@ -1012,7 +1010,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, size_t idx2 = 0; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_match start - errstat:%d", opts->err_stat); /* * if not root, prepare object name to be pre-appended to group path to * make full path @@ -1065,41 +1063,41 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, #endif for(i = 0; i < table->nobjs; i++) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff for common objects[%d] - errstat:%d", i, opts->err_stat); + H5TOOLS_DEBUG("diff for common objects[%d] - errstat:%d", i, opts->err_stat); if(table->objs[i].flags[0] && table->objs[i].flags[1]) { /* make full path for obj1 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(1, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ if((obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(1, "name buffer allocation failed"); } else { HDstrcpy(obj1_fullpath, grp1_path); HDstrcat(obj1_fullpath, table->objs[i].name); } #endif /* H5_HAVE_ASPRINTF */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match path1 - %s", obj1_fullpath); + H5TOOLS_DEBUG("diff_match path1 - %s", obj1_fullpath); /* make full path for obj2 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(1, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ if((obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) { - H5TOOLS_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); + H5TOOLS_ERROR(1, "name buffer allocation failed"); } else { HDstrcpy(obj2_fullpath, grp2_path); HDstrcat(obj2_fullpath, table->objs[i].name); } #endif /* H5_HAVE_ASPRINTF */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match path2 - %s", obj2_fullpath); + H5TOOLS_DEBUG("diff_match path2 - %s", obj2_fullpath); /* get index to figure out type of the object in file1 */ while(info1->paths[idx1].path && (HDstrcmp(obj1_fullpath, info1->paths[idx1].path) != 0)) @@ -1115,7 +1113,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, opts->cmn_objs = 1; if(!g_Parallel) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff paths - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff paths - errstat:%d", opts->err_stat); nfound += diff(file1_id, obj1_fullpath, file2_id, obj2_fullpath, opts, &argdata); @@ -1124,7 +1122,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, else { int workerFound = 0; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Beginning of big else block"); + H5TOOLS_DEBUG("Beginning of big else block"); /* We're in parallel mode */ /* Since the data type of diff value is hsize_t which can * be arbitary large such that there is no MPI type that @@ -1278,7 +1276,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, HDfree(obj2_fullpath); } /* end if */ } /* end for */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "done with for loop - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("done with for loop - errstat:%d", opts->err_stat); #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -1355,21 +1353,22 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, /* Print any final data waiting in our queue */ print_incoming_data(); } /* end if */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "done with if block"); + H5TOOLS_DEBUG("done with if block"); HDfree(workerTasks); } #endif /* H5_HAVE_PARALLEL */ +done: opts->err_stat = opts->err_stat | ret_value; -/* free table */ + /* free table */ if (table) trav_table_free(table); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_match finish diffs=%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_match finish diffs=%d - errstat:%d", nfound, opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } @@ -1415,7 +1414,7 @@ diff(hid_t file1_id, h5tool_link_info_t linkinfo2; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff start - errstat:%d", opts->err_stat); /*init link info struct */ HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); @@ -1435,10 +1434,10 @@ diff(hid_t file1_id, * check dangling links for path1 and path2 */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff links"); + H5TOOLS_DEBUG("diff links"); /* target object1 - get type and name */ if ((status = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, opts->follow_links)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); + H5TOOLS_GOTO_ERROR(1, "H5tools_get_symlink_info failed"); /* dangling link */ if (status == 0) { @@ -1446,7 +1445,7 @@ diff(hid_t file1_id, /* dangling link is error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "dangling link is error"); + H5TOOLS_GOTO_ERROR(1, "dangling link is error"); } else is_dangle_link1 = TRUE; @@ -1454,14 +1453,14 @@ diff(hid_t file1_id, /* target object2 - get type and name */ if ((status = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, opts->follow_links)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); + H5TOOLS_GOTO_ERROR(1, "H5tools_get_symlink_info failed"); /* dangling link */ if (status == 0) { if (opts->no_dangle_links) { /* dangling link is error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path2); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "dangling link is error"); + H5TOOLS_GOTO_ERROR(1, "dangling link is error"); } else is_dangle_link2 = TRUE; @@ -1469,7 +1468,7 @@ diff(hid_t file1_id, /* found dangling link */ if (is_dangle_link1 || is_dangle_link2) { - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } /* follow symbolic link option */ @@ -1484,7 +1483,7 @@ diff(hid_t file1_id, } /* if objects are not the same type */ if (argdata->type[0] != argdata->type[1]) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff objects are not the same"); + H5TOOLS_DEBUG("diff objects are not the same"); if (opts->m_verbose||opts->m_list_not_cmp) { parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n", path1, get_type(argdata->type[0]), @@ -1494,7 +1493,7 @@ diff(hid_t file1_id, /* TODO: will need to update non-comparable is different * opts->contents = 0; */ - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } else /* now both object types are same */ object_type = argdata->type[0]; @@ -1508,7 +1507,7 @@ diff(hid_t file1_id, * Perform this to match the outputs as bypassing. */ if (argdata->is_same_trgobj) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "argdata->is_same_trgobj"); + H5TOOLS_DEBUG("argdata->is_same_trgobj"); is_hard_link = (object_type == H5TRAV_TYPE_DATASET || object_type == H5TRAV_TYPE_NAMED_DATATYPE || object_type == H5TRAV_TYPE_GROUP); @@ -1546,7 +1545,7 @@ diff(hid_t file1_id, } /* if(opts->m_verbose || opts->m_report) */ /* exact same, so comparison is done */ - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } } @@ -1556,15 +1555,15 @@ diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_DATASET: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff object type H5TRAV_TYPE_DATASET - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff object type H5TRAV_TYPE_DATASET - errstat:%d", opts->err_stat); if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dopen2 failed"); if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dopen2 failed"); /* verbose (-v) and report (-r) mode */ if(opts->m_verbose || opts->m_report) { do_print_objname("dataset", path1, path2, opts); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_dataset 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG("call diff_dataset 1:%s 2:%s ", path1, path2); nfound = diff_dataset(file1_id, file2_id, path1, path2, opts); print_found(nfound); } @@ -1581,7 +1580,7 @@ diff(hid_t file1_id, print_found(nfound); } } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff after dataset:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff after dataset:%d - errstat:%d", nfound, opts->err_stat); /*--------------------------------------------------------- * compare attributes @@ -1590,14 +1589,14 @@ diff(hid_t file1_id, *--------------------------------------------------------- */ if(path1) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_attr 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG( "call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts); } if(H5Dclose(dset1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dclose failed"); if(H5Dclose(dset2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dclose failed"); break; /*---------------------------------------------------------------------- @@ -1605,14 +1604,14 @@ diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_NAMED_DATATYPE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_NAMED_DATATYPE 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG("H5TRAV_TYPE_NAMED_DATATYPE 1:%s 2:%s ", path1, path2); if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR(1, "H5Topen2 failed"); if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR(1, "H5Topen2 failed"); if((status = H5Tequal(type1_id, type2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tequal failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tequal failed"); /* if H5Tequal is > 0 then the datatypes refer to the same datatype */ nfound = (status > 0) ? 0 : 1; @@ -1631,14 +1630,14 @@ diff(hid_t file1_id, *----------------------------------------------------------------- */ if(path1) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_attr 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(type1_id, type2_id, path1, path2, opts); } if(H5Tclose(type1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tclose failed"); if(H5Tclose(type2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tclose failed"); break; /*---------------------------------------------------------------------- @@ -1646,7 +1645,7 @@ diff(hid_t file1_id, *---------------------------------------------------------------------- */ case H5TRAV_TYPE_GROUP: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_GROUP 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG("H5TRAV_TYPE_GROUP 1:%s 2:%s ", path1, path2); if(print_objname(opts, nfound)) do_print_objname("group", path1, path2, opts); @@ -1655,9 +1654,9 @@ diff(hid_t file1_id, print_found(nfound); if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Gclose failed"); if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Gclose failed"); /*----------------------------------------------------------------- * compare attributes @@ -1666,14 +1665,14 @@ diff(hid_t file1_id, *----------------------------------------------------------------- */ if(path1) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_attr 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2); nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts); } if(H5Gclose(grp1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Gclose failed"); if(H5Gclose(grp2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(1, "H5Gclose failed"); break; @@ -1683,7 +1682,7 @@ diff(hid_t file1_id, */ case H5TRAV_TYPE_LINK: { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_LINK 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG("H5TRAV_TYPE_LINK 1:%s 2:%s ", path1, path2); status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path); /* if the target link name is not same then the links are "different" */ @@ -1705,7 +1704,7 @@ diff(hid_t file1_id, */ case H5TRAV_TYPE_UDLINK: { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5TRAV_TYPE_UDLINK 1:%s 2:%s ", path1, path2); + H5TOOLS_DEBUG("H5TRAV_TYPE_UDLINK 1:%s 2:%s ", path1, path2); /* Only external links will have a query function registered */ if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) { /* If the buffers are the same size, compare them */ @@ -1806,9 +1805,9 @@ done: /* enable error reporting */ } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff finish:%d - errstat:%d", nfound, opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index 0931c1a..b04ec23 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -57,28 +57,35 @@ struct exclude_path_list { struct exclude_path_list * next; }; +/* Enumeration value for keeping track of whether an error occurred or differences were found */ +typedef enum { + H5DIFF_NO_ERR, /* No error occurred */ + H5DIFF_ERR_DIFF, /* Differences were found */ + H5DIFF_ERR /* An error occurred */ +} diff_err_t; + typedef struct { - int m_quiet; /* quiet mide: no output at all */ - int m_report; /* report mode: print the data */ - int m_verbose; /* verbose mode: print the data, list of objcets, warnings */ - int m_verbose_level; /* control verbose details */ - int d; /* delta, absolute value to compare */ - double delta; /* delta value */ - int p; /* relative error to compare*/ - int use_system_epsilon; /* flag to use system epsilon (1 or 0) */ - double percent; /* relative error value */ - int n; /* count, compare up to count */ - hsize_t count; /* count value */ - hbool_t follow_links; /* follow symbolic links */ - int no_dangle_links; /* return error when find dangling link */ - int err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */ - int cmn_objs; /* do we have common objects */ - int not_cmp; /* are the objects comparable */ - int contents; /* equal contents */ - int do_nans; /* consider Nans while diffing floats */ - int m_list_not_cmp; /* list not comparable messages */ - int exclude_path; /* exclude path to an object */ - struct exclude_path_list * exclude; /* keep exclude path list */ + int m_quiet; /* quiet mode: no output at all */ + int m_report; /* report mode: print the data */ + int m_verbose; /* verbose mode: print the data, list of objcets, warnings */ + int m_verbose_level; /* control verbose details */ + int d; /* delta, absolute value to compare */ + double delta; /* delta value */ + int p; /* relative error to compare*/ + int use_system_epsilon; /* flag to use system epsilon (1 or 0) */ + double percent; /* relative error value */ + int n; /* count, compare up to count */ + hsize_t count; /* count value */ + hbool_t follow_links; /* follow symbolic links */ + int no_dangle_links; /* return error when find dangling link */ + diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */ + int cmn_objs; /* do we have common objects */ + int not_cmp; /* are the objects comparable */ + int contents; /* equal contents */ + int do_nans; /* consider Nans while diffing floats */ + int m_list_not_cmp; /* list not comparable messages */ + int exclude_path; /* exclude path to an object */ + struct exclude_path_list * exclude; /* keep exclude path list */ } diff_opt_t; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index dcc2c81..46de59d 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -289,7 +289,7 @@ hsize_t diff_array( H5T_class_t type_class; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_array start - errstat:%d", opts->err_stat); /* get the size. */ size = H5Tget_size(m_type); type_class = H5Tget_class(m_type); @@ -314,7 +314,7 @@ hsize_t diff_array( pos[j] = 0; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array type_class:%d", type_class); + H5TOOLS_DEBUG("diff_array type_class:%d", type_class); switch (type_class) { case H5T_NO_CLASS: case H5T_TIME: @@ -375,7 +375,7 @@ hsize_t diff_array( case H5T_REFERENCE: HDmemset(&members, 0, sizeof(mcomp_t)); get_member_types(m_type, &members); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call diff_datum nelmts:%d - errstat:%d", nelmts, opts->err_stat); + H5TOOLS_DEBUG("call diff_datum nelmts:%d - errstat:%d", nelmts, opts->err_stat); for (i = 0; i < nelmts; i++) { nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, opts, name1, name2, container1_id, container2_id, &ph, &members); @@ -384,9 +384,9 @@ hsize_t diff_array( } /* i */ close_member_types(&members); } /* switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_array finish:%d - errstat:%d", nfound, opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit: %d", nfound); + H5TOOLS_ENDDEBUG("exit: %d", nfound); H5TOOLS_POP_STACK(); return nfound; } @@ -460,7 +460,7 @@ static hsize_t diff_datum( hbool_t both_zero; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_datum start - errstat:%d", opts->err_stat); type_size = H5Tget_size(m_type); type_class = H5Tget_class(m_type); @@ -474,14 +474,14 @@ static hsize_t diff_datum( type_class != H5T_STRING && type_class != H5T_VLEN && HDmemcmp(mem1, mem2, type_size) == 0) - HGOTO_DONE(opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); switch (H5Tget_class(m_type)) { case H5T_NO_CLASS: case H5T_TIME: case H5T_NCLASSES: default: - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Invalid type class"); + H5TOOLS_GOTO_ERROR(1, "Invalid type class"); break; /*------------------------------------------------------------------------- @@ -489,7 +489,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_COMPOUND: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_COMPOUND"); + H5TOOLS_DEBUG("diff_datum H5T_COMPOUND"); { hid_t memb_type = -1; nmembs = members->n; @@ -509,7 +509,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_STRING: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_STRING"); + H5TOOLS_DEBUG("diff_datum H5T_STRING"); { char *s = NULL; char *sx = NULL; @@ -523,7 +523,7 @@ static hsize_t diff_datum( /* if variable length string */ if (H5Tis_variable_str(m_type)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_STRING variable"); + H5TOOLS_DEBUG("diff_datum H5T_STRING variable"); /* Get pointer to first string */ s1 = *(char **)((void *)mem1); if (s1) @@ -539,7 +539,7 @@ static hsize_t diff_datum( size2 = 0; } else if (H5T_STR_NULLTERM == pad) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_STRING null term"); + H5TOOLS_DEBUG("diff_datum H5T_STRING null term"); /* Get pointer to first string */ s1 = (char*) mem1; if (s1) @@ -576,10 +576,10 @@ static hsize_t diff_datum( * of length of strings. * For now mimic the previous way. */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum string size:%d", size1); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum string size:%d", size2); + H5TOOLS_DEBUG("diff_datum string size:%d", size1); + H5TOOLS_DEBUG("diff_datum string size:%d", size2); if (size1 != size2) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum string sizes difference"); + H5TOOLS_DEBUG("diff_datum string sizes difference"); nfound++; } if (size1 < size2) { @@ -616,7 +616,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_BITFIELD: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_BITFIELD"); + H5TOOLS_DEBUG("diff_datum H5T_BITFIELD"); /* byte-by-byte comparison */ for (u = 0; u < type_size; u++) nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph); @@ -627,7 +627,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_OPAQUE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_OPAQUE"); + H5TOOLS_DEBUG("diff_datum H5T_OPAQUE"); /* byte-by-byte comparison */ for (u = 0; u < type_size; u++) nfound += character_compare_opt(mem1 + u, mem2 + u, index, rank, dims, acc, pos, opts, obj1, obj2, ph); @@ -643,7 +643,7 @@ static hsize_t diff_datum( * compared, we convert both bit patterns to their corresponding * enumeration constant and do a string comparison */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_ENUM"); + H5TOOLS_DEBUG("diff_datum H5T_ENUM"); { char enum_name1[1024]; char enum_name2[1024]; @@ -706,7 +706,7 @@ static hsize_t diff_datum( hsize_t adims[H5S_MAX_RANK]; int ndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_ARRAY"); + H5TOOLS_DEBUG("diff_datum H5T_ARRAY"); /* get the array's base datatype for each element */ memb_type = H5Tget_super(m_type); size = H5Tget_size(memb_type); @@ -730,12 +730,12 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_REFERENCE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE"); + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE"); iszero1 = all_zero(_mem1, H5Tget_size(m_type)); iszero2 = all_zero(_mem2, H5Tget_size(m_type)); if (iszero1 != iszero2) { nfound++; - HGOTO_DONE (opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); } else if (!iszero1 && !iszero2) { hid_t obj1_id = -1; @@ -756,34 +756,34 @@ static hsize_t diff_datum( H5O_type_t obj2_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE - H5T_STD_REF"); + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF"); ref_type = H5Rget_type(ref1_buf); switch (ref_type) { case H5R_OBJECT1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); } if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); } /* check object type */ if (obj1_type != obj2_type) { parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); } if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 1 failed"); } if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 2 failed"); } switch (obj1_type) { @@ -803,88 +803,92 @@ static hsize_t diff_datum( break; } /* end switch */ if(obj1_id >= 0) - if(H5Oclose(obj1_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT1 failed"); + if(H5Oclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed"); + } if(obj2_id >= 0) - if(H5Oclose(obj2_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT1 failed"); + if(H5Oclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed"); + } if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_OBJECT1 failed"); if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_OBJECT1 failed"); break; case H5R_DATASET_REGION1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); if(H5Sclose(region2_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Sclose H5R_DATASET_REGION1 failed"); } if(H5Sclose(region1_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Sclose H5R_DATASET_REGION1 failed"); } if(H5Oclose(obj2_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Oclose H5R_DATASET_REGION1 failed"); } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Ropen_object H5R_DATASET_REGION1 failed"); } if(H5Oclose(obj1_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Oclose H5R_DATASET_REGION1 failed"); } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Ropen_object H5R_DATASET_REGION1 failed"); } if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_DATASET_REGION1 failed"); if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_DATASET_REGION1 failed"); break; case H5R_OBJECT2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed"); } if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type3 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed"); } /* check object type */ if (obj1_type != obj2_type) { parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); } if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 1 failed"); } if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_object object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Ropen_object object 2 failed"); } switch (obj1_type) { case H5O_TYPE_DATASET: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2 : DATASET"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : DATASET"); nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts); break; case H5O_TYPE_GROUP: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2 : GROUP"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : GROUP"); if (opts->m_verbose) parallel_print("Warning: Comparison not possible of group object types referenced: <%s> and <%s>\n", obj1, obj2); opts->not_cmp = 1; break; case H5O_TYPE_NAMED_DATATYPE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2 : NAMED"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : NAMED"); if (opts->m_verbose) parallel_print("Warning: Comparison not possible of named datatypes object types referenced: <%s> and <%s>\n", obj1, obj2); opts->not_cmp = 1; @@ -900,60 +904,68 @@ static hsize_t diff_datum( break; } /* end switch */ if(obj1_id >= 0) - if(H5Oclose(obj1_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed"); + if(H5Oclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + } if(obj2_id >= 0) - if(H5Oclose(obj2_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed"); + if(H5Oclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed"); + } if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_OBJECT2 failed"); if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_OBJECT2 failed"); break; case H5R_DATASET_REGION2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); /* if (obj_id < 0) - could mean that no reference was written do not throw failure */ obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT); obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT); - if((obj1_id < 0) || (obj1_id < 0)) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5R_DATASET_REGION2 failed"); + if((obj1_id < 0) || (obj1_id < 0)) { + H5TOOLS_ERROR(opts->err_stat, "H5Ropen_object H5R_DATASET_REGION2 failed"); + } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "open_region - H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("open_region - H5R_DATASET_REGION2"); if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(ref1_buf, H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); } else { if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(ref2_buf, H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); } else { nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); } if(H5Sclose(region2_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(1, "H5Sclose H5R_DATASET_REGION2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(1, "H5Ropen_region H5R_DATASET_REGION2 failed"); } /* end else to if (h5tools_is_zero(... */ if(H5Sclose(region1_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(1, "H5Sclose H5R_DATASET_REGION2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(1, "H5Ropen_region H5R_DATASET_REGION2 failed"); if (obj1_id >= 0) - if(H5Dclose(obj1_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed"); + if(H5Dclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); + } if (obj2_id >= 0) - if(H5Dclose(obj2_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed"); + if(H5Dclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed"); + } if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_DATASET_REGION2 failed"); if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_DATASET_REGION2 failed"); } break; case H5R_ATTR: @@ -961,41 +973,45 @@ static hsize_t diff_datum( char name1[ATTR_NAME_MAX]; char name2[ATTR_NAME_MAX]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR"); + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); if((obj1_id = H5Ropen_attr(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { parallel_print("Warning: Cannot open referenced attribute: attribute 1\n"); - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_attr object 1 failed"); + H5TOOLS_INFO("H5Ropen_attr object 1 failed"); } if((obj2_id = H5Ropen_attr(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) { parallel_print("Warning: Cannot open referenced attribute: attribute 2\n"); - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Ropen_attr object 2 failed"); + H5TOOLS_INFO("H5Ropen_attr object 2 failed"); } - if((obj1_id < 0) || (obj1_id < 0)) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_attr H5R_ATTR failed"); + if((obj1_id < 0) || (obj1_id < 0)) { + H5TOOLS_ERROR(opts->err_stat, "H5Ropen_attr H5R_ATTR failed"); + } else { /* get name */ if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); /* get name */ if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2); + H5TOOLS_DEBUG("H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2); nfound = diff_attr_data(obj1_id, obj2_id, name1, name2, NULL, NULL, opts); } if(obj1_id >= 0) - if(H5Aclose(obj1_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed"); + if(H5Aclose(obj1_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); + } if(obj2_id >= 0) - if(H5Aclose(obj2_id) < 0) - H5TOOLS_INFO(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed"); + if(H5Aclose(obj2_id) < 0) { + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Aclose H5R_ATTR failed"); + } if(H5Rdestroy(ref2_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_ATTR failed"); if(H5Rdestroy(ref1_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed"); + H5TOOLS_ERROR(1, "H5Rdestroy H5R_ATTR failed"); } break; case H5R_BADTYPE: @@ -1003,7 +1019,7 @@ static hsize_t diff_datum( default: break; } /* end switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, opts->err_stat); } /*------------------------------------------------------------------------- * H5T_STD_REF_DSETREG @@ -1015,23 +1031,23 @@ static hsize_t diff_datum( hid_t region1_id = -1; hid_t region2_id = -1; - H5TOOLS_INFO(H5E_tools_min_info_id_g, "H5T_STD_REF_DSETREG reference type"); + H5TOOLS_INFO("H5T_STD_REF_DSETREG reference type"); if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 1 failed"); } if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 2 failed"); } if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_region object 1 failed"); } if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_region object 2 failed"); } nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); @@ -1052,31 +1068,31 @@ static hsize_t diff_datum( H5O_type_t obj1_type; H5O_type_t obj2_type; - H5TOOLS_INFO(H5E_tools_min_info_id_g, "H5T_STD_REF_OBJ reference type"); + H5TOOLS_INFO("H5T_STD_REF_OBJ reference type"); if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type2 object 1 failed"); } if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rget_obj_type2 object 2 failed"); } /* check object type */ if (obj1_type != obj2_type) { parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); + H5TOOLS_GOTO_DONE(opts->err_stat); } if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 1 failed"); } if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_INFO("H5Rdereference2 object 2 failed"); } /* compare */ @@ -1092,7 +1108,7 @@ static hsize_t diff_datum( H5Oclose(obj2_id); }/*object reference*/ }/*is zero*/ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_REFERENCE complete"); + H5TOOLS_DEBUG("diff_datum H5T_REFERENCE complete"); break; /*------------------------------------------------------------------------- @@ -1103,7 +1119,7 @@ static hsize_t diff_datum( { hid_t memb_type = -1; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_VLEN"); + H5TOOLS_DEBUG("diff_datum H5T_VLEN"); /* get the VL sequences's base datatype for each element */ memb_type = H5Tget_super(m_type); size = H5Tget_size(memb_type); @@ -1124,7 +1140,7 @@ static hsize_t diff_datum( *------------------------------------------------------------------------- */ case H5T_INTEGER: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_INTEGER"); + H5TOOLS_DEBUG("diff_datum H5T_INTEGER"); type_sign = H5Tget_sign(m_type); /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR @@ -1135,7 +1151,7 @@ static hsize_t diff_datum( char temp2_char; if(type_size != sizeof(char)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not char size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not char size"); HDmemcpy(&temp1_char, mem1, sizeof(char)); HDmemcpy(&temp2_char, mem2, sizeof(char)); /* -d and !-p */ @@ -1210,7 +1226,7 @@ static hsize_t diff_datum( unsigned char temp2_uchar; if(type_size != sizeof(unsigned char)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned char size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not unsigned char size"); HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); @@ -1286,7 +1302,7 @@ static hsize_t diff_datum( short temp2_short; if(type_size != sizeof(short)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not short size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not short size"); HDmemcpy(&temp1_short, mem1, sizeof(short)); HDmemcpy(&temp2_short, mem2, sizeof(short)); @@ -1362,7 +1378,7 @@ static hsize_t diff_datum( unsigned short temp2_ushort; if(type_size != sizeof(unsigned short)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned short size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not unsigned short size"); HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); @@ -1438,7 +1454,7 @@ static hsize_t diff_datum( int temp2_int; if(type_size != sizeof(int)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not int size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not int size"); HDmemcpy(&temp1_int, mem1, sizeof(int)); HDmemcpy(&temp2_int, mem2, sizeof(int)); @@ -1514,7 +1530,7 @@ static hsize_t diff_datum( unsigned int temp2_uint; if(type_size != sizeof(unsigned int)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned int size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not unsigned int size"); HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); @@ -1590,7 +1606,7 @@ static hsize_t diff_datum( long temp2_long; if(type_size != sizeof(long)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not long size"); HDmemcpy(&temp1_long, mem1, sizeof(long)); HDmemcpy(&temp2_long, mem2, sizeof(long)); @@ -1666,7 +1682,7 @@ static hsize_t diff_datum( unsigned long temp2_ulong; if(type_size != sizeof(unsigned long)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned long size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not unsigned long size"); HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); @@ -1743,7 +1759,7 @@ static hsize_t diff_datum( * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum H5T_FLOAT"); + H5TOOLS_DEBUG("diff_datum H5T_FLOAT"); if (type_size == 4) { float temp1_float; float temp2_float; @@ -1751,7 +1767,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(float)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not float size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not float size"); HDmemcpy(&temp1_float, mem1, sizeof(float)); HDmemcpy(&temp2_float, mem2, sizeof(float)); @@ -1910,7 +1926,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(double)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not double size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not double size"); HDmemcpy(&temp1_double, mem1, sizeof(double)); HDmemcpy(&temp2_double, mem2, sizeof(double)); @@ -2069,7 +2085,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(long double)) { - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long double size"); + H5TOOLS_GOTO_ERROR(1, "Type size is not long double size"); } HDmemcpy(&temp1_double, mem1, sizeof(long double)); @@ -2224,9 +2240,9 @@ static hsize_t diff_datum( done: opts->err_stat = opts->err_stat | ret_value; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datum finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_datum finish:%d - errstat:%d", nfound, opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } @@ -2317,7 +2333,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t hsize_t nfound_p = 0; /* point differences found */ H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_region start"); + H5TOOLS_DEBUG("diff_region start"); ndims1 = H5Sget_simple_extent_ndims(region1_id); ndims2 = H5Sget_simple_extent_ndims(region2_id); @@ -2334,12 +2350,12 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t npoints1 = H5Sget_select_elem_npoints(region1_id); npoints2 = H5Sget_select_elem_npoints(region2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_region blocks: 1=%ld-2=%ld", nblocks1, nblocks2); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_region points: 1=%ld-2=%ld", npoints1, npoints2); + H5TOOLS_DEBUG("diff_region blocks: 1=%ld-2=%ld", nblocks1, nblocks2); + H5TOOLS_DEBUG("diff_region points: 1=%ld-2=%ld", npoints1, npoints2); if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) { opts->not_cmp = 1; - HGOTO_DONE (0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -2347,22 +2363,22 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t *------------------------------------------------------------------------- */ if (nblocks1 > 0) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "region compare blocks"); + H5TOOLS_DEBUG("region compare blocks"); HDassert(ndims1 > 0); alloc_size = (hsize_t) nblocks1 * (unsigned) ndims1 * 2 * sizeof(ptdata1[0]); HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(opts->err_stat, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0, (hsize_t) nblocks1, ptdata1); if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(opts->err_stat, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t); @@ -2412,21 +2428,21 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t *------------------------------------------------------------------------- */ if (npoints1 > 0) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "region compare points"); + H5TOOLS_DEBUG("region compare points"); alloc_size = (hsize_t) npoints1 * (unsigned) ndims1 * sizeof(ptdata1[0]); HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(opts->err_stat, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t); H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0, (hsize_t) npoints1, ptdata1); if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - opts->err_stat = 1; - H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = H5DIFF_ERR; + H5TOOLS_GOTO_ERROR(opts->err_stat, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t); @@ -2490,7 +2506,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t ret_value = nfound_p + nfound_b; done: - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit with diffs:%d", ret_value); + H5TOOLS_ENDDEBUG("exit with diffs:%d", ret_value); H5TOOLS_POP_STACK(); return ret_value; } @@ -2515,7 +2531,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, H5TOOLS_PUSH_STACK(); HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "character_compare start %d=%d",temp1_uchar,temp2_uchar); + H5TOOLS_DEBUG("character_compare start %d=%d",temp1_uchar,temp2_uchar); if (temp1_uchar != temp2_uchar) { if (print_data(opts)) { @@ -2528,9 +2544,9 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u, } nfound++; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "character_compare finish"); + H5TOOLS_DEBUG("character_compare finish"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit: %d", nfound); + H5TOOLS_ENDDEBUG("exit: %d", nfound); H5TOOLS_POP_STACK(); return nfound; } @@ -4510,20 +4526,20 @@ int ull2float(unsigned long long ull_value, float *f_value) size_t dst_size; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ull2float start"); + H5TOOLS_DEBUG("ull2float start"); if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); if((buf = (unsigned char*) HDcalloc((size_t )1, MAX(src_size, dst_size))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims"); HDmemcpy(buf, &ull_value, src_size); /* do conversion */ if (H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t) 1, buf, NULL, dxpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tconvert failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tconvert failed"); HDmemcpy(f_value, buf, dst_size); @@ -4535,9 +4551,9 @@ done: if (buf) HDfree(buf); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ull2float finish"); + H5TOOLS_DEBUG("ull2float finish"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 40a3b01..6b1857f 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -153,43 +153,43 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t table_attrs_t *table_lp = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs start - errstat:%d", opts->err_stat); if(H5Oget_info2(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info first object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info first object failed"); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Oget_info2 loc1id=%d", oinfo1.num_attrs); + H5TOOLS_DEBUG("H5Oget_info2 loc1id=%d", oinfo1.num_attrs); if(H5Oget_info2(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info second object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info second object failed"); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Oget_info2 loc2id=%d", oinfo2.num_attrs); + H5TOOLS_DEBUG("H5Oget_info2 loc2id=%d", oinfo2.num_attrs); table_attrs_init(&table_lp); if (table_lp == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Table allocation failed"); + H5TOOLS_GOTO_ERROR(FAIL, "Table allocation failed"); /*-------------------------------------------------- * build the list */ while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed"); /* get name */ if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); /*------------------ * open attribute2 */ if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed"); /* get name */ if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); /* criteria is string compare */ cmp = HDstrcmp(name1, name2); @@ -227,16 +227,16 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t infile[0] = 1; infile[1] = 0; while(curr1 < oinfo1.num_attrs) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs); /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx first attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx first attribute failed"); /* get name */ if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name first attribute failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs #1 name - %s", name1); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed"); + H5TOOLS_DEBUG("build_match_list_attrs #1 name - %s", name1); table_attr_mark_exist(infile, name1, table_lp); table_lp->nattrs_only1++; @@ -251,15 +251,15 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t infile[0] = 0; infile[1] = 1; while(curr2 < oinfo2.num_attrs) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); + H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs); /*------------------ * open attribute2 */ if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx second attribute failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx second attribute failed"); /* get name */ if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name second attribute failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs #2 name - %s", name2); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed"); + H5TOOLS_DEBUG("build_match_list_attrs #2 name - %s", name2); table_attr_mark_exist(infile, name2, table_lp); table_lp->nattrs_only2++; @@ -299,9 +299,9 @@ done: H5Aclose(attr2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs end - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs end - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -343,52 +343,52 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const int j; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_attr_data start - errstat:%d", opts->err_stat); /* get the datatypes */ if((ftype1_id = H5Aget_type(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if((ftype2_id = H5Aget_type(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); if (H5Tget_class(ftype1_id) == H5T_REFERENCE) { if((mtype1_id = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) first attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) first attribute ftype failed"); } else { if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type first attribute ftype failed"); } if (H5Tget_class(ftype2_id) == H5T_REFERENCE) { if((mtype2_id = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) second attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) second attribute ftype failed"); } else { if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type second attribute ftype failed"); } if((msize1 = H5Tget_size(mtype1_id)) == 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_size first attribute mtype failed"); if((msize2 = H5Tget_size(mtype2_id)) == 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_size second attribute mtype failed"); /* get the dataspace */ if((space1_id = H5Aget_space(attr1_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_space first attribute failed"); if((space2_id = H5Aget_space(attr2_id)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_space second attribute failed"); /* get dimensions */ if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_dims first attribute failed"); if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_dims second attribute failed"); /*---------------------------------------------------------------------- * check for comparable TYPE and SPACE *---------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data check for comparable TYPE and SPACE"); + H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE"); /* pass dims1 and dims2 for maxdims as well since attribute's maxdims * are always same */ @@ -398,9 +398,9 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const *------------------------------------------------------------------ */ if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed"); + H5TOOLS_GOTO_ERROR(1, "match_up_memsize failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data read"); + H5TOOLS_DEBUG("diff_attr_data read"); /*--------------------------------------------------------------------- * read *---------------------------------------------------------------------- @@ -413,18 +413,18 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); if(buf1 == NULL || buf2 == NULL) { parallel_print("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "buffer allocation failed"); + H5TOOLS_GOTO_ERROR(1, "buffer allocation failed"); } if(H5Aread(attr1_id, mtype1_id, buf1) < 0) { parallel_print("Failed reading attribute1 %s\n", name1); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); } else buf1hasdata = TRUE; if(H5Aread(attr2_id, mtype2_id, buf2) < 0) { parallel_print("Failed reading attribute2 %s\n", name2); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); } else buf2hasdata = TRUE; @@ -437,7 +437,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const * array compare *---------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data array compare %s - %s", name1, name1); + H5TOOLS_DEBUG("diff_attr_data array compare %s - %s", name1, name1); /* always print name */ /* verbose (-v) and report (-r) mode */ @@ -465,7 +465,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const } /* end if */ } /* end else */ } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat); /*---------------------------------------------------------------------- * close @@ -485,17 +485,17 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const buf2 = NULL; if(H5Tclose(ftype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if(H5Tclose(ftype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); if(H5Sclose(space1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if(H5Sclose(space2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); if(H5Tclose(mtype1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tclose first attribute mtype failed"); if(H5Tclose(mtype2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tclose second attribute mtype failed"); done: opts->err_stat = opts->err_stat | ret_value; @@ -520,9 +520,9 @@ done: H5Sclose(space2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr_data end - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_attr_data end - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } @@ -553,43 +553,43 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p table_attrs_t *match_list_attrs = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_attr start - errstat:%d", opts->err_stat); if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) { - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "build_match_list_attrs failed"); + H5TOOLS_GOTO_ERROR(1, "build_match_list_attrs failed"); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "build_match_list_attrs - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("build_match_list_attrs - errstat:%d", opts->err_stat); /* if detect any unique extra attr */ if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr attributes only in one file"); + H5TOOLS_DEBUG("diff_attr attributes only in one file"); /* exit will be 1 */ opts->contents = 0; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g,"match_list_attrs info - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs info - errstat:%d", opts->err_stat); for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "match_list_attrs loop[%d] - errstat:%d", u, opts->err_stat); + H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, opts->err_stat); if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) { name1 = name2 = match_list_attrs->attrs[u].name; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr name - %s", name1); + H5TOOLS_DEBUG("diff_attr name - %s", name1); /*-------------- * attribute 1 */ if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aopen first attribute failed"); /*-------------- * attribute 2 */ if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aopen second attribute failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr got attributes"); + H5TOOLS_DEBUG("diff_attr got attributes"); nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, opts); if(H5Aclose(attr1_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type first attribute failed"); if(H5Aclose(attr2_id) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + H5TOOLS_GOTO_ERROR(1, "H5Aget_type second attribute failed"); nfound_total += nfound; } @@ -605,8 +605,8 @@ done: H5Aclose(attr2_id); } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_attr end - errstat:%d", opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_DEBUG("diff_attr end - errstat:%d", opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound_total; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 5fb0ebf..ced72b3 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -42,7 +42,7 @@ hsize_t diff_dataset(hid_t file1_id, hsize_t nfound = 0; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_dataset start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_dataset start - errstat:%d", opts->err_stat); /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- @@ -50,17 +50,17 @@ hsize_t diff_dataset(hid_t file1_id, /* Open the datasets */ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj1_name); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 first dataset failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dopen2 first dataset failed"); } if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj2_name); - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 second dataset failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dopen2 second dataset failed"); } if((dcpl1 = H5Dget_create_plist(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist first dataset failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_create_plist first dataset failed"); if((dcpl2 = H5Dget_create_plist(did2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist second dataset failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_create_plist second dataset failed"); /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -69,12 +69,12 @@ hsize_t diff_dataset(hid_t file1_id, * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_dataset h5tools_canreadf then diff_datasetid"); + H5TOOLS_DEBUG("diff_dataset h5tools_canreadf then diff_datasetid"); if ((status = h5tools_canreadf((opts->m_verbose ? obj1_name : NULL), dcpl1) == 1) && (status = h5tools_canreadf((opts->m_verbose ? obj2_name : NULL), dcpl2) == 1)) nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, opts); else if (status < 0) { - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "h5tools_canreadf failed"); + H5TOOLS_GOTO_ERROR(1, "h5tools_canreadf failed"); } else { ret_value = 1; @@ -93,8 +93,8 @@ done: /* enable error reporting */ } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_dataset finish:%d - errstat:%d", nfound, opts->err_stat); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_DEBUG("diff_dataset finish:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } @@ -200,31 +200,31 @@ hsize_t diff_datasetid(hid_t did1, unsigned int vl_data2 = 0; /*contains VL datatypes */ H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datasetid start - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_datasetid start - errstat:%d", opts->err_stat); /* Get the dataspace handle */ if((sid1 = H5Dget_space(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_space failed"); /* Get rank */ if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_ndims failed"); /* Get the dataspace handle */ if((sid2 = H5Dget_space(did2)) < 0 ) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_space failed"); /* Get rank */ if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_ndims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sget_simple_extent_dims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rank: %ld - %ld", rank1, rank2); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); + H5TOOLS_DEBUG("rank: %ld - %ld", rank1, rank2); /*------------------------------------------------------------------------- * get the file data type @@ -233,35 +233,35 @@ hsize_t diff_datasetid(hid_t did1, /* Get the data type */ if((f_tid1 = H5Dget_type(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_type failed"); /* Get the data type */ if((f_tid2 = H5Dget_type(did2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_type failed"); /*------------------------------------------------------------------------- * get the storage layout type *------------------------------------------------------------------------- */ if((dcpl1 = H5Dget_create_plist(did1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(did2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dget_create_plist failed"); if((stl1 = H5Pget_layout(dcpl1)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR(1, "H5Pget_layout failed"); if((stl2 = H5Pget_layout(dcpl2)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR(1, "H5Pget_layout failed"); /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check for empty datasets"); + H5TOOLS_DEBUG("check for empty datasets"); storage_size1 = H5Dget_storage_size(did1); storage_size2 = H5Dget_storage_size(did2); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "storage size: %ld - %ld", storage_size1, storage_size2); + H5TOOLS_DEBUG("storage size: %ld - %ld", storage_size1, storage_size2); if(storage_size1 == 0 || storage_size2 == 0) { if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) { @@ -285,45 +285,45 @@ hsize_t diff_datasetid(hid_t did1, obj1_name, obj2_name, opts, 0) != 1) can_compare = 0; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("diff_can_type - errstat:%d", opts->err_stat); /*------------------------------------------------------------------------- * memory type and sizes *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check for memory type and sizes"); + H5TOOLS_DEBUG("check for memory type and sizes"); if (H5Tget_class(f_tid1) == H5T_REFERENCE) { if((m_tid1 = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) first ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) first ftype failed"); } else { if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type first ftype failed"); } if (H5Tget_class(f_tid2) == H5T_REFERENCE) { if((m_tid2 = H5Tcopy(H5T_STD_REF)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tcopy(H5T_STD_REF) second ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tcopy(H5T_STD_REF) second ftype failed"); } else { if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second ftype failed"); + H5TOOLS_GOTO_ERROR(1, "H5Tget_native_type second ftype failed"); } m_size1 = H5Tget_size(m_tid1); m_size2 = H5Tget_size(m_tid2); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "type size: %ld - %ld", m_size1, m_size2); + H5TOOLS_DEBUG("type size: %ld - %ld", m_size1, m_size2); /*------------------------------------------------------------------------- * check for different signed/unsigned types *------------------------------------------------------------------------- */ if(can_compare) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare for sign"); + H5TOOLS_DEBUG("can_compare for sign"); sign1 = H5Tget_sign(m_tid1); sign2 = H5Tget_sign(m_tid2); if(sign1 != sign2) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sign1 != sign2"); + H5TOOLS_DEBUG("sign1 != sign2"); if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); @@ -332,7 +332,7 @@ hsize_t diff_datasetid(hid_t did1, can_compare = 0; opts->not_cmp = 1; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare for sign - can_compare=%d opts->not_cmp=%d", can_compare, opts->not_cmp); + H5TOOLS_DEBUG("can_compare for sign - can_compare=%d opts->not_cmp=%d", can_compare, opts->not_cmp); } /* Check if type is either VLEN-data or VLEN-string to reclaim any @@ -342,7 +342,7 @@ hsize_t diff_datasetid(hid_t did1, vl_data1 = TRUE; if(TRUE == h5tools_detect_vlen(m_tid2)) vl_data2 = TRUE; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5tools_detect_vlen %d:%d - errstat:%d", vl_data1, vl_data2, opts->err_stat); + H5TOOLS_DEBUG("h5tools_detect_vlen %d:%d - errstat:%d", vl_data1, vl_data2, opts->err_stat); /*------------------------------------------------------------------------ * only attempt to compare if possible @@ -350,7 +350,7 @@ hsize_t diff_datasetid(hid_t did1, */ if(can_compare) { /* it is possible to compare */ H5T_class_t tclass = H5Tget_class(f_tid1); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare attempt"); + H5TOOLS_DEBUG("can_compare attempt"); /*----------------------------------------------------------------- * get number of elements @@ -364,19 +364,19 @@ hsize_t diff_datasetid(hid_t did1, for(i = 0; i < rank2; i++) nelmts2 *= dims2[i]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "nelmts: %ld - %ld", nelmts1, nelmts2); + H5TOOLS_DEBUG("nelmts: %ld - %ld", nelmts1, nelmts2); if(tclass != H5T_ARRAY) { /*----------------------------------------------------------------- * "upgrade" the smaller memory size *------------------------------------------------------------------ */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NOT H5T_ARRAY, upgrade the smaller memory size?"); + H5TOOLS_DEBUG("NOT H5T_ARRAY, upgrade the smaller memory size?"); if (FAIL == match_up_memsize (f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2)) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "m_size: %ld - %ld", m_size1, m_size2); + H5TOOLS_GOTO_ERROR(1, "match_up_memsize failed"); + H5TOOLS_DEBUG("m_size: %ld - %ld", m_size1, m_size2); dadims = dims1; dam_size = m_size1; dam_tid = m_tid1; @@ -384,7 +384,7 @@ hsize_t diff_datasetid(hid_t did1, need = (size_t)(nelmts1 * m_size1); /* bytes needed */ } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Array dims: %d - %d", dims1[0], dims2[0]); + H5TOOLS_DEBUG("Array dims: %d - %d", dims1[0], dims2[0]); /* Compare the smallest array, but create the largest buffer */ if(m_size1 <= m_size2) { dadims = dims1; @@ -406,10 +406,10 @@ hsize_t diff_datasetid(hid_t did1, name1 = diff_basename(obj1_name); if(obj2_name) name2 = diff_basename(obj2_name); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "obj_names: %s - %s", name1, name2); + H5TOOLS_DEBUG("obj_names: %s - %s", name1, name2); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "read/compare"); + H5TOOLS_DEBUG("read/compare"); /*---------------------------------------------------------------- * read/compare *----------------------------------------------------------------- @@ -420,24 +420,24 @@ hsize_t diff_datasetid(hid_t did1, } /* end if */ if(buf1 != NULL && buf2 != NULL) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf1 != NULL && buf2 != NULL"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Dread did1"); + H5TOOLS_DEBUG("buf1 != NULL && buf2 != NULL"); + H5TOOLS_DEBUG("H5Dread did1"); if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Dread did2"); + H5TOOLS_GOTO_ERROR(1, "H5Dread failed"); + H5TOOLS_DEBUG("H5Dread did2"); if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dread failed"); /* array diff */ nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims, opts, name1, name2, dam_tid, did1, did2); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_array nfound:%d - errstat:%d", nfound, opts->err_stat); + H5TOOLS_DEBUG("diff_array nfound:%d - errstat:%d", nfound, opts->err_stat); /* reclaim any VL memory, if necessary */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check vl_data1:%d", vl_data1); + H5TOOLS_DEBUG("check vl_data1:%d", vl_data1); if(vl_data1) H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "check vl_data2:%d", vl_data2); + H5TOOLS_DEBUG("check vl_data2:%d", vl_data2); if(vl_data2) H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2); if(buf1 != NULL) { @@ -479,7 +479,7 @@ hsize_t diff_datasetid(hid_t did1, size = 1; sm_size[i - 1] = MIN(dadims[i - 1], size); sm_nbytes *= sm_size[i - 1]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sm_nbytes: %ld", sm_nbytes); + H5TOOLS_DEBUG("sm_nbytes: %ld", sm_nbytes); } /* end for */ /* malloc return code should be verified. @@ -490,9 +490,9 @@ hsize_t diff_datasetid(hid_t did1, * E.g., sm_space. */ if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(1, "HDmalloc failed"); if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(1, "HDmalloc failed"); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); @@ -509,19 +509,19 @@ hsize_t diff_datasetid(hid_t did1, hs_nelmts *= hs_size[i]; } /* end for */ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(1, "H5Sselect_hyperslab failed"); } /* end if */ else hs_nelmts = 1; if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dread failed"); if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0) - H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(1, "H5Dread failed"); /* get array differences. in the case of hyperslab read, increment the number of differences found in each hyperslab and pass the position at the beginning for printing */ @@ -554,7 +554,7 @@ hsize_t diff_datasetid(hid_t did1, H5Sclose(sm_space); } /* hyperslab read */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "can_compare complete"); + H5TOOLS_DEBUG("can_compare complete"); } /*can_compare*/ @@ -562,7 +562,7 @@ hsize_t diff_datasetid(hid_t did1, * close *------------------------------------------------------------------------- */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reclaim any VL memory - errstat:%d", opts->err_stat); + H5TOOLS_DEBUG("reclaim any VL memory - errstat:%d", opts->err_stat); done: opts->err_stat = opts->err_stat | ret_value; @@ -609,8 +609,8 @@ done: /* enable error reporting */ } H5E_END_TRY; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_datasetid return:%d with nfound:%d", ret_value, nfound); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_DEBUG("diff_datasetid return:%d with nfound:%d", ret_value, nfound); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return nfound; } @@ -648,15 +648,15 @@ int diff_can_type(hid_t f_tid1, /* file data type */ int i; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type start"); + H5TOOLS_DEBUG("diff_can_type start"); /*------------------------------------------------------------------------- * check for the same class *------------------------------------------------------------------------- */ if((tclass1 = H5Tget_class(f_tid1)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class first object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class first object failed"); if((tclass2 = H5Tget_class(f_tid2)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_class second object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class second object failed"); if(tclass1 != tclass2) { if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) { @@ -672,7 +672,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -686,7 +686,8 @@ int diff_can_type(hid_t f_tid1, /* file data type */ obj1_name, obj2_name, get_class(tclass2)); } /* end if */ opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); + break; case H5T_INTEGER: case H5T_FLOAT: @@ -701,7 +702,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ case H5T_NO_CLASS: case H5T_NCLASSES: default: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type class - %s", get_class(tclass1)); + H5TOOLS_DEBUG("diff_can_type class - %s", get_class(tclass1)); break; } /* end switch */ @@ -741,7 +742,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ parallel_print("\n"); } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -777,7 +778,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } /*------------------------------------------------------------------------- @@ -799,7 +800,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ if(tclass1 == H5T_STRING) { htri_t vstrtype1 = -1; htri_t vstrtype2 = -1; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type end - H5T_STRING"); + H5TOOLS_DEBUG("diff_can_type end - H5T_STRING"); vstrtype1 = H5Tis_variable_str(f_tid1); vstrtype2 = H5Tis_variable_str(f_tid2); @@ -810,7 +811,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n", obj1_name, obj2_name); opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } } @@ -820,7 +821,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ int j; hid_t memb_type1 = -1; hid_t memb_type2 = -1; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type end - H5T_COMPOUND"); + H5TOOLS_DEBUG("diff_can_type end - H5T_COMPOUND"); nmembs1 = H5Tget_nmembers(f_tid1); nmembs2 = H5Tget_nmembers(f_tid2); @@ -832,7 +833,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ parallel_print("\n"); } opts->not_cmp = 1; - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } for (j = 0; j < nmembs1; j++) { @@ -845,7 +846,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */ opts->not_cmp = 1; H5Tclose(memb_type1); H5Tclose(memb_type2); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } H5Tclose(memb_type1); H5Tclose(memb_type2); @@ -853,10 +854,10 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } done: if (ret_value < 0) - opts->err_stat = 1; + opts->err_stat = H5DIFF_ERR; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "diff_can_type end - %d", ret_value); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_DEBUG("diff_can_type end - %d", ret_value); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index b54ffe1..98df0c7 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -347,7 +347,7 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, H5Tclose(*m_tid1); if(((*m_tid1) = H5Tget_native_type(f_tid2_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed"); *m_size1 = H5Tget_size(*m_tid1); } /* end if */ @@ -355,16 +355,16 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, H5Tclose(*m_tid2); if(((*m_tid2) = H5Tget_native_type(f_tid1_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed"); *m_size2 = H5Tget_size(*m_tid2); } /* end else */ } /* end if */ if((*m_size1) != (*m_size2)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "native type sizes do not compare"); + H5TOOLS_GOTO_ERROR(FAIL, "native type sizes do not compare"); done: - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index f70ecd2..8eaa805 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -91,14 +91,8 @@ typedef enum { void h5tools_init(void) { - char lib_str[256]; - if (!h5tools_init_g) { - /* register the error class */ - HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d",H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - - H5tools_ERR_STACK_g = H5Ecreate_stack(); - H5TOOLS_INIT_ERROR() + H5TOOLS_INIT_ERROR(); if (!rawattrstream) rawattrstream = stdout; @@ -175,8 +169,8 @@ h5tools_close(void) /* Clean up the reference path table, if it's been used */ term_ref_path_table(); - H5TOOLS_CLOSE_ERROR() - H5Eclose_stack(H5tools_ERR_STACK_g); + H5TOOLS_CLOSE_ERROR(); + /* Shut down the library */ H5close(); @@ -442,11 +436,11 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) /* Make a copy of the FAPL, for the file open call to use, eventually */ if (fapl == H5P_DEFAULT) { if ((new_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); } /* end if */ else { if ((new_fapl = H5Pcopy(fapl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcopy failed"); } /* end else */ /* Determine which driver the user wants to open the file with. Try @@ -454,7 +448,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if (!HDstrcmp(driver, drivernames[SEC2_IDX])) { /* SEC2 driver */ if (H5Pset_fapl_sec2(new_fapl) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_sec2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_sec2 failed"); if (drivernum) *drivernum = SEC2_IDX; @@ -466,7 +460,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) * is the member size. */ if (H5Pset_fapl_family(new_fapl, (hsize_t) 0, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_family failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_family failed"); if (drivernum) *drivernum = FAMILY_IDX; @@ -474,7 +468,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) else if (!HDstrcmp(driver, drivernames[SPLIT_IDX])) { /* SPLIT Driver */ if (H5Pset_fapl_split(new_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_split failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_split failed"); if (drivernum) *drivernum = SPLIT_IDX; @@ -482,7 +476,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) else if (!HDstrcmp(driver, drivernames[MULTI_IDX])) { /* MULTI Driver */ if (H5Pset_fapl_multi(new_fapl, NULL, NULL, NULL, NULL, TRUE) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_multi failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_multi failed"); if(drivernum) *drivernum = MULTI_IDX; @@ -498,7 +492,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum) if(mpi_initialized && !mpi_finalized) { if(H5Pset_fapl_mpio(new_fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fapl_mpio failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fapl_mpio failed"); if(drivernum) *drivernum = MPIO_IDX; } /* end if */ @@ -749,23 +743,23 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, return; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&prefix, 0, sizeof(h5tools_str_t)); HDmemset(&str, 0, sizeof(h5tools_str_t)); /* Terminate previous line, if any */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "before CR elmtno=%ld, ctx->cur_column=%d, info->idx_fmt=%s, info->line_suf=%s", elmtno, ctx->cur_column, info->idx_fmt, info->line_suf); + H5TOOLS_DEBUG("before CR elmtno=%ld, ctx->cur_column=%d, info->idx_fmt=%s, info->line_suf=%s", elmtno, ctx->cur_column, info->idx_fmt, info->line_suf); if (ctx->cur_column) { PUTSTREAM(OPT(info->line_suf, ""), stream); HDputc('\n', stream); PUTSTREAM(OPT(info->line_sep, ""), stream); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "after CR elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); + H5TOOLS_DEBUG("after CR elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); /* Calculate new prefix */ h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - str=%s", prefix.s, str.s); + H5TOOLS_DEBUG("prefix=%s - str=%s", prefix.s, str.s); /* Write new prefix to output */ if (ctx->indent_level > 0) @@ -793,7 +787,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); templength = h5tools_str_len(&prefix); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - templength=%d", prefix.s, templength); + H5TOOLS_DEBUG("prefix=%s - templength=%d", prefix.s, templength); for (u = 0; u < indentlevel; u++) { /*we already made the indent for the array indices case */ @@ -806,18 +800,18 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, templength += h5tools_str_len(&str); } } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - templength=%d", prefix.s, templength); + H5TOOLS_DEBUG("prefix=%s - templength=%d", prefix.s, templength); ctx->cur_column = ctx->prev_prefix_len = templength; ctx->cur_elmt = 0; ctx->need_prefix = 0; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "prefix=%s - str=%s", prefix.s, str.s); + H5TOOLS_DEBUG("prefix=%s - str=%s", prefix.s, str.s); /* Free string */ h5tools_str_close(&prefix); h5tools_str_close(&str); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); } @@ -945,11 +939,11 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, return dimension_break; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter need_prefix=%d", ctx->need_prefix); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); + H5TOOLS_DEBUG("enter need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); s = h5tools_str_fmt(buffer, (size_t)0, "%s"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "s=%s", s); + H5TOOLS_DEBUG("s=%s", s); /* * If the element would split on multiple lines if printed at our @@ -976,7 +970,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ ctx->need_prefix = TRUE; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); } /* @@ -992,9 +986,9 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, ctx->need_prefix = TRUE; dimension_break = FALSE; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmt_counter=%ld - ctx->size_last_dim=%ld info->line_suf=%s", elmt_counter, ctx->size_last_dim, info->line_suf); + H5TOOLS_DEBUG("elmt_counter=%ld - ctx->size_last_dim=%ld info->line_suf=%s", elmt_counter, ctx->size_last_dim, info->line_suf); /* * If the previous element occupied multiple lines and this element @@ -1008,7 +1002,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols) ctx->need_prefix = TRUE; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); /* * If too many elements have already been printed then we need to @@ -1016,7 +1010,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, */ if (info->line_per_line > 0 && ctx->cur_elmt >= info->line_per_line) ctx->need_prefix = TRUE; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); /* * Each OPTIONAL_LINE_BREAK embedded in the rendered string can cause @@ -1045,7 +1039,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * Print the prefix or separate the beginning of this element * from the previous element. */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->need_prefix=%d", ctx->need_prefix); + H5TOOLS_DEBUG("ctx->need_prefix=%d", ctx->need_prefix); if (ctx->need_prefix) { if (secnum) multiline++; @@ -1055,7 +1049,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, * this is necessary to print the array indices */ *curr_pos = ctx->sm_pos + local_elmt_counter; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->sm_pos=%ld - ctx->ndims=%ld", *curr_pos, ctx->sm_pos, ctx->ndims); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->sm_pos=%ld - ctx->ndims=%ld", *curr_pos, ctx->sm_pos, ctx->ndims); h5tools_simple_prefix(stream, info, ctx, *curr_pos, secnum); } @@ -1063,7 +1057,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, PUTSTREAM(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += HDstrlen(OPT(info->elmt_suf2, " ")); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "section=%s", section); + H5TOOLS_DEBUG("section=%s", section); /* Print the section */ PUTSTREAM(section, stream); @@ -1072,7 +1066,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info, ctx->prev_multiline = multiline; - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return dimension_break; @@ -1116,8 +1110,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, int multiline; /* datum was multiline */ H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); + H5TOOLS_DEBUG("enter"); + H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter); s = h5tools_str_fmt(buffer, (size_t)0, "%s"); @@ -1210,7 +1204,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, * this is necessary to print the array indices */ *curr_pos = ctx->sm_pos + local_elmt_counter; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->sm_pos=%ld", *curr_pos, ctx->sm_pos); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->sm_pos=%ld", *curr_pos, ctx->sm_pos); h5tools_region_simple_prefix(stream, info, ctx, local_elmt_counter, ptdata, secnum); } @@ -1226,7 +1220,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, ctx->prev_multiline = multiline; - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return dimension_break; @@ -1248,19 +1242,19 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) unsigned j; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); if(ctx->ndims > 0) { ctx->acc[ctx->ndims - 1] = 1; for (i = ((int)ctx->ndims - 2); i >= 0; i--) { ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->acc[%d]=%ld", i, ctx->acc[i]); + H5TOOLS_DEBUG("ctx->acc[%d]=%ld", i, ctx->acc[i]); } for (j = 0; j < ctx->ndims; j++) ctx->pos[j] = 0; } - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); } @@ -1283,7 +1277,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t H5T_class_t type_class; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); if((size = H5Tget_size(tid)) == 0) H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); @@ -1295,7 +1289,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t case H5T_FLOAT: case H5T_ENUM: case H5T_BITFIELD: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "numbers"); + H5TOOLS_DEBUG("numbers"); block_index = block_nelmts * size; while(block_index > 0) { size_t bytes_in = 0; /* # of bytes to write */ @@ -1322,7 +1316,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t char *s = NULL; unsigned char tempuchar; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STRING"); + H5TOOLS_DEBUG("H5T_STRING"); pad = H5Tget_strpad(tid); for (block_index = 0; block_index < block_nelmts; block_index++) { @@ -1351,7 +1345,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t int snmembs; unsigned nmembs; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_COMPOUND"); + H5TOOLS_DEBUG("H5T_COMPOUND"); if((snmembs = H5Tget_nmembers(tid)) < 0) H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed"); nmembs = (unsigned)snmembs; @@ -1383,7 +1377,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts; hid_t memb = -1; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_ARRAY"); + H5TOOLS_DEBUG("H5T_ARRAY"); /* get the array's base datatype for each element */ memb = H5Tget_super(tid); ndims = H5Tget_array_ndims(tid); @@ -1417,7 +1411,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t hsize_t nelmts; hid_t memb = -1; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_VLEN"); + H5TOOLS_DEBUG("H5T_VLEN"); /* get the VL sequences's base datatype for each element */ memb = H5Tget_super(tid); @@ -1437,9 +1431,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t break; case H5T_REFERENCE: { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + H5TOOLS_DEBUG("reference class type"); if (H5Tequal(tid, H5T_STD_REF)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STD_REF"); + H5TOOLS_DEBUG("H5T_STD_REF"); if (region_output) { /* region data */ hid_t region_id = H5I_INVALID_HID; @@ -1449,8 +1443,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; if((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5T_STD_REF failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Ropen_object H5T_STD_REF failed"); else { if((region_space = H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (!h5tools_is_zero(mem, H5Tget_size(H5T_STD_REF))) { @@ -1461,8 +1454,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t render_bin_output_region_blocks(region_space, region_id, stream, container); } else { - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5T_STD_REF NULL"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Ropen_object H5T_STD_REF NULL"); } H5Sclose(region_space); } /* end if (region_space >= 0) */ @@ -1473,18 +1465,18 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t } else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { /* if (size == H5R_DSET_REG_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STD_REF_DSETREG"); + H5TOOLS_DEBUG("H5T_STD_REF_DSETREG"); } else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { /* if (size == H5R_OBJ_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STD_REF_OBJ"); + H5TOOLS_DEBUG("H5T_STD_REF_OBJ"); } } break; case H5T_TIME: case H5T_OPAQUE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_OPAQUE"); + H5TOOLS_DEBUG("H5T_OPAQUE"); for (block_index = 0; block_index < block_nelmts; block_index++) { mem = ((unsigned char*)_mem) + block_index * size; if (size != HDfwrite(mem, sizeof(char), size, stream)) @@ -1500,8 +1492,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t break; } /* end switch */ +done: + CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1575,16 +1569,16 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, } if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_hyperslab failed"); if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); if(render_bin_output(stream, container, type_id, (char*)region_buf, numelem) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data region failed"); + H5TOOLS_GOTO_ERROR(FAIL, "render_bin_output of data region failed"); /* Render the region data element end */ done: ; @@ -1597,11 +1591,11 @@ CATCH HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); if(H5Sclose(sid1) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1642,15 +1636,15 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + H5TOOLS_GOTO_ERROR(FALSE, "Could not allocate buffer for ptdata"); if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, nblocks, ptdata) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Rget_select_hyper_blocklist failed"); if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Tget_native_type failed"); render_bin_output_region_data_blocks(region_id, stream, container, ndims, type_id, nblocks, ptdata); @@ -1658,15 +1652,15 @@ done: HDfree(ptdata); if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); H5_LEAVE(TRUE) CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1701,35 +1695,35 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id, H5TOOLS_PUSH_STACK(); if((type_size = H5Tget_size(type_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_size failed"); if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for region"); /* Allocate space for the dimension array */ if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims"); dims1[0] = npoints; if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Screate_simple failed"); if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); if(H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); if(render_bin_output(stream, container, type_id, (char*)region_buf, npoints) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "render_bin_output of data points failed"); + H5TOOLS_GOTO_ERROR(FAIL, "render_bin_output of data points failed"); done: HDfree(region_buf); HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1767,23 +1761,23 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, ndims = (unsigned)sndims; if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FALSE, "H5Tget_native_type failed"); render_bin_output_region_data_points(region_space, region_id, stream, container, ndims, type_id, npoints); done: if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(FALSE, "H5Tclose failed"); H5_LEAVE(ret_value) CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index eb73431..ada7ae8 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -274,11 +274,11 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * to the ctx->size_last_dim. */ H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter file=%p", (void*)stream); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rawdata file=%p", (void*)rawdatastream); + H5TOOLS_DEBUG("enter file=%p", (void*)stream); + H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream); /* binary dump */ if (bin_output && (rawdatastream != NULL)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "render_bin_output"); + H5TOOLS_DEBUG("render_bin_output"); if (render_bin_output(rawdatastream, container, type, _mem, nelmts) < 0) { PRINTVALSTREAM(rawoutstream, "\nError in writing binary stream\n"); } @@ -287,7 +287,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); size = H5Tget_size(type); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "type size is %ld", size); + H5TOOLS_DEBUG("type size is %ld", size); if (info->line_ncols > 0) ncols = info->line_ncols; @@ -298,7 +298,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai */ curr_pos = ctx->sm_pos; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render start:%ld", nelmts); + H5TOOLS_DEBUG("data render start:%ld", nelmts); for (i = 0; i < nelmts; i++, ctx->cur_elmt++, elmt_counter++) { void* memref = mem + i * size; @@ -315,12 +315,12 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai if(FALSE == dimension_break) elmt_counter = 0; } /* end for (i = 0; i < nelmts... */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render finish"); + H5TOOLS_DEBUG("data render finish"); h5tools_str_close(&buffer); }/* else bin */ - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -376,8 +376,8 @@ h5tools_dump_region_attribute(hid_t region_id, outputformat.idx_sep = ""; outputformat.line_pre = ""; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter file=%p", (void*)stream); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rawdata file=%p", (void*)rawdatastream); + H5TOOLS_DEBUG("enter file=%p", (void*)stream); + H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream); /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -387,11 +387,11 @@ h5tools_dump_region_attribute(hid_t region_id, /* Render the region { element end */ if((region_space = H5Aget_space(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Aget_space failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Aget_space failed"); if((atype = H5Aget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Aget_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Aget_type failed"); if((type_id = H5Tget_native_type(atype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed"); ctx->indent_level++; ctx->need_prefix = TRUE; @@ -442,13 +442,13 @@ h5tools_dump_region_attribute(hid_t region_id, h5tools_dump_data(stream, &outputformat, ctx, region_id, FALSE); } - done: +done: if(H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if(H5Tclose(atype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); ctx->indent_level--; ctx->need_prefix = TRUE; @@ -463,7 +463,7 @@ h5tools_dump_region_attribute(hid_t region_id, CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; @@ -521,18 +521,18 @@ h5tools_print_region_data_blocks(hid_t region_id, HDmemset(&ctx, 0, sizeof(ctx)); H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); if((type_size = H5Tget_size(type_id)) == 0) H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); /* Get the dataspace of the dataset */ if((sid1 = H5Dget_space(region_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); /* Allocate space for the dimension array */ if((dims1 = (hsize_t *) HDmalloc((size_t)(sizeof(hsize_t) * ndims))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for dims"); /* find the dimensions of each data space from the block coordinates */ numelem = 1; @@ -543,18 +543,18 @@ h5tools_print_region_data_blocks(hid_t region_id, /* Create dataspace for reading buffer */ if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Screate_simple failed"); if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate region buffer"); /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ /* 1 2 n 1 2 n */ if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for start"); if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count"); + H5TOOLS_GOTO_ERROR(FAIL, "Could not allocate buffer for count"); curr_pos = 0; ctx.indent_level = cur_ctx->indent_level; @@ -592,7 +592,7 @@ h5tools_print_region_data_blocks(hid_t region_id, h5tools_region_simple_prefix(stream, info, &ctx, curr_pos, ptdata, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render start:%ld", numelem); + H5TOOLS_DEBUG("data render start:%ld", numelem); elmtno = 0; for (numindex = 0; numindex < numelem; numindex++, elmtno++, ctx.cur_elmt++) { /* Render the region data element begin */ @@ -614,16 +614,17 @@ h5tools_print_region_data_blocks(hid_t region_id, } /* end for (numindex = 0; numindex < numelem; numindex++, elmtno++, ctx.cur_elmt++) */ } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + ctx.indent_level--; + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); } ctx.indent_level--; } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); } } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_hyperslab failed"); } } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ @@ -635,11 +636,11 @@ done: HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); if(H5Sclose(sid1) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; @@ -711,7 +712,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter ndims=%d", ndims); + H5TOOLS_DEBUG("enter ndims=%d", ndims); /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -730,10 +731,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata"); if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Rget_select_hyper_blocklist failed"); for(indx = 0; indx < nblocks; indx++) { unsigned loop_indx; @@ -759,9 +760,9 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, ctx->need_prefix = TRUE; if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed"); /* Render the datatype element begin */ h5tools_str_reset(buffer); @@ -818,14 +819,15 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, h5tools_print_region_data_blocks(region_id, rawdatastream, info, ctx, buffer, ncols, ndims, type_id, nblocks, ptdata); } - done: + +done: HDfree(ptdata); if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if (region_output) { ctx->need_prefix = TRUE; @@ -858,7 +860,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; @@ -909,7 +911,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, HDassert(ndims > 0); H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&ctx, 0, sizeof(ctx)); /* Allocate space for the dimension array */ @@ -935,9 +937,9 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, ctx.ndims = ndims; if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "data render start:%ld", npoints); + H5TOOLS_DEBUG("data render start:%ld", npoints); elmtno = 0; for (jndx = 0; jndx < npoints; jndx++, elmtno++) { ctx.need_prefix = TRUE; @@ -984,7 +986,8 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, elmtno = 0; } else { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + ctx.indent_level--; + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); } ctx.indent_level--; } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ @@ -995,9 +998,9 @@ CATCH HDfree(dims1); if(H5Sclose(mem_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; @@ -1066,7 +1069,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter ndims=%d", ndims); + H5TOOLS_DEBUG("enter ndims=%d", ndims); /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -1085,10 +1088,10 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, alloc_size = npoints * ndims * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); + H5TOOLS_GOTO_ERROR(dimension_break, "Could not allocate buffer for ptdata"); if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, npoints, ptdata) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Sget_select_elem_pointlist failed"); for (indx = 0; indx < npoints; indx++) { unsigned loop_indx; @@ -1109,9 +1112,9 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, ctx->need_prefix = TRUE; if((dtype = H5Dget_type(region_id)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Dget_type failed"); if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(dimension_break, "H5Tget_native_type failed"); /* Render the datatype element begin */ h5tools_str_reset(buffer); @@ -1170,14 +1173,14 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, h5tools_print_region_data_points(region_space, region_id, rawdatastream, info, ctx, buffer, ncols, ndims, type_id, npoints, ptdata); } - done: +done: HDfree(ptdata); if(type_id > 0 && H5Tclose(type_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if(dtype > 0 && H5Tclose(dtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_ERROR(dimension_break, "H5Tclose failed"); if (region_output) { ctx->need_prefix = TRUE; @@ -1210,7 +1213,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, H5_LEAVE(dimension_break) CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; @@ -1378,7 +1381,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c ctx->need_prefix = TRUE; if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); + H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) @@ -1401,7 +1404,7 @@ CATCH if(sm_buf) HDfree(sm_buf); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1614,7 +1617,7 @@ CATCH if(f_space >= 0 && H5Sclose(f_space) < 0) H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1668,18 +1671,18 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont unsigned int vl_data = 0; /* contains VL datatypes */ H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); if (FAIL == (f_space = H5Dget_space(dset))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); sndims = H5Sget_simple_extent_ndims(f_space); if(sndims < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sndims:%d", sndims); + H5TOOLS_DEBUG("sndims:%d", sndims); if ((size_t)ctx->ndims > NELMTS(sm_size)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); + H5TOOLS_GOTO_ERROR(FAIL, "ctx->ndims > NELMTS(sm_size) failed"); /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1726,22 +1729,22 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont HDassert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ if (NULL != (sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "stripmine size:%ld", sm_nbytes); + H5TOOLS_DEBUG("stripmine size:%ld", sm_nbytes); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sm_nelmts size:%ld", sm_nelmts); + H5TOOLS_DEBUG("sm_nelmts size:%ld", sm_nelmts); if (ctx->ndims > 0) init_acc_pos(ctx, total_size); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->ndims:%d", ctx->ndims); + H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims); /* The stripmine loop */ HDmemset(hs_offset, 0, sizeof hs_offset); HDmemset(zero, 0, sizeof zero); for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "stripmine read loop:%d", i); + H5TOOLS_DEBUG("stripmine read loop:%d", i); /* Calculate the hyperslab size */ if (ctx->ndims > 0) { for (i = 0, hs_nelmts = 1; i < ctx->ndims; i++) { @@ -1751,19 +1754,19 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont } if (H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab hs_offset failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_hyperslab hs_offset failed"); if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab zero failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_hyperslab zero failed"); } else { if (H5Sselect_all(f_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_all f_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_all f_space failed"); if (H5Sselect_all(sm_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_all sm_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_all sm_space failed"); hs_nelmts = 1; } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Read the data"); + H5TOOLS_DEBUG("Read the data"); /* Read the data */ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) >= 0) { /* Print the data */ @@ -1775,13 +1778,13 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont ctx->sm_pos = elmtno; if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); + H5TOOLS_GOTO_ERROR(FAIL, "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Calculate the next hyperslab offset"); + H5TOOLS_DEBUG("Calculate the next hyperslab offset"); /* Calculate the next hyperslab offset */ for (i = ctx->ndims, carry = 1; i > 0 && carry; --i) { ctx->p_min_idx[i - 1] = ctx->p_max_idx[i - 1]; @@ -1794,20 +1797,21 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont } } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); ctx->continuation++; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "stripmine read loop:%d complete", i); + H5TOOLS_DEBUG("stripmine read loop:%d complete", i); } HDfree(sm_buf); } /* if (NULL != (sm_buf...)) */ + done: if(sm_space >= 0 && H5Sclose(sm_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); if(f_space >= 0 && H5Sclose(f_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1839,15 +1843,15 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte unsigned int vl_data = 0; /* contains VL datatypes */ H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); if (FAIL == (f_space = H5Aget_space(attr_id))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); sndims = H5Sget_simple_extent_ndims(f_space); if(sndims < 0) H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); ctx->ndims = (unsigned)sndims; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "sndims:%d", sndims); + H5TOOLS_DEBUG("sndims:%d", sndims); if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); @@ -1882,27 +1886,27 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) { if (ctx->ndims > 0) init_acc_pos(ctx, total_size); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ctx->ndims:%d", ctx->ndims); + H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Read the data"); + H5TOOLS_DEBUG("Read the data"); /* Read the data */ if (H5Aread(attr_id, p_type, buf) >= 0) { if(h5tools_dump_simple_data(stream, info, attr_id, ctx, START_OF_DATA | END_OF_DATA, p_nelmts, p_type, buf) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "h5tools_dump_simple_data failed"); + H5TOOLS_GOTO_ERROR(FAIL, "h5tools_dump_simple_data failed"); /* Reclaim any VL memory, if necessary */ if (vl_data) H5Treclaim(p_type, f_space, H5P_DEFAULT, buf); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread failed"); HDfree(buf); } /* if (NULL != (buf...)) */ done: if(f_space >= 0 && H5Sclose(f_space) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose failed"); CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -1985,7 +1989,7 @@ done: if (f_space > 0) H5Sclose(f_space); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -2043,7 +2047,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c /* Check the data space */ if (H5Sis_simple(f_space) <= 0) { - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sis_simple failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sis_simple failed"); } else { ret_value = h5tools_dump_simple_mem(rawattrstream, info, ctx, attr_id, p_type); @@ -2056,7 +2060,7 @@ done: if (f_space > 0) H5Sclose(f_space); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -2391,11 +2395,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ order = H5Tget_order(tmp_type); if(order == H5T_ORDER_LE) { if(H5Tset_order(str_type, H5T_ORDER_LE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tset_order failed"); } /* end if */ else if(order == H5T_ORDER_BE) { if(H5Tset_order(str_type, H5T_ORDER_BE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tset_order failed"); } /* end if */ if(H5Tequal(tmp_type, str_type)) { @@ -2405,7 +2409,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ /* If not equal to C variable-length string, check Fortran type. */ if(H5Tclose(str_type) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); str_type = H5Tcopy(H5T_FORTRAN_S1); H5Tset_cset(str_type, cset); @@ -2422,11 +2426,11 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ order = H5Tget_order(tmp_type); if(order == H5T_ORDER_LE) { if(H5Tset_order(str_type, H5T_ORDER_LE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tset_order failed"); } /* end if */ else if(order == H5T_ORDER_BE) { if(H5Tset_order(str_type, H5T_ORDER_BE) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tset_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tset_order failed"); } /* end if */ if(H5Tequal(tmp_type, str_type)) { @@ -2445,9 +2449,9 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_reset(buffer); if(H5Tclose(str_type) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if(H5Tclose(tmp_type) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend); break; @@ -2527,10 +2531,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, " \"%s\";", mname); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5Tclose(mtype) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_member_type failed"); H5free_memory(mname); } ctx->indent_level--; @@ -2571,7 +2575,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); if(H5Tclose(super) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); h5tools_str_append(buffer, ";"); h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); @@ -2596,7 +2600,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); if(H5Tclose(super) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend); @@ -2617,10 +2621,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, " "); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_dims2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_array_dims2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_ndims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_array_ndims failed"); /* Get array base type */ if((super = H5Tget_super(type)) >= 0) { @@ -2628,10 +2632,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE); /* Close array base type */ if(H5Tclose(super) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_super failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_super failed"); h5tools_str_append(buffer, " }"); @@ -2644,8 +2648,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ break; } +done: + CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -2723,7 +2729,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space) } /* end switch */ CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -2870,7 +2876,7 @@ CATCH if(0 == nmembs) h5tools_str_append(buffer, "\n<empty>"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return ret_value; } @@ -4006,8 +4012,8 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * H5R_ref_t *ref_buf = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter file=%p", (void*)stream); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "rawdata file=%p", (void*)rawdatastream); + H5TOOLS_DEBUG("enter file=%p", (void*)stream); + H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream); /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); if (info->line_ncols > 0) @@ -4019,12 +4025,12 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * string_dataformat.pindex = ctx->display_index; if(obj_data) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "dataset"); + H5TOOLS_DEBUG("dataset"); f_type = H5Dget_type(obj_id); space = H5Dget_space(obj_id); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "attribute"); + H5TOOLS_DEBUG("attribute"); f_type = H5Aget_type(obj_id); space = H5Aget_space(obj_id); } @@ -4052,13 +4058,13 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * if (H5Tget_class(f_type) == H5T_REFERENCE) { ctx->indent_level++; datactx = *ctx; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + H5TOOLS_DEBUG("reference class type"); if (!H5Tequal(f_type, H5T_STD_REF) && !H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) { - HGOTO_DONE(SUCCEED); + H5TOOLS_GOTO_DONE(SUCCEED); } ndims = (int)H5Sget_simple_extent_npoints(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d - datactx.ndims=%d", ndims, datactx.ndims); + H5TOOLS_DEBUG("ndims=%d - datactx.ndims=%d", ndims, datactx.ndims); /* Assume entire data space to be printed */ if (datactx.ndims > 0) @@ -4074,31 +4080,31 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * if(obj_data) { if(H5Dread(obj_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread reference failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread reference failed"); } } else { if(H5Aread(obj_id, H5T_STD_REF, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread reference failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread reference failed"); } } for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) { H5O_type_t obj_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop:%d with curr_pos=%ld", i, curr_pos); + H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); datactx.need_prefix = TRUE; h5tools_str_reset(&buffer); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); + H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); h5tools_str_sprint(&buffer, &outputformat, obj_id, H5T_STD_REF, &ref_buf[i], &datactx); h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims); ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]); switch (ref_type) { case H5R_OBJECT1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_DATASET: @@ -4107,12 +4113,12 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_ERROR(FAIL, "H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); break; case H5O_TYPE_GROUP: @@ -4125,24 +4131,24 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT1 failed"); + H5TOOLS_ERROR(FAIL, "H5Rget_obj_type3 H5R_OBJECT1 failed"); break; case H5R_DATASET_REGION1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(FAIL, "H5Dclose H5R_DATASET_REGION1 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_DATASET_REGION1 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_DATASET_REGION1 failed"); break; case H5R_OBJECT2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_GROUP: @@ -4154,12 +4160,12 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE); datactx.indent_level--; if(H5Oclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Oclose H5R_OBJECT2 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_OBJECT2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_OBJECT2 failed"); break; case H5O_TYPE_NAMED_DATATYPE: @@ -4173,22 +4179,21 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Rget_obj_type3 H5R_OBJECT2 failed"); break; case H5R_DATASET_REGION2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); if (outputformat.line_ncols > 0) ncols = outputformat.line_ncols; /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_DATASET_REGION2 failed"); else { if((new_obj_sid = H5Ropen_region((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -4214,42 +4219,42 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * region_type = H5Sget_select_type(new_obj_sid); if(region_type == H5S_SEL_POINTS) { /* Print point information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_POINTS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, &outputformat, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else if(region_type == H5S_SEL_HYPERSLABS) { /* Print block information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, &outputformat, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); + H5TOOLS_ERROR(FAIL, "invalid region type"); } /* end else to if (h5tools_is_zero(... */ if(H5Sclose(new_obj_sid) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose H5R_DATASET_REGION2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_region H5R_DATASET_REGION2 failed"); if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Dclose H5R_DATASET_REGION2 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_DATASET_REGION2 failed"); } break; case H5R_ATTR: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR"); + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); if((new_obj_id = H5Ropen_attr((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { h5tools_dump_region_attribute(new_obj_id, stream, &outputformat, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); if(H5Aclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed"); + H5TOOLS_ERROR(FAIL, "H5Aclose H5R_ATTR failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_ATTR failed"); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_ATTR"); + H5TOOLS_DEBUG("NULL H5R_ATTR"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -4271,7 +4276,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_str_append(&buffer, "}"); h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_attr H5R_ATTR failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_attr H5R_ATTR failed"); } break; case H5R_BADTYPE: @@ -4280,18 +4285,18 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * break; } /* end switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "finished reference loop:%d",i); + H5TOOLS_DEBUG("finished reference loop:%d",i); } /* end for(i = 0; i < ndims; i++, datactx->cur_elmt++, elmt_counter++) */ HDfree(ref_buf); } ctx->indent_level--; } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print all the values"); + H5TOOLS_DEBUG("Print all the values"); datactx = *ctx; string_dataformat = *info; if((datactx.display_char && H5Tget_size(f_type) == 1) && (H5Tget_class(f_type) == H5T_INTEGER)) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print 1-byte integer data as an ASCII character string"); + H5TOOLS_DEBUG("Print 1-byte integer data as an ASCII character string"); /* * Print 1-byte integer data as an ASCII character string * instead of integers if the `-r' or `--string' command-line @@ -4318,7 +4323,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * /* Print all the values. */ if(obj_data) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "h5tools_dump_dset"); + H5TOOLS_DEBUG("h5tools_dump_dset"); status = h5tools_dump_dset(stream, &string_dataformat, &datactx, obj_id); } else { @@ -4328,12 +4333,12 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * status = SUCCEED; } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "call h5tools_dump_mem"); + H5TOOLS_DEBUG("call h5tools_dump_mem"); status = h5tools_dump_mem(stream, &string_dataformat, &datactx, obj_id); } } if (datactx.display_char && H5Tget_size(f_type) == 1 && H5Tget_class(f_type) == H5T_INTEGER) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print 1-byte integer data as an ASCII character string eol=%s",string_dataformat.line_suf); + H5TOOLS_DEBUG("Print 1-byte integer data as an ASCII character string eol=%s",string_dataformat.line_suf); datactx.need_prefix = FALSE; string_dataformat.arr_linebreak = 0; string_dataformat.idx_fmt = ""; @@ -4343,7 +4348,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t * h5tools_str_append(&buffer, "\""); h5tools_render_element(stream, &string_dataformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); } - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Print all the values Complete"); + H5TOOLS_DEBUG("Print all the values Complete"); if (status == FAIL) { error_msg("unable to print data\n"); @@ -4386,7 +4391,7 @@ done: } h5tools_str_close(&buffer); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); } diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h index 6e20b7c..9ad54bc 100644 --- a/tools/lib/h5tools_error.h +++ b/tools/lib/h5tools_error.h @@ -40,30 +40,67 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; /* * H5TOOLS_INIT_ERROR macro, used to initialize error reporting. */ -#define H5TOOLS_INIT_ERROR() { \ - H5tools_ERR_CLS_g = H5Eregister_class("H5tools", "HDF5:tools", lib_str); \ - H5E_tools_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MAJOR, "Failure in tools library"); \ - H5E_tools_min_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "error in function"); \ - H5E_tools_min_info_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function info"); \ - H5E_tools_min_dbg_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function debug"); \ -} +#define H5TOOLS_INIT_ERROR() \ +do { \ + char lib_str[256]; \ + \ + /* Initialize library version string for error class */ \ + HDsnprintf(lib_str, sizeof(lib_str), "%d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); \ + \ + /* Create new HDF5 error stack for the tools to use */ \ + if ((H5tools_ERR_STACK_g = H5Ecreate_stack()) < 0) \ + HDfprintf(stderr, "Failed to create HDF5 tools error stack\n"); \ + \ + /* Register errors from the HDF5 tools as a new error class */ \ + if ((H5tools_ERR_CLS_g = H5Eregister_class("H5tools", "HDF5:tools", lib_str)) < 0) \ + HDfprintf(stderr, "Failed to register HDF5 tools error class\n"); \ + \ + /* Create a new HDF5 major error message for errors from the tools library */ \ + if ((H5E_tools_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MAJOR, "Failure in tools library")) < 0) \ + HDfprintf(stderr, "Failed to register major error message for tools library errors\n"); \ + \ + /* Create a new HDF5 minor error message for errors from the tools library */ \ + if ((H5E_tools_min_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "error in function")) < 0) \ + HDfprintf(stderr, "Failed to register minor error message for tools library errors\n"); \ + \ + /* Create a new HDF5 minor error message for info messages from the tools library */ \ + if ((H5E_tools_min_info_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function info")) < 0) \ + HDfprintf(stderr, "Failed to register minor error message for tools library info messages\n"); \ + \ + /* Create a new HDF5 minor error message for debug messages from the tools library */ \ + if ((H5E_tools_min_dbg_id_g = H5Ecreate_msg(H5tools_ERR_CLS_g, H5E_MINOR, "function debug")) < 0) \ + HDfprintf(stderr, "Failed to register minor error message for tools library debug messages\n"); \ +} while(0) /* - * H5TOOLS_CLOSE_ERROR macro, used to initialize error reporting. + * H5TOOLS_CLOSE_ERROR macro, used to terminate error reporting. */ -#define H5TOOLS_CLOSE_ERROR() { \ - H5Eclose_msg(H5E_tools_min_dbg_id_g); \ - H5Eclose_msg(H5E_tools_min_info_id_g); \ - H5Eclose_msg(H5E_tools_min_id_g); \ - H5Eclose_msg(H5E_tools_g); \ - H5Eunregister_class(H5tools_ERR_CLS_g); \ -} +#define H5TOOLS_CLOSE_ERROR() \ +do { \ + /* Close all error messages created by H5TOOLS_INIT_ERROR() */ \ + if (H5Eclose_msg(H5E_tools_min_dbg_id_g) < 0) \ + HDfprintf(stderr, "Failed to close minor error message for tools library debug messages\n"); \ + if (H5Eclose_msg(H5E_tools_min_info_id_g) < 0) \ + HDfprintf(stderr, "Failed to close minor error message for tools library info messages\n"); \ + if (H5Eclose_msg(H5E_tools_min_id_g) < 0) \ + HDfprintf(stderr, "Failed to close minor error message for tools library errors\n"); \ + if (H5Eclose_msg(H5E_tools_g) < 0) \ + HDfprintf(stderr, "Failed to close major error message for tools library errors\n"); \ + \ + /* Unregister the HDF5 tools error class */ \ + if (H5Eunregister_class(H5tools_ERR_CLS_g) < 0) \ + HDfprintf(stderr, "Failed to unregister the HDF5 tools error class\n"); \ + \ + /* Close the tools error stack */ \ + if (H5Eclose_stack(H5tools_ERR_STACK_g) < 0) \ + HDfprintf(stderr, "Failed to close HDF5 tools error stack\n"); \ +} while(0) /* * H5TOOLS_ERR_INIT macro, used to facilitate error reporting. Declaration and assignments of error variables. * Use at the beginning of a function using error handling macros. */ -#define H5TOOLS_ERR_INIT(ret_typ, ret_init) \ +#define H5TOOLS_ERR_INIT(ret_typ, ret_init) \ hid_t pstack_id = H5I_INVALID_HID; \ hid_t estack_id = H5tools_ERR_STACK_g; \ hbool_t past_catch = FALSE; \ @@ -73,7 +110,7 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; * H5TOOLS_PUSH_STACK macro, used to create a new error stack. */ #define H5TOOLS_PUSH_STACK() { \ - pstack_id = estack_id; \ + pstack_id = estack_id; \ estack_id = H5Ecreate_stack(); \ } @@ -89,40 +126,88 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; } /* - * H5TOOLS_DEBUG macro, used to facilitate error reporting. The arguments are the minor error number, and a description of the error. + * H5TOOLS_PUSH_ERROR macro, used to push an error to an error stack. Not meant to + * be called directly. */ -#ifdef H5_TOOLS_DEBUG -#define H5TOOLS_DEBUG(min_id, ...) { \ - H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ -} -#define H5TOOLS_ENDDEBUG(min_id, ...) { \ - H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ - H5Eprint2(estack_id, stderr); \ -} -#else -#define H5TOOLS_DEBUG(min_id, ...) { \ - ; \ -} -#define H5TOOLS_ENDDEBUG(min_id, ...) { \ - ; \ -} -#endif +#define H5TOOLS_PUSH_ERROR(estack_id, err_cls, maj_err_id, min_err_id, ...) \ +do { \ + if (estack_id >= 0 && err_cls >= 0) \ + H5Epush2(estack_id, __FILE__, FUNC, __LINE__, err_cls, maj_err_id, min_err_id, __VA_ARGS__); \ + else { \ + HDfprintf(stderr, __VA_ARGS__); \ + HDfprintf(stderr, "\n"); \ + } \ +} while(0) /* - * H5TOOLS_INFO macro, used to facilitate error reporting . The arguments are the minor error number, and a description of the error. + * H5TOOLS_ERROR macro, used to facilitate error reporting within a function body. + * The arguments are the return value and an error string. The return value is assigned + * to a variable `ret_value'. This macro is meant to be used for reporting an error without + * having control branch to the `done' label. This is often used when an error occurs + * after the `done' label, in which case an infinite loop would ensue if control branched + * backwards. */ -#define H5TOOLS_INFO(min_id, ...) { \ - H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \ -} +#define H5TOOLS_ERROR(ret_val, ...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \ + ret_value = ret_val; \ +} while(0) /* - * H5TOOLS_ERROR macro, used to facilitate error reporting . The arguments are the major - * error number, the minor error number, and a description of the error. + * H5TOOLS_GOTO_ERROR macro, used to facilitate error reporting within a function body. + * The arguments are the return value and an error string. The return value is assigned + * to a variable `ret_value' and control branches to the `done' label. */ -#define H5TOOLS_ERROR(maj_id, min_id, ...) { \ - H5Epush2(estack_id, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \ - ret_value = FAIL; \ -} +#define H5TOOLS_GOTO_ERROR(ret_val, ...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \ + H5TOOLS_GOTO_DONE(ret_val); \ +} while(0) + +/* + * H5TOOLS_GOTO_DONE macro, used to facilitate normal return within a function body. + * The argument is the return value which is assigned to the `ret_value' + * variable. Control branches to the `done' label. + */ +#define H5TOOLS_GOTO_DONE(ret_val) \ +do { \ + ret_value = ret_val; \ + goto done; \ +} while(0) + +/* + * H5TOOLS_INFO macro, used to facilitate error reporting. The arguments are + * a description of the error. + */ +#define H5TOOLS_INFO(...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_info_id_g, __VA_ARGS__); \ +} while(0) + +/* + * H5TOOLS_DEBUG macro, used to facilitate error reporting. The arguments are the + * minor error number, and a description of the error. + */ +#ifdef H5_TOOLS_DEBUG +#define H5TOOLS_DEBUG(...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_dbg_id_g, __VA_ARGS__); \ +} while(0) +#define H5TOOLS_ENDDEBUG(...) \ +do { \ + H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_dbg_id_g, __VA_ARGS__); \ + H5Eprint2(H5tools_ERR_STACK_g, stderr); \ +} while(0) +#else +#define H5TOOLS_DEBUG(...) \ +do { \ + ; \ +} while(0) +#define H5TOOLS_ENDDEBUG(...) \ +do { \ + ; \ +} while(0) +#endif /* Macro for "catching" flow of control when an error occurs. Note that the @@ -156,23 +241,5 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g; H5_LEAVE(fail_value) \ } -/* - * H5TOOLS_GOTO_ERROR macro, used to facilitate error reporting within a function body. The arguments are - * the major error number, the minor error number, the return value, and an - * error string. The return value is assigned to a variable `ret_value' and - * control branches to the `done' label. - */ -#define H5TOOLS_GOTO_ERROR(fail_value, min_id, ...) { \ - H5TOOLS_ERROR(H5E_tools_g, min_id, __VA_ARGS__); \ - HGOTO_DONE(fail_value) \ -} - -/* - * HGOTO_DONE macro, used to facilitate normal return within a function body. - * The argument is the return value which is assigned to the `ret_value' - * variable. Control branches to the `done' label. - */ -/* #define HGOTO_DONE(ret_val) {ret_value = ret_val; goto done;} defined in H5Eprivate.h */ - #endif /* H5TOOLS_ERROR_H_ */ diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index acaf24a..13e075b 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -51,16 +51,16 @@ h5tools_canreadf(const char* name, /* object name, serves also as boolean pr /* get information about filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_nfilters failed"); /* if we do not have filters, we can read the dataset safely */ if (!nfilters) - HGOTO_DONE(1); + H5TOOLS_GOTO_DONE(1); /* check availability of filters */ for (i = 0; i < nfilters; i++) { if ((filtn = H5Pget_filter2(dcpl_id, (unsigned) i, 0, 0, 0, (size_t) 0, 0, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_filter2 failed"); switch (filtn) { /*------------------------------------------------------------------------- @@ -69,7 +69,7 @@ h5tools_canreadf(const char* name, /* object name, serves also as boolean pr */ default: if ((udfilter_avail = H5Zfilter_avail(filtn)) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zfilter_avail failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Zfilter_avail failed"); } else if (!udfilter_avail) { if (name) @@ -149,41 +149,42 @@ h5tools_can_encode(H5Z_filter_t filtn) switch (filtn) { /* user defined filter */ default: - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); + break; case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); #endif break; case H5Z_FILTER_SZIP: #ifndef H5_HAVE_FILTER_SZIP - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); #else { unsigned int filter_config_flags; if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Zget_filter_info failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Zget_filter_info failed"); if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "neither encode nor decode is supported"); + H5TOOLS_GOTO_ERROR(FAIL, "neither encode nor decode is supported"); } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { /* decoder only: read but not write */ - HGOTO_DONE(0) + H5TOOLS_GOTO_DONE(0); } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { /* encoder only: write but not read (???) */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "encoder only: write but not read"); + H5TOOLS_GOTO_ERROR(FAIL, "encoder only: write but not read"); } else if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) == (H5Z_FILTER_CONFIG_ENCODE_ENABLED | H5Z_FILTER_CONFIG_DECODE_ENABLED)) { - HGOTO_DONE(1) + H5TOOLS_GOTO_DONE(1); } } #endif diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 4b27847..c555a61 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -294,22 +294,22 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t curr_pos = elmtno; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); + H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims); h5tools_str_reset(str); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d", ndims); + H5TOOLS_DEBUG("ndims=%d", ndims); if(ndims > 0) { /* * Calculate the number of elements represented by a unit change in a * certain index position. */ for(i = 0; i < (size_t) ndims; i++) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->acc[i]); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->acc[i]); ctx->pos[i] = curr_pos / ctx->acc[i]; curr_pos -= ctx->acc[i] * ctx->pos[i]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "curr_pos=%ld - ctx->pos[%d]=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->pos[i], i, ctx->acc[i]); + H5TOOLS_DEBUG("curr_pos=%ld - ctx->pos[%d]=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->pos[i], i, ctx->acc[i]); } HDassert(curr_pos == 0); @@ -325,9 +325,9 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, } else /* Scalar */ h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)elmtno); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "str=%s", str->s); + H5TOOLS_DEBUG("str=%s", str->s); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); /* Add prefix and suffix to the index */ @@ -697,7 +697,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai H5T_class_t type_class; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); /* Build default formats for long long types */ if(!fmt_llong[0]) { HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH); @@ -726,7 +726,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai return NULL; switch (type_class) { case H5T_FLOAT: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_FLOAT"); + H5TOOLS_DEBUG("H5T_FLOAT"); if(sizeof(float) == nsize) { /* if (H5Tequal(type, H5T_NATIVE_FLOAT)) */ float tempfloat; @@ -758,7 +758,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai char quote = '\0'; char *s; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_STRING"); + H5TOOLS_DEBUG("H5T_STRING"); quote = '\0'; if(H5Tis_variable_str(type)) { /* cp_vp is the pointer into the struct where a `char*' is stored. So we have @@ -833,7 +833,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; case H5T_INTEGER: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_INTEGER"); + H5TOOLS_DEBUG("H5T_INTEGER"); if(sizeof(char) == nsize) { if(info->ascii) h5tools_print_char(str, info, (char) (*ucp_vp)); @@ -971,7 +971,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; case H5T_COMPOUND: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_COMPOUND"); + H5TOOLS_DEBUG("H5T_COMPOUND"); if(ctx->cmpd_listv) { /* there is <list_of_fields> */ unsigned save_indent_level; /* The indentation level */ size_t curr_field; /* Current field to display */ @@ -1073,7 +1073,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai { char enum_name[1024]; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_ENUM"); + H5TOOLS_DEBUG("H5T_ENUM"); if(H5Tenum_nameof(type, vp, enum_name, sizeof enum_name) >= 0) h5tools_str_append(str, h5tools_escape(enum_name, sizeof(enum_name))); else { @@ -1088,7 +1088,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; case H5T_REFERENCE: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE"); + H5TOOLS_DEBUG("H5T_REFERENCE"); if(h5tools_str_is_zero(vp, nsize)) h5tools_str_append(str, "NULL"); else { @@ -1097,7 +1097,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai H5R_type_t ref_type; /* Reference type */ const H5R_ref_t *ref_vp = (const H5R_ref_t *)vp; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF"); ref_type = H5Rget_type(ref_vp); H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type); switch (ref_type) { @@ -1106,16 +1106,14 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* Object references -- show the type and OID of the referenced object. */ H5O_info_t oi; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); if((obj = H5Ropen_object(ref_vp, H5P_DEFAULT, H5P_DEFAULT)) >= 0) { H5Oget_info2(obj, &oi, H5O_INFO_BASIC); if(H5Oclose(obj) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Oclose H5R_OBJECT1 failed"); + H5TOOLS_GOTO_ERROR(NULL, "H5Oclose H5R_OBJECT1 failed"); } else - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5R_OBJECT1 failed"); + H5TOOLS_GOTO_ERROR(NULL, "H5Ropen_object H5R_OBJECT1 failed"); /* Print object type and close object */ switch (obj_type) { @@ -1149,12 +1147,12 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } break; case H5R_DATASET_REGION1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); h5tools_str_append(str, H5_TOOLS_DATASET); h5tools_str_sprint_reference(str, info, container, ref_vp); break; case H5R_OBJECT2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); switch (obj_type) { case H5O_TYPE_GROUP: h5tools_str_append(str, H5_TOOLS_GROUP); @@ -1178,12 +1176,12 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_sprint_reference(str, info, container, ref_vp); break; case H5R_DATASET_REGION2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); h5tools_str_append(str, H5_TOOLS_DATASET); h5tools_str_sprint_reference(str, info, container, ref_vp); break; case H5R_ATTR: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR"); + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); h5tools_str_append(str, H5_TOOLS_ATTRIBUTE); h5tools_str_sprint_reference(str, info, container, ref_vp); break; @@ -1192,15 +1190,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai default: break; } /* end switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF end"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF end"); } else if (H5Tequal(type, H5T_STD_REF_DSETREG)) { /* if(nsize == H5R_DSET_REG_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF_DSETREG"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_DSETREG"); } else if (H5Tequal(type, H5T_STD_REF_OBJ)) { /* if (nsize == H5R_OBJ_REF_BUF_SIZE) */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_REFERENCE:H5T_STD_REF_OBJ"); + H5TOOLS_DEBUG("H5T_REFERENCE:H5T_STD_REF_OBJ"); } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; @@ -1211,7 +1209,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai hsize_t i, dims[H5S_MAX_RANK], temp_nelmts; static int is_next_arry_elmt = 0; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_ARRAY"); + H5TOOLS_DEBUG("H5T_ARRAY"); /* Get the array's base datatype for each element */ memb = H5Tget_super(type); size = H5Tget_size(memb); @@ -1273,7 +1271,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai { unsigned int i; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5T_VLEN"); + H5TOOLS_DEBUG("H5T_VLEN"); /* Get the VL sequences's base datatype for each element */ memb = H5Tget_super(type); size = H5Tget_size(memb); @@ -1323,7 +1321,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai /* All other types get printed as hexadecimal */ size_t i; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "OTHER"); + H5TOOLS_DEBUG("OTHER"); if(1 == nsize) h5tools_str_append(str, "0x%02x", ucp_vp[0]); else @@ -1339,10 +1337,13 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai break; } /* end switch */ } + +done: + CATCH ret_value = h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s")); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit with %s", ret_value); + H5TOOLS_ENDDEBUG("exit with %s", ret_value); H5TOOLS_POP_STACK(); return ret_value; } @@ -1364,28 +1365,28 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, ssize_t buf_size; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); h5tools_str_append(str, " \""); buf_size = H5Rget_file_name(ref_vp, NULL, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf_size=%ld", buf_size); + H5TOOLS_DEBUG("buf_size=%ld", buf_size); if (buf_size) { char *file_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_file_name(ref_vp, file_name, buf_size + 1) >= 0) { file_name[buf_size] = '\0'; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "name=%s", file_name); + H5TOOLS_DEBUG("name=%s", file_name); h5tools_str_append(str, "%s", file_name); } HDfree(file_name); } buf_size = H5Rget_obj_name(ref_vp, H5P_DEFAULT, NULL, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf_size=%ld", buf_size); + H5TOOLS_DEBUG("buf_size=%ld", buf_size); if (buf_size) { char *obj_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, obj_name, buf_size + 1) >= 0) { obj_name[buf_size] = '\0'; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "name=%s", obj_name); + H5TOOLS_DEBUG("name=%s", obj_name); h5tools_str_append(str, "%s", obj_name); } HDfree(obj_name); @@ -1393,12 +1394,12 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, if (H5Rget_type(ref_vp) == H5R_ATTR) { buf_size = H5Rget_attr_name(ref_vp, NULL, 0); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "buf_size=%ld", buf_size); + H5TOOLS_DEBUG("buf_size=%ld", buf_size); if (buf_size) { char *attr_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1); if (H5Rget_attr_name(ref_vp, attr_name, buf_size + 1) >= 0) { attr_name[buf_size] = '\0'; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "name=%s", attr_name); + H5TOOLS_DEBUG("name=%s", attr_name); h5tools_str_append(str, "/%s", attr_name); } HDfree(attr_name); @@ -1407,7 +1408,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, h5tools_str_append(str, "\""); CATCH - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); } diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 96f1e04..4924e4e 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -803,7 +803,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, /* Find all shared objects */ if((ret_value = h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "finding shared objects failed") + H5TOOLS_GOTO_ERROR(FAIL, "finding shared objects failed"); done: /* Release resources */ @@ -904,39 +904,39 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ /* if path is root, return group type */ if(!HDstrcmp(linkpath,"/")) { link_info->trg_type = H5O_TYPE_GROUP; - HGOTO_DONE(2); + H5TOOLS_GOTO_DONE(2); } /* check if link itself exist */ if(H5Lexists(file_id, linkpath, H5P_DEFAULT) <= 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: link <%s> doesn't exist \n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* get info from link */ if(H5Lget_info(file_id, linkpath, &(link_info->linfo), H5P_DEFAULT) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get link info from <%s>\n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* given path is hard link (object) */ if(link_info->linfo.type == H5L_TYPE_HARD) - HGOTO_DONE(2); + H5TOOLS_GOTO_DONE(2); /* trg_path must be freed out of this function when finished using */ if((link_info->trg_path = (char*)HDcalloc(link_info->linfo.u.val_size, sizeof(char))) == NULL) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to allocate buffer for <%s>\n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* get link value */ if(H5Lget_val(file_id, linkpath, (void *)link_info->trg_path, link_info->linfo.u.val_size, H5P_DEFAULT) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get link value from <%s>\n",linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /*----------------------------------------------------- @@ -945,13 +945,13 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ */ if(link_info->linfo.type == H5L_TYPE_EXTERNAL) { if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); if(H5Pset_fapl_sec2(fapl) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); if((lapl = H5Pcreate(H5P_LINK_ACCESS)) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); if(H5Pset_elink_fapl(lapl, fapl) < 0) - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* Check for retrieving object info */ @@ -964,24 +964,24 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ /* detect dangling link */ if(l_ret == FALSE) { - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } else if(l_ret < 0) { /* function failed */ - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* get target object info */ if(H5Oget_info_by_name2(file_id, linkpath, &trg_oinfo, H5O_INFO_BASIC, lapl) < 0) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: unable to get object information for <%s>\n", linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* check unknown type */ if(trg_oinfo.type < H5O_TYPE_GROUP || trg_oinfo.type >=H5O_TYPE_NTYPES) { if(link_info->opt.msg_mode == 1) parallel_print("Warning: target object of <%s> is unknown type\n", linkpath); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } /* end if */ /* set target obj type to return */ @@ -1056,7 +1056,7 @@ h5tools_getenv_update_hyperslab_bufsize(void) errno = 0; hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10); if (errno != 0 || hyperslab_bufsize_mb <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "hyperslab buffer size failed"); + H5TOOLS_GOTO_ERROR(FAIL, "hyperslab buffer size failed"); /* convert MB to byte */ H5TOOLS_BUFSIZE = (hsize_t)hyperslab_bufsize_mb * 1024 * 1024; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index ab1635c..a30da9b 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -259,7 +259,7 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, /* Get info for starting object */ if(H5Oget_info_by_name2(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info_by_name failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info_by_name failed"); /* Visit the starting object */ if(visit_start && visitor->visit_obj) @@ -289,12 +289,12 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start, if(recurse) { /* Visit all links in group, recursively */ if(H5Lvisit_by_name(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lvisit_by_name failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Lvisit_by_name failed"); } /* end if */ else { /* Iterate over links in group */ if(H5Literate_by_name(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Literate_by_name failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Literate_by_name failed"); } /* end else */ /* Free visited addresses table */ @@ -439,7 +439,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info) /* Traverse all objects in the file, visiting each object & link */ if(traverse(file_id, "/", TRUE, TRUE, &info_visitor, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR(FAIL, "traverse failed"); done: return ret_value; @@ -605,7 +605,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table) /* Traverse all objects in the file, visiting each object & link */ if(traverse(fid, "/", TRUE, TRUE, &table_visitor, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR(FAIL, "traverse failed"); done: return ret_value; @@ -1031,7 +1031,7 @@ h5trav_print(hid_t fid) /* Traverse all objects in the file, visiting each object & link */ if(traverse(fid, "/", TRUE, TRUE, &print_visitor, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR(FAIL, "traverse failed"); done: return ret_value; @@ -1062,7 +1062,7 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start, /* Traverse all objects in the file, visiting each object & link */ if(traverse(fid, grp_name, visit_start, recurse, &visitor, fields) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "traverse failed"); + H5TOOLS_GOTO_ERROR(FAIL, "traverse failed"); done: return ret_value; @@ -1089,7 +1089,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co visited->nalloc = MAX(1, visited->nalloc * 2); if(NULL == (tmp_ptr = HDrealloc(visited->objs, visited->nalloc * sizeof(symlink_trav_path_t)))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure realloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "visited data structure realloc failed"); visited->objs = (symlink_trav_path_t *)tmp_ptr; } /* end if */ @@ -1103,7 +1103,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co if(type == H5L_TYPE_EXTERNAL) { if(NULL == (visited->objs[idx].file = HDstrdup(file))) { visited->nused--; - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure name allocation failed"); + H5TOOLS_GOTO_ERROR(FAIL, "visited data structure name allocation failed"); } /* end if */ } /* end if */ @@ -1111,7 +1111,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co visited->nused--; if(visited->objs[idx].file) HDfree (visited->objs[idx].file); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "visited data structure path allocation failed"); + H5TOOLS_GOTO_ERROR(FAIL, "visited data structure path allocation failed"); } /* end if */ done: diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 06240f5..fee8777 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -394,19 +394,19 @@ main (int argc, const char *argv[]) *-------------------------------------------------------------------------*/ /* create property to pass copy options */ - if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed"); + if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pcreate failed"); /* set options for object copy */ if (flag) { if ( H5Pset_copy_object(ocpl_id, flag) < 0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_copy_object failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_copy_object failed"); } /* Create link creation property list */ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) { error_msg("Could not create link creation property list\n"); - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pcreate failed"); } /* end if */ /* Check for creating intermediate groups */ @@ -414,7 +414,7 @@ main (int argc, const char *argv[]) /* Set the intermediate group creation property */ if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) { error_msg("Could not set property for creating parent groups\n"); - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pset_create_intermediate_group failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pset_create_intermediate_group failed"); } /* end if */ /* Display some output if requested */ @@ -438,7 +438,7 @@ main (int argc, const char *argv[]) if (H5Lexists(fid_dst, str_ptr, H5P_DEFAULT) <= 0) { error_msg("group <%s> doesn't exist. Use -p to create parent groups.\n", str_ptr); HDfree(str_ptr); - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lexists failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Lexists failed"); } HDfree(str_ptr); } @@ -458,7 +458,7 @@ main (int argc, const char *argv[]) if(H5Lcopy(fid_src, oname_src, fid_dst, oname_dst, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Lcopy failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Lcopy failed"); } else { /* valid link */ @@ -468,7 +468,7 @@ main (int argc, const char *argv[]) oname_dst, /* Name of the destination object */ ocpl_id, /* Object copy property list */ lcpl_id)<0) /* Link creation property list */ - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Ocopy failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Ocopy failed"); } /* free link info path */ @@ -477,15 +477,15 @@ main (int argc, const char *argv[]) /* close propertis */ if(H5Pclose(ocpl_id)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed"); if(H5Pclose(lcpl_id)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Pclose failed"); /* close files */ if (H5Fclose(fid_src)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed"); if (H5Fclose(fid_dst)<0) - H5TOOLS_GOTO_ERROR(EXIT_FAILURE, H5E_tools_min_id_g, "H5Fclose failed"); + H5TOOLS_GOTO_ERROR(EXIT_FAILURE, "H5Fclose failed"); leave(EXIT_SUCCESS); diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c index 362e3f2..e05a8e3 100644 --- a/tools/src/h5diff/h5diff_common.c +++ b/tools/src/h5diff/h5diff_common.c @@ -302,30 +302,29 @@ void parse_command_line(int argc, * *------------------------------------------------------------------------- */ +void print_info(diff_opt_t* opts) +{ + if (opts->m_quiet || opts->err_stat) + return; + + if (opts->cmn_objs == 0) { + HDprintf("No common objects found. Files are not comparable.\n"); + if (!opts->m_verbose) + HDprintf("Use -v for a list of objects.\n"); + } - void print_info(diff_opt_t* opts) - { - if (opts->m_quiet || opts->err_stat) - return; - - if (opts->cmn_objs == 0) { - HDprintf("No common objects found. Files are not comparable.\n"); - if (!opts->m_verbose) - HDprintf("Use -v for a list of objects.\n"); - } - - if (opts->not_cmp == 1) { - if (opts->m_list_not_cmp == 0) { - HDprintf("--------------------------------\n"); - HDprintf("Some objects are not comparable\n"); - HDprintf("--------------------------------\n"); - if (opts->m_verbose) - HDprintf("Use -c for a list of objects without details of differences.\n"); - else - HDprintf("Use -c for a list of objects.\n"); - } - } - } + if (opts->not_cmp == 1) { + if (opts->m_list_not_cmp == 0) { + HDprintf("--------------------------------\n"); + HDprintf("Some objects are not comparable\n"); + HDprintf("--------------------------------\n"); + if (opts->m_verbose) + HDprintf("Use -c for a list of objects without details of differences.\n"); + else + HDprintf("Use -c for a list of objects.\n"); + } + } +} /*------------------------------------------------------------------------- * Function: check_n_input diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 70af8cf..fe24868 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -1302,7 +1302,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_context_t datactx; /* print context */ H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); datactx = *ctx; /* print context */ /* Assume entire data space to be printed */ @@ -1316,18 +1316,18 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx H5O_type_t obj_type = -1; /* Object type */ H5R_type_t ref_type; /* Reference type */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop:%d with curr_pos=%ld", i, curr_pos); + H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos); datactx.need_prefix = TRUE; h5tools_str_reset(&buffer); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); + H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i); h5tools_str_sprint(&buffer, info, container, H5T_STD_REF, &ref_buf[i], &datactx); h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims); ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]); switch (ref_type) { case H5R_OBJECT1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT1"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT1"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_DATASET: @@ -1336,12 +1336,12 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_ERROR(FAIL, "H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed"); break; case H5O_TYPE_GROUP: @@ -1354,24 +1354,24 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT1 failed"); + H5TOOLS_ERROR(FAIL, "H5Rget_obj_type3 H5R_OBJECT1 failed"); break; case H5R_DATASET_REGION1: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION1"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1"); if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { datactx.indent_level++; h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(FAIL, "H5Dclose H5R_DATASET_REGION1 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_DATASET_REGION1 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_DATASET_REGION1 failed"); break; case H5R_OBJECT2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_OBJECT2"); + H5TOOLS_DEBUG("ref_type is H5R_OBJECT2"); if (H5Rget_obj_type3((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) { switch (obj_type) { case H5O_TYPE_GROUP: @@ -1383,12 +1383,12 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_dump_dset(stream, info, &datactx, new_obj_id); datactx.indent_level--; if(H5Oclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Oclose H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Oclose H5R_OBJECT2 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_OBJECT2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_OBJECT2 failed"); break; case H5O_TYPE_NAMED_DATATYPE: @@ -1402,22 +1402,21 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx } /* end switch */ } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type3 H5R_OBJECT2 failed"); + H5TOOLS_ERROR(FAIL, "H5Rget_obj_type3 H5R_OBJECT2 failed"); break; case H5R_DATASET_REGION2: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2"); if (info->line_ncols > 0) ncols = info->line_ncols; /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */ if((new_obj_id = H5Ropen_object((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, - "H5Ropen_object H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_object H5R_DATASET_REGION2 failed"); else { if((new_obj_sid = H5Ropen_region((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -1441,41 +1440,41 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx region_type = H5Sget_select_type(new_obj_sid); if(region_type == H5S_SEL_POINTS) { /* Print point information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_POINTS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2"); h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else if(region_type == H5S_SEL_HYPERSLABS) { /* Print block information */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); + H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2"); h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx, &buffer, &curr_pos, ncols, i, elmt_counter); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "invalid region type"); + H5TOOLS_ERROR(FAIL, "invalid region type"); } /* end else to if (h5tools_is_zero(... */ if(H5Sclose(new_obj_sid) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Sclose H5R_DATASET_REGION2 failed"); } else - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_region H5R_DATASET_REGION2 failed"); if(H5Dclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dclose H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Dclose H5R_DATASET_REGION2 failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_DATASET_REGION2 failed"); } break; case H5R_ATTR: - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ref_type is H5R_ATTR"); + H5TOOLS_DEBUG("ref_type is H5R_ATTR"); if((new_obj_id = H5Ropen_attr((const H5R_ref_t *)&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) { h5tools_dump_region_attribute(new_obj_id, stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); if(H5Aclose(new_obj_id) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Aclose H5R_ATTR failed"); + H5TOOLS_ERROR(FAIL, "H5Aclose H5R_ATTR failed"); if(H5Rdestroy(&ref_buf[i]) < 0) - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed"); + H5TOOLS_ERROR(FAIL, "H5Rdestroy H5R_ATTR failed"); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "NULL H5R_ATTR"); + H5TOOLS_DEBUG("NULL H5R_ATTR"); h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " {"); @@ -1493,7 +1492,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx h5tools_str_append(&buffer, "}"); h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_attr H5R_ATTR failed"); + H5TOOLS_ERROR(FAIL, "H5Ropen_attr H5R_ATTR failed"); } break; case H5R_BADTYPE: @@ -1502,14 +1501,14 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx break; } /* end switch */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "finished reference loop:%d",i); + H5TOOLS_DEBUG("finished reference loop:%d",i); } /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */ done: h5tools_str_close(&buffer); PRINTVALSTREAM(stream, "\n"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); } @@ -1541,7 +1540,7 @@ dump_dataset_values(hid_t dset) H5R_ref_t *ref_buf = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); f_type = H5Dget_type(dset); space = H5Dget_space(dset); @@ -1637,13 +1636,13 @@ dump_dataset_values(hid_t dset) ctx.need_prefix = TRUE; ctx.cur_column = (size_t)curr_pos; if (H5Tget_class(f_type) == H5T_REFERENCE) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + H5TOOLS_DEBUG("reference class type"); if (!H5Tequal(f_type, H5T_STD_REF) && !H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) { - HGOTO_DONE(SUCCEED); + H5TOOLS_GOTO_DONE(SUCCEED); } ndims = (int)H5Sget_simple_extent_npoints(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); + H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); /* Assume entire data space to be printed */ if (ctx.ndims > 0) @@ -1656,10 +1655,10 @@ dump_dataset_values(hid_t dset) ctx.need_prefix = TRUE; if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) { - H5TOOLS_DEBUG(H5E_tools_min_id_g, "H5Dread reference read"); + H5TOOLS_DEBUG("H5Dread reference read"); if(H5Dread(dset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread reference failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread reference failed"); } dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims); HDfree(ref_buf); @@ -1680,7 +1679,7 @@ done: PRINTVALSTREAM(rawoutstream, "\n"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); } @@ -1713,7 +1712,7 @@ dump_attribute_values(hid_t attr, const char *attr_name) H5R_ref_t *ref_buf = NULL; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); f_type = H5Aget_type(attr); space = H5Aget_space(attr); @@ -1810,13 +1809,13 @@ dump_attribute_values(hid_t attr, const char *attr_name) ctx.need_prefix = TRUE; ctx.cur_column = (size_t)curr_pos; if (H5Tget_class(f_type) == H5T_REFERENCE) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "reference class type"); + H5TOOLS_DEBUG("reference class type"); if (!H5Tequal(f_type, H5T_STD_REF) && !H5Tequal(f_type, H5T_STD_REF_DSETREG) && !H5Tequal(f_type, H5T_STD_REF_OBJ)) { - HGOTO_DONE(SUCCEED); + H5TOOLS_GOTO_DONE(SUCCEED); } ndims = (int)H5Sget_simple_extent_npoints(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); + H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims); /* Assume entire data space to be printed */ if (ctx.ndims > 0) @@ -1829,10 +1828,10 @@ dump_attribute_values(hid_t attr, const char *attr_name) ctx.need_prefix = TRUE; if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "H5Aread reference read"); + H5TOOLS_DEBUG("H5Aread reference read"); if(H5Aread(attr, H5T_STD_REF, ref_buf) < 0) { HDfree(ref_buf); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread reference failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread reference failed"); } ctx.indent_level++; dump_reference(rawoutstream, info, &ctx, attr, ref_buf, ndims); @@ -1841,7 +1840,7 @@ dump_attribute_values(hid_t attr, const char *attr_name) } } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute data read"); + H5TOOLS_DEBUG("Attribute data read"); ctx.indent_level++; if (h5tools_dump_mem(rawoutstream, info, &ctx, attr) < 0) { h5tools_str_reset(&buffer); @@ -1849,7 +1848,7 @@ dump_attribute_values(hid_t attr, const char *attr_name) h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0); } ctx.indent_level--; - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute data read complete"); + H5TOOLS_DEBUG("Attribute data read complete"); } done: H5Sclose(space); @@ -1859,7 +1858,7 @@ done: PRINTVALSTREAM(rawoutstream, "\n"); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); } @@ -1891,7 +1890,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain h5tool_format_t *info = &ls_dataformat; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -1904,7 +1903,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain print_string(&buffer, attr_name, TRUE); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute name:%s", attr_name); + H5TOOLS_DEBUG("Attribute name:%s", attr_name); if ((attr = H5Aopen(obj, attr_name, H5P_DEFAULT)) >= 0) { space = H5Aget_space(attr); type = H5Aget_type(attr); @@ -1912,7 +1911,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain /* Data space */ ndims = H5Sget_simple_extent_dims(space, size, NULL); space_type = H5Sget_simple_extent_type(space); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute ndims:%d", ndims); + H5TOOLS_DEBUG("Attribute ndims:%d", ndims); switch(space_type) { case H5S_SCALAR: /* scalar dataspace */ @@ -1962,10 +1961,10 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain H5Aclose(attr); } else { - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Attribute open failed"); + H5TOOLS_DEBUG("Attribute open failed"); h5tools_str_close(&buffer); } - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return 0; @@ -2306,14 +2305,14 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void h5tool_format_t *info = &ls_dataformat; H5TOOLS_PUSH_STACK(); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter"); + H5TOOLS_DEBUG("enter"); HDmemset(&ctx, 0, sizeof(ctx)); HDmemset(&buffer, 0, sizeof(h5tools_str_t)); h5tools_str_reset(&buffer); - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Object name:%s", name); + H5TOOLS_DEBUG("Object name:%s", name); /* Print the link's name, either full name or base name */ if (!iter->symlink_target) print_obj_name(&buffer, iter, name, ""); @@ -2345,7 +2344,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void /* Open the object. Not all objects can be opened. If this is the case * then return right away. */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Open object name=%s", name); + H5TOOLS_DEBUG("Open object name=%s", name); if (obj_type >= 0 && (obj = H5Oopen(iter->fid, name, H5P_DEFAULT)) < 0) { h5tools_str_reset(&buffer); h5tools_str_append(&buffer, " *ERROR*\n"); @@ -2354,7 +2353,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void } /* end if */ /* List the first line of information for the object. */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Object type:%d", obj_type); + H5TOOLS_DEBUG("Object type:%d", obj_type); if (obj_type >= 0 && dispatch_g[obj_type].list1) (dispatch_g[obj_type].list1)(obj); if (!iter->symlink_target || (verbose_g > 0)) { @@ -2371,7 +2370,7 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void ssize_t cmt_bufsize = -1; /* Display attributes */ - H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "Display attributes"); + H5TOOLS_DEBUG("Display attributes"); if (obj_type >= 0) H5Aiterate2(obj, H5_INDEX_NAME, H5_ITER_INC, NULL, list_attr, NULL); @@ -2439,7 +2438,7 @@ done: } h5tools_str_close(&buffer); - H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit"); + H5TOOLS_ENDDEBUG("exit"); H5TOOLS_POP_STACK(); return 0; diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index 4fb1507..0f77626 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -228,7 +228,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t H5O_info_t oinfo; /* Object info of input dtype */ if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info failed"); if (*named_dt_head_p) { /* Stack already exists, search for the datatype */ @@ -244,7 +244,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t if (travt->objs[i].type == H5TRAV_TYPE_NAMED_DATATYPE) { /* Push onto the stack */ if (NULL == (dt = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed"); + H5TOOLS_GOTO_ERROR(FAIL, "buffer allocation failed failed"); dt->next = *named_dt_head_p; *named_dt_head_p = dt; @@ -266,7 +266,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t if (!dt_ret) { /* Push the new datatype onto the stack */ if (NULL == (dt_ret = (named_dt_t *)HDmalloc(sizeof(named_dt_t)))) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed failed"); + H5TOOLS_GOTO_ERROR(FAIL, "buffer allocation failed failed"); dt_ret->next = *named_dt_head_p; *named_dt_head_p = dt_ret; @@ -284,9 +284,9 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t else dt_ret->id_out = H5Tcopy(type_in); if (dt_ret->id_out < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type-H5Tcopy failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type-H5Tcopy failed"); if (H5Tcommit_anon(fidout, dt_ret->id_out, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommit_anon failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tcommit_anon failed"); } /* end if named datatype not yet in output file */ /* Set return value */ @@ -296,7 +296,7 @@ copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, t * to close it. (TODO: fix scope envy) */ if (H5Iinc_ref(ret_value) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iinc_ref failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Iinc_ref failed"); done: return ret_value; @@ -317,7 +317,7 @@ named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err) while (dt) { /* Pop the datatype off the stack and free it */ if (H5Tclose(dt->id_out) < 0 && !ignore_err) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); dt = dt->next; HDfree(*named_dt_head_p); *named_dt_head_p = dt; @@ -363,7 +363,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ H5T_class_t type_class = -1; if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info failed"); /*------------------------------------------------------------------------- * copy all attributes @@ -372,33 +372,33 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ for (u = 0; u < (unsigned) oinfo.num_attrs; u++) { /* open attribute */ if ((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t) u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx failed"); if (H5Aget_name(attr_id, (size_t) 255, name) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); /* get the file datatype */ if ((ftype_id = H5Aget_type(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_type failed"); /* Check if the datatype is committed */ if ((is_named = H5Tcommitted(ftype_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tcommitted failed"); if (is_named && travt) { hid_t fidout = -1; /* Create out file id */ if ((fidout = H5Iget_file_id(loc_out)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Iget_file_id failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Iget_file_id failed"); /* Copy named dt */ if ((wtype_id = copy_named_datatype(ftype_id, fidout, named_dt_head_p, travt, options)) < 0) { H5Fclose(fidout); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_named_datatype failed"); } if (H5Fclose(fidout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fclose failed"); } /* end if datatype is committed and we have a traversal table */ else { if (options->use_native == 1) @@ -409,18 +409,18 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ /* get the dataspace handle */ if ((space_id = H5Aget_space(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_space failed"); /* get dimensions */ if ((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); nelmts = 1; for (j = 0; j < rank; j++) nelmts *= dims[j]; if ((msize = H5Tget_size(wtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_size failed"); /*--------------------------------------------------------------------- * object references are a special case. We cannot just copy the @@ -437,7 +437,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ base_type = H5Tget_super(ftype_id); is_ref = (is_ref || (H5Tget_class(base_type) == H5T_REFERENCE)); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose base_type failed"); } /* end if type_class is variable length or array */ if (type_class == H5T_COMPOUND) { @@ -447,7 +447,7 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ hid_t mtid = H5Tget_member_type(wtype_id, (unsigned)j); H5T_class_t mtclass = H5Tget_class(mtid); if (H5Tclose(mtid) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose mtid failed"); if (mtclass == H5T_REFERENCE) { is_ref = 1; @@ -464,10 +464,10 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ buf = (void *)HDmalloc((size_t)(nelmts * msize)); if (buf == NULL) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDmalloc failed"); } /* end if */ if (H5Aread(attr_id, wtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread failed"); /*----------------------------------------------------------------- * copy @@ -475,13 +475,13 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ */ if ((attr_out = H5Acreate2(loc_out, name, wtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed on ,%s>", name); + H5TOOLS_GOTO_ERROR(FAIL, "H5Acreate2 failed on ,%s>", name); if (H5Awrite(attr_out, wtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Awrite failed"); /*close*/ if (H5Aclose(attr_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aclose failed"); /* Check if we have VL data and string in the attribute's datatype that must * be reclaimed */ @@ -499,16 +499,16 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_ *--------------------------------------------------------------------- */ if (H5Sclose(space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); space_id = -1; if (H5Tclose(wtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); wtype_id = -1; if (H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); ftype_id = -1; if (H5Aclose(attr_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aclose failed"); attr_id = -1; } /* for u (each attribute) */ @@ -573,10 +573,11 @@ check_options(pack_opt_t *options) break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid layout"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid layout"); + break; default: strcpy(slayout, "invalid layout\n"); - HGOTO_DONE(FAIL); + H5TOOLS_GOTO_DONE(FAIL); } HDprintf(" Apply %s layout to all", slayout); if (H5D_CHUNKED == options->layout_g) { @@ -611,7 +612,7 @@ check_options(pack_opt_t *options) } /* end for each object in options */ if (options->all_layout == 1 && has_ck) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid chunking input: 'all' option is present with other objects"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid chunking input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * Objects to filter @@ -669,7 +670,7 @@ check_options(pack_opt_t *options) } /* end for each object in options table */ if (options->all_filter == 1 && has_cp) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid compression input: 'all' option is present with other objects"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid compression input: 'all' option is present with other objects"); /*------------------------------------------------------------------------- * Check options for the latest format @@ -677,14 +678,14 @@ check_options(pack_opt_t *options) */ if (options->grp_compact < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid maximum number of links to store as header messages"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid maximum number of links to store as header messages"); if (options->grp_indexed < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid minimum number of links to store in the indexed format"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid minimum number of links to store in the indexed format"); if (options->grp_indexed > options->grp_compact) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "minimum indexed size is greater than the maximum compact size"); + H5TOOLS_GOTO_ERROR(FAIL, "minimum indexed size is greater than the maximum compact size"); for (i = 0; i < 8; i++) if (options->msg_size[i] < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid shared message size"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid shared message size"); /*------------------------------------------------------------------------ * Verify new user userblock options; file name must be present @@ -698,7 +699,7 @@ check_options(pack_opt_t *options) } if (options->ublock_filename == NULL && options->ublock_size != 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file name missing for user block", options->ublock_filename); + H5TOOLS_GOTO_ERROR(FAIL, "file name missing for user block", options->ublock_filename); /*------------------------------------------------------------------------ * Verify alignment options; threshold is zero default but alignment not @@ -706,7 +707,7 @@ check_options(pack_opt_t *options) */ if (options->alignment == 0 && options->threshold != 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "alignment for H5Pset_alignment missing"); + H5TOOLS_GOTO_ERROR(FAIL, "alignment for H5Pset_alignment missing"); done: return ret_value; @@ -734,14 +735,14 @@ check_objects(const char* fname, pack_opt_t *options) /* nothing to do */ if (options->op_tbl->nelems == 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /*------------------------------------------------------------------------- * open the file *------------------------------------------------------------------------- */ if ((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); + H5TOOLS_GOTO_ERROR(FAIL, "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR); /*------------------------------------------------------------------------- * get the list of objects in the file @@ -755,7 +756,7 @@ check_objects(const char* fname, pack_opt_t *options) /* get the list of objects in the file */ if (h5trav_gettable(fid, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR(FAIL, "h5trav_gettable failed"); /*------------------------------------------------------------------------- * compare with user supplied list @@ -774,14 +775,14 @@ check_objects(const char* fname, pack_opt_t *options) /* the input object names are present in the file and are valid */ if (h5trav_getindext(name, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "%s Could not find <%s> in file <%s>. Exiting...\n", + H5TOOLS_GOTO_ERROR(FAIL, "%s Could not find <%s> in file <%s>. Exiting...\n", (options->verbose ? "\n" : ""), name, fname); if (options->verbose) HDprintf("...Found\n"); for (ifil = 0; ifil < obj.nfilters; ifil++) { if (obj.filter[ifil].filtn < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid filter"); /* check for extra filter conditions */ switch (obj.filter[ifil].filtn) { /* chunk size must be smaller than pixels per block */ @@ -800,25 +801,25 @@ check_objects(const char* fname, pack_opt_t *options) } else { if ((did = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed"); if ((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); if ((rank = H5Sget_simple_extent_ndims(sid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); for (j = 0; j < rank; j++) csize *= dims[j]; if (H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); if (H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); } if (csize < ppb) { HDprintf(" <warning: SZIP settings, chunk size is smaller than pixels per block>\n"); - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); } } /* end case SZIP */ break; diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 2c0af19..c20219e 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -86,59 +86,59 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) *------------------------------------------------------------------------- */ if ((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t) 0)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR); + H5TOOLS_GOTO_ERROR(FAIL, "h5tools_fopen failed <%s>: %s", fnamein, H5FOPENERROR); /* get user block size and file space strategy/persist/threshold */ { if ((fcpl_in = H5Fget_create_plist(fidin)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fget_create_plist failed to retrieve file creation property list"); if (H5Pget_userblock(fcpl_in, &ub_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_userblock failed to retrieve userblock size"); /* If the -S option is not set, get "strategy" from the input file */ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_file_space_strategy failed to retrieve file space strategy"); /* If the -G option is not set, get "pagesize" from the input file */ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space threshold"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_file_space_page_size failed to retrieve file space threshold"); /* open root group */ if ((grp_in = H5Gopen2(fidin, "/", H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gopen2 failed"); /* get root group creation property list */ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_create_plist failed"); /* query and set the group creation properties */ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_link_creation_order failed"); if (H5Pclose(fcpl_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed to close property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed to close property list"); } if(options->latest) options->low_bound = options->high_bound = H5F_LIBVER_LATEST; /* Create file access property list */ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed to create file access property list"); /* It can be default, latest or other settings by users */ if(H5Pset_libver_bounds(fapl, options->low_bound, options->high_bound) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_libver_bounds failed to set format version bounds"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_libver_bounds failed to set format version bounds"); /* Check if we need to create a non-default file creation property list */ if (options->low_bound >= H5F_LIBVER_V18 || ub_size > 0) { /* Create file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed to create a file creation property list"); if (ub_size > 0) if (H5Pset_userblock(fcpl, ub_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set non-default userblock size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_userblock failed to set non-default userblock size"); if (options->low_bound >= H5F_LIBVER_V18) { unsigned i = 0, nindex = 0, mesg_type_flags[5], min_mesg_sizes[5]; @@ -146,7 +146,7 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) /* Adjust group creation parameters for root group */ /* (So that it is created in "dense storage" form) */ if (H5Pset_link_phase_change(fcpl, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed to adjust group creation parameters for root group"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_link_phase_change failed to adjust group creation parameters for root group"); for (i = 0; i < 5; i++) { if (options->msg_size[i] > 0) { @@ -182,12 +182,12 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) if (nindex > 0) { if (H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_shared_mesg_nindexes failed to set the number of shared object header message indexes"); /* msg_size[0]=dataspace, 1=datatype, 2=file value, 3=filter pipleline, 4=attribute */ for (i = 0; i < (nindex - 1); i++) if (H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_shared_mesg_index failed to configure the specified shared object header message index"); } /* if (nindex>0) */ } /* end if */ @@ -205,11 +205,11 @@ print_user_block(fnamein, fidin); if (fcpl == H5P_DEFAULT) /* create a file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed to create a file creation property list"); /* set user block size */ if (H5Pset_userblock(fcpl, options->ublock_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_userblock failed to set userblock size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_userblock failed to set userblock size"); } /*------------------------------------------------------------------------- @@ -221,10 +221,10 @@ print_user_block(fnamein, fidin); if (fapl == H5P_DEFAULT) /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed to create file access property list"); if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alignment failed to set alignment"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_alignment failed to set alignment"); } /*------------------------------------------------------------------------- @@ -236,10 +236,10 @@ print_user_block(fnamein, fidin); if (fapl == H5P_DEFAULT) /* create a file access property list */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create file access property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed to create file access property list"); if (H5Pset_meta_block_size(fapl, options->meta_block_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_meta_block_size failed to set metadata block size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_meta_block_size failed to set metadata block size"); } /*------------------------------------------------------------------------- @@ -251,10 +251,10 @@ print_user_block(fnamein, fidin); if (fcpl == H5P_DEFAULT) /* create a file creation property list */ if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed to create a file creation property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed to create a file creation property list"); if(H5Pset_link_creation_order(fcpl, crt_order_flags ) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_link_creation_order failed"); /* Set file space info to those from input file */ set_strategy = in_strategy; @@ -279,7 +279,7 @@ print_user_block(fnamein, fidin); /* Set file space information as specified */ if(H5Pset_file_space_strategy(fcpl, set_strategy, set_persist, set_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_strategy failed to set file space strategy"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_file_space_strategy failed to set file space strategy"); if(options->fs_pagesize == -1) /* A "0" file space page size is specified by user */ set_pagesize = (hsize_t)0; @@ -288,7 +288,7 @@ print_user_block(fnamein, fidin); if(set_pagesize != FS_PAGESIZE_DEF) /* Set non-default file space page size as specified */ if(H5Pset_file_space_page_size(fcpl, set_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_file_space_page_size failed to set file space page size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_file_space_page_size failed to set file space page size"); /*------------------------------------------------------------------------- * create the output file @@ -298,7 +298,7 @@ print_user_block(fnamein, fidin); HDprintf("Making new file ...\n"); if ((fidout = H5Fcreate(fnameout, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fcreate could not create file <%s>:", fnameout); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fcreate could not create file <%s>:", fnameout); /*------------------------------------------------------------------------- * write a new user block if requested @@ -306,7 +306,7 @@ print_user_block(fnamein, fidin); */ if (options->ublock_size > 0) if (copy_user_block(options->ublock_filename, fnameout, options->ublock_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); + H5TOOLS_GOTO_ERROR(FAIL, "Could not copy user block. Exiting..."); /*------------------------------------------------------------------------- * get list of objects @@ -321,14 +321,14 @@ print_user_block(fnamein, fidin); if (travt) { /* get the list of objects in the file */ if (h5trav_gettable(fidin, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR(FAIL, "h5trav_gettable failed"); /*------------------------------------------------------------------------- * do the copy *------------------------------------------------------------------------- */ if (do_copy_objects(fidin, fidout, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout); + H5TOOLS_GOTO_ERROR(FAIL, "do_copy_objects from <%s> could not copy data to <%s>", fnamein, fnameout); /*------------------------------------------------------------------------- * do the copy of referenced objects @@ -336,7 +336,7 @@ print_user_block(fnamein, fidin); *------------------------------------------------------------------------- */ if (do_copy_refobjs(fidin, fidout, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout); + H5TOOLS_GOTO_ERROR(FAIL, "do_copy_refobjs from <%s> could not copy data to <%s>", fnamein, fnameout); } /*------------------------------------------------------------------------- @@ -346,7 +346,7 @@ print_user_block(fnamein, fidin); if (ub_size > 0 && options->ublock_size == 0) if (copy_user_block(fnamein, fnameout, ub_size) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not copy user block. Exiting..."); + H5TOOLS_GOTO_ERROR(FAIL, "Could not copy user block. Exiting..."); done: H5E_BEGIN_TRY { @@ -425,7 +425,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], /* get chunk dims */ rank_chunk = H5Pget_chunk(dcpl_id, rank_dset, dims_chunk); if (rank_chunk < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_chunk failed"); for (k = rank_dset; k > 0; --k) size_chunk *= dims_chunk[k - 1]; @@ -487,7 +487,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], hslab_nbytes *= dims_hslab[k - 1]; if (hslab_nbytes <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed"); + H5TOOLS_GOTO_ERROR(FAIL, "calculate total size for the hyperslab failed"); } } } @@ -511,7 +511,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[], hslab_nbytes *= dims_hslab[k - 1]; if (hslab_nbytes <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "calculate total size for the hyperslab failed"); + H5TOOLS_GOTO_ERROR(FAIL, "calculate total size for the hyperslab failed"); } } @@ -649,22 +649,22 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* open input group */ if ((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gopen2 failed"); /* get input group creation property list */ if ((gcpl_in = H5Gget_create_plist(grp_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_create_plist failed"); /* query and set the group creation properties */ if (H5Pget_link_creation_order(gcpl_in, &crt_order_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_link_creation_order failed"); /* set up group creation property list */ if ((gcpl_out = H5Pcreate(H5P_GROUP_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); if (H5Pset_link_creation_order(gcpl_out, crt_order_flags) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_creation_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_link_creation_order failed"); /*------------------------------------------------------------------------- * the root is a special case, we get an ID for the root group @@ -673,15 +673,15 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ if (HDstrcmp(travt->objs[i].name, "/") == 0) { if ((grp_out = H5Gopen2(fidout, "/", H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gopen2 failed"); } else { if (options->grp_compact > 0 || options->grp_indexed > 0) if (H5Pset_link_phase_change(gcpl_out, (unsigned) options->grp_compact, (unsigned) options->grp_indexed) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_link_phase_change failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_link_phase_change failed"); if ((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_out, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gcreate2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gcreate2 failed"); } /*------------------------------------------------------------------------- @@ -689,16 +689,16 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ if (copy_attr(grp_in, grp_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_attr failed"); if (H5Pclose(gcpl_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Pclose(gcpl_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Gclose(grp_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gclose failed"); if (H5Gclose(grp_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gclose failed"); break; @@ -740,23 +740,23 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* early detection of references */ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed"); if ((ftype_id = H5Dget_type(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type failed"); if (H5T_REFERENCE == H5Tget_class(ftype_id)) is_ref = 1; /* Check if the datatype is committed */ if ((is_named = H5Tcommitted(ftype_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcommitted failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tcommitted failed"); if (is_named) if ((wtype_id = copy_named_datatype(ftype_id, fidout, &named_dt_head, travt, options)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_named_datatype failed"); if (H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if (H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); /*------------------------------------------------------------------------- * check if we should use H5Ocopy or not @@ -770,20 +770,20 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, int j; if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed"); if ((f_space_id = H5Dget_space(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); if ((ftype_id = H5Dget_type(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type failed"); if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist failed"); if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); if (H5Sget_simple_extent_dims(f_space_id, dims, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); if (H5Dget_space_status(dset_in, &space_status) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space_status failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space_status failed"); /* If the input dataset has external storage, it must be contiguous. * Accordingly, there would be no filter or chunk properties to preserve, @@ -792,10 +792,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ if (H5Pget_external_count(dcpl_in)) { if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); } else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) { - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcopy failed"); } nelmts = 1; @@ -811,7 +811,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } if ((msize = H5Tget_size(wtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_size failed"); /* size of current dset */ size_dset = nelmts * msize; @@ -848,7 +848,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* apply the filter */ if (apply_s) if (apply_filters(travt->objs[i].name, rank, dims, msize, dcpl_out, options, &has_filter) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "apply_filters failed"); + H5TOOLS_GOTO_ERROR(FAIL, "apply_filters failed"); /* only if layout change requested for entire file or * individual obj */ @@ -889,12 +889,12 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, */ dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); if (dset_out == FAIL) { - H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, "H5Dcreate2 failed"); + H5TOOLS_INFO("H5Dcreate2 failed"); if (options->verbose) HDprintf(" warning: could not create dataset <%s>. Applying original settings\n", travt->objs[i].name); if ((dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_in, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dcreate2 failed"); apply_f = 0; } /* end if retry dataset create */ @@ -911,15 +911,15 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (buf != NULL) { if(H5Dread(dset_in, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); if(H5Dwrite(dset_out, wtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dwrite failed"); /* Check if we have VL data in the dataset's * datatype that must be reclaimed */ if (TRUE == H5Tdetect_class(wtype_id, H5T_VLEN)) if (H5Treclaim(wtype_id, f_space_id, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Treclaim failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Treclaim failed"); if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */ HDfree(buf); @@ -965,11 +965,11 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* get hyperslab dims and size in byte */ if (get_hyperslab(dcpl_tmp, rank, dims, p_type_nbytes, hslab_dims, &hslab_nbytes) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "get_hyperslab failed"); + H5TOOLS_GOTO_ERROR(FAIL, "get_hyperslab failed"); hslab_buf = HDmalloc((size_t)hslab_nbytes); if (hslab_buf == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "can't allocate space for hyperslab"); + H5TOOLS_GOTO_ERROR(FAIL, "can't allocate space for hyperslab"); hslab_nelmts = hslab_nbytes / p_type_nbytes; hslab_space = H5Screate_simple(1, &hslab_nelmts, NULL); @@ -993,9 +993,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } if (H5Sselect_hyperslab(f_space_id, H5S_SELECT_SET, hs_sel_offset, NULL, hs_sel_count, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_hyperslab failed"); if (H5Sselect_hyperslab(hslab_space, H5S_SELECT_SET, zero, NULL, &hs_select_nelmts, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sselect_hyperslab failed"); } /* end if rank > 0 */ else { H5Sselect_all(f_space_id); @@ -1004,9 +1004,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, } /* end (else) rank == 0 */ if(H5Dread(dset_in, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); if(H5Dwrite(dset_out, wtype_id, hslab_space, f_space_id, H5P_DEFAULT, hslab_buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dwrite failed"); /* reclaim any VL memory, if necessary */ if (vl_data) @@ -1066,10 +1066,10 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_attr failed"); if (H5Dclose(dset_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); } /* end if not a reference */ } /* end if h5tools_canreadf (filter availability check) */ @@ -1078,17 +1078,17 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, *------------------------------------------------------------------------- */ if (H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if (H5Tclose(wtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if (H5Pclose(dcpl_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Pclose(dcpl_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Sclose(f_space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); if (H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); } /*------------------------------------------------------------------------- * We do not have request for filter/chunking; use H5Ocopy instead @@ -1099,11 +1099,11 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, /* create property to pass copy options */ if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed"); /* set options for object copy */ if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_copy_object failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_copy_object failed"); if (H5Ocopy(fidin, /* Source file or group identifier */ travt->objs[i].name, /* Name of the source object to be copied */ @@ -1111,25 +1111,25 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, travt->objs[i].name, /* Name of the destination object */ pid, /* Properties which apply to the copy */ H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Ocopy failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Ocopy failed"); if (H5Pclose(pid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); /*------------------------------------------------------------------------- * Copy attrs manually *------------------------------------------------------------------------- */ if ((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed"); if ((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed"); if (copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_attr failed"); if (H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); if (H5Dclose(dset_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); if (options->verbose) HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name); @@ -1146,27 +1146,27 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HDprintf(FORMAT_OBJ, "type", travt->objs[i].name); if ((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Topen2 failed"); /* Copy the datatype anonymously */ if ((type_out = copy_named_datatype(type_in, fidout, &named_dt_head, travt, options)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_named_datatype failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_named_datatype failed"); /* Link in to group structure */ if (H5Lcreate_hard(type_out, ".", fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcreate_hard failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Lcreate_hard failed"); /*------------------------------------------------------------------------- * copy attrs *------------------------------------------------------------------------- */ if (copy_attr(type_in, type_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_attr failed"); if (H5Tclose(type_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if (H5Tclose(type_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); type_out = -1; /* named datatypes stack, named_dt_head, manages allocation */ break; @@ -1185,14 +1185,14 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lcopy failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Lcopy failed"); if (options->verbose) HDprintf(FORMAT_OBJ, "link", travt->objs[i].name); break; default: - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "Object type not found"); + H5TOOLS_GOTO_ERROR(FAIL, "Object type not found"); } /* switch */ } /* end for each object to traverse */ } /* end if there are objects */ @@ -1203,7 +1203,7 @@ done: * because of reference counting */ if (0 == ret_value && named_dt_head != NULL) { if (named_datatype_free(&named_dt_head, 0) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "named_datatype_free failed"); + H5TOOLS_ERROR(FAIL, "named_datatype_free failed"); } else H5E_BEGIN_TRY { @@ -1361,9 +1361,9 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) /* Open files */ if ((infid = HDopen(infile, O_RDONLY)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed input file <%s>", infile); + H5TOOLS_GOTO_ERROR(FAIL, "HDopen failed input file <%s>", infile); if ((outfid = HDopen(outfile, O_WRONLY)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDopen failed output file <%s>", outfile); + H5TOOLS_GOTO_ERROR(FAIL, "HDopen failed output file <%s>", outfile); /* Copy the userblock from the input file to the output file */ while (size > 0) { @@ -1377,7 +1377,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) else nread = HDread(infid, rbuf, (size_t)size); if (nread < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDread failed to read userblock"); + H5TOOLS_GOTO_ERROR(FAIL, "HDread failed to read userblock"); /* Write buffer to destination file */ /* (compensating for interrupted writes & checking for errors, etc.) */ @@ -1390,7 +1390,7 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size) nwritten = HDwrite(outfid, wbuf, (size_t)nbytes); } while (-1 == nwritten && EINTR == errno); if (-1 == nwritten) /* error */ - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDwrite failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDwrite failed"); HDassert(nwritten > 0); HDassert(nwritten <= nbytes); @@ -1435,20 +1435,20 @@ print_user_block(const char *filename, hid_t fid) /* get user block size */ if ((fcpl = H5Fget_create_plist(fid)) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fget_create_plist failed to retrieve file creation property list"); } if (H5Pget_userblock(fcpl, &ub_size) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pget_userblock failed to retrieve userblock size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_userblock failed to retrieve userblock size"); } if (H5Pclose(fcpl) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Pclose failed to close property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed to close property list"); } /* open file */ if ((fh = HDopen(filename, O_RDONLY)) < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "HDopen failed to open file <%s>", filename); + H5TOOLS_GOTO_ERROR(FAIL, "HDopen failed to open file <%s>", filename); } size = ub_size; @@ -1472,7 +1472,7 @@ print_user_block(const char *filename, hid_t fid) HDprintf("\n"); if (nread < 0) { - H5TOOLS_GOTO_ERROR(H5E_tools_g, H5E_tools_min_id_g, "nread < 0"); + H5TOOLS_GOTO_ERROR(FAIL, "nread < 0"); } /* update size of userblock left to transfer */ diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 9eb7c89..407dac0 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -47,24 +47,24 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_nfilters failed"); /* copy filter_info_t structure */ for (i = 0; i < nfilters; i++) { if ((objout->filter[i].filtn = H5Pget_filter2(dcpl_id, (unsigned) i, &objout->filter[i].filt_flag, &objout->filter[i].cd_nelmts, objout->filter[i].cd_values, sizeof(f_objname), f_objname, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_filter2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_filter2 failed"); } objout->nfilters = nfilters; HDstrcpy(objout->path, name); if ((layout = H5Pget_layout(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_layout failed"); objout->layout = layout; if (layout == H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_chunk failed"); objout->chunk.rank = rank; for (u = 0; u < (unsigned)rank; u++) objout->chunk.chunk_lengths[u] = chsize[u]; @@ -249,7 +249,7 @@ int apply_filters(const char* name, /* object name from traverse list */ *has_filter = 0; if (rank == 0) /* scalar dataset, do not apply */ - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /*------------------------------------------------------------------------- * initialize the assigment object @@ -263,11 +263,11 @@ int apply_filters(const char* name, /* object name from traverse list */ *------------------------------------------------------------------------- */ if (aux_assign_obj(name, options, &obj) == 0) - HGOTO_DONE(0); + H5TOOLS_GOTO_DONE(0); /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_nfilters failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_nfilters failed"); /*------------------------------------------------------------------------- @@ -279,12 +279,12 @@ int apply_filters(const char* name, /* object name from traverse list */ if (nfilters && obj.nfilters) { *has_filter = 1; if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Premove_filter failed"); } else if(nfilters) { *has_filter = 1; if (aux_copy_obj(dcpl_id, name, &filtobj) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "aux_copy_obj failed"); + H5TOOLS_GOTO_ERROR(FAIL, "aux_copy_obj failed"); } /*------------------------------------------------------------------------- @@ -294,11 +294,11 @@ int apply_filters(const char* name, /* object name from traverse list */ */ if (obj.layout == -1) { if ((layout = H5Pget_layout(dcpl_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_layout failed"); if (layout == H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_chunk failed"); obj.layout = H5D_CHUNKED; obj.chunk.rank = rank; for (i = 0; i < rank; i++) @@ -340,7 +340,7 @@ int apply_filters(const char* name, /* object name from traverse list */ for (i = rank; i > 0; --i) { hsize_t size = 0; if(sm_nbytes == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "number of bytes per stripmine must be > 0"); + H5TOOLS_GOTO_ERROR(FAIL, "number of bytes per stripmine must be > 0"); size = H5TOOLS_BUFSIZE / sm_nbytes; if (size == 0) /* datum size > H5TOOLS_BUFSIZE */ size = 1; @@ -355,7 +355,7 @@ int apply_filters(const char* name, /* object name from traverse list */ for (i = 0; i < obj.nfilters; i++) { if (obj.filter[i].filtn < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid filter"); switch (obj.filter[i].filtn) { /*------------------------------------------------------------------------- @@ -376,9 +376,9 @@ int apply_filters(const char* name, /* object name from traverse list */ aggression = obj.filter[i].cd_values[0]; /* set up for deflated data */ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); if (H5Pset_deflate(dcpl_id, aggression) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_deflate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_deflate failed"); } break; @@ -396,9 +396,9 @@ int apply_filters(const char* name, /* object name from traverse list */ /* set up for szip data */ if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); if (H5Pset_szip(dcpl_id, options_mask, pixels_per_block) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_szip failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_szip failed"); } break; @@ -408,9 +408,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_SHUFFLE: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); if (H5Pset_shuffle(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shuffle failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_shuffle failed"); break; /*------------------------------------------------------------------------- @@ -419,9 +419,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_FLETCHER32: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); if (H5Pset_fletcher32(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fletcher32 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_fletcher32 failed"); break; /*----------- ------------------------------------------------------------- * H5Z_FILTER_NBIT , NBIT compression @@ -429,9 +429,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ case H5Z_FILTER_NBIT: if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); if (H5Pset_nbit(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_nbit failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_nbit failed"); break; /*----------- ------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET , scale+offset compression @@ -446,19 +446,19 @@ int apply_filters(const char* name, /* object name from traverse list */ scale_factor = (int) obj.filter[i].cd_values[1]; if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); if (H5Pset_scaleoffset(dcpl_id, scale_type, scale_factor) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_scaleoffset failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_scaleoffset failed"); } break; default: { if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); if (H5Pset_filter(dcpl_id, obj.filter[i].filtn, obj.filter[i].filt_flag, obj.filter[i].cd_nelmts, obj.filter[i].cd_values) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_filter failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_filter failed"); } break; } /* switch */ @@ -469,10 +469,10 @@ int apply_filters(const char* name, /* object name from traverse list */ if (filtobj.nfilters) { for (i = 0; i < filtobj.nfilters; i++) { if (filtobj.filter[i].filtn < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); + H5TOOLS_GOTO_ERROR(FAIL, "invalid filter"); if (H5Zfilter_avail(filtobj.filter[i].filtn) <= 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "%d filter unavailable", filtobj.filter[i].filtn); + H5TOOLS_GOTO_ERROR(FAIL, "%d filter unavailable", filtobj.filter[i].filtn); } /* for */ } /* nfilters */ @@ -484,20 +484,20 @@ int apply_filters(const char* name, /* object name from traverse list */ if (obj.layout >= 0) { /* a layout was defined */ if (H5Pset_layout(dcpl_id, obj.layout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_layout failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_layout failed"); if (H5D_CHUNKED == obj.layout) { if (H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_chunk failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_chunk failed"); } else if (H5D_COMPACT == obj.layout) { if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_alloc_time failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pset_alloc_time failed"); } /* remove filters for the H5D_CONTIGUOUS case */ else if (H5D_CONTIGUOUS == obj.layout) { if (H5Premove_filter(dcpl_id, H5Z_FILTER_ALL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Premove_filter failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Premove_filter failed"); } } diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c index 0239f6c..b1e4fbc 100644 --- a/tools/src/h5repack/h5repack_opttable.c +++ b/tools/src/h5repack/h5repack_opttable.c @@ -56,7 +56,7 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_in if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS) table->objs[I].filter[table->objs[I].nfilters++] = filt; else - H5TOOLS_INFO(H5E_tools_min_id_g, "cannot insert the filter in this object. Maximum capacity exceeded"); + H5TOOLS_INFO("cannot insert the filter in this object. Maximum capacity exceeded"); } /*------------------------------------------------------------------------- @@ -106,7 +106,7 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs) table->size += n_objs; table->objs = (pack_info_t*) HDrealloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs == NULL) { - H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table"); + H5TOOLS_INFO("not enough memory for options table"); ret_value = -1; } else { @@ -132,14 +132,14 @@ int options_table_init(pack_opttbl_t **tbl) { pack_opttbl_t *table; if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) { - H5TOOLS_GOTO_ERROR(-1, H5E_tools_min_id_g, "not enough memory for options table"); + H5TOOLS_GOTO_ERROR(-1, "not enough memory for options table"); } table->size = 30; table->nelems = 0; if (NULL == (table->objs = (pack_info_t*) HDmalloc(table->size * sizeof(pack_info_t)))) { HDfree(table); - H5TOOLS_GOTO_ERROR(-1, H5E_tools_min_id_g, "not enough memory for options table"); + H5TOOLS_GOTO_ERROR(-1, "not enough memory for options table"); } for (i = 0; i < table->size; i++) @@ -197,7 +197,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa if (HDstrcmp(obj_list[j].obj,table->objs[i].path) == 0) { /* already chunk info inserted for this one; exit */ if (table->objs[i].chunk.rank > 0) { - H5TOOLS_INFO(H5E_tools_min_info_id_g, "chunk information already inserted for <%s>\n", obj_list[j].obj); + H5TOOLS_INFO("chunk information already inserted for <%s>\n", obj_list[j].obj); HDexit(EXIT_FAILURE); } /* insert the layout info */ diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c index 02a2a6d..01ef1d3 100644 --- a/tools/src/h5repack/h5repack_refs.c +++ b/tools/src/h5repack/h5repack_refs.c @@ -76,18 +76,18 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((grp_out = H5Gopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gopen2 failed"); if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gopen2 failed"); if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_refs_attr failed"); if(H5Gclose(grp_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gclose failed"); if(H5Gclose(grp_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gclose failed"); /*------------------------------------------------------------------------- * check for hard links @@ -104,26 +104,26 @@ int do_copy_refobjs(hid_t fidin, */ case H5TRAV_TYPE_DATASET: if((dset_in = H5Dopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed"); if((space_id = H5Dget_space(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); if((ftype_id = H5Dget_type(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type failed"); if((dcpl_id = H5Dget_create_plist(dset_in)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist failed"); if((rank = H5Sget_simple_extent_ndims(space_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_ndims failed"); if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); nelmts = 1; for(k = 0; k < rank; k++) nelmts *= dims[k]; if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed"); if((msize = H5Tget_size(mtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_size failed"); /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -159,15 +159,15 @@ int do_copy_refobjs(hid_t fidin, buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf==NULL) { HDprintf("cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); refbuf = (hobj_ref_t*) HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL){ HDprintf("cannot allocate memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDcalloc failed"); } /* end if */ for(u = 0; u < nelmts; u++) { H5E_BEGIN_TRY { @@ -181,7 +181,7 @@ int do_copy_refobjs(hid_t fidin, if((refname = MapIdToName(refobj_id, travt)) != NULL) { /* create the reference, -1 parameter for objects */ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_OBJECT, (hid_t)-1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rcreate failed"); if(options->verbose) { HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name ); HDprintf("object <%s> object reference created to <%s>\n", @@ -190,7 +190,7 @@ int do_copy_refobjs(hid_t fidin, } } /*refname*/ if (H5Oclose(refobj_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refob failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oclose refob failed"); } /* u */ } /*nelmts*/ @@ -199,10 +199,10 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dcreate2 failed"); if(nelmts) if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dwrite failed"); if(buf) HDfree(buf); @@ -213,7 +213,7 @@ int do_copy_refobjs(hid_t fidin, * copy attrs *----------------------------------------------------*/ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_attr failed"); } /*H5T_STD_REF_OBJ*/ /*------------------------------------------------------------------------- @@ -235,10 +235,10 @@ int do_copy_refobjs(hid_t fidin, buf = (hdset_reg_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDmalloc failed"); } /* end if */ if(H5Dread(dset_in, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dread failed"); /*------------------------------------------------------------------------- * create output @@ -247,7 +247,7 @@ int do_copy_refobjs(hid_t fidin, refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDcalloc failed"); } /* end if */ for(u = 0; u < nelmts; u++) { @@ -263,13 +263,13 @@ int do_copy_refobjs(hid_t fidin, hid_t region_id = -1; /* region id of the referenced dataset */ if((region_id = H5Rget_region(dset_in, H5R_DATASET_REGION, &buf[u])) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rget_region failed"); /* create the reference, we need the space_id */ if(H5Rcreate(&refbuf[u], fidout, refname, H5R_DATASET_REGION, region_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rcreate failed"); if(H5Sclose(region_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); if(options->verbose) { HDprintf(FORMAT_OBJ,"dset",travt->objs[i].name ); HDprintf("object <%s> region reference created to <%s>\n", @@ -278,7 +278,7 @@ int do_copy_refobjs(hid_t fidin, } } /*refname*/ if (H5Oclose(refobj_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Oclose refobj_id failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oclose refobj_id failed"); } /* u */ } /*nelmts*/ @@ -287,10 +287,10 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if((dset_out = H5Dcreate2(fidout, travt->objs[i].name, mtype_id, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dcreate2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dcreate2 failed"); if(nelmts) if(H5Dwrite(dset_out, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, refbuf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dwrite failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dwrite failed"); if(buf) HDfree(buf); @@ -301,7 +301,7 @@ int do_copy_refobjs(hid_t fidin, * copy attrs *----------------------------------------------------*/ if(copy_attr(dset_in, dset_out, &named_dt_head, travt, options) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_attr failed"); } /* H5T_STD_REF_DSETREG */ /*------------------------------------------------------------------------- * not references, open previously created object in 1st traversal @@ -309,7 +309,7 @@ int do_copy_refobjs(hid_t fidin, */ else { if((dset_out = H5Dopen2(fidout, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed"); } /* end else */ /*------------------------------------------------------------------------- @@ -317,7 +317,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed"); + H5TOOLS_GOTO_ERROR(FAIL, "copy_refs_attr failed"); /*------------------------------------------------------------------------- * check for hard links @@ -328,7 +328,7 @@ int do_copy_refobjs(hid_t fidin, H5Lcreate_hard(fidout, travt->objs[i].name, H5L_SAME_LOC, travt->objs[i].links[j].new_name, H5P_DEFAULT, H5P_DEFAULT); if(H5Dclose(dset_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); } /*can_read*/ /*------------------------------------------------------------------------- @@ -336,15 +336,15 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ if(H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if(H5Tclose(mtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if(H5Pclose(dcpl_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if(H5Sclose(space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); if(H5Dclose(dset_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); break; /*------------------------------------------------------------------------- @@ -353,9 +353,9 @@ int do_copy_refobjs(hid_t fidin, */ case H5TRAV_TYPE_NAMED_DATATYPE: if((type_in = H5Topen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Topen2 failed"); if(H5Tclose(type_in) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); break; /*------------------------------------------------------------------------- @@ -368,7 +368,8 @@ int do_copy_refobjs(hid_t fidin, case H5TRAV_TYPE_UNKNOWN: case H5TRAV_TYPE_UDLINK: - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5TRAV invalid type"); + H5TOOLS_GOTO_ERROR(FAIL, "H5TRAV invalid type"); + break; default: break; @@ -380,7 +381,7 @@ int do_copy_refobjs(hid_t fidin, * in copy_attr(), so need to free. */ if (named_datatype_free(&named_dt_head, 0) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "named_datatype_free failed"); + H5TOOLS_GOTO_ERROR(FAIL, "named_datatype_free failed"); return ret_value; @@ -453,28 +454,27 @@ static int copy_refs_attr(hid_t loc_in, size_t *ref_comp_size = NULL; int ref_comp_field_n = 0; - if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info failed"); for(u = 0; u < (unsigned)oinfo.num_attrs; u++) { is_ref = is_ref_vlen = is_ref_array = is_ref_comp = 0; /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen_by_idx failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aopen_by_idx failed"); /* get the file datatype */ if((ftype_id = H5Aget_type(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_type failed"); type_class = H5Tget_class(ftype_id); if((mtype_id = H5Tget_native_type(ftype_id, H5T_DIR_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_native_type failed"); if((msize = H5Tget_size(mtype_id)) == 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_size failed"); is_ref = (type_class == H5T_REFERENCE); @@ -484,7 +484,7 @@ static int copy_refs_attr(hid_t loc_in, is_ref_vlen = (H5Tget_class(base_type) == H5T_REFERENCE); msize = H5Tget_size(base_type); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose base_type failed"); } else if(type_class == H5T_ARRAY ) { hid_t base_type = H5Tget_super(ftype_id); @@ -492,13 +492,13 @@ static int copy_refs_attr(hid_t loc_in, is_ref_array = (H5Tget_class(base_type) == H5T_REFERENCE); msize = H5Tget_size(base_type); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose base_type failed"); } else if(type_class == H5T_COMPOUND) { int nmembers = H5Tget_nmembers(ftype_id) ; if (nmembers < 1) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_nmembers failed"); ref_comp_index = (unsigned *)HDmalloc((size_t)nmembers*sizeof(unsigned)); ref_comp_size = (size_t *)HDmalloc((size_t)nmembers*sizeof(ref_comp_size)); @@ -513,7 +513,7 @@ static int copy_refs_attr(hid_t loc_in, ref_comp_field_n++; } if (H5Tclose(mtid) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtid failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose mtid failed"); } /* if compound don't contain reference type member, free the above @@ -536,25 +536,25 @@ static int copy_refs_attr(hid_t loc_in, if (!(is_ref || is_ref_vlen || is_ref_array || is_ref_comp)) { if (H5Tclose(mtype_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose mtype_id failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose mtype_id failed"); if (H5Tclose(ftype_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose ftype_id failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose ftype_id failed"); if (H5Aclose(attr_id) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Aclose attr_id failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aclose attr_id failed"); continue; } /* get name */ if(H5Aget_name(attr_id, 255, name) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_name failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name failed"); /* get the dataspace handle */ if((space_id = H5Aget_space(attr_id)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_space failed"); /* get dimensions */ if((rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims failed"); /*------------------------------------------------------------------------- @@ -573,7 +573,7 @@ static int copy_refs_attr(hid_t loc_in, msize = H5Tget_size(base_type); if (H5Tclose(base_type) < 0) - H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose base_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose base_type failed"); array_rank = (unsigned)H5Tget_array_ndims(mtype_id); H5Tget_array_dims2(mtype_id, array_dims); @@ -583,7 +583,7 @@ static int copy_refs_attr(hid_t loc_in, } if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Acreate2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Acreate2 failed"); if (nelmts>0) { /* handle object references */ @@ -591,15 +591,15 @@ static int copy_refs_attr(hid_t loc_in, buf = (hobj_ref_t *)HDmalloc((unsigned)(nelmts * msize)); if(buf == NULL) { HDprintf("cannot read into memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread failed"); refbuf = (hobj_ref_t *)HDcalloc((unsigned)nelmts, msize); if(refbuf == NULL) { HDprintf("cannot allocate memory\n"); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDcalloc failed"); } /* end if */ for(i = 0; i < (unsigned)nelmts; i++) @@ -612,10 +612,10 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { HDprintf( "cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread failed"); /*------------------------------------------------------------------------- * create output @@ -624,7 +624,7 @@ static int copy_refs_attr(hid_t loc_in, refbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)nelmts); /*init to zero */ if(refbuf == NULL) { HDprintf( "cannot allocate memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDcalloc failed"); } /* end if */ for(i = 0; i < (unsigned)nelmts; i++) @@ -639,11 +639,11 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { HDprintf( "cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread failed"); if (H5R_OBJ_REF_BUF_SIZE==msize) { hobj_ref_t ref_out; @@ -680,11 +680,11 @@ static int copy_refs_attr(hid_t loc_in, if(buf == NULL) { HDprintf( "cannot read into memory\n" ); - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + H5TOOLS_GOTO_ERROR(FAIL, "HDmalloc failed"); } /* end if */ if(H5Aread(attr_id, mtype_id, buf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aread failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aread failed"); for (i=0; i<(unsigned)nelmts; i++) { for (j=0; j<(unsigned)ref_comp_field_n; j++) { @@ -709,7 +709,7 @@ static int copy_refs_attr(hid_t loc_in, } /* else if (is_ref_comp) */ if(H5Awrite(attr_out, mtype_id, refbuf) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Awrite failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Awrite failed"); if (is_ref_vlen && buf) H5Treclaim (mtype_id, space_id, H5P_DEFAULT, buf); @@ -739,20 +739,20 @@ static int copy_refs_attr(hid_t loc_in, } if(H5Aclose(attr_out) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aclose failed"); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ if(H5Tclose(ftype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if(H5Tclose(mtype_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); if(H5Sclose(space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); if(H5Aclose(attr_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Aclose failed"); } /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */ done: @@ -829,20 +829,20 @@ static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in, ref_obj_id = H5Rdereference2(obj_id, H5P_DEFAULT, ref_type, ref_in); if (ref_obj_id < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rdereference2 failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rdereference2 failed"); ref_obj_name = MapIdToName(ref_obj_id, travt); if (ref_obj_name == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "MapIdToName failed"); + H5TOOLS_GOTO_ERROR(FAIL, "MapIdToName failed"); if (ref_type == H5R_DATASET_REGION) { space_id = H5Rget_region(obj_id, H5R_DATASET_REGION, ref_in); if (space_id < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rget_region failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rget_region failed"); } if(H5Rcreate(ref_out, fid_out, ref_obj_name, ref_type, space_id) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Rcreate failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Rcreate failed"); done: H5E_BEGIN_TRY { diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c index 29ce5bd..f874476 100644 --- a/tools/src/h5repack/h5repack_verify.c +++ b/tools/src/h5repack/h5repack_verify.c @@ -58,7 +58,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* open the output file */ if((fidout = H5Fopen(out_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on <%s>", out_fname); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fopen failed on <%s>", out_fname); for(i = 0; i < options->op_tbl->nelems; i++) { char *name = options->op_tbl->objs[i].path; @@ -69,13 +69,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed on <%s>", name); if((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist failed"); if((tid = H5Dget_type(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type failed"); /*------------------------------------------------------------------------- * filter check @@ -96,13 +96,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if(H5Pclose(pid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); if (H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); if (H5Tclose(tid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); } /*------------------------------------------------------------------------- @@ -118,7 +118,7 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* get the list of objects in the file */ if(h5trav_gettable(fidout, travt) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR(FAIL, "h5trav_gettable failed"); for(i = 0; i < travt->nobjs; i++) { char *name = travt->objs[i].name; @@ -129,13 +129,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if((did = H5Dopen2(fidout, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on <%s>", name); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed on <%s>", name); if((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_space failed"); if((pid = H5Dget_create_plist(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist failed"); if((tid = H5Dget_type(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type failed"); /*------------------------------------------------------------------------- * filter check @@ -165,13 +165,13 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options *------------------------------------------------------------------------- */ if (H5Pclose(pid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose failed"); if (H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); if (H5Tclose(tid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose failed"); } /* if */ } /* i */ @@ -187,32 +187,32 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options /* open the input file */ if((fidin = H5Fopen(in_fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fopen failed on file <%s>", in_fname); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fopen failed on file <%s>", in_fname); /* Get file creation property list for input file */ if((fcpl_in = H5Fget_create_plist(fidin)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fget_create_plist failed to retrieve file creation property list"); /* Get file space info for input file */ if(H5Pget_file_space_strategy(fcpl_in, &in_strategy, &in_persist, &in_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); /* Get file space page size for input file */ if(H5Pget_file_space_page_size(fcpl_in, &in_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_file_space_page_size failed to retrieve file space page size"); /* Output file is already opened */ /* Get file creation property list for output file */ if((fcpl_out = H5Fget_create_plist(fidout)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fget_create_plist failed to retrieve file creation property list"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Fget_create_plist failed to retrieve file creation property list"); /* Get file space info for output file */ if(H5Pget_file_space_strategy(fcpl_out, &out_strategy, &out_persist, &out_threshold) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_file_space_strategy failed to retrieve file space strategy & threshold"); /* Get file space page size for output file */ if(H5Pget_file_space_page_size(fcpl_out, &out_pagesize) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_file_space_page_size failed to retrieve file space page size"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_file_space_page_size failed to retrieve file space page size"); /* * If -S option is set, the file space handling strategy should be set as specified. @@ -221,11 +221,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_strategy) { if(out_strategy != (options->fs_strategy == (H5F_fspace_strategy_t)-1 ? 0 : options->fs_strategy)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "file space strategy not set as unexpected"); } else { if(out_strategy != in_strategy) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space strategy not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "file space strategy not set as unexpected"); } /* @@ -235,11 +235,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_persist) { if(out_persist != (hbool_t)(options->fs_persist == (-1) ? FALSE : options->fs_persist)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "free-space persist status not set as unexpected"); } else { if(out_persist != in_persist) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "free-space persist status not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "free-space persist status not set as unexpected"); } /* @@ -249,11 +249,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_threshold) { if(out_threshold != (hsize_t)(options->fs_threshold == (-1) ? 0 : options->fs_threshold)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "threshold not set as unexpected"); } else { if(out_threshold != in_threshold) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "threshold not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "threshold not set as unexpected"); } /* @@ -263,11 +263,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options */ if(options->fs_pagesize) { if(out_pagesize != (hsize_t)(options->fs_pagesize == (-1) ? 0 : options->fs_pagesize)) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "file space page size not set as unexpected"); } else { /* "-G" is not set */ if(out_pagesize != in_pagesize) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "file space page size not set as unexpected"); + H5TOOLS_GOTO_ERROR(FAIL, "file space page size not set as unexpected"); } @@ -375,9 +375,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) */ /* Open the files */ if ((fid1 = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR); + H5TOOLS_GOTO_ERROR(FAIL, "h5tools_fopen failed <%s>: %s", fname1, H5FOPENERROR); if ((fid2 = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR); + H5TOOLS_GOTO_ERROR(FAIL, "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR); /*------------------------------------------------------------------------- * get file table list of objects @@ -388,7 +388,7 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) /* init table */ trav_table_init(&trav); if(h5trav_gettable(fid1, trav) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed"); + H5TOOLS_GOTO_ERROR(FAIL, "h5trav_gettable failed"); /*------------------------------------------------------------------------- * traverse the suppplied object list @@ -397,62 +397,62 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2) for(i = 0; i < trav->nobjs; i++) { if(trav->objs[i].type == H5TRAV_TYPE_GROUP) { if ((gid = H5Gopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on first <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gopen2 failed on first <%s>", trav->objs[i].name); if ((gcplid = H5Gget_create_plist(gid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_link_creation_order failed"); if (H5Pclose(gcplid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Gclose(gid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gclose failed"); if ((gid = H5Gopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed on second <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gopen2 failed on second <%s>", trav->objs[i].name); if ((gcplid = H5Gget_create_plist(gid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_create_plist failed"); if (H5Pget_link_creation_order(gcplid, &crt_order_flag2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_link_creation_order failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_link_creation_order failed"); if (H5Pclose(gcplid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if (H5Gclose(gid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gclose failed"); if (crt_order_flag1 != crt_order_flag2) - H5TOOLS_GOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name); } else if(trav->objs[i].type == H5TRAV_TYPE_DATASET) { if((dset1 = H5Dopen2(fid1, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on first <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed on first <%s>", trav->objs[i].name); if((dset2 = H5Dopen2(fid2, trav->objs[i].name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed on second <%s>", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen2 failed on second <%s>", trav->objs[i].name); if((dcpl1 = H5Dget_create_plist(dset1)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(dset2)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist failed"); /*------------------------------------------------------------------------- * compare the property lists *------------------------------------------------------------------------- */ if((ret_value = H5Pequal(dcpl1, dcpl2)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pequal failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pequal failed"); if(ret_value == 0) - H5TOOLS_GOTO_ERROR(0, H5E_tools_min_id_g, "property lists failed for <%s> are different", trav->objs[i].name); + H5TOOLS_GOTO_ERROR(0, "property lists failed for <%s> are different", trav->objs[i].name); /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ if(H5Pclose(dcpl1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if(H5Pclose(dcpl2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose failed"); if(H5Dclose(dset1) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); if(H5Dclose(dset2) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose failed"); } /*if*/ } /*for*/ diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 64053a8..f9e5816 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -455,7 +455,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Get group information */ if((ret_value = H5Gget_info_by_name(iter->fid, name, &ginfo, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gget_info_by_name() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Gget_info_by_name() failed"); /* Update link stats */ /* Collect statistics for small groups */ @@ -470,7 +470,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) if((bin + 1) > iter->group_nbins) { /* Allocate more storage for info about dataset's datatype */ if((iter->group_bins = (unsigned long *)HDrealloc(iter->group_bins, (bin + 1) * sizeof(unsigned long))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Drealloc() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize counts for intermediate bins */ while(iter->group_nbins < bin) @@ -489,7 +489,7 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Update attribute metadata info */ if((ret_value = attribute_stats(iter, oi)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats failed"); + H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed"); done: return ret_value; @@ -537,7 +537,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) iter->dset_ohdr_info.free_size += oi->hdr.space.free; if((did = H5Dopen2(iter->fid, name, H5P_DEFAULT)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dopen() failed"); /* Update dataset metadata info */ iter->datasets_index_storage_size += oi->meta_size.obj.index_size; @@ -545,7 +545,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Update attribute metadata info */ if((ret_value = attribute_stats(iter, oi)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed"); /* Get storage info */ /* Failure 0 indistinguishable from no-data-stored 0 */ @@ -553,10 +553,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_create_plist() failed"); if((lout = H5Pget_layout(dcpl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_layout() failed"); /* Object header's total size for H5D_COMPACT layout includes raw data size */ /* "storage" also includes H5D_COMPACT raw data size */ @@ -568,7 +568,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Get the number of external files for the dataset */ if((num_ext = H5Pget_external_count(dcpl)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_external_count() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pget_external_count() failed"); /* Accumulate raw data size accordingly */ if(num_ext) { @@ -580,10 +580,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Gather dataspace statistics */ if((sid = H5Dget_space(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_space() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_space() failed"); if((ndims = H5Sget_simple_extent_dims(sid, dims, NULL)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sget_simple_extent_dims() failed"); /* Check for larger rank of dataset */ if((unsigned)ndims > iter->max_dset_rank) @@ -606,7 +606,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) if((bin + 1) > iter->dset_dim_nbins) { /* Allocate more storage for info about dataset's datatype */ if((iter->dset_dim_bins = (unsigned long *)HDrealloc(iter->dset_dim_bins, (bin + 1) * sizeof(unsigned long))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Drealloc() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize counts for intermediate bins */ while(iter->dset_dim_nbins < bin) @@ -621,11 +621,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) } /* end if */ if(H5Sclose(sid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Sclose() failed"); /* Gather datatype statistics */ if((tid = H5Dget_type(did)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dget_type() failed"); type_found = FALSE; for(u = 0; u < iter->dset_ntypes; u++) @@ -644,11 +644,11 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) /* Allocate more storage for info about dataset's datatype */ if((iter->dset_type_info = (dtype_info_t *)HDrealloc(iter->dset_type_info, iter->dset_ntypes * sizeof(dtype_info_t))) == NULL) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Drealloc() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Drealloc() failed"); /* Initialize information about datatype */ if((iter->dset_type_info[curr_ntype].tid = H5Tcopy(tid)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tcopy() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tcopy() failed"); iter->dset_type_info[curr_ntype].count = 1; iter->dset_type_info[curr_ntype].named = 0; @@ -661,7 +661,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) (iter->dset_type_info[u].named)++; if(H5Tclose(tid) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Tclose() failed"); /* Track different filters */ if((nfltr = H5Pget_nfilters(dcpl)) >= 0) { @@ -679,10 +679,10 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) } /* endif nfltr */ if(H5Pclose(dcpl) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Pclose() failed"); if(H5Dclose(did) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "H5Dclose() failed"); done: return ret_value; @@ -715,7 +715,7 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi) /* Update attribute metadata info */ if((ret_value = attribute_stats(iter, oi)) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); + H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed"); done: return ret_value; } /* end datatype_stats() */ @@ -750,17 +750,17 @@ obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited, switch(oi->type) { case H5O_TYPE_GROUP: if(group_stats(iter, path, oi) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "group_stats failed"); + H5TOOLS_GOTO_ERROR(FAIL, "group_stats failed"); break; case H5O_TYPE_DATASET: if(dataset_stats(iter, path, oi) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "dataset_stats failed"); + H5TOOLS_GOTO_ERROR(FAIL, "dataset_stats failed"); break; case H5O_TYPE_NAMED_DATATYPE: if(datatype_stats(iter, oi) < 0) - H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "datatype_stats failed"); + H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed"); break; case H5O_TYPE_MAP: |