summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/CMakeLists.txt2
-rw-r--r--tools/lib/h5diff.c335
-rw-r--r--tools/lib/h5diff.h56
-rw-r--r--tools/lib/h5diff_array.c551
-rw-r--r--tools/lib/h5diff_attr.c528
-rw-r--r--tools/lib/h5diff_dset.c234
-rw-r--r--tools/lib/h5diff_util.c8
-rw-r--r--tools/lib/h5tools.c322
-rw-r--r--tools/lib/h5tools.h1
-rw-r--r--tools/lib/h5tools_dump.c557
-rw-r--r--tools/lib/h5tools_error.h239
-rw-r--r--tools/lib/h5tools_filters.c27
-rw-r--r--tools/lib/h5tools_ref.c148
-rw-r--r--tools/lib/h5tools_ref.h8
-rw-r--r--tools/lib/h5tools_str.c140
-rw-r--r--tools/lib/h5tools_str.h2
-rw-r--r--tools/lib/h5tools_type.c4
-rw-r--r--tools/lib/h5tools_utils.c109
-rw-r--r--tools/lib/h5tools_utils.h15
-rw-r--r--tools/lib/h5trav.c189
-rw-r--r--tools/lib/h5trav.h15
-rw-r--r--tools/lib/io_timer.c85
-rw-r--r--tools/lib/io_timer.h10
-rw-r--r--tools/libtest/CMakeLists.txt4
-rw-r--r--tools/libtest/h5tools_test_utils.c6
-rw-r--r--tools/src/h5copy/h5copy.c30
-rw-r--r--tools/src/h5diff/CMakeLists.txt2
-rw-r--r--tools/src/h5diff/h5diff_common.c45
-rw-r--r--tools/src/h5diff/ph5diff_main.c3
-rw-r--r--tools/src/h5dump/h5dump.c8
-rw-r--r--tools/src/h5dump/h5dump_ddl.c75
-rw-r--r--tools/src/h5dump/h5dump_xml.c193
-rw-r--r--tools/src/h5format_convert/h5format_convert.c8
-rw-r--r--tools/src/h5import/h5import.c12
-rw-r--r--tools/src/h5jam/h5jam.c4
-rw-r--r--tools/src/h5jam/h5unjam.c4
-rw-r--r--tools/src/h5ls/h5ls.c202
-rw-r--r--tools/src/h5repack/h5repack.c181
-rw-r--r--tools/src/h5repack/h5repack.h2
-rw-r--r--tools/src/h5repack/h5repack_copy.c280
-rw-r--r--tools/src/h5repack/h5repack_filters.c84
-rw-r--r--tools/src/h5repack/h5repack_opttable.c40
-rw-r--r--tools/src/h5repack/h5repack_refs.c221
-rw-r--r--tools/src/h5repack/h5repack_verify.c158
-rw-r--r--tools/src/h5stat/h5stat.c103
-rw-r--r--tools/src/misc/h5clear.c4
-rw-r--r--tools/test/h5copy/CMakeLists.txt4
-rw-r--r--tools/test/h5copy/h5copygentest.c18
-rw-r--r--tools/test/h5diff/CMakeLists.txt4
-rw-r--r--tools/test/h5diff/CMakeTests.cmake80
-rw-r--r--tools/test/h5diff/h5diffgentest.c378
-rw-r--r--tools/test/h5diff/testfiles/h5diff_58.txt4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_58_ref.txt37
-rw-r--r--tools/test/h5diff/testfiles/h5diff_reg.txt15
-rw-r--r--tools/test/h5diff/testh5diff.sh.in22
-rw-r--r--tools/test/h5dump/CMakeLists.txt10
-rw-r--r--tools/test/h5dump/CMakeTests.cmake33
-rw-r--r--tools/test/h5dump/errfiles/tdset-2.err2
-rw-r--r--tools/test/h5dump/errfiles/tperror.err2
-rw-r--r--tools/test/h5dump/errfiles/tqmarkfile.err2
-rw-r--r--tools/test/h5dump/h5dumpgentest.c170
-rw-r--r--tools/test/h5dump/testh5dump.sh.in38
-rw-r--r--tools/test/h5format_convert/CMakeLists.txt4
-rw-r--r--tools/test/h5format_convert/h5fc_chk_idx.c4
-rw-r--r--tools/test/h5format_convert/h5fc_gentest.c52
-rw-r--r--tools/test/h5import/CMakeLists.txt4
-rw-r--r--tools/test/h5jam/CMakeLists.txt4
-rw-r--r--tools/test/h5jam/getub.c2
-rw-r--r--tools/test/h5ls/CMakeLists.txt6
-rw-r--r--tools/test/h5repack/CMakeLists.txt4
-rw-r--r--tools/test/h5repack/h5repacktst.c202
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst2
-rw-r--r--tools/test/h5stat/CMakeLists.txt4
-rw-r--r--tools/test/h5stat/h5stat_gentest.c56
-rw-r--r--tools/test/misc/CMakeLists.txt8
-rw-r--r--tools/test/misc/h5clear_gentest.c26
-rw-r--r--tools/test/misc/repart_test.c6
-rw-r--r--tools/test/misc/talign.c10
-rw-r--r--tools/test/misc/vds/UC_1_one_dim_gen.c16
-rw-r--r--tools/test/misc/vds/UC_2_two_dims_gen.c16
-rw-r--r--tools/test/misc/vds/UC_3_gaps_gen.c20
-rw-r--r--tools/test/misc/vds/UC_4_printf_gen.c16
-rw-r--r--tools/test/misc/vds/UC_5_stride_gen.c16
-rw-r--r--tools/test/perform/CMakeLists.txt22
-rw-r--r--tools/test/perform/CMakeTests.cmake305
-rw-r--r--tools/test/perform/chunk.c2
-rw-r--r--tools/test/perform/iopipe.c2
-rw-r--r--tools/test/perform/pio_engine.c36
-rw-r--r--tools/test/perform/pio_perf.h3
-rw-r--r--tools/test/perform/pio_standalone.c132
-rw-r--r--tools/test/perform/pio_standalone.h4
-rw-r--r--tools/test/perform/sio_engine.c28
-rw-r--r--tools/test/perform/sio_perf.h3
-rw-r--r--tools/test/perform/sio_standalone.h10
-rw-r--r--tools/testfiles/trefer_attr.h5bin0 -> 7528 bytes
-rw-r--r--tools/testfiles/trefer_attrR.ddl76
-rw-r--r--tools/testfiles/trefer_compat.h5bin0 -> 11368 bytes
-rw-r--r--tools/testfiles/trefer_compatR.ddl114
-rw-r--r--tools/testfiles/trefer_ext1.h5bin0 -> 3088 bytes
-rw-r--r--tools/testfiles/trefer_ext2.h5bin0 -> 6216 bytes
-rw-r--r--tools/testfiles/trefer_extR.ddl34
-rw-r--r--tools/testfiles/trefer_grp.h5bin0 -> 4130 bytes
-rw-r--r--tools/testfiles/trefer_grpR.ddl15
-rw-r--r--tools/testfiles/trefer_obj.h5bin0 -> 104832 bytes
-rw-r--r--tools/testfiles/trefer_objR.ddl59
-rw-r--r--tools/testfiles/trefer_obj_del.h5bin0 -> 2066 bytes
-rw-r--r--tools/testfiles/trefer_obj_delR.ddl11
-rw-r--r--tools/testfiles/trefer_param.h5bin0 -> 5264 bytes
-rw-r--r--tools/testfiles/trefer_paramR.ddl43
-rw-r--r--tools/testfiles/trefer_reg.h5bin0 -> 6316 bytes
-rw-r--r--tools/testfiles/trefer_regR.ddl66
-rw-r--r--tools/testfiles/trefer_reg_1d.h5bin0 -> 6280 bytes
-rw-r--r--tools/testfiles/trefer_reg_1dR.ddl66
113 files changed, 4469 insertions, 3113 deletions
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index f46eb23..2acfab0 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -39,6 +39,7 @@ if (NOT ONLY_SHARED_LIBS)
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5_TOOLS_DEBUG)
+ #target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG)
TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_TOOLS_LIB_TARGET}
PUBLIC ${HDF5_LIB_TARGET}
@@ -59,6 +60,7 @@ if (BUILD_SHARED_LIBS)
target_compile_definitions(${HDF5_TOOLS_LIBSH_TARGET}
PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
#PRIVATE H5_TOOLS_DEBUG
+ #PRIVATE H5DIFF_DEBUG
)
TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET}
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 58e3740..8c434ac 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;
@@ -274,15 +273,15 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
int cmp;
trav_table_t *table = NULL;
size_t idx;
- int ret_value = 0;
- h5difftrace("build_match_list start\n");
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* init */
- trav_table_init(&table);
+ trav_table_init(info1->fid, &table);
if (table == NULL) {
- H5TOOLS_INFO(H5E_tools_min_info_id_g, "Cannot create traverse table");
- HGOTO_DONE(-1);
+ H5TOOLS_INFO("Cannot create traverse table");
+ H5TOOLS_GOTO_DONE_NO_RET();
}
+
/*
* This is necessary for the case that given objects are group and
* have different names (ex: obj1 is /grp1 and obj2 is /grp5).
@@ -315,10 +314,20 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
trav_table_addflags(infile, path1_lp, info1->paths[curr1].type, table);
/* if the two point to the same target object,
* mark that in table */
- if (info1->paths[curr1].fileno == info2->paths[curr2].fileno &&
- info1->paths[curr1].objno == info2->paths[curr2].objno) {
- idx = table->nobjs - 1;
- table->objs[idx].is_same_trgobj = 1;
+ if(info1->paths[curr1].fileno == info2->paths[curr2].fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(info1->fid, &info1->paths[curr1].obj_token,
+ &info2->paths[curr2].obj_token, &token_cmp) < 0) {
+ H5TOOLS_INFO("Failed to compare object tokens");
+ opts->err_stat = H5DIFF_ERR;
+ H5TOOLS_GOTO_DONE_NO_RET();
+ }
+
+ if(!token_cmp) {
+ idx = table->nobjs - 1;
+ table->objs[idx].is_same_trgobj = 1;
+ }
}
}
curr1++;
@@ -372,7 +381,8 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
done:
*table_out = table;
- h5difftrace("build_match_list finish\n");
+
+ H5TOOLS_ENDDEBUG("");
}
@@ -382,7 +392,7 @@ done:
* Purpose: Call back function from h5trav_visit().
*------------------------------------------------------------------------*/
static herr_t
-trav_grp_objs(const char *path, const H5O_info_t *oinfo,
+trav_grp_objs(const char *path, const H5O_info2_t *oinfo,
const char *already_visited, void *udata)
{
trav_info_visit_obj(path, oinfo, already_visited, udata);
@@ -397,82 +407,83 @@ trav_grp_objs(const char *path, const H5O_info_t *oinfo,
* Track and extra checkings while visiting all symbolic-links.
*------------------------------------------------------------------------*/
static herr_t
-trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata)
+trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata)
{
- herr_t ret_value = 0;
trav_info_t *tinfo = (trav_info_t *)udata;
diff_opt_t *opts = (diff_opt_t *)tinfo->opts;
h5tool_link_info_t lnk_info;
const char *ext_fname;
const char *ext_path;
+ herr_t ret_value = SUCCEED;
+ H5TOOLS_START_DEBUG("");
/* init linkinfo struct */
HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t));
if (!opts->follow_links) {
trav_info_visit_lnk(path, linfo, tinfo);
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(SUCCEED);
}
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(SUCCEED);
}
/* 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(SUCCEED);
/* 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(SUCCEED);
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(SUCCEED);
}
if(H5Lunpack_elink_val(lnk_info.trg_path, linfo->u.val_size, NULL, &ext_fname, &ext_path) < 0)
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(SUCCEED);
/* 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(SUCCEED);
/* 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(SUCCEED);
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;
@@ -481,14 +492,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("");
return ret_value;
}
@@ -503,15 +515,10 @@ done:
*-------------------------------------------------------------------------
*/
hsize_t
-h5diff(const char *fname1,
- const char *fname2,
- const char *objname1,
- const char *objname2,
- diff_opt_t *opts)
+h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts)
{
- int ret_value = 0;
- hid_t file1_id = -1;
- hid_t file2_id = -1;
+ hid_t file1_id = H5I_INVALID_HID;
+ hid_t file2_id = H5I_INVALID_HID;
char filenames[2][MAX_FILENAME];
hsize_t nfound = 0;
int l_ret1 = -1;
@@ -523,7 +530,7 @@ h5diff(const char *fname1,
h5trav_type_t obj1type = H5TRAV_TYPE_GROUP;
h5trav_type_t obj2type = H5TRAV_TYPE_GROUP;
/* for single object */
- H5O_info_t oinfo1, oinfo2; /* object info */
+ H5O_info2_t oinfo1, oinfo2; /* object info */
trav_info_t *info1_obj = NULL;
trav_info_t *info2_obj = NULL;
/* for group object */
@@ -533,15 +540,16 @@ h5diff(const char *fname1,
trav_info_t *info1_lp = NULL;
trav_info_t *info2_lp = NULL;
/* link info from specified object */
- H5L_info_t src_linfo1;
- H5L_info_t src_linfo2;
+ H5L_info2_t src_linfo1;
+ H5L_info2_t src_linfo2;
/* link info from member object */
h5tool_link_info_t trg_linfo1;
h5tool_link_info_t trg_linfo2;
/* list for common objects */
trav_table_t *match_list = NULL;
+ diff_err_t ret_value = H5DIFF_NO_ERR;
- h5difftrace("h5diff start\n");
+ H5TOOLS_START_DEBUG("");
/* init filenames */
HDmemset(filenames, 0, MAX_FILENAME * 2);
/* init link info struct */
@@ -552,10 +560,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
@@ -564,15 +572,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(H5DIFF_ERR, "<%s>: unable to open file\n", fname1);
} /* end if */
-
+ 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(H5DIFF_ERR, "<%s>: unable to open file\n", fname2);
} /* end if */
+ H5TOOLS_DEBUG("file2_id = %s", fname2);
/*-------------------------------------------------------------------------
* Initialize the info structs
@@ -581,7 +590,7 @@ h5diff(const char *fname1,
trav_info_init(fname1, file1_id, &info1_obj);
trav_info_init(fname2, file2_id, &info2_obj);
- h5difftrace("trav_info_init initialized\n");
+ H5TOOLS_DEBUG("trav_info_init initialized");
/* if any object is specified */
if (objname1) {
/* make the given object1 fullpath, start with "/" */
@@ -589,11 +598,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(H5DIFF_ERR, "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(H5DIFF_ERR, "name buffer allocation failed");
HDstrcpy(obj1fullname, "/");
HDstrcat(obj1fullname, objname1);
@@ -607,11 +616,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(H5DIFF_ERR, "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(H5DIFF_ERR, "name buffer allocation failed");
HDstrcpy(obj2fullname, "/");
HDstrcat(obj2fullname, objname2);
#endif /* H5_HAVE_ASPRINTF */
@@ -622,7 +631,7 @@ h5diff(const char *fname1,
/*----------------------------------------------------------
* check if obj1 is root, group, single object or symlink
*/
- h5difftrace("h5diff check if obj1 is root, group, single object or symlink\n");
+ H5TOOLS_DEBUG("h5diff check if obj1=%s is root, group, single object or symlink", obj1fullname);
if(!HDstrcmp(obj1fullname, "/")) {
obj1type = H5TRAV_TYPE_GROUP;
}
@@ -630,12 +639,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(H5DIFF_ERR, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(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(H5DIFF_ERR, "H5Lget_info failed");
}
info1_lp = info1_obj;
@@ -649,14 +658,14 @@ h5diff(const char *fname1,
/* optional data pass */
info1_obj->opts = (diff_opt_t*)opts;
- if(H5Oget_info_by_name2(file1_id, obj1fullname, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(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(H5DIFF_ERR, "Error: Could not get file contents");
}
obj1type = (h5trav_type_t)oinfo1.type;
trav_info_add(info1_obj, obj1fullname, obj1type);
idx = info1_obj->nused - 1;
- info1_obj->paths[idx].objno = oinfo1.addr;
+ HDmemcpy(&info1_obj->paths[idx].obj_token, &oinfo1.token, sizeof(H5O_token_t));
info1_obj->paths[idx].fileno = oinfo1.fileno;
}
else if (src_linfo1.type == H5L_TYPE_SOFT) {
@@ -672,7 +681,7 @@ h5diff(const char *fname1,
/*----------------------------------------------------------
* check if obj2 is root, group, single object or symlink
*/
- h5difftrace("h5diff check if obj2 is root, group, single object or symlink\n");
+ H5TOOLS_DEBUG("h5diff check if obj2=%s is root, group, single object or symlink", obj2fullname);
if(!HDstrcmp(obj2fullname, "/")) {
obj2type = H5TRAV_TYPE_GROUP;
}
@@ -680,12 +689,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(H5DIFF_ERR, "Error: Object could not be found");
}
/* get info from link */
- if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(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(H5DIFF_ERR, "H5Lget_info failed");
}
info2_lp = info2_obj;
@@ -699,14 +708,14 @@ h5diff(const char *fname1,
/* optional data pass */
info2_obj->opts = (diff_opt_t*)opts;
- if(H5Oget_info_by_name2(file2_id, obj2fullname, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(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(H5DIFF_ERR, "Error: Could not get file contents");
}
obj2type = (h5trav_type_t)oinfo2.type;
trav_info_add(info2_obj, obj2fullname, obj2type);
idx = info2_obj->nused - 1;
- info2_obj->paths[idx].objno = oinfo2.addr;
+ HDmemcpy(&info2_obj->paths[idx].obj_token, &oinfo2.token, sizeof(H5O_token_t));
info2_obj->paths[idx].fileno = oinfo2.fileno;
}
else if (src_linfo2.type == H5L_TYPE_SOFT) {
@@ -721,7 +730,7 @@ h5diff(const char *fname1,
}
/* if no object specified */
else {
- h5difftrace("h5diff no object specified\n");
+ H5TOOLS_DEBUG("h5diff no object specified");
/* set root group */
obj1fullname = (char*)HDstrdup("/");
obj1type = H5TRAV_TYPE_GROUP;
@@ -729,7 +738,7 @@ h5diff(const char *fname1,
obj2type = H5TRAV_TYPE_GROUP;
}
- h5diffdebug2("get any symbolic links info - errstat:%d\n", 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);
@@ -745,15 +754,15 @@ h5diff(const char *fname1,
/*-------------------------------
* check symbolic link (object1)
*/
- h5difftrace("h5diff check symbolic link (object1)\n");
+ H5TOOLS_DEBUG("h5diff check symbolic link (object1)");
/* dangling link */
if (l_ret1 == 0) {
- h5difftrace("h5diff ... dangling link\n");
+ 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(H5DIFF_ERR, "treat dangling link as error");
}
else {
if(opts->m_verbose)
@@ -761,40 +770,40 @@ h5diff(const char *fname1,
if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR);
}
}
}
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(H5DIFF_ERR, "Object could not be found");
}
else if(l_ret1 != 2) { /* symbolic link */
obj1type = (h5trav_type_t)trg_linfo1.trg_type;
- h5difftrace("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD\n");
+ H5TOOLS_DEBUG("h5diff ... ... trg_linfo1.trg_type == H5L_TYPE_HARD");
if (info1_lp != NULL) {
size_t idx = info1_lp->nused - 1;
- h5difftrace("h5diff ... ... ... info1_obj not null\n");
+ H5TOOLS_DEBUG("h5diff ... ... ... info1_obj not null");
+ HDmemcpy(&info1_lp->paths[idx].obj_token, &trg_linfo1.obj_token, sizeof(H5O_token_t));
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;
}
- h5difftrace("h5diff check symbolic link (object1) finished\n");
+ H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished");
}
/*-------------------------------
* check symbolic link (object2)
*/
- h5difftrace("h5diff check symbolic link (object2)\n");
+ H5TOOLS_DEBUG("h5diff check symbolic link (object2)");
/* dangling link */
if (l_ret2 == 0) {
- h5difftrace("h5diff ... dangling link\n");
+ 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(H5DIFF_ERR, "treat dangling link as error");
}
else {
if(opts->m_verbose)
@@ -802,25 +811,25 @@ h5diff(const char *fname1,
if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
print_found(nfound);
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR);
}
}
}
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(H5DIFF_ERR, "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;
- h5difftrace("h5diff ... ... ... info2_obj not null\n");
+ H5TOOLS_DEBUG("h5diff ... ... ... info2_obj not null");
+ HDmemcpy(&info2_lp->paths[idx].obj_token, &trg_linfo2.obj_token, sizeof(H5O_token_t));
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;
}
- h5difftrace("h5diff check symbolic link (object1) finished\n");
+ H5TOOLS_DEBUG("h5diff check symbolic link (object1) finished");
}
} /* end of if follow symlinks */
@@ -832,16 +841,16 @@ h5diff(const char *fname1,
*/
if(!(opts->m_verbose || opts->m_report)) {
- h5difftrace("h5diff NOT (opts->m_verbose || opts->m_report)\n");
+ 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(H5DIFF_NO_ERR);
}
both_objs_grp = (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP);
if (both_objs_grp) {
- h5difftrace("h5diff both_objs_grp TRUE\n");
+ H5TOOLS_DEBUG("h5diff both_objs_grp TRUE");
/*
* traverse group1
*/
@@ -852,7 +861,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(H5DIFF_ERR, "Could not get file contents");
}
info1_lp = info1_grp;
@@ -866,11 +875,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(H5DIFF_ERR, "Could not get file contents");
} /* end if */
info2_lp = info2_grp;
}
- h5diffdebug2("groups traversed - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG("groups traversed - errstat:%d", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
if(g_Parallel) {
@@ -890,8 +899,10 @@ h5diff(const char *fname1,
} /* end if */
#endif
+ 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("build_match_list finished - errstat:%d", opts->err_stat);
if (both_objs_grp) {
/*------------------------------------------------------
* print the list
@@ -915,6 +926,7 @@ h5diff(const char *fname1,
parallel_print ("\n");
} /* end if */
}
+ 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);
@@ -957,7 +969,7 @@ done:
H5Fclose(file2_id);
} H5E_END_TRY;
- h5difftrace("h5diff finish\n");
+ H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
return nfound;
}
@@ -987,7 +999,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
{
hsize_t nfound = 0;
unsigned i;
- int ret_value = opts->err_stat;
const char *grp1_path = "";
const char *grp2_path = "";
char *obj1_fullpath = NULL;
@@ -995,8 +1006,9 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
diff_args_t argdata;
size_t idx1 = 0;
size_t idx2 = 0;
+ diff_err_t ret_value = opts->err_stat;
- h5difftrace("diff_match start\n");
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/*
* if not root, prepare object name to be pre-appended to group path to
* make full path
@@ -1049,41 +1061,41 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
#endif
for(i = 0; i < table->nobjs; i++) {
- h5diffdebug3("diff for common objects[%d] - errstat:%d\n", 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(H5DIFF_ERR, "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(H5DIFF_ERR, "name buffer allocation failed");
}
else {
HDstrcpy(obj1_fullpath, grp1_path);
HDstrcat(obj1_fullpath, table->objs[i].name);
}
#endif /* H5_HAVE_ASPRINTF */
- h5diffdebug2("diff_match path1 - %s\n", 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(H5DIFF_ERR, "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(H5DIFF_ERR, "name buffer allocation failed");
}
else {
HDstrcpy(obj2_fullpath, grp2_path);
HDstrcat(obj2_fullpath, table->objs[i].name);
}
#endif /* H5_HAVE_ASPRINTF */
- h5diffdebug2("diff_match path2 - %s\n", 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))
@@ -1099,6 +1111,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
opts->cmn_objs = 1;
if(!g_Parallel) {
+ H5TOOLS_DEBUG("diff paths - errstat:%d", opts->err_stat);
nfound += diff(file1_id, obj1_fullpath,
file2_id, obj2_fullpath,
opts, &argdata);
@@ -1107,7 +1120,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
else {
int workerFound = 0;
- h5difftrace("Beginning of big else block\n");
+ 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
@@ -1261,7 +1274,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
HDfree(obj2_fullpath);
} /* end if */
} /* end for */
- h5diffdebug2("done with for loop - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG("done with for loop - errstat:%d", opts->err_stat);
#ifdef H5_HAVE_PARALLEL
if(g_Parallel) {
@@ -1338,7 +1351,7 @@ 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 */
- h5difftrace("done with if block\n");
+ H5TOOLS_DEBUG("done with if block");
HDfree(workerTasks);
}
@@ -1346,10 +1359,11 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
opts->err_stat = opts->err_stat | ret_value;
-/* free table */
+ /* free table */
if (table)
trav_table_free(table);
- h5diffdebug2("diff_match finish:%d\n", nfound);
+
+ H5TOOLS_ENDDEBUG(" diffs=%d - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -1369,32 +1383,27 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
*-------------------------------------------------------------------------
*/
hsize_t
-diff(hid_t file1_id,
- const char *path1,
- hid_t file2_id,
- const char *path2,
- diff_opt_t * opts,
- diff_args_t *argdata)
+diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t * opts, diff_args_t *argdata)
{
- int ret_value = opts->err_stat;
int status = -1;
- hid_t dset1_id = -1;
- hid_t dset2_id = -1;
- hid_t type1_id = -1;
- hid_t type2_id = -1;
- hid_t grp1_id = -1;
- hid_t grp2_id = -1;
+ hid_t dset1_id = H5I_INVALID_HID;
+ hid_t dset2_id = H5I_INVALID_HID;
+ hid_t type1_id = H5I_INVALID_HID;
+ hid_t type2_id = H5I_INVALID_HID;
+ hid_t grp1_id = H5I_INVALID_HID;
+ hid_t grp2_id = H5I_INVALID_HID;
hbool_t is_dangle_link1 = FALSE;
hbool_t is_dangle_link2 = FALSE;
hbool_t is_hard_link = FALSE;
hsize_t nfound = 0;
h5trav_type_t object_type;
+ diff_err_t ret_value = opts->err_stat;
/* to get link info */
h5tool_link_info_t linkinfo1;
h5tool_link_info_t linkinfo2;
- h5difftrace("diff start\n");
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/*init link info struct */
HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t));
@@ -1414,9 +1423,10 @@ diff(hid_t file1_id,
* check dangling links for path1 and path2
*/
+ 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(H5DIFF_ERR, "H5tools_get_symlink_info failed");
/* dangling link */
if (status == 0) {
@@ -1424,7 +1434,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(H5DIFF_ERR, "dangling link is error");
}
else
is_dangle_link1 = TRUE;
@@ -1432,14 +1442,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(H5DIFF_ERR, "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(H5DIFF_ERR, "dangling link is error");
}
else
is_dangle_link2 = TRUE;
@@ -1447,7 +1457,7 @@ diff(hid_t file1_id,
/* found dangling link */
if (is_dangle_link1 || is_dangle_link2) {
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR);
}
/* follow symbolic link option */
@@ -1462,6 +1472,7 @@ diff(hid_t file1_id,
}
/* if objects are not the same type */
if (argdata->type[0] != argdata->type[1]) {
+ 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]),
@@ -1471,7 +1482,7 @@ diff(hid_t file1_id,
/* TODO: will need to update non-comparable is different
* opts->contents = 0;
*/
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR);
}
else /* now both object types are same */
object_type = argdata->type[0];
@@ -1485,7 +1496,7 @@ diff(hid_t file1_id,
* Perform this to match the outputs as bypassing.
*/
if (argdata->is_same_trgobj) {
- h5difftrace("argdata->is_same_trgobj\n");
+ 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);
@@ -1523,7 +1534,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(H5DIFF_NO_ERR);
}
}
@@ -1533,13 +1544,15 @@ diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_DATASET:
+ 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(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Dopen2 failed");
/* verbose (-v) and report (-r) mode */
if(opts->m_verbose || opts->m_report) {
do_print_objname("dataset", path1, path2, opts);
+ H5TOOLS_DEBUG("call diff_dataset 1:%s 2:%s ", path1, path2);
nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
print_found(nfound);
}
@@ -1556,7 +1569,7 @@ diff(hid_t file1_id,
print_found(nfound);
}
}
- h5diffdebug2("diff after dataset:%d\n", nfound);
+ H5TOOLS_DEBUG("diff after dataset:%d - errstat:%d", nfound, opts->err_stat);
/*---------------------------------------------------------
* compare attributes
@@ -1564,14 +1577,15 @@ diff(hid_t file1_id,
* referenced object
*---------------------------------------------------------
*/
- if(path1)
+ if(path1) {
+ 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(H5DIFF_ERR, "H5Dclose failed");
if(H5Dclose(dset2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dclose failed");
break;
/*----------------------------------------------------------------------
@@ -1579,13 +1593,14 @@ diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_NAMED_DATATYPE:
+ 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(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Topen2 failed");
if((status = H5Tequal(type1_id, type2_id)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tequal failed");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tequal failed");
/* if H5Tequal is > 0 then the datatypes refer to the same datatype */
nfound = (status > 0) ? 0 : 1;
@@ -1603,13 +1618,15 @@ diff(hid_t file1_id,
* referenced object
*-----------------------------------------------------------------
*/
- if(path1)
+ if(path1) {
+ 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(H5DIFF_ERR, "H5Tclose failed");
if(H5Tclose(type2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose failed");
break;
/*----------------------------------------------------------------------
@@ -1617,6 +1634,7 @@ diff(hid_t file1_id,
*----------------------------------------------------------------------
*/
case H5TRAV_TYPE_GROUP:
+ H5TOOLS_DEBUG("H5TRAV_TYPE_GROUP 1:%s 2:%s ", path1, path2);
if(print_objname(opts, nfound))
do_print_objname("group", path1, path2, opts);
@@ -1625,9 +1643,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(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Gclose failed");
/*-----------------------------------------------------------------
* compare attributes
@@ -1635,13 +1653,15 @@ diff(hid_t file1_id,
* referenced object
*-----------------------------------------------------------------
*/
- if(path1)
+ if(path1) {
+ 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(H5DIFF_ERR, "H5Gclose failed");
if(H5Gclose(grp2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Gclose failed");
break;
@@ -1651,6 +1671,7 @@ diff(hid_t file1_id,
*/
case H5TRAV_TYPE_LINK:
{
+ 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" */
@@ -1662,7 +1683,6 @@ diff(hid_t file1_id,
/* always print the number of differences found in verbose mode */
if(opts->m_verbose)
print_found(nfound);
-
}
break;
@@ -1672,6 +1692,7 @@ diff(hid_t file1_id,
*/
case H5TRAV_TYPE_UDLINK:
{
+ 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 */
@@ -1772,7 +1793,7 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(": %d - errstat:%d", nfound, opts->err_stat);
return nfound;
}
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 26bcd95..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 (1, error, 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;
@@ -165,6 +172,13 @@ int diff_can_type( hid_t f_type1, /* file data type */
diff_opt_t *opts,
int is_compound);
+hsize_t diff_attr_data(hid_t attr1_id,
+ hid_t attr2_id,
+ const char *attr1_name,
+ const char *attr2_name,
+ const char *path1,
+ const char *path2,
+ diff_opt_t *opts);
hsize_t diff_attr(hid_t loc1_id,
hid_t loc2_id,
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index c83b88d..088e230 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -17,6 +17,8 @@
#include "h5diff.h"
#include "ph5diff.h"
+#define ATTR_NAME_MAX 255
+
/*-------------------------------------------------------------------------
* printf formatting
*-------------------------------------------------------------------------
@@ -259,19 +261,9 @@ static void close_member_types(mcomp_t *members);
*-------------------------------------------------------------------------
*/
-hsize_t diff_array(
- void *_mem1,
- void *_mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- diff_opt_t *opts,
- const char *name1,
- const char *name2,
- hid_t m_type,
- hid_t container1_id,
- hid_t container2_id) /* dataset where the reference came from*/
+hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start,
+ int rank, hsize_t *dims, diff_opt_t *opts, const char *name1, const char *name2,
+ hid_t m_type, hid_t container1_id, hid_t container2_id)
{
hsize_t nfound = 0; /* number of differences found */
size_t size; /* size of datum */
@@ -285,7 +277,7 @@ hsize_t diff_array(
mcomp_t members;
H5T_class_t type_class;
- h5diffdebug2("diff_array start - errstat:%d\n", opts->err_stat);
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* get the size. */
size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -310,6 +302,7 @@ hsize_t diff_array(
pos[j] = 0;
}
+ H5TOOLS_DEBUG("diff_array type_class:%d", type_class);
switch (type_class) {
case H5T_NO_CLASS:
case H5T_TIME:
@@ -370,6 +363,7 @@ hsize_t diff_array(
case H5T_REFERENCE:
HDmemset(&members, 0, sizeof(mcomp_t));
get_member_types(m_type, &members);
+ 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);
@@ -378,8 +372,9 @@ hsize_t diff_array(
} /* i */
close_member_types(&members);
} /* switch */
- h5diffdebug3("diff_array finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_DEBUG("diff_array finish:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(": %d", nfound);
return nfound;
}
@@ -416,20 +411,9 @@ hsize_t diff_array(
* Dereference the object and compare the type (basic object type).
*-------------------------------------------------------------------------
*/
-static hsize_t diff_datum(
- void *_mem1,
- void *_mem2,
- hid_t m_type,
- hsize_t index,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *opts,
- const char *obj1,
- const char *obj2,
- hid_t container1_id,
- hid_t container2_id, /*where the reference came from*/
+static hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t index, int rank,
+ hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2,
+ hid_t container1_id, hid_t container2_id,
int *ph, /*print header */
mcomp_t *members) /*compound members */
{
@@ -447,11 +431,11 @@ static hsize_t diff_datum(
hbool_t iszero1;
hbool_t iszero2;
hsize_t nfound = 0; /* differences found */
- hsize_t ret_value = opts->err_stat;
double per;
hbool_t both_zero;
+ diff_err_t ret_value = opts->err_stat;
- h5difftrace("diff_datum start\n");
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@@ -465,14 +449,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(H5DIFF_ERR, "Invalid type class");
break;
/*-------------------------------------------------------------------------
@@ -480,9 +464,9 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_COMPOUND:
- h5difftrace("diff_datum H5T_COMPOUND\n");
+ H5TOOLS_DEBUG("diff_datum H5T_COMPOUND");
{
- hid_t memb_type = -1;
+ hid_t memb_type = H5I_INVALID_HID;
nmembs = members->n;
for (j = 0; j < nmembs; j++) {
@@ -500,7 +484,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_STRING:
- h5difftrace("diff_datum H5T_STRING\n");
+ H5TOOLS_DEBUG("diff_datum H5T_STRING");
{
char *s = NULL;
char *sx = NULL;
@@ -514,7 +498,7 @@ static hsize_t diff_datum(
/* if variable length string */
if (H5Tis_variable_str(m_type)) {
- h5difftrace("diff_datum H5T_STRING variable\n");
+ H5TOOLS_DEBUG("diff_datum H5T_STRING variable");
/* Get pointer to first string */
s1 = *(char **)((void *)mem1);
if (s1)
@@ -530,7 +514,7 @@ static hsize_t diff_datum(
size2 = 0;
}
else if (H5T_STR_NULLTERM == pad) {
- h5difftrace("diff_datum H5T_STRING null term\n");
+ H5TOOLS_DEBUG("diff_datum H5T_STRING null term");
/* Get pointer to first string */
s1 = (char*) mem1;
if (s1)
@@ -567,10 +551,10 @@ static hsize_t diff_datum(
* of length of strings.
* For now mimic the previous way.
*/
- h5diffdebug2("diff_datum string size:%d\n", size1);
- h5diffdebug2("diff_datum string size:%d\n", size2);
+ H5TOOLS_DEBUG("diff_datum string size:%d", size1);
+ H5TOOLS_DEBUG("diff_datum string size:%d", size2);
if (size1 != size2) {
- h5difftrace("diff_datum string sizes\n");
+ H5TOOLS_DEBUG("diff_datum string sizes difference");
nfound++;
}
if (size1 < size2) {
@@ -607,7 +591,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_BITFIELD:
- h5difftrace("diff_datum H5T_BITFIELD\n");
+ 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);
@@ -618,7 +602,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_OPAQUE:
- h5difftrace("diff_datum H5T_OPAQUE\n");
+ 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);
@@ -634,7 +618,7 @@ static hsize_t diff_datum(
* compared, we convert both bit patterns to their corresponding
* enumeration constant and do a string comparison
*/
- h5difftrace("diff_datum H5T_ENUM\n");
+ H5TOOLS_DEBUG("diff_datum H5T_ENUM");
{
char enum_name1[1024];
char enum_name2[1024];
@@ -693,10 +677,11 @@ static hsize_t diff_datum(
*/
case H5T_ARRAY:
{
- hid_t memb_type = -1;
+ hid_t memb_type = H5I_INVALID_HID;
hsize_t adims[H5S_MAX_RANK];
int ndims;
+ 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);
@@ -720,45 +705,324 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case 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 = H5I_INVALID_HID;
+ hid_t obj2_id = H5I_INVALID_HID;
+
/*-------------------------------------------------------------------------
- * H5T_STD_REF_DSETREG
- * Dataset region reference
+ * H5T_STD_REF
+ * Reference
*-------------------------------------------------------------------------
*/
- hid_t obj1_id = -1;
- hid_t obj2_id = -1;
-
if (H5Tequal(m_type, H5T_STD_REF)) {
/* if (type_size == H5R_STD_REF_SIZE) */
- H5TOOLS_INFO(H5E_tools_min_info_id_g, "NEW reference type");
+ hid_t region1_id = H5I_INVALID_HID;
+ hid_t region2_id = H5I_INVALID_HID;
+ H5R_ref_t *ref1_buf = (H5R_ref_t *)_mem1;
+ H5R_ref_t *ref2_buf = (H5R_ref_t *)_mem2;
+ H5O_type_t obj1_type = -1; /* Object type */
+ H5O_type_t obj2_type = -1; /* Object type */
+ H5R_type_t ref_type; /* Reference type */
+
+ H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF");
+ ref_type = H5Rget_type(ref1_buf);
+ switch (ref_type) {
+ case H5R_OBJECT1:
+ H5TOOLS_DEBUG("ref_type is H5R_OBJECT1");
+ if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) {
+ 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 = 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;
+ H5TOOLS_GOTO_DONE(opts->err_stat);
+ }
+
+ if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ 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 = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Ropen_object object 2 failed");
+ }
+
+ switch (obj1_type) {
+ case H5O_TYPE_DATASET:
+ nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
+ break;
+
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_NAMED_DATATYPE:
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ if (opts->m_verbose)
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
+ opts->not_cmp = 1;
+ break;
+ } /* end switch */
+ if(obj1_id >= 0)
+ 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) {
+ opts->err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed");
+ }
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed");
+ break;
+ case 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(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed");
+ }
+ if(H5Sclose(region1_id) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed");
+ }
+ if(H5Oclose(obj2_id) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed");
+ }
+ else {
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ }
+ if(H5Oclose(obj1_id) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed");
+ }
+ else {
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ }
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed");
+ break;
+ case H5R_OBJECT2:
+ H5TOOLS_DEBUG("ref_type is H5R_OBJECT2");
+ if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) {
+ 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 = 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;
+ H5TOOLS_GOTO_DONE(opts->err_stat);
+ }
+
+ if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ 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 = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Ropen_object object 2 failed");
+ }
+
+ switch (obj1_type) {
+ case H5O_TYPE_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("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("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;
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ if (opts->m_verbose)
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
+ opts->not_cmp = 1;
+ break;
+ } /* end switch */
+ if(obj1_id >= 0)
+ 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) {
+ opts->err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
+ }
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed");
+ break;
+ case 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) || (obj2_id < 0)) {
+ H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed");
+ }
+ else {
+ 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("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("NULL H5R_DATASET_REGION2");
+ }
+ else {
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
+ }
+ if(H5Sclose(region2_id) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed");
+ }
+ else
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed");
+ } /* end else to if (h5tools_is_zero(... */
+ if(H5Sclose(region1_id) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed");
+ }
+ else
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed");
+ if (obj1_id >= 0)
+ 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) {
+ opts->err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed");
+ }
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed");
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed");
+ }
+ break;
+ case H5R_ATTR:
+ {
+ char name1[ATTR_NAME_MAX];
+ char name2[ATTR_NAME_MAX];
+
+ 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("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("H5Ropen_attr object 2 failed");
+ }
+
+ if((obj1_id < 0) || (obj2_id < 0)) {
+ H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed");
+ }
+ else {
+ /* get name */
+ if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name first attribute failed");
+ /* get name */
+ if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name second attribute failed");
+
+ 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) {
+ opts->err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
+ }
+ if(obj2_id >= 0)
+ if(H5Aclose(obj2_id) < 0) {
+ opts->err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
+ }
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed");
+ }
+ break;
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ break;
+ } /* end switch */
+ H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, opts->err_stat);
}
+ /*-------------------------------------------------------------------------
+ * H5T_STD_REF_DSETREG
+ * Dataset region reference
+ *-------------------------------------------------------------------------
+ */
else if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) {
/* if (type_size == H5R_DSET_REG_REF_BUF_SIZE) */
- hid_t region1_id = -1;
- hid_t region2_id = -1;
+ hid_t region1_id = H5I_INVALID_HID;
+ hid_t region2_id = H5I_INVALID_HID;
+
+ 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);
@@ -779,29 +1043,31 @@ static hsize_t diff_datum(
H5O_type_t obj1_type;
H5O_type_t obj2_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 */
@@ -809,9 +1075,7 @@ static hsize_t diff_datum(
nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
else {
if (opts->m_verbose)
- parallel_print(
- "Warning: Comparison not possible of object types referenced: <%s> and <%s>\n",
- obj1, obj2);
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
opts->not_cmp = 1;
}
@@ -819,6 +1083,7 @@ static hsize_t diff_datum(
H5Oclose(obj2_id);
}/*object reference*/
}/*is zero*/
+ H5TOOLS_DEBUG("diff_datum H5T_REFERENCE complete");
break;
/*-------------------------------------------------------------------------
@@ -827,8 +1092,9 @@ static hsize_t diff_datum(
*/
case H5T_VLEN:
{
- hid_t memb_type = -1;
+ hid_t memb_type = H5I_INVALID_HID;
+ 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);
@@ -849,6 +1115,7 @@ static hsize_t diff_datum(
*-------------------------------------------------------------------------
*/
case H5T_INTEGER:
+ H5TOOLS_DEBUG("diff_datum H5T_INTEGER");
type_sign = H5Tget_sign(m_type);
/*-------------------------------------------------------------------------
* H5T_NATIVE_SCHAR
@@ -859,7 +1126,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(H5DIFF_ERR, "Type size is not char size");
HDmemcpy(&temp1_char, mem1, sizeof(char));
HDmemcpy(&temp2_char, mem2, sizeof(char));
/* -d and !-p */
@@ -934,7 +1201,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(H5DIFF_ERR, "Type size is not unsigned char size");
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
@@ -1010,7 +1277,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(H5DIFF_ERR, "Type size is not short size");
HDmemcpy(&temp1_short, mem1, sizeof(short));
HDmemcpy(&temp2_short, mem2, sizeof(short));
@@ -1086,7 +1353,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(H5DIFF_ERR, "Type size is not unsigned short size");
HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
@@ -1162,7 +1429,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(H5DIFF_ERR, "Type size is not int size");
HDmemcpy(&temp1_int, mem1, sizeof(int));
HDmemcpy(&temp2_int, mem2, sizeof(int));
@@ -1238,7 +1505,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(H5DIFF_ERR, "Type size is not unsigned int size");
HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
@@ -1314,7 +1581,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(H5DIFF_ERR, "Type size is not long size");
HDmemcpy(&temp1_long, mem1, sizeof(long));
HDmemcpy(&temp2_long, mem2, sizeof(long));
@@ -1390,7 +1657,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(H5DIFF_ERR, "Type size is not unsigned long size");
HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
@@ -1467,6 +1734,7 @@ static hsize_t diff_datum(
* H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
*/
+ H5TOOLS_DEBUG("diff_datum H5T_FLOAT");
if (type_size == 4) {
float temp1_float;
float temp2_float;
@@ -1474,7 +1742,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(H5DIFF_ERR, "Type size is not float size");
HDmemcpy(&temp1_float, mem1, sizeof(float));
HDmemcpy(&temp2_float, mem2, sizeof(float));
@@ -1633,7 +1901,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(H5DIFF_ERR, "Type size is not double size");
HDmemcpy(&temp1_double, mem1, sizeof(double));
HDmemcpy(&temp2_double, mem2, sizeof(double));
@@ -1792,7 +2060,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(H5DIFF_ERR, "Type size is not long double size");
}
HDmemcpy(&temp1_double, mem1, sizeof(long double));
@@ -1947,8 +2215,9 @@ static hsize_t diff_datum(
done:
opts->err_stat = opts->err_stat | ret_value;
- h5diffdebug3("diff_datum finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_DEBUG("diff_datum finish:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG("");
return nfound;
}
@@ -2025,7 +2294,6 @@ void print_points(int i, hsize_t *ptdata, int ndims) {
static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts)
{
- hsize_t ret_value = 0;
hssize_t nblocks1, npoints1;
hssize_t nblocks2, npoints2;
hsize_t alloc_size;
@@ -2036,6 +2304,9 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
int i, j;
hsize_t nfound_b = 0; /* block differences found */
hsize_t nfound_p = 0; /* point differences found */
+ hsize_t ret_value = 0;
+
+ H5TOOLS_START_DEBUG("");
ndims1 = H5Sget_simple_extent_ndims(region1_id);
ndims2 = H5Sget_simple_extent_ndims(region2_id);
@@ -2052,10 +2323,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("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);
}
/*-------------------------------------------------------------------------
@@ -2063,21 +2336,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("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_INFO("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_INFO("Buffer allocation failed");
}
else {
H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t);
@@ -2099,14 +2373,22 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
/* print differences if found */
if (nfound_b && opts->m_verbose) {
- H5O_info_t oi1, oi2;
+ H5O_info2_t oi1, oi2;
+ char *obj1_str = NULL, *obj2_str = NULL;
+
+ H5Oget_info3(obj1_id, &oi1, H5O_INFO_BASIC);
+ H5Oget_info3(obj2_id, &oi2, H5O_INFO_BASIC);
- H5Oget_info2(obj1_id, &oi1, H5O_INFO_BASIC);
- H5Oget_info2(obj2_id, &oi2, H5O_INFO_BASIC);
+ /* Convert object tokens into printable output */
+ H5Otoken_to_str(obj1_id, &oi1.token, &obj1_str);
+ H5Otoken_to_str(obj2_id, &oi2.token, &obj2_str);
- parallel_print("Referenced dataset %lu %lu\n", (unsigned long) oi1.addr, (unsigned long) oi2.addr);
+ parallel_print("Referenced dataset %s %s\n", obj1_str, obj2_str);
parallel_print( "------------------------------------------------------------\n");
+ H5free_memory(obj1_str);
+ H5free_memory(obj2_str);
+
parallel_print("Region blocks\n");
for (i = 0; i < nblocks1; i++) {
parallel_print("block #%d", i);
@@ -2127,20 +2409,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("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_INFO("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_INFO("Buffer allocation failed");
}
else {
H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t);
@@ -2191,6 +2474,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
parallel_print(")");
}
+ parallel_print("\n");
#endif
HDfree(ptdata1);
@@ -2203,6 +2487,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(" with diffs:%d", ret_value);
return ret_value;
}
@@ -2224,7 +2509,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- h5diffdebug3("character_compare start %d=%d\n",temp1_uchar,temp2_uchar);
+ H5TOOLS_START_DEBUG(" %d=%d",temp1_uchar,temp2_uchar);
if (temp1_uchar != temp2_uchar) {
if (print_data(opts)) {
@@ -2237,8 +2522,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
}
nfound++;
}
- h5difftrace("character_compare finish\n");
-
+ H5TOOLS_ENDDEBUG(": %d", nfound);
return nfound;
}
@@ -2263,7 +2547,6 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- h5difftrace("character_compare_opt start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
@@ -2307,7 +2590,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
- } h5difftrace("character_compare_opt finish\n");
+ }
return nfound;
}
@@ -2335,8 +2618,6 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- h5difftrace("diff_float start\n");
-
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -2520,7 +2801,6 @@ static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_float finish\n");
return nfound;
}
@@ -2548,7 +2828,6 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- h5difftrace("diff_double start\n");
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -2731,7 +3010,6 @@ static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_double finish\n");
return nfound;
}
@@ -2769,8 +3047,6 @@ static hsize_t diff_ldouble(unsigned char *mem1,
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- h5difftrace("diff_ldouble start\n");
-
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -2949,7 +3225,6 @@ static hsize_t diff_ldouble(unsigned char *mem1,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ldouble finish\n");
return nfound;
}
@@ -2976,7 +3251,6 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_schar start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3077,7 +3351,6 @@ static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_schar finish\n");
return nfound;
}
@@ -3102,7 +3375,6 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_uchar start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3203,7 +3475,6 @@ static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_uchar finish\n");
return nfound;
}
@@ -3228,7 +3499,6 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_short start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3329,7 +3599,6 @@ static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_short finish\n");
return nfound;
}
@@ -3355,7 +3624,6 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_ushort start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3456,7 +3724,6 @@ static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ushort finish\n");
return nfound;
}
@@ -3481,7 +3748,6 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_int start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3583,7 +3849,6 @@ static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
} /* nelmts */
}
- h5difftrace("diff_int finish\n");
return nfound;
}
@@ -3607,7 +3872,6 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_uint start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3709,7 +3973,6 @@ static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_uint finish\n");
return nfound;
}
@@ -3734,7 +3997,6 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_long start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3837,7 +4099,6 @@ static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_long finish\n");
return nfound;
}
@@ -3862,8 +4123,6 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_ulong start\n");
-
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -3967,7 +4226,6 @@ static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ulong finish\n");
return nfound;
}
@@ -3992,7 +4250,6 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_llong start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -4094,7 +4351,6 @@ static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_llong finish\n");
return nfound;
}
@@ -4120,7 +4376,6 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
double per;
hbool_t both_zero;
- h5difftrace("diff_ullong start\n");
/* -d and !-p */
if (opts->d && !opts->p) {
for (i = 0; i < nelmts; i++) {
@@ -4226,7 +4481,6 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
return nfound;
} /* nelmts */
}
- h5difftrace("diff_ullong finish\n");
return nfound;
}
@@ -4240,26 +4494,26 @@ static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
static
int ull2float(unsigned long long ull_value, float *f_value)
{
- int ret_value = SUCCEED;
- hid_t dxpl_id = -1;
+ hid_t dxpl_id = H5I_INVALID_HID;
unsigned char *buf = NULL;
size_t src_size;
size_t dst_size;
+ int ret_value = 0;
- h5difftrace("ull2float start\n");
+ H5TOOLS_START_DEBUG("");
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);
@@ -4271,8 +4525,7 @@ done:
if (buf)
HDfree(buf);
- h5difftrace("ull2float finish\n");
-
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -4283,7 +4536,6 @@ done:
*-------------------------------------------------------------------------
*/
static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
- h5difftrace("equal_double start\n");
if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -4314,8 +4566,6 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- h5difftrace("equal_double finish\n");
-
return FALSE;
}
@@ -4330,7 +4580,6 @@ static hbool_t equal_double(double value, double expected, diff_opt_t *opts) {
static
hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
{
- h5difftrace("equal_ldouble start\n");
if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -4361,8 +4610,6 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
if (ABS((value-expected)) < DBL_EPSILON)
return TRUE;
- h5difftrace("equal_ldouble finish\n");
-
return FALSE;
}
@@ -4375,7 +4622,6 @@ hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts)
*-------------------------------------------------------------------------
*/
static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
- h5difftrace("equal_float start\n");
if (opts->do_nans) {
/*-------------------------------------------------------------------------
* detect NaNs
@@ -4406,8 +4652,6 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
if (ABS( (value-expected) ) < FLT_EPSILON)
return TRUE;
- h5difftrace("equal_float finish\n");
-
return FALSE;
}
@@ -4423,7 +4667,6 @@ static hbool_t my_isnan(dtype_t type, void *val) {
hbool_t retval = FALSE;
char s[256];
- h5difftrace("my_isnan start\n");
if (FLT_FLOAT == type) {
float x;
@@ -4483,8 +4726,6 @@ static hbool_t my_isnan(dtype_t type, void *val) {
}
}
- h5difftrace("my_isnan finish\n");
-
return retval;
}
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 1972d10..087414d 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -139,52 +139,57 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
*------------------------------------------------------------------------*/
static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
{
- int ret_value = 0;
- H5O_info_t oinfo1, oinfo2; /* Object info */
- hid_t attr1_id = -1; /* attr ID */
- hid_t attr2_id = -1; /* attr ID */
- size_t curr1 = 0;
- size_t curr2 = 0;
- unsigned infile[2];
- char name1[ATTR_NAME_MAX];
- char name2[ATTR_NAME_MAX];
- int cmp;
- unsigned i;
table_attrs_t *table_lp = NULL;
-
- h5difftrace("build_match_list_attrs start\n");
-
- 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");
- 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");
+ H5O_info2_t oinfo1, oinfo2; /* Object info */
+ hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
+ size_t curr1 = 0;
+ size_t curr2 = 0;
+ unsigned infile[2];
+ char name1[ATTR_NAME_MAX];
+ char name2[ATTR_NAME_MAX];
+ int cmp;
+ unsigned i;
+ herr_t ret_value = SUCCEED;
+
+
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
+
+ if(H5Oget_info3(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) {
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info first object failed");
+ }
+ H5TOOLS_DEBUG("H5Oget_info3 loc1id=%d", oinfo1.num_attrs);
+ if(H5Oget_info3(loc2_id, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) {
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info second object failed");
+ }
+ H5TOOLS_DEBUG("H5Oget_info3 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) {
- h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs);
- h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", 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);
@@ -213,25 +218,25 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr1_id);
- attr1_id = -1;
+ attr1_id = H5I_INVALID_HID;
H5Aclose(attr2_id);
- attr2_id = -1;
+ attr2_id = H5I_INVALID_HID;
} /* end while */
/* list1 did not end */
infile[0] = 1;
infile[1] = 0;
while(curr1 < oinfo1.num_attrs) {
- h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", 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");
- h5diffdebug2("build_match_list_attrs #1 name - %s\n", 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++;
@@ -239,22 +244,22 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr1_id);
- attr1_id = -1;
+ attr1_id = H5I_INVALID_HID;
}
/* list2 did not end */
infile[0] = 0;
infile[1] = 1;
while(curr2 < oinfo2.num_attrs) {
- h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", 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");
- h5diffdebug2("build_match_list_attrs #2 name - %s\n", 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++;
@@ -262,7 +267,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* close for next turn */
H5Aclose(attr2_id);
- attr2_id = -1;
+ attr2_id = H5I_INVALID_HID;
}
/*------------------------------------------------------
@@ -294,43 +299,33 @@ done:
H5Aclose(attr2_id);
} H5E_END_TRY;
- h5diffdebug2("build_match_list_attrs end - errstat:%d\n", opts->err_stat);
+ H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: diff_attr
+ * Function: diff_attr_data
*
- * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are
- * obtained either from
- * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
- * loc_id = H5Dopen2(fid, name);
- * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
+ * Purpose: compare attribute data located in attr1_id and attr2_id, which are
+ * obtained from open attributes
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-hsize_t diff_attr(hid_t loc1_id,
- hid_t loc2_id,
- const char *path1,
- const char *path2,
- diff_opt_t *opts)
+hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts)
{
- int ret_value = opts->err_stat;
- hid_t attr1_id = -1; /* attr ID */
- hid_t attr2_id = -1; /* attr ID */
- hid_t space1_id = -1; /* space ID */
- hid_t space2_id = -1; /* space ID */
- hid_t ftype1_id = -1; /* file data type ID */
- hid_t ftype2_id = -1; /* file data type ID */
- hid_t mtype1_id = -1; /* memory data type ID */
- hid_t mtype2_id = -1; /* memory data type ID */
+ hid_t space1_id = H5I_INVALID_HID; /* space ID */
+ hid_t space2_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype1_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t ftype2_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype1_id = H5I_INVALID_HID; /* memory data type ID */
+ hid_t mtype2_id = H5I_INVALID_HID; /* memory data type ID */
size_t msize1; /* memory size of memory type */
size_t msize2; /* memory size of memory type */
- void *buf1 = NULL; /* data buffer */
- void *buf2 = NULL; /* data buffer */
+ void *buf1 = NULL; /* data buffer */
+ void *buf2 = NULL; /* data buffer */
hbool_t buf1hasdata = FALSE; /* buffer has data */
hbool_t buf2hasdata = FALSE; /* buffer has data */
hsize_t nelmts1; /* number of elements in dataset */
@@ -338,208 +333,256 @@ hsize_t diff_attr(hid_t loc1_id,
int rank2; /* rank of dataset */
hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */
hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
- char *name1 = NULL;
- char *name2 = NULL;
char np1[512];
char np2[512];
- unsigned u; /* Local index variable */
hsize_t nfound = 0;
- hsize_t nfound_total = 0;
- int j;
+ int j;
+ diff_err_t ret_value = opts->err_stat;
+
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
+
+ /* get the datatypes */
+ if((ftype1_id = H5Aget_type(attr1_id)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
+ if((ftype2_id = H5Aget_type(attr2_id)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
+
+ if (H5Tget_class(ftype1_id) == H5T_REFERENCE) {
+ if((mtype1_id = H5Tcopy(H5T_STD_REF)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) first attribute ftype failed");
+ }
+ else {
+ if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) second attribute ftype failed");
+ }
+ else {
+ if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type second attribute ftype failed");
+ }
+ if((msize1 = H5Tget_size(mtype1_id)) == 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size first attribute mtype failed");
+ if((msize2 = H5Tget_size(mtype2_id)) == 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_size second attribute mtype failed");
+
+ /* get the dataspace */
+ if((space1_id = H5Aget_space(attr1_id)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space first attribute failed");
+ if((space2_id = H5Aget_space(attr2_id)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_space second attribute failed");
+
+ /* get dimensions */
+ if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims first attribute failed");
+ if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims second attribute failed");
+
+ /*----------------------------------------------------------------------
+ * 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 */
+ if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, name1, name2, opts, 0) == 1) {
+ /*-----------------------------------------------------------------
+ * "upgrade" the smaller memory size
+ *------------------------------------------------------------------
+ */
+ if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed");
+
+ H5TOOLS_DEBUG("diff_attr_data read");
+ /*---------------------------------------------------------------------
+ * read
+ *----------------------------------------------------------------------
+ */
+ nelmts1 = 1;
+ for(j = 0; j < rank1; j++)
+ nelmts1 *= dims1[j];
+
+ buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1);
+ buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2);
+ if(buf1 == NULL || buf2 == NULL) {
+ parallel_print("cannot read into memory\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "buffer allocation failed");
+ }
+ if(H5Aread(attr1_id, mtype1_id, buf1) < 0) {
+ parallel_print("Failed reading attribute1 %s\n", name1);
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Aget_type second attribute failed");
+ }
+ else
+ buf2hasdata = TRUE;
+
+ /* format output string */
+ HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);
+ HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2);
+
+ /*---------------------------------------------------------------------
+ * array compare
+ *----------------------------------------------------------------------
+ */
+ H5TOOLS_DEBUG("diff_attr_data array compare %s - %s", name1, name1);
+
+ /* always print name */
+ /* verbose (-v) and report (-r) mode */
+ if(opts->m_verbose || opts->m_report) {
+ do_print_attrname("attribute", np1, np2);
+
+ nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+ print_found(nfound);
+ }
+ /* quiet mode (-q), just count differences */
+ else if(opts->m_quiet) {
+ nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+ }
+ /* the rest (-c, none, ...) */
+ else {
+ nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
+ dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+ /* print info if compatible and difference found */
+ if (nfound) {
+ do_print_attrname("attribute", np1, np2);
+ print_found(nfound);
+ } /* end if */
+ } /* end else */
+ }
+ H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat);
+
+ /*----------------------------------------------------------------------
+ * close
+ *----------------------------------------------------------------------
+ */
+
+ /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
+ * VLEN memory first */
+ if(TRUE == h5tools_detect_vlen(mtype1_id))
+ H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
+ HDfree(buf1);
+ buf1 = NULL;
+
+ if(TRUE == h5tools_detect_vlen(mtype2_id))
+ H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
+ HDfree(buf2);
+ buf2 = NULL;
+
+ if(H5Tclose(ftype1_id) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
+ if(H5Tclose(ftype2_id) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
+ if(H5Sclose(space1_id) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
+ if(H5Sclose(space2_id) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type second attribute failed");
+ if(H5Tclose(mtype1_id) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose first attribute mtype failed");
+ if(H5Tclose(mtype2_id) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tclose second attribute mtype failed");
+
+done:
+ opts->err_stat = opts->err_stat | ret_value;
+
+ H5E_BEGIN_TRY {
+ if(buf1) {
+ if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
+ H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
+ HDfree(buf1);
+ } /* end if */
+ if(buf2) {
+ if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
+ H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
+ HDfree(buf2);
+ } /* end if */
+
+ H5Tclose(ftype1_id);
+ H5Tclose(ftype2_id);
+ H5Tclose(mtype1_id);
+ H5Tclose(mtype2_id);
+ H5Sclose(space1_id);
+ H5Sclose(space2_id);
+ } H5E_END_TRY;
+
+ H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
+
+ return nfound;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: diff_attr
+ *
+ * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are
+ * obtained either from
+ * loc_id = H5Gopen2(fid, name, H5P_DEFAULT);
+ * loc_id = H5Dopen2(fid, name);
+ * loc_id = H5Topen2(fid, name, H5P_DEFAULT);
+ *
+ * Return: number of differences found
+ *-------------------------------------------------------------------------
+ */
+
+hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *path2, diff_opt_t *opts)
+{
table_attrs_t *match_list_attrs = NULL;
- h5difftrace("diff_attr start\n");
+ hid_t attr1_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr2_id = H5I_INVALID_HID; /* attr ID */
+ char *name1 = NULL;
+ char *name2 = NULL;
+ unsigned u; /* Local index variable */
+ hsize_t nfound = 0;
+ hsize_t nfound_total = 0;
+ diff_err_t ret_value = opts->err_stat;
+
+ H5TOOLS_START_DEBUG(" - 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(H5DIFF_ERR, "build_match_list_attrs failed");
}
- h5diffdebug2("build_match_list_attrs - errstat:%d\n", 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) {
- h5difftrace("diff_attr attributes only in one file\n");
+ H5TOOLS_DEBUG("diff_attr attributes only in one file");
/* exit will be 1 */
opts->contents = 0;
}
- h5diffdebug2("match_list_attrs info - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG("match_list_attrs info - errstat:%d", opts->err_stat);
for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) {
- h5diffdebug3("match_list_attrs loop[%d] - errstat:%d\n", 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;
- h5diffdebug2("diff_attr name - %s\n", 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(H5DIFF_ERR, "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");
-
- h5difftrace("diff_attr got attributes\n");
- /* 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");
- if((ftype2_id = H5Aget_type(attr2_id)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
-
- 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");
- 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");
- if((msize1 = H5Tget_size(mtype1_id)) == 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "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");
-
- /* 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");
- if((space2_id = H5Aget_space(attr2_id)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "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");
- 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");
-
- /*----------------------------------------------------------------------
- * check for comparable TYPE and SPACE
- *----------------------------------------------------------------------
- */
-
- /* pass dims1 and dims2 for maxdims as well since attribute's maxdims
- * are always same */
- if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2,
- dims1, dims2, name1, name2, opts, 0) != 1) {
- if(H5Tclose(ftype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed");
- if(H5Tclose(ftype2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed");
- if(H5Sclose(space1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose first attribute failed");
- if(H5Sclose(space2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose second attribute failed");
- if(H5Aclose(attr1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed");
- if(H5Aclose(attr2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed");
- if(H5Tclose(mtype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed");
- if(H5Tclose(mtype2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed");
-
- continue;
- }
-
- /*-----------------------------------------------------------------
- * "upgrade" the smaller memory size
- *------------------------------------------------------------------
- */
- 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");
-
- /*---------------------------------------------------------------------
- * read
- *----------------------------------------------------------------------
- */
- nelmts1 = 1;
- for(j = 0; j < rank1; j++)
- nelmts1 *= dims1[j];
-
- buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1);
- 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");
- }
- if(H5Aread(attr1_id, mtype1_id, buf1) < 0) {
- parallel_print("Failed reading attribute1 %s/%s\n", path1, name1);
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
- }
- else
- buf1hasdata = TRUE;
-
- if(H5Aread(attr2_id, mtype2_id, buf2) < 0) {
- parallel_print("Failed reading attribute2 %s/%s\n", path2, name2);
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
- }
- else
- buf2hasdata = TRUE;
-
- /* format output string */
- HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);
- HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2);
-
- /*---------------------------------------------------------------------
- * array compare
- *----------------------------------------------------------------------
- */
-
- /* always print name */
- /* verbose (-v) and report (-r) mode */
- if(opts->m_verbose || opts->m_report) {
- do_print_attrname("attribute", np1, np2);
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen second attribute failed");
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
- print_found(nfound);
- }
- /* quiet mode (-q), just count differences */
- else if(opts->m_quiet) {
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
- }
- /* the rest (-c, none, ...) */
- else {
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
-
- /* print info if compatible and difference found */
- if (nfound) {
- do_print_attrname("attribute", np1, np2);
- print_found(nfound);
- } /* end if */
- } /* end else */
-
- /*----------------------------------------------------------------------
- * close
- *----------------------------------------------------------------------
- */
-
- /* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
- * VLEN memory first */
- if(TRUE == h5tools_detect_vlen(mtype1_id))
- H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
- HDfree(buf1);
- buf1 = NULL;
-
- if(TRUE == h5tools_detect_vlen(mtype2_id))
- H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
- HDfree(buf2);
- buf2 = NULL;
-
- if(H5Tclose(ftype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed");
- if(H5Tclose(ftype2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
- if(H5Sclose(space1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "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_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(H5DIFF_ERR, "H5Aget_type first attribute failed");
if(H5Aclose(attr2_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed");
- if(H5Tclose(mtype1_id) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "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(H5DIFF_ERR, "H5Aget_type second attribute failed");
nfound_total += nfound;
}
@@ -549,30 +592,13 @@ done:
opts->err_stat = opts->err_stat | ret_value;
H5E_BEGIN_TRY {
- if(buf1) {
- if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
- H5Treclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
- HDfree(buf1);
- } /* end if */
- if(buf2) {
- if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
- H5Treclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
- HDfree(buf2);
- } /* end if */
-
table_attrs_free(match_list_attrs);
- H5Tclose(ftype1_id);
- H5Tclose(ftype2_id);
- H5Tclose(mtype1_id);
- H5Tclose(mtype2_id);
- H5Sclose(space1_id);
- H5Sclose(space2_id);
H5Aclose(attr1_id);
H5Aclose(attr2_id);
} H5E_END_TRY;
- h5diffdebug2("diff_attr end - errstat:%d\n", opts->err_stat);
+ H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
return nfound_total;
}
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 56c4f0b..cea20a8 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -27,21 +27,17 @@
* Return: Number of differences found
*-------------------------------------------------------------------------
*/
-hsize_t diff_dataset(hid_t file1_id,
- hid_t file2_id,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *opts)
+hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
- int ret_value = opts->err_stat;
- int status = -1;
- hid_t did1 = -1;
- hid_t did2 = -1;
- hid_t dcpl1 = -1;
- hid_t dcpl2 = -1;
- hsize_t nfound = 0;
-
- h5difftrace("diff_dataset start\n");
+ int status = -1;
+ hid_t did1 = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID;
+ hid_t dcpl1 = H5I_INVALID_HID;
+ hid_t dcpl2 = H5I_INVALID_HID;
+ hsize_t nfound = 0;
+ diff_err_t ret_value = opts->err_stat;
+
+ H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/*-------------------------------------------------------------------------
* open the handles
*-------------------------------------------------------------------------
@@ -49,17 +45,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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Dget_create_plist second dataset failed");
/*-------------------------------------------------------------------------
* check if the dataset creation property list has filters that
@@ -68,11 +64,12 @@ hsize_t diff_dataset(hid_t file1_id,
* 2) the internal filters might be turned off
*-------------------------------------------------------------------------
*/
+ 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(H5DIFF_ERR, "h5tools_canreadf failed");
}
else {
ret_value = 1;
@@ -91,7 +88,7 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff_dataset finish:%d - errstat:%d\n", nfound, opts->err_stat);
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@@ -146,22 +143,17 @@ done:
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_datasetid(hid_t did1,
- hid_t did2,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *opts)
+hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
- int ret_value = opts->err_stat;
- hid_t sid1 = -1;
- hid_t sid2 = -1;
- hid_t f_tid1 = -1;
- hid_t f_tid2 = -1;
- hid_t dam_tid = -1; /* m_tid for diff_array function */
- hid_t m_tid1 = -1;
- hid_t m_tid2 = -1;
- hid_t dcpl1 = -1;
- hid_t dcpl2 = -1;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t sid2 = H5I_INVALID_HID;
+ hid_t f_tid1 = H5I_INVALID_HID;
+ hid_t f_tid2 = H5I_INVALID_HID;
+ hid_t dam_tid = H5I_INVALID_HID; /* m_tid for diff_array function */
+ hid_t m_tid1 = H5I_INVALID_HID;
+ hid_t m_tid2 = H5I_INVALID_HID;
+ hid_t dcpl1 = H5I_INVALID_HID;
+ hid_t dcpl2 = H5I_INVALID_HID;
H5D_layout_t stl1 = -1;
H5D_layout_t stl2 = -1;
size_t dam_size; /* m_size for diff_array function */
@@ -189,37 +181,38 @@ hsize_t diff_datasetid(hid_t did1,
void *buf2 = NULL;
void *sm_buf1 = NULL;
void *sm_buf2 = NULL;
- hid_t sm_space = -1; /*stripmine data space */
+ hid_t sm_space = H5I_INVALID_HID; /*stripmine data space */
size_t need; /* bytes needed for malloc */
int i;
unsigned int vl_data1 = 0; /*contains VL datatypes */
unsigned int vl_data2 = 0; /*contains VL datatypes */
+ diff_err_t ret_value = opts->err_stat;
- h5difftrace("diff_datasetid start\n");
+ H5TOOLS_START_DEBUG(" - 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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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");
- h5diffdebug3("rank: %ld - %ld\n", rank1, rank2);
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_simple_extent_dims failed");
+ H5TOOLS_DEBUG("rank: %ld - %ld", rank1, rank2);
/*-------------------------------------------------------------------------
* get the file data type
@@ -228,35 +221,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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Pget_layout failed");
if((stl2 = H5Pget_layout(dcpl2)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed");
/*-------------------------------------------------------------------------
* check for empty datasets
*-------------------------------------------------------------------------
*/
- h5difftrace("check for empty datasets\n");
+ H5TOOLS_DEBUG("check for empty datasets");
storage_size1 = H5Dget_storage_size(did1);
storage_size2 = H5Dget_storage_size(did2);
- h5diffdebug3("storage size: %ld - %ld\n", 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) {
@@ -280,33 +273,45 @@ hsize_t diff_datasetid(hid_t did1,
obj1_name, obj2_name,
opts, 0) != 1)
can_compare = 0;
- h5diffdebug2("diff_can_type - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG("diff_can_type - errstat:%d", opts->err_stat);
/*-------------------------------------------------------------------------
* memory type and sizes
*-------------------------------------------------------------------------
*/
- h5difftrace("check for memory type and sizes\n");
- if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ 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(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) first ftype failed");
+ }
+ else {
+ if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type first ftype failed");
+ }
- if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
- H5TOOLS_GOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed");
+ if (H5Tget_class(f_tid2) == H5T_REFERENCE) {
+ if((m_tid2 = H5Tcopy(H5T_STD_REF)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tcopy(H5T_STD_REF) second ftype failed");
+ }
+ else {
+ if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Tget_native_type second ftype failed");
+ }
m_size1 = H5Tget_size(m_tid1);
m_size2 = H5Tget_size(m_tid2);
- h5diffdebug3("type size: %ld - %ld\n", m_size1, m_size2);
+ H5TOOLS_DEBUG("type size: %ld - %ld", m_size1, m_size2);
/*-------------------------------------------------------------------------
* check for different signed/unsigned types
*-------------------------------------------------------------------------
*/
if(can_compare) {
- h5difftrace("can_compare for sign\n");
+ H5TOOLS_DEBUG("can_compare for sign");
sign1 = H5Tget_sign(m_tid1);
sign2 = H5Tget_sign(m_tid2);
if(sign1 != sign2) {
- h5difftrace("sign1 != sign2\n");
+ 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));
@@ -315,6 +320,7 @@ hsize_t diff_datasetid(hid_t did1,
can_compare = 0;
opts->not_cmp = 1;
}
+ 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
@@ -324,7 +330,7 @@ hsize_t diff_datasetid(hid_t did1,
vl_data1 = TRUE;
if(TRUE == h5tools_detect_vlen(m_tid2))
vl_data2 = TRUE;
- h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", 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
@@ -332,7 +338,7 @@ hsize_t diff_datasetid(hid_t did1,
*/
if(can_compare) { /* it is possible to compare */
H5T_class_t tclass = H5Tget_class(f_tid1);
- h5difftrace("can_compare attempt\n");
+ H5TOOLS_DEBUG("can_compare attempt");
/*-----------------------------------------------------------------
* get number of elements
@@ -346,19 +352,19 @@ hsize_t diff_datasetid(hid_t did1,
for(i = 0; i < rank2; i++)
nelmts2 *= dims2[i];
- h5diffdebug3("nelmts: %ld - %ld\n", nelmts1, nelmts2);
+ H5TOOLS_DEBUG("nelmts: %ld - %ld", nelmts1, nelmts2);
if(tclass != H5T_ARRAY) {
/*-----------------------------------------------------------------
* "upgrade" the smaller memory size
*------------------------------------------------------------------
*/
- h5difftrace("upgrade the smaller memory size?\n");
+ 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");
- h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2);
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed");
+ H5TOOLS_DEBUG("m_size: %ld - %ld", m_size1, m_size2);
dadims = dims1;
dam_size = m_size1;
dam_tid = m_tid1;
@@ -366,7 +372,7 @@ hsize_t diff_datasetid(hid_t did1,
need = (size_t)(nelmts1 * m_size1); /* bytes needed */
}
else {
- h5diffdebug3("Array dims: %d - %d\n", 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;
@@ -388,9 +394,10 @@ hsize_t diff_datasetid(hid_t did1,
name1 = diff_basename(obj1_name);
if(obj2_name)
name2 = diff_basename(obj2_name);
- h5diffdebug3("obj_names: %s - %s\n", name1, name2);
+ H5TOOLS_DEBUG("obj_names: %s - %s", name1, name2);
+ H5TOOLS_DEBUG("read/compare");
/*----------------------------------------------------------------
* read/compare
*-----------------------------------------------------------------
@@ -401,23 +408,24 @@ hsize_t diff_datasetid(hid_t did1,
} /* end if */
if(buf1 != NULL && buf2 != NULL) {
- h5difftrace("buf1 != NULL && buf2 != NULL\n");
+ 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");
- h5difftrace("H5Dread did2\n");
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "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(H5DIFF_ERR, "H5Dread failed");
/* array diff */
nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims,
opts, name1, name2, dam_tid, did1, did2);
- h5diffdebug2("diff_array nfound:%d\n", nfound);
+ H5TOOLS_DEBUG("diff_array nfound:%d - errstat:%d", nfound, opts->err_stat);
/* reclaim any VL memory, if necessary */
- h5diffdebug2("check vl_data1:%d\n", vl_data1);
+ H5TOOLS_DEBUG("check vl_data1:%d", vl_data1);
if(vl_data1)
H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
- h5diffdebug2("check vl_data2:%d\n", vl_data2);
+ H5TOOLS_DEBUG("check vl_data2:%d", vl_data2);
if(vl_data2)
H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
if(buf1 != NULL) {
@@ -459,7 +467,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];
- h5diffdebug2("sm_nbytes: %ld\n", sm_nbytes);
+ H5TOOLS_DEBUG("sm_nbytes: %ld", sm_nbytes);
} /* end for */
/* malloc return code should be verified.
@@ -470,9 +478,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(H5DIFF_ERR, "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(H5DIFF_ERR, "HDmalloc failed");
sm_nelmts = sm_nbytes / p_type_nbytes;
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
@@ -489,19 +497,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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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(H5DIFF_ERR, "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 */
@@ -534,6 +542,7 @@ hsize_t diff_datasetid(hid_t did1,
H5Sclose(sm_space);
} /* hyperslab read */
+ H5TOOLS_DEBUG("can_compare complete");
} /*can_compare*/
@@ -541,7 +550,7 @@ hsize_t diff_datasetid(hid_t did1,
* close
*-------------------------------------------------------------------------
*/
- h5diffdebug2("reclaim any VL memory - errstat:%d\n", opts->err_stat);
+ H5TOOLS_DEBUG("reclaim any VL memory - errstat:%d", opts->err_stat);
done:
opts->err_stat = opts->err_stat | ret_value;
@@ -588,7 +597,7 @@ done:
/* enable error reporting */
} H5E_END_TRY;
- h5diffdebug3("diff_datasetid return:%d with nfound:%d\n", ret_value, nfound);
+ H5TOOLS_ENDDEBUG(": %d with nfound:%d", ret_value, nfound);
return nfound;
}
@@ -604,35 +613,27 @@ done:
*-------------------------------------------------------------------------
*/
-int diff_can_type(hid_t f_tid1, /* file data type */
- hid_t f_tid2, /* file data type */
- int rank1,
- int rank2,
- hsize_t *dims1,
- hsize_t *dims2,
- hsize_t *maxdim1,
- hsize_t *maxdim2,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *opts,
- int is_compound)
+int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
+ hsize_t *dims1, hsize_t *dims2, hsize_t *maxdim1, hsize_t *maxdim2,
+ const char *obj1_name, const char *obj2_name,
+ diff_opt_t *opts, int is_compound)
{
- int ret_value = 1; /* can_compare value */
H5T_class_t tclass1;
H5T_class_t tclass2;
int maxdim_diff = 0; /* maximum dimensions are different */
int dim_diff = 0; /* current dimensions are different */
int i;
+ int ret_value = 1;
- h5difftrace("diff_can_type start\n");
+ H5TOOLS_START_DEBUG("");
/*-------------------------------------------------------------------------
* 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) {
@@ -648,7 +649,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
}
}
opts->not_cmp = 1;
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(0);
}
/*-------------------------------------------------------------------------
@@ -662,7 +663,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:
@@ -677,7 +679,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- h5diffdebug2("diff_can_type class - %s\n", get_class(tclass1));
+ H5TOOLS_DEBUG("diff_can_type class - %s", get_class(tclass1));
break;
} /* end switch */
@@ -717,7 +719,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);
}
/*-------------------------------------------------------------------------
@@ -753,7 +755,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
}
}
opts->not_cmp = 1;
- HGOTO_DONE(0);
+ H5TOOLS_GOTO_DONE(0);
}
/*-------------------------------------------------------------------------
@@ -775,7 +777,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
if(tclass1 == H5T_STRING) {
htri_t vstrtype1 = -1;
htri_t vstrtype2 = -1;
- h5difftrace("diff_can_type end - H5T_STRING\n");
+ H5TOOLS_DEBUG("diff_can_type end - H5T_STRING");
vstrtype1 = H5Tis_variable_str(f_tid1);
vstrtype2 = H5Tis_variable_str(f_tid2);
@@ -786,7 +788,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);
}
}
@@ -794,9 +796,9 @@ int diff_can_type(hid_t f_tid1, /* file data type */
int nmembs1;
int nmembs2;
int j;
- hid_t memb_type1 = -1;
- hid_t memb_type2 = -1;
- h5difftrace("diff_can_type end - H5T_COMPOUND\n");
+ hid_t memb_type1 = H5I_INVALID_HID;
+ hid_t memb_type2 = H5I_INVALID_HID;
+ H5TOOLS_DEBUG("diff_can_type end - H5T_COMPOUND");
nmembs1 = H5Tget_nmembers(f_tid1);
nmembs2 = H5Tget_nmembers(f_tid2);
@@ -808,7 +810,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++) {
@@ -821,7 +823,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);
@@ -829,9 +831,9 @@ 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;
- h5diffdebug2("diff_can_type end - %d\n", ret_value);
+ H5TOOLS_ENDDEBUG(" - %d", ret_value);
return ret_value;
}
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 6b5ca2f..59b11d6 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -341,12 +341,13 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
{
herr_t ret_value = SUCCEED;
+ H5TOOLS_START_DEBUG("");
if((*m_size1) != (*m_size2)) {
if((*m_size1) < (*m_size2)) {
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 */
@@ -354,15 +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("");
return ret_value;
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index d015e1c..47f6e3f 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -22,13 +22,19 @@
#include "h5tools_utils.h"
#include "H5private.h"
+#ifdef H5_TOOLS_DEBUG
+/* global debug variables */
+int H5tools_INDENT_g = 0;
+#endif
+
+
/* global variables */
hid_t H5tools_ERR_STACK_g = 0;
-hid_t H5tools_ERR_CLS_g = -1;
-hid_t H5E_tools_g = -1;
-hid_t H5E_tools_min_id_g = -1;
-hid_t H5E_tools_min_info_id_g = -1;
-hid_t H5E_tools_min_dbg_id_g = -1;
+hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID;
+hid_t H5E_tools_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_id_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_info_id_g = H5I_INVALID_HID;
+hid_t H5E_tools_min_dbg_id_g = H5I_INVALID_HID;
int compound_data;
FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */
FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */
@@ -91,14 +97,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 +175,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();
@@ -436,17 +436,17 @@ h5tools_set_error_file(const char *fname, int is_bin)
static hid_t
h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
{
- hid_t new_fapl = -1; /* Copy of file access property list passed in, or new property list */
- int ret_value = SUCCEED;
+ hid_t new_fapl = H5I_INVALID_HID; /* Copy of file access property list passed in, or new property list */
+ herr_t ret_value = SUCCEED;
/* 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 +454,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 +466,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 +474,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,10 +482,10 @@ 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;
+ *drivernum = MULTI_IDX;
}
#ifdef H5_HAVE_PARALLEL
else if(!HDstrcmp(driver, drivernames[MPIO_IDX])) {
@@ -498,7 +498,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 */
@@ -510,7 +510,7 @@ h5tools_get_fapl(hid_t fapl, const char *driver, unsigned *drivernum)
done:
if((new_fapl != H5P_DEFAULT) && (ret_value < 0)) {
H5Pclose(new_fapl);
- new_fapl = -1;
+ new_fapl = H5I_INVALID_HID;
}
return(new_fapl);
@@ -736,7 +736,6 @@ void
h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, hsize_t elmtno, int secnum)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
h5tools_str_t prefix;
h5tools_str_t str; /*temporary for indentation */
size_t templength = 0;
@@ -748,24 +747,23 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
if (!ctx->need_prefix)
return;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
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 +791,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,19 +804,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@@ -934,7 +931,6 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos,
size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
- H5TOOLS_ERR_INIT(hbool_t, TRUE)
hbool_t dimension_break = TRUE;
char *s = NULL;
char *section = NULL; /* a section of output */
@@ -944,12 +940,11 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
if (stream == NULL)
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_START_DEBUG(" 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 +971,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 +987,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 +1003,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 +1011,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 +1040,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 +1050,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 +1058,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,8 +1067,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return dimension_break;
}
@@ -1108,16 +1102,14 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos,
size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
- H5TOOLS_ERR_INIT(hbool_t, TRUE)
hbool_t dimension_break = TRUE;
char *s = NULL;
char *section = NULL; /* a section of output */
int secnum; /* section sequence number */
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_START_DEBUG("");
+ 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 +1202,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,8 +1218,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return dimension_break;
}
@@ -1243,25 +1234,22 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
void
init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
int i;
unsigned j;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@@ -1276,26 +1264,26 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
int
render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
- unsigned char *mem = (unsigned char*)_mem;
- size_t size; /* datum size */
- hsize_t block_index;
- H5T_class_t type_class;
-
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ unsigned char *mem = (unsigned char*)_mem;
+ size_t size; /* datum size */
+ hsize_t block_index;
+ H5T_class_t type_class;
+ hbool_t past_catch = FALSE;
+ int ret_value = 0;
+
+ H5TOOLS_START_DEBUG("");
if((size = H5Tget_size(tid)) == 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5TOOLS_THROW((-1), "H5Tget_size failed");
if((type_class = H5Tget_class(tid)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
+ H5TOOLS_THROW((-1), "H5Tget_class failed");
switch (type_class) {
case H5T_INTEGER:
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 */
@@ -1309,7 +1297,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
bytes_wrote = HDfwrite(mem, 1, bytes_in, stream);
if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream)))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5TOOLS_THROW((-1), "fwrite failed");
block_index -= (hsize_t)bytes_wrote;
mem = mem + bytes_wrote;
@@ -1322,7 +1310,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++) {
@@ -1333,7 +1321,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
if (s != NULL)
size = HDstrlen(s);
else
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "NULL string");
+ H5TOOLS_THROW((-1), "NULL string");
}
else {
s = (char *) mem;
@@ -1341,7 +1329,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5TOOLS_THROW((-1), "fwrite failed");
} /* i */
} /* for (block_index = 0; block_index < block_nelmts; block_index++) */
}
@@ -1351,9 +1339,9 @@ 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");
+ H5TOOLS_THROW((-1), "H5Tget_nmembers of compound failed");
nmembs = (unsigned)snmembs;
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1361,7 +1349,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
mem = ((unsigned char*)_mem) + block_index * size;
for (j = 0; j < nmembs; j++) {
- hid_t memb = -1;
+ hid_t memb = H5I_INVALID_HID;
size_t offset;
offset = H5Tget_member_offset(tid, j);
@@ -1369,7 +1357,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
H5Tclose(memb);
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed");
+ H5TOOLS_THROW((-1), "render_bin_output of compound member failed");
}
H5Tclose(memb);
@@ -1381,9 +1369,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
{
int k, ndims;
hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb = -1;
+ hid_t memb = H5I_INVALID_HID;
- 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);
@@ -1398,7 +1386,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
}
else {
H5Tclose(memb);
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed");
+ H5TOOLS_THROW((-1), "calculate the number of array elements failed");
}
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1406,7 +1394,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
/* dump the array element */
if (render_bin_output(stream, container, memb, mem, nelmts) < 0) {
H5Tclose(memb);
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ H5TOOLS_THROW((-1), "render_bin_output failed");
}
}
H5Tclose(memb);
@@ -1415,9 +1403,9 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_VLEN:
{
hsize_t nelmts;
- hid_t memb = -1;
+ hid_t memb = H5I_INVALID_HID;
- 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);
@@ -1429,7 +1417,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
/* dump the array element */
if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) {
H5Tclose(memb);
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ H5TOOLS_THROW((-1), "render_bin_output failed");
}
}
H5Tclose(memb);
@@ -1437,9 +1425,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 +1437,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_INFO("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 +1448,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_INFO("H5Ropen_object H5T_STD_REF NULL");
}
H5Sclose(region_space);
} /* end if (region_space >= 0) */
@@ -1473,22 +1459,22 @@ 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))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5TOOLS_THROW((-1), "fwrite failed");
} /* end for */
break;
@@ -1496,13 +1482,12 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_NCLASSES:
default:
/* Badness */
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "bad type class");
+ H5TOOLS_THROW((-1), "bad type class");
break;
} /* end switch */
CATCH
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1521,7 +1506,6 @@ int
render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hsize_t *dims1 = NULL;
hsize_t *start = NULL;
hsize_t *count = NULL;
@@ -1529,18 +1513,21 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hsize_t total_size[H5S_MAX_RANK];
unsigned jndx;
size_t type_size;
- hid_t mem_space = -1;
+ hid_t mem_space = H5I_INVALID_HID;
void *region_buf = NULL;
+ hbool_t past_catch = FALSE;
hsize_t blkndx;
- hid_t sid1 = -1;
+ hid_t sid1 = H5I_INVALID_HID;
+ int ret_value = -1;
+ H5TOOLS_START_DEBUG("");
/* Get the dataspace of the dataset */
if((sid1 = H5Dget_space(region_id)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5TOOLS_THROW((-1), "H5Dget_space failed");
/* Allocate space for the dimension array */
if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
+ H5TOOLS_THROW((-1), "Could not allocate buffer for dims");
/* find the dimensions of each data space from the block coordinates */
numelem = 1;
@@ -1551,21 +1538,21 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
/* Create dataspace for reading buffer */
if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+ H5TOOLS_THROW((-1), "H5Screate_simple failed");
if((type_size = H5Tget_size(type_id)) == 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5TOOLS_THROW((-1), "H5Tget_size failed");
if((region_buf = HDmalloc(type_size * (size_t)numelem)) == NULL)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate region buffer");
+ H5TOOLS_THROW((-1), "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_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for start");
+ H5TOOLS_THROW((-1), "Could not allocate buffer for start");
if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for count");
+ H5TOOLS_THROW((-1), "Could not allocate buffer for count");
for (blkndx = 0; blkndx < nblocks; blkndx++) {
for (jndx = 0; jndx < ndims; jndx++) {
@@ -1574,16 +1561,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((-1), "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((-1), "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((-1), "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((-1), "render_bin_output of data region failed");
/* Render the region data element end */
done:
;
@@ -1596,10 +1583,11 @@ CATCH
HDfree(dims1);
if(H5Sclose(mem_space) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_ERROR((-1), "H5Sclose failed");
if(H5Sclose(sid1) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_ERROR((-1), "H5Sclose failed");
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1617,51 +1605,54 @@ hbool_t
render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container)
{
- H5TOOLS_ERR_INIT(hbool_t, TRUE)
hssize_t snblocks;
hsize_t nblocks;
hsize_t alloc_size;
hsize_t *ptdata = NULL;
int sndims;
unsigned ndims;
- hid_t dtype = -1;
- hid_t type_id = -1;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
+ H5TOOLS_START_DEBUG("");
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
- H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+ H5TOOLS_THROW(FALSE, "H5Sget_select_hyper_nblocks failed");
nblocks = (hsize_t)snblocks;
/* Print block information */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5TOOLS_THROW(FALSE, "H5Sget_simple_extent_ndims failed");
ndims = (unsigned)sndims;
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);
- 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(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
+CATCH
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1687,41 +1678,43 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container,
unsigned ndims, hid_t type_id, hsize_t npoints)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hsize_t *dims1 = NULL;
size_t type_size;
- hid_t mem_space = -1;
+ hid_t mem_space = H5I_INVALID_HID;
void *region_buf = NULL;
+ int ret_value = 0;
+ H5TOOLS_START_DEBUG("");
if((type_size = H5Tget_size(type_id)) == 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "render_bin_output of data points failed");
- done:
+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((-1), "H5Sclose failed");
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1739,40 +1732,43 @@ hbool_t
render_bin_output_region_points(hid_t region_space, hid_t region_id,
FILE *stream, hid_t container)
{
- H5TOOLS_ERR_INIT(hbool_t, TRUE)
hssize_t snpoints;
hsize_t npoints;
int sndims;
unsigned ndims;
- hid_t dtype = -1;
- hid_t type_id = -1;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
+ H5TOOLS_START_DEBUG("");
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
- H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ H5TOOLS_THROW(FALSE, "H5Sget_select_elem_npoints failed");
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5TOOLS_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5TOOLS_THROW(FALSE, "H5Sget_simple_extent_ndims failed");
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:
+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("");
return ret_value;
}
@@ -1818,21 +1814,27 @@ hbool_t
h5tools_is_obj_same(hid_t loc_id1, const char *name1,
hid_t loc_id2, const char *name2)
{
- H5O_info_t oinfo1, oinfo2;
+ H5O_info2_t oinfo1, oinfo2;
hbool_t ret_val = FALSE;
if ( name1 && HDstrcmp(name1, "."))
- H5Oget_info_by_name2(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
+ H5Oget_info_by_name3(loc_id1, name1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id1, &oinfo1, H5O_INFO_BASIC);
+ H5Oget_info3(loc_id1, &oinfo1, H5O_INFO_BASIC);
if ( name2 && HDstrcmp(name2, "."))
- H5Oget_info_by_name2(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ H5Oget_info_by_name3(loc_id2, name2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id2, &oinfo2, H5O_INFO_BASIC);
+ H5Oget_info3(loc_id2, &oinfo2, H5O_INFO_BASIC);
- if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr)
- ret_val = TRUE;
+ if (oinfo1.fileno == oinfo2.fileno) {
+ int token_cmp_val;
+
+ H5Otoken_cmp(loc_id1, &oinfo1.token, &oinfo2.token, &token_cmp_val);
+
+ if(!token_cmp_val)
+ ret_val = TRUE;
+ }
return ret_val;
}
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index dad4af7..9440e7a 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -581,6 +581,7 @@ H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack; disable=0 e
#define H5_TOOLS_DATASET "DATASET"
#define H5_TOOLS_DATATYPE "DATATYPE"
#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE"
+#define H5_TOOLS_UNKNOWN "UNKNOWN"
/* Definitions of useful routines */
H5TOOLS_DLL void h5tools_init(void);
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 8b08d7f..d6d94a6 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -257,7 +257,6 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
h5tools_context_t *ctx, /* in,out */
unsigned flags, hsize_t nelmts, hid_t type, void *_mem)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
unsigned char *mem = (unsigned char*) _mem;
hsize_t i; /* element counter */
size_t size; /* size of each datum */
@@ -272,13 +271,13 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
* this var to count elements and
* break after we see a number equal
* to the ctx->size_last_dim. */
+ int ret_value = 0;
- 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_START_DEBUG(" 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 +286,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 +297,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,13 +314,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("exit");
return ret_value;
}
@@ -357,27 +355,26 @@ h5tools_dump_region_attribute(hid_t region_id,
size_t ncols, hsize_t region_elmt_counter, /* element counter */
hsize_t elmt_counter)
{
- H5TOOLS_ERR_INIT(hbool_t, TRUE)
- hbool_t dimension_break = TRUE;
- hid_t atype = H5I_INVALID_HID;
- hid_t type_id = H5I_INVALID_HID;
- hid_t region_space = H5I_INVALID_HID;
- h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
+ hbool_t dimension_break = TRUE;
+ hid_t atype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t region_space = H5I_INVALID_HID;
+ h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
HDassert(info);
HDassert(ctx);
HDassert(buffer);
- H5TOOLS_PUSH_STACK();
-
outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
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 +384,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 +439,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,9 +460,7 @@ h5tools_dump_region_attribute(hid_t region_id,
CATCH
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
-
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -488,12 +483,10 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-h5tools_print_region_data_blocks(hid_t region_id,
- FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
+h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
h5tools_str_t *buffer, /* string into which to render */
size_t ncols, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hbool_t dimension_break = TRUE;
hsize_t *dims1 = NULL;
hsize_t *start = NULL;
@@ -507,11 +500,13 @@ h5tools_print_region_data_blocks(hid_t region_id,
hsize_t numindex;
unsigned indx;
unsigned jndx;
+ hbool_t past_catch = FALSE;
size_t type_size;
- hid_t mem_space = -1;
- hid_t sid1 = -1;
+ hid_t mem_space = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
h5tools_context_t ctx;
void *region_buf = NULL;
+ int ret_value = 0;
HDassert(info);
HDassert(cur_ctx);
@@ -520,19 +515,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_START_DEBUG("");
if((type_size = H5Tget_size(type_id)) == 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5TOOLS_THROW(FAIL, "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 +537,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 +586,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,33 +608,32 @@ 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");
+ H5TOOLS_ERROR(FAIL, "H5Sget_simple_extent_dims failed");
}
ctx.indent_level--;
}
else {
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Dread failed");
+ H5TOOLS_ERROR(FAIL, "H5Dread failed");
}
}
else {
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ H5TOOLS_ERROR(FAIL, "H5Sselect_hyperslab failed");
}
} /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
- done:
+done:
HDfree(start);
HDfree(count);
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");
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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -677,7 +670,6 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
size_t ncols, hsize_t region_elmt_counter, /* element counter */
hsize_t elmt_counter)
{
- H5TOOLS_ERR_INIT(hbool_t, TRUE)
hbool_t dimension_break = TRUE;
hssize_t snblocks;
hsize_t nblocks;
@@ -689,13 +681,14 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
hid_t dtype = H5I_INVALID_HID;
hid_t type_id = H5I_INVALID_HID;
h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
HDassert(info);
HDassert(ctx);
HDassert(buffer);
- H5TOOLS_PUSH_STACK();
-
+ H5TOOLS_START_DEBUG("");
outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
@@ -703,15 +696,15 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
outputformat.line_pre = "";
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
- H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+ H5TOOLS_THROW(dimension_break, "H5Sget_select_hyper_nblocks failed");
nblocks = (hsize_t)snblocks;
/* Print block information */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5TOOLS_THROW(dimension_break, "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 +723,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 +752,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 +811,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,8 +852,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -888,7 +881,6 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
h5tools_str_t *buffer, size_t ncols,
unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hbool_t dimension_break = TRUE;
hsize_t *dims1 = NULL;
hsize_t elmtno; /* elemnt index */
@@ -901,6 +893,8 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
hid_t mem_space = H5I_INVALID_HID;
void *region_buf = NULL;
h5tools_context_t ctx;
+ hbool_t past_catch = FALSE;
+ int ret_value = 0;
HDassert(info);
HDassert(cur_ctx);
@@ -908,25 +902,24 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
HDassert(ptdata);
HDassert(ndims > 0);
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
HDmemset(&ctx, 0, sizeof(ctx));
/* Allocate space for the dimension array */
if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims");
+ H5TOOLS_THROW((-1), "Could not allocate buffer for dims");
dims1[0] = npoints;
/* Create dataspace for reading buffer */
if((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+ H5TOOLS_THROW((-1), "H5Screate_simple failed");
if((type_size = H5Tget_size(type_id)) == 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5TOOLS_THROW((-1), "H5Tget_size failed");
if((region_buf = HDmalloc(type_size * (size_t)npoints)) == NULL)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for region");
+ H5TOOLS_THROW((-1), "Could not allocate buffer for region");
curr_pos = 0;
ctx.indent_level = cur_ctx->indent_level;
@@ -935,9 +928,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((-1), "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 +977,7 @@ 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");
+ H5TOOLS_ERROR((-1), "H5Sget_simple_extent_dims failed");
}
ctx.indent_level--;
} /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */
@@ -995,10 +988,9 @@ CATCH
HDfree(dims1);
if(H5Sclose(mem_space) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_ERROR((-1), "H5Sclose failed");
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1032,7 +1024,6 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter,
hsize_t elmt_counter)
{
- H5TOOLS_ERR_INIT(hbool_t, TRUE)
hbool_t dimension_break = TRUE;
hssize_t snpoints;
hsize_t npoints;
@@ -1044,13 +1035,14 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
hid_t dtype = H5I_INVALID_HID;
hid_t type_id = H5I_INVALID_HID;
h5tool_format_t outputformat; /* Use to disable prefix for DATA attribute display */
+ hbool_t past_catch = FALSE;
+ hbool_t ret_value = TRUE;
HDassert(info);
HDassert(ctx);
HDassert(buffer);
- H5TOOLS_PUSH_STACK();
-
+ H5TOOLS_START_DEBUG("");
outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
@@ -1058,15 +1050,15 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
outputformat.line_pre = "";
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
- H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ H5TOOLS_THROW(dimension_break, "H5Sget_select_elem_npoints failed");
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5TOOLS_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5TOOLS_THROW(dimension_break, "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 +1077,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 +1101,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 +1162,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,8 +1202,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1250,8 +1241,7 @@ CATCH
*/
static herr_t
h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t dset, hid_t p_type,
- hid_t f_space, hsize_t hyperslab_count,
+ hid_t dset, hid_t p_type, hid_t f_space, hsize_t hyperslab_count,
hsize_t *temp_start, /* start inside offset count loop */
hsize_t *temp_count, /* count inside offset count loop */
hsize_t *temp_block, /* block size used in loop */
@@ -1259,7 +1249,6 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
hsize_t *total_size, /* total size of dataset */
unsigned int row_dim) /* index of row_counter dimension */
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
size_t i; /* counters */
size_t j; /* counters */
hsize_t zero[1] = {0}; /* vector of zeros */
@@ -1276,12 +1265,14 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
hsize_t size_row_block; /* size for blocks along rows */
hsize_t row_counter = 0;
-
+ hbool_t past_catch = FALSE;
/* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+ herr_t ret_value = SUCCEED;
+ H5TOOLS_START_DEBUG("");
if ((size_t) ctx->ndims > NELMTS(sm_size))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed");
+ H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed");
if (ctx->ndims > 0)
init_acc_pos(ctx, total_size);
@@ -1309,10 +1300,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* calculate the potential number of elements we're going to print */
if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ H5TOOLS_THROW(FAIL, "H5Sselect_hyperslab failed");
if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed");
+ H5TOOLS_THROW(FAIL, "H5Sget_select_npoints failed");
sm_nelmts = (hsize_t)ssm_nelmts;
if (sm_nelmts > 0) {
@@ -1321,7 +1312,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
* a hyperslab whose size is manageable.
*/
if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5TOOLS_THROW(FAIL, "H5Tget_size failed");
if (ctx->ndims > 0)
for (i = ctx->ndims; i > 0; --i) {
@@ -1335,17 +1326,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/
if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes)))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine");
+ H5TOOLS_THROW(FAIL, "Could not allocate buffer for strip-mine");
if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+ H5TOOLS_THROW(FAIL, "H5Screate_simple failed");
if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ H5TOOLS_THROW(FAIL, "H5Sselect_hyperslab failed");
/* read the data */
if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ H5TOOLS_THROW(FAIL, "H5Dread failed");
/* print the data */
flags = START_OF_DATA;
@@ -1359,7 +1350,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* print array indices. get the lower bound of the hyperslab and calulate
the element position at the start of hyperslab */
if(H5Sget_select_bounds(f_space, low, high) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed");
+ H5TOOLS_THROW(FAIL, "H5Sget_select_bounds failed");
elmtno = 0;
for (i = 0; i < (size_t) ctx->ndims - 1; i++) {
@@ -1377,20 +1368,20 @@ 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, "h5tools_dump_simple_data failed");
/* Reclaim any VL memory, if necessary */
if (vl_data)
H5Treclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
if(H5Sclose(sm_space) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_THROW(FAIL, "H5Sclose failed");
if(sm_buf)
HDfree(sm_buf);
sm_buf = NULL;
}
else
- H5TOOLS_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print");
+ H5TOOLS_THROW(SUCCEED, "nothing to print");
ctx->continuation++;
@@ -1400,6 +1391,7 @@ CATCH
if(sm_buf)
HDfree(sm_buf);
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1576,20 +1568,21 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
*-------------------------------------------------------------------------
*/
static herr_t
-h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t dset, hid_t p_type)
+h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type)
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
- int sndims;
- hid_t f_space = H5I_INVALID_HID; /* file data space */
- size_t i; /* counters */
- hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/
-
+ int sndims;
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ size_t i; /* counters */
+ hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/
+ hbool_t past_catch = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ H5TOOLS_START_DEBUG("");
if((f_space = H5Dget_space(dset)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5TOOLS_THROW(FAIL, "H5Dget_space failed");
if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_ndims failed");
ctx->ndims = (unsigned)sndims;
/* assume entire data space to be printed */
@@ -1598,7 +1591,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
ctx->p_min_idx[i] = 0;
if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_dims failed");
ctx->size_last_dim = total_size[ctx->ndims - 1];
/* Set the compound datatype field list for display */
@@ -1608,8 +1601,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
CATCH
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_THROW(FAIL, "H5Sclose failed");
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1632,7 +1626,6 @@ static int
h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
hid_t dset, hid_t p_type)
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
hid_t f_space = H5I_INVALID_HID; /* file data space */
hsize_t elmtno; /* counter */
size_t i; /* counter */
@@ -1641,6 +1634,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
hsize_t zero[8]; /* vector of zeros */
unsigned int flags; /* buffer extent flags */
hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hbool_t past_catch = FALSE;
/* Print info */
size_t p_type_nbytes; /* size of memory type */
@@ -1660,20 +1654,20 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
+ int ret_value = 0;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
- if (FAIL == (f_space = H5Dget_space(dset)))
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5TOOLS_START_DEBUG("");
+ if (H5I_INVALID_HID == (f_space = H5Dget_space(dset)))
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "ctx->ndims > NELMTS(sm_size) failed");
/* Assume entire data space to be printed */
if (ctx->ndims > 0)
@@ -1720,22 +1714,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++) {
@@ -1745,19 +1739,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_ERROR((-1), "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_ERROR((-1), "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_ERROR((-1), "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_ERROR((-1), "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 */
@@ -1769,13 +1763,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_ERROR((-1), "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];
@@ -1788,21 +1782,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_ERROR((-1), "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((-1), "H5Sclose failed");
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_ERROR((-1), "H5Sclose failed");
CATCH
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1820,31 +1814,31 @@ static int
h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
hid_t attr_id, hid_t p_type)
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
hid_t f_space = H5I_INVALID_HID; /* file data space */
hsize_t alloc_size;
int sndims; /* rank of dataspace */
unsigned i; /* counters */
hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
hsize_t p_nelmts; /* total selected elmts */
- unsigned char *buf = NULL; /* buffer for raw data */
+ hbool_t past_catch = FALSE;
+ unsigned char *buf = NULL; /* buffer for raw data */
+ int ret_value = 0;
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
- if (FAIL == (f_space = H5Aget_space(attr_id)))
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5TOOLS_START_DEBUG("");
+ if (H5I_INVALID_HID == (f_space = H5Aget_space(attr_id)))
+ H5TOOLS_GOTO_ERROR((-1), "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");
+ H5TOOLS_THROW((-1), "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");
+ H5TOOLS_THROW((-1), "ctx->ndims > NELMTS(ctx->p_min_idx) failed");
/* Assume entire data space to be printed */
if (ctx->ndims > 0)
@@ -1876,28 +1870,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_ERROR((-1), "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_ERROR((-1), "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((-1), "H5Sclose failed");
CATCH
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1922,12 +1915,14 @@ CATCH
int
h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hid_t f_space = H5I_INVALID_HID;
hid_t p_type = H5I_INVALID_HID;
hid_t f_type = H5I_INVALID_HID;
H5S_class_t space_type;
h5tool_format_t info_dflt;
+ int ret_value = 0;
+
+ H5TOOLS_START_DEBUG("");
/* Use default values */
if (!stream)
stream = rawoutstream;
@@ -1979,6 +1974,7 @@ done:
if (f_space > 0)
H5Sclose(f_space);
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -1996,12 +1992,13 @@ done:
int
h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t attr_id)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hid_t f_space = H5I_INVALID_HID;
hid_t p_type = H5I_INVALID_HID;
hid_t f_type = H5I_INVALID_HID;
h5tool_format_t info_dflt;
+ int ret_value = 0;
+ H5TOOLS_START_DEBUG("");
/* Use default values */
if (!stream)
stream = rawoutstream;
@@ -2034,7 +2031,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_ERROR((-1), "H5Sis_simple failed");
}
else {
ret_value = h5tools_dump_simple_mem(rawattrstream, info, ctx, attr_id, p_type);
@@ -2047,6 +2044,7 @@ done:
if (f_space > 0)
H5Sclose(f_space);
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -2065,12 +2063,11 @@ int
h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info,
h5tools_context_t *ctx, hid_t type, int object_search)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
char *mname;
- hid_t mtype = -1;
- hid_t str_type = -1;
- hid_t super = -1;
- hid_t tmp_type = -1;
+ hid_t mtype = H5I_INVALID_HID;
+ hid_t str_type = H5I_INVALID_HID;
+ hid_t super = H5I_INVALID_HID;
+ hid_t tmp_type = H5I_INVALID_HID;
int snmembers;
int sndims;
unsigned nmembers;
@@ -2085,21 +2082,29 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
H5T_class_t type_class;
H5T_sign_t sign; /* sign scheme value */
htri_t is_vlstr = FALSE;
+ hbool_t past_catch = FALSE;
const char *sign_s = NULL; /* sign scheme string */
const char *order_s = NULL; /* byte order string */
+ int ret_value = 0;
+ H5TOOLS_START_DEBUG("");
if((type_class = H5Tget_class(type)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
+ H5TOOLS_THROW((-1), "H5Tget_class failed");
if (object_search && H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
- obj_t *obj = NULL; /* Found object */
+ H5O_info2_t oinfo;
+ obj_t *obj = NULL; /* Found object */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- obj = search_obj(h5dump_type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ obj = search_obj(h5dump_type_table, &oinfo.token);
if(obj) {
- if(!obj->recorded)
- h5tools_str_append(buffer,"\"/#"H5_PRINTF_HADDR_FMT"\"", obj->objno);
+ if(!obj->recorded) {
+ char *obj_addr_str = NULL;
+
+ H5Otoken_to_str(type, &oinfo.token, &obj_addr_str);
+ h5tools_str_append(buffer,"\"/#%s\"", obj_addr_str);
+ H5free_memory(obj_addr_str);
+ }
else
h5tools_str_append(buffer, "\"%s\"", obj->objname);
}
@@ -2379,11 +2384,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_ERROR((-1), "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_ERROR((-1), "H5Tset_order failed");
} /* end if */
if(H5Tequal(tmp_type, str_type)) {
@@ -2393,7 +2398,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_ERROR((-1), "H5Tclose failed");
str_type = H5Tcopy(H5T_FORTRAN_S1);
H5Tset_cset(str_type, cset);
@@ -2410,11 +2415,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_ERROR((-1), "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_ERROR((-1), "H5Tset_order failed");
} /* end if */
if(H5Tequal(tmp_type, str_type)) {
@@ -2433,9 +2438,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_ERROR((-1), "H5Tclose failed");
if(H5Tclose(tmp_type) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_ERROR((-1), "H5Tclose failed");
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->strblockend);
break;
@@ -2469,7 +2474,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
char *ttag;
if(NULL == (ttag = H5Tget_tag(type)))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed");
+ H5TOOLS_THROW((-1), "H5Tget_tag failed");
ctx->need_prefix = TRUE;
@@ -2497,7 +2502,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_COMPOUND:
if((snmembers = H5Tget_nmembers(type)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ H5TOOLS_THROW((-1), "H5Tget_nmembers failed");
nmembers = (unsigned)snmembers;
h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin);
@@ -2515,10 +2520,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_ERROR((-1), "H5Tclose failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_member_type failed");
+ H5TOOLS_ERROR((-1), "H5Tget_member_type failed");
H5free_memory(mname);
}
ctx->indent_level--;
@@ -2547,7 +2552,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_ENUM:
if((super = H5Tget_super(type)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5TOOLS_THROW((-1), "H5Tget_super failed");
h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin);
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
@@ -2559,7 +2564,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_ERROR((-1), "H5Tclose failed");
h5tools_str_append(buffer, ";");
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
@@ -2577,14 +2582,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_VLEN:
if((super = H5Tget_super(type)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5TOOLS_THROW((-1), "H5Tget_super failed");
h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin);
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_ERROR((-1), "H5Tclose failed");
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend);
@@ -2605,10 +2610,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_ERROR((-1), "H5Tget_array_dims2 failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_array_ndims failed");
+ H5TOOLS_ERROR((-1), "H5Tget_array_ndims failed");
/* Get array base type */
if((super = H5Tget_super(type)) >= 0) {
@@ -2616,10 +2621,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_ERROR((-1), "H5Tclose failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5TOOLS_ERROR((-1), "H5Tget_super failed");
h5tools_str_append(buffer, " }");
@@ -2633,6 +2638,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
}
CATCH
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -2650,18 +2656,20 @@ CATCH
int
h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hsize_t size[H5TOOLS_DUMP_MAX_RANK];
hsize_t maxsize[H5TOOLS_DUMP_MAX_RANK];
int ndims = -1;
H5S_class_t space_type = -1;
+ hbool_t past_catch = FALSE;
int i;
+ int ret_value = 0;
+ H5TOOLS_START_DEBUG("");
if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ H5TOOLS_THROW((-1), "H5Sget_simple_extent_dims failed");
if((space_type = H5Sget_simple_extent_type(space)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed");
+ H5TOOLS_THROW((-1), "H5Sget_simple_extent_type failed");
switch(space_type) {
case H5S_SCALAR:
@@ -2708,6 +2716,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
} /* end switch */
CATCH
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -2726,34 +2735,36 @@ CATCH
int
h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t type)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
char **name = NULL; /*member names */
unsigned char *value = NULL; /*value array */
unsigned char *copy = NULL; /*a pointer to value array */
unsigned i;
unsigned nmembs = 0; /*number of members */
int snmembs;
- hid_t super = -1; /*enum base integer type */
- hid_t native = -1; /*native integer datatype */
+ hid_t super = H5I_INVALID_HID; /*enum base integer type */
+ hid_t native = H5I_INVALID_HID; /*native integer datatype */
H5T_sign_t sign_type; /*sign of value type */
size_t type_size; /*value type size */
size_t dst_size; /*destination value type size */
size_t ncols = 80; /*available output width */
hsize_t curr_pos = 0; /* total data element position */
+ hbool_t past_catch = FALSE;
+ int ret_value = 0;
+ H5TOOLS_START_DEBUG("");
if (info->line_ncols > 0)
ncols = info->line_ncols;
if((snmembs = H5Tget_nmembers(type)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ H5TOOLS_THROW((-1), "H5Tget_nmembers failed");
nmembs = (unsigned)snmembs;
HDassert(nmembs > 0);
if((super = H5Tget_super(type)) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5TOOLS_THROW((-1), "H5Tget_super failed");
if((type_size = H5Tget_size(type)) <= 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed");
+ H5TOOLS_THROW((-1), "H5Tget_size(type) failed");
/*
* Determine what datatype to use for the native values. To simplify
@@ -2766,7 +2777,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
dst_size = sizeof(long long);
if((sign_type = H5Tget_sign(type))<0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed");
+ H5TOOLS_THROW((-1), "H5Tget_sign failed");
if(H5T_SGN_NONE == sign_type)
native = H5T_NATIVE_ULLONG;
else
@@ -2777,20 +2788,20 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
/* Get the names and raw values of all members */
if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *))))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name");
+ H5TOOLS_THROW((-1), "Could not allocate buffer for member name");
if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size))))
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value");
+ H5TOOLS_THROW((-1), "Could not allocate buffer for member value");
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
if(H5Tget_member_value(type, i, value + i * type_size) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed");
+ H5TOOLS_THROW((-1), "H5Tget_member_value failed");
}
/* Convert values to native datatype */
if (native > 0)
if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed");
+ H5TOOLS_THROW((-1), "H5Tconvert failed");
/*
* Sort members by increasing value
@@ -2847,11 +2858,12 @@ CATCH
HDfree(value);
if(super >= 0 && H5Tclose(super) < 0)
- H5TOOLS_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class");
+ H5TOOLS_THROW((-1), "Could not close datatype's super class");
if(0 == nmembs)
h5tools_str_append(buffer, "\n<empty>");
+ H5TOOLS_ENDDEBUG("");
return ret_value;
}
@@ -3070,7 +3082,7 @@ h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/, const h5tool_format_t
h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id)
{
size_t size;
- hid_t n_type = -1;
+ hid_t n_type = H5I_INVALID_HID;
void *buf = NULL;
n_type = H5Tget_native_type(type_id, H5T_DIR_DEFAULT);
@@ -3772,8 +3784,8 @@ h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_contex
error_msg("unable to open attribute \"%s\"\n", attr_name);
}
else {
- hid_t type = -1;
- hid_t space = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
ctx->indent_level++;
@@ -3966,7 +3978,6 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool
void
h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t obj_id, int obj_data)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
H5S_class_t space_type;
int ndims;
size_t i;
@@ -3985,9 +3996,8 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
h5tool_format_t outputformat;
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_START_DEBUG(" file=%p", (void*)stream);
+ H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
if (info->line_ncols > 0)
@@ -3999,12 +4009,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);
}
@@ -4032,13 +4042,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_NO_RET();
}
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)
@@ -4050,35 +4060,37 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
init_acc_pos(&datactx, total_size);
datactx.need_prefix = TRUE;
- if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), ndims))) {
+ if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) {
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_INFO("H5Dread reference failed");
+ H5TOOLS_GOTO_DONE_NO_RET();
}
}
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_INFO("H5Aread reference failed");
+ H5TOOLS_GOTO_DONE_NO_RET();
}
}
- for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) {
- H5O_type_t obj_type; /* Object type */
+ for(i = 0; i < (size_t)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:
@@ -4087,12 +4099,10 @@ 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");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed");
+ H5TOOLS_INFO("H5Dclose 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_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed");
break;
case H5O_TYPE_GROUP:
@@ -4105,24 +4115,22 @@ 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_INFO("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");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION1 failed");
+ H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ H5TOOLS_INFO("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:
@@ -4134,12 +4142,10 @@ 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");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_OBJECT2 failed");
+ H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT2 failed");
+ H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed");
break;
case H5O_TYPE_NAMED_DATATYPE:
@@ -4153,22 +4159,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_INFO("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_INFO("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, " {");
@@ -4194,42 +4199,38 @@ 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_INFO("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_INFO("H5Sclose H5R_DATASET_REGION2 failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed");
+ H5TOOLS_INFO("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");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_DATASET_REGION2 failed");
+ H5TOOLS_INFO("H5Dclose 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");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdestroy H5R_ATTR failed");
+ H5TOOLS_INFO("H5Aclose 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, " {");
@@ -4251,7 +4252,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_INFO("H5Ropen_attr H5R_ATTR failed");
}
break;
case H5R_BADTYPE:
@@ -4260,18 +4261,21 @@ 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);
+ if(H5Rdestroy(&ref_buf[i]) < 0)
+ H5TOOLS_INFO("H5Rdestroy failed");
+
+ 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
@@ -4298,7 +4302,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 {
@@ -4308,12 +4312,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 = "";
@@ -4323,7 +4327,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");
@@ -4366,7 +4370,6 @@ done:
}
h5tools_str_close(&buffer);
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
}
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index 2c5e6c9..4e2e935 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -21,6 +21,7 @@
#include "H5Eprivate.h" /* Error handling */
/* tools-HDF5 Error variables */
+H5TOOLS_DLLVAR int H5tools_INDENT_g;
H5TOOLS_DLLVAR hid_t H5tools_ERR_STACK_g;
H5TOOLS_DLLVAR hid_t H5tools_ERR_CLS_g;
H5TOOLS_DLLVAR hid_t H5E_tools_g;
@@ -40,89 +41,176 @@ 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.
+ * H5TOOLS_PUSH_ERROR macro, used to push an error to an error stack. Not meant to
+ * be called directly.
*/
-#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; \
- ret_typ ret_value = ret_init;
+#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_PUSH_STACK macro, used to create a new error stack.
+ * 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_PUSH_STACK() { \
- pstack_id = estack_id; \
- estack_id = H5Ecreate_stack(); \
-}
+#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_POP_STACK macro, used to release a new error stack.
+ * 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_POP_STACK() { \
- if (H5I_INVALID_HID != pstack_id) { \
- H5Eclose_stack(estack_id); \
- estack_id = pstack_id; \
- pstack_id = H5I_INVALID_HID; \
- } \
-}
+#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_DEBUG macro, used to facilitate error reporting. The arguments are the minor error number, and a description of the error.
+ * 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.
*/
-#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_GOTO_DONE(ret_val) \
+do { \
+ ret_value = ret_val; \
+ goto done; \
+} while(0)
/*
- * H5TOOLS_INFO macro, used to facilitate error reporting . The arguments are the minor error number, and a description of the error.
+ * H5TOOLS_GOTO_DONE_NO_RET macro, used to facilitate normal return within a function body.
+ * Control simply branches to the `done' label without setting any return value.
*/
-#define H5TOOLS_INFO(min_id, ...) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
-}
+#define H5TOOLS_GOTO_DONE_NO_RET() \
+do { \
+ goto done; \
+} 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_INFO macro, used to facilitate error reporting. The arguments are
+ * a description of the error.
*/
-#define H5TOOLS_ERROR(maj_id, min_id, ...) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \
- ret_value = FAIL; \
-}
+#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)
+
+#ifdef H5_TOOLS_DEBUG
+
+#define H5TOOLS_START_DEBUG(...) \
+do { \
+ H5tools_INDENT_g += 2; \
+ HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, __VA_ARGS__); \
+ HDfprintf(stderr, "\n"); \
+ HDfflush(stderr); \
+} while(0)
+
+#define H5TOOLS_DEBUG(...) \
+do { \
+ HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, __VA_ARGS__); \
+ HDfprintf(stderr, "\n"); \
+ HDfflush(stderr); \
+} while(0)
+
+#define H5TOOLS_ENDDEBUG(...) \
+do { \
+ HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
+ HDfprintf(stderr, __VA_ARGS__); \
+ HDfprintf(stderr, "\n"); \
+ H5tools_INDENT_g -= 2; \
+ HDfflush(stderr); \
+} while(0)
+
+#else
+
+#define H5TOOLS_START_DEBUG(...) \
+do { \
+ ; \
+} while(0)
+
+#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
@@ -151,28 +239,11 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
* The return value is assigned to a variable `ret_value' and control branches
* to the `catch_except' label, if we're not already past it.
*/
-#define H5TOOLS_THROW(fail_value, min_id, ...) { \
- H5Epush2(H5tools_ERR_STACK_g, __FILE__, FUNC, __LINE__, H5tools_ERR_CLS_g, H5E_tools_g, min_id, __VA_ARGS__); \
- 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 */
+#define H5TOOLS_THROW(ret_val, ...) \
+do { \
+ H5TOOLS_PUSH_ERROR(H5tools_ERR_STACK_g, H5tools_ERR_CLS_g, H5E_tools_g, H5E_tools_min_id_g, __VA_ARGS__); \
+ H5_LEAVE(ret_val) \
+} while(0)
#endif /* H5TOOLS_ERROR_H_ */
diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c
index aafc7ba..0e4c476 100644
--- a/tools/lib/h5tools_filters.c
+++ b/tools/lib/h5tools_filters.c
@@ -43,24 +43,24 @@ int
h5tools_canreadf(const char* name, /* object name, serves also as boolean print */
hid_t dcpl_id) /* dataset creation property list */
{
- int ret_value = 1;
int nfilters; /* number of filters */
H5Z_filter_t filtn; /* filter identification number */
int i; /* index */
int udfilter_avail; /* index */
+ int ret_value = 1;
/* 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_ref.c b/tools/lib/h5tools_ref.c
index e98a8e2..0e1fa03 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -17,6 +17,7 @@
#include "h5tools.h"
#include "h5tools_utils.h"
#include "h5trav.h"
+#include "H5VLnative_private.h"
/*
@@ -34,14 +35,14 @@
*/
typedef struct {
- haddr_t objno; /* Object ID (i.e. address) */
- char *path; /* Object path */
+ H5O_token_t obj_token; /* Object token */
+ char *path; /* Object path */
} ref_path_node_t;
static H5SL_t *ref_path_table = NULL; /* the "table" (implemented with a skip list) */
static hid_t thefile = (-1);
-static int ref_path_table_put(const char *, haddr_t objno);
+static int ref_path_table_put(const char *, const H5O_token_t *token);
/*-------------------------------------------------------------------------
* Function: free_ref_path_info
@@ -80,19 +81,47 @@ free_ref_path_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op
*-------------------------------------------------------------------------
*/
static herr_t
-init_ref_path_cb(const char *obj_name, const H5O_info_t *oinfo,
+init_ref_path_cb(const char *obj_name, const H5O_info2_t *oinfo,
const char *already_seen, void H5_ATTR_UNUSED *_udata)
{
/* Check if the object is already in the path table */
if(NULL == already_seen) {
/* Insert the object into the path table */
- ref_path_table_put(obj_name, oinfo->addr);
+ ref_path_table_put(obj_name, &oinfo->token);
} /* end if */
return 0;
}
/*-------------------------------------------------------------------------
+ * Function: ref_path_table_cmp
+ *
+ * Purpose: Skip list key comparison function which compares two
+ * H5O_token_t objects.
+ *
+ * Return: Negative (if token2 is greater than token1)
+ * 0 (if tokens are equal)
+ * or
+ * Positive (if token1 is greater than token2)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+ref_path_table_cmp(const void *key1, const void *key2)
+{
+ const H5O_token_t *token1 = (const H5O_token_t *)key1;
+ const H5O_token_t *token2 = (const H5O_token_t *)key2;
+ int cmp_value = 0;
+
+ if(thefile > 0)
+ H5Otoken_cmp(thefile, token1, token2, &cmp_value);
+ else
+ cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t));
+
+ return cmp_value;
+}
+
+/*-------------------------------------------------------------------------
* Function: init_ref_path_table
*
* Purpose: Initalize the reference path table
@@ -109,7 +138,7 @@ init_ref_path_table(void)
/* Sanity check */
if(thefile > 0) {
/* Create skip list to store reference path information */
- if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL)
+ if((ref_path_table = H5SL_create(H5SL_TYPE_GENERIC, ref_path_table_cmp)) == NULL)
return (-1);
/* Iterate over objects in this file */
@@ -153,8 +182,10 @@ term_ref_path_table(void)
* Purpose: Looks up a table entry given a path name.
* Used during construction of the table.
*
- * Return: The table entre (pte) or NULL if not in the
- * table.
+ * Return: Negative on failure, Non-negative on success. The object
+ * token for the table entry is returned through the token
+ * parameter if the table entry is found by the given path
+ * name.
*
* Programmer: REMcG
*
@@ -162,33 +193,35 @@ term_ref_path_table(void)
*
*-------------------------------------------------------------------------
*/
-haddr_t
-ref_path_table_lookup(const char *thepath)
+int
+ref_path_table_lookup(const char *thepath, H5O_token_t *token)
{
- H5O_info_t oi;
+ H5O_info2_t oi;
if((thepath == NULL) || (HDstrlen(thepath) == 0))
- return HADDR_UNDEF;
+ return -1;
/* Allow lookups on the root group, even though it doesn't have any link info */
if(HDstrcmp(thepath, "/")) {
- H5L_info_t li;
+ H5L_info2_t li;
/* Check for external link first, so we don't return the OID of an object in another file */
- if(H5Lget_info(thefile, thepath, &li, H5P_DEFAULT) < 0)
- return HADDR_UNDEF;
+ if(H5Lget_info2(thefile, thepath, &li, H5P_DEFAULT) < 0)
+ return -1;
/* UD links can't be followed, so they always "dangle" like soft links. */
if(li.type >= H5L_TYPE_UD_MIN)
- return HADDR_UNDEF;
+ return -1;
} /* end if */
/* Get the object info now */
/* (returns failure for dangling soft links) */
- if(H5Oget_info_by_name2(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
- return HADDR_UNDEF;
+ if(H5Oget_info_by_name3(thefile, thepath, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ return -1;
- /* Return OID */
- return(oi.addr);
+ /* Return object token through parameter */
+ HDmemcpy(token, &oi.token, sizeof(H5O_token_t));
+
+ return 0;
}
/*-------------------------------------------------------------------------
@@ -211,7 +244,7 @@ ref_path_table_lookup(const char *thepath)
*-------------------------------------------------------------------------
*/
static int
-ref_path_table_put(const char *path, haddr_t objno)
+ref_path_table_put(const char *path, const H5O_token_t *token)
{
ref_path_node_t *new_node;
@@ -219,10 +252,10 @@ ref_path_table_put(const char *path, haddr_t objno)
if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
return(-1);
- new_node->objno = objno;
+ HDmemcpy(&new_node->obj_token, token, sizeof(H5O_token_t));
new_node->path = HDstrdup(path);
- return(H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
+ return(H5SL_insert(ref_path_table, new_node, &(new_node->obj_token)));
}
else
return (-1);
@@ -239,46 +272,50 @@ int get_next_xid(void) {
/*
* This counter is used to create fake object ID's
- * The idea is to set it to the largest possible offest, which
+ * The idea is to set it to the largest possible offset, which
* minimizes the chance of collision with a real object id.
*
*/
haddr_t fake_xid = HADDR_MAX;
-haddr_t
-get_fake_xid (void) {
- return (fake_xid--);
+
+void
+get_fake_token(H5O_token_t *token) {
+ if(thefile > 0) {
+ /* TODO: potential for this to be called with non-native connector objects */
+ if(H5VLnative_addr_to_token(thefile, fake_xid, token) < 0)
+ *token = H5O_TOKEN_UNDEF;
+ fake_xid--;
+ }
+ else
+ *token = H5O_TOKEN_UNDEF;
}
/*
- * for an object that does not have an object id (e.g., soft link),
- * create a table entry with a fake object id as the key.
+ * for an object that does not have an object token (e.g., soft link),
+ * create a table entry with a fake object token as the key.
*
* Assumes 'path' is for an object that is not in the table.
*
*/
-haddr_t
-ref_path_table_gen_fake(const char *path)
+void
+ref_path_table_gen_fake(const char *path, H5O_token_t *token)
{
- haddr_t fake_objno;
-
- /* Generate fake ID for string */
- fake_objno = get_fake_xid();
+ /* Generate fake object token for string */
+ get_fake_token(token);
/* Create ref path table, if it hasn't already been created */
if(ref_path_table == NULL)
init_ref_path_table();
/* Insert "fake" object into table */
- ref_path_table_put(path, fake_objno);
-
- return(fake_objno);
+ ref_path_table_put(path, token);
}
/*-------------------------------------------------------------------------
* Function: lookup_ref_path
*
- * Purpose: Lookup the path to the object with refernce 'ref'.
+ * Purpose: Lookup the path to the object with the reference 'refbuf'.
*
* Return: Return a path to the object, or NULL if not found.
*
@@ -289,19 +326,48 @@ ref_path_table_gen_fake(const char *path)
*-------------------------------------------------------------------------
*/
const char *
-lookup_ref_path(haddr_t ref)
+lookup_ref_path(H5R_ref_t refbuf)
{
+ H5O_info2_t oinfo;
+ H5R_type_t ref_type;
+ hid_t ref_object;
ref_path_node_t *node;
/* Be safer for h5ls */
if(thefile < 0)
return(NULL);
+ /* Retrieve reference type */
+ if(H5R_BADTYPE == (ref_type = H5Rget_type(&refbuf)))
+ return(NULL);
+
+ /* Open the referenced object */
+ switch (ref_type) {
+ case H5R_OBJECT1:
+ case H5R_OBJECT2:
+ if((ref_object = H5Ropen_object(&refbuf, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ return(NULL);
+ break;
+
+ /* Invalid referenced object type */
+ case H5R_DATASET_REGION1:
+ case H5R_DATASET_REGION2:
+ case H5R_ATTR:
+ case H5R_MAXTYPE:
+ case H5R_BADTYPE:
+ default:
+ return(NULL);
+ }
+
+ /* Retrieve info about the referenced object */
+ if(H5Oget_info3(ref_object, &oinfo, H5O_INFO_ALL) < 0)
+ return(NULL);
+
/* Create ref path table, if it hasn't already been created */
if(ref_path_table == NULL)
init_ref_path_table();
- node = (ref_path_node_t *)H5SL_search(ref_path_table, &ref);
+ node = (ref_path_node_t *)H5SL_search(ref_path_table, &oinfo.token);
return(node ? node->path : NULL);
}
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
index b7bd9a3..debbea1 100644
--- a/tools/lib/h5tools_ref.h
+++ b/tools/lib/h5tools_ref.h
@@ -21,11 +21,11 @@ extern "C" {
#endif
H5TOOLS_DLL herr_t fill_ref_path_table(hid_t fid);
-H5TOOLS_DLL const char *lookup_ref_path(haddr_t ref);
+H5TOOLS_DLL const char *lookup_ref_path(H5R_ref_t refbuf);
H5TOOLS_DLL int get_next_xid(void);
-H5TOOLS_DLL haddr_t get_fake_xid(void);
-H5TOOLS_DLL haddr_t ref_path_table_lookup(const char *);
-H5TOOLS_DLL haddr_t ref_path_table_gen_fake(const char *);
+H5TOOLS_DLL void get_fake_token(H5O_token_t *token);
+H5TOOLS_DLL int ref_path_table_lookup(const char *thepath, H5O_token_t *token);
+H5TOOLS_DLL void ref_path_table_gen_fake(const char *path, H5O_token_t *token);
H5TOOLS_DLL int term_ref_path_table(void);
#ifdef __cplusplus
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index f35fdab..6515ecd 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -289,27 +289,25 @@ char *
h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
size_t i = 0;
hsize_t curr_pos = elmtno;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
- 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,10 +323,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
/* Add prefix and suffix to the index */
return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: "));
@@ -684,7 +681,6 @@ char *
h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t container,
hid_t type, void *vp, h5tools_context_t *ctx)
{
- H5TOOLS_ERR_INIT(char*, NULL)
size_t nsize, offset, size=0, nelmts, start;
H5T_sign_t nsign;
char *name = NULL;
@@ -695,9 +691,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
static char fmt_llong[8], fmt_ullong[8];
H5T_str_t pad;
H5T_class_t type_class;
+ char *ret_value = NULL;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
/* Build default formats for long long types */
if(!fmt_llong[0]) {
HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH);
@@ -726,7 +722,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 +754,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 +829,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 +967,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 +1069,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,34 +1084,32 @@ 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 {
if (H5Tequal(type, H5T_STD_REF)) {
- H5O_type_t obj_type; /* Object type */
+ H5O_type_t obj_type = -1; /* Object type */
H5R_type_t ref_type; /* Reference type */
- const H5R_ref_t *ref_vp = (const H5R_ref_t *)vp;
+ H5R_ref_t *ref_vp = (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) {
case H5R_OBJECT1:
{
/* Object references -- show the type and OID of the referenced object. */
- H5O_info_t oi;
+ H5O_info2_t oi;
+ char *obj_addr_str = NULL;
- 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");
+ H5Oget_info3(obj, &oi, H5O_INFO_BASIC);
+ H5Otoken_to_str(obj, &oi.token, &obj_addr_str);
}
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_ERROR(NULL, "H5Ropen_object H5R_OBJECT1 failed");
/* Print object type and close object */
switch (obj_type) {
@@ -1135,26 +1129,36 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
- h5tools_str_append(str, "%u-", (unsigned) oi.type);
+ h5tools_str_append(str, "%u-%s", (unsigned) oi.type, H5_TOOLS_UNKNOWN);
break;
} /* end switch */
- H5Oclose(obj);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+
+ h5tools_str_sprint_reference(str, ref_vp);
/* Print OID */
if(info->obj_hidefileno)
- h5tools_str_append(str, info->obj_format, oi.addr);
+ h5tools_str_append(str, info->obj_format, obj_addr_str);
else
- h5tools_str_append(str, info->obj_format, oi.fileno, oi.addr);
+ h5tools_str_append(str, info->obj_format, oi.fileno, obj_addr_str);
+
+ if(obj_addr_str) {
+ H5free_memory(obj_addr_str);
+ obj_addr_str = NULL;
}
+
+ if(obj >= 0)
+ if(H5Oclose(obj) < 0)
+ H5TOOLS_ERROR(NULL, "H5Oclose 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");
h5tools_str_append(str, H5_TOOLS_DATASET);
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, 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);
@@ -1172,34 +1176,35 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
case H5O_TYPE_UNKNOWN:
case H5O_TYPE_NTYPES:
default:
+ h5tools_str_append(str, H5_TOOLS_UNKNOWN);
break;
} /* end switch */
- h5tools_str_sprint_reference(str, info, container, ref_vp);
+ h5tools_str_sprint_reference(str, 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);
+ h5tools_str_sprint_reference(str, 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);
+ h5tools_str_sprint_reference(str, ref_vp);
break;
case H5R_BADTYPE:
case H5R_MAXTYPE:
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;
@@ -1210,7 +1215,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);
@@ -1272,7 +1277,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);
@@ -1319,9 +1324,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
case H5T_BITFIELD:
case H5T_OPAQUE:
{
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "OTHER");
/* All other types get printed as hexadecimal */
size_t i;
+
+ H5TOOLS_DEBUG("OTHER");
if(1 == nsize)
h5tools_str_append(str, "0x%02x", ucp_vp[0]);
else
@@ -1337,11 +1343,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
break;
} /* end switch */
}
-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_POP_STACK();
+ H5TOOLS_ENDDEBUG(" with %s", ret_value);
return ret_value;
}
@@ -1355,35 +1360,32 @@ CATCH
*-------------------------------------------------------------------------
*/
void
-h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info,
- hid_t container, H5R_ref_t *ref_vp)
+h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
- ssize_t buf_size;
+ ssize_t buf_size;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
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) {
+ if (H5Rget_file_name(ref_vp, file_name, (size_t)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) {
+ if (H5Rget_obj_name(ref_vp, H5P_DEFAULT, obj_name, (size_t)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);
@@ -1391,12 +1393,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) {
+ if (H5Rget_attr_name(ref_vp, attr_name, (size_t)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);
@@ -1404,9 +1406,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 6fdf36a..02bfe40 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -41,7 +41,7 @@ H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_
H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx);
H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
-H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, const h5tool_format_t *info, hid_t container, H5R_ref_t *vp);
+H5TOOLS_DLL void h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *vp);
H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info,
hid_t container, hid_t type, void *vp,
h5tools_context_t *ctx);
diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c
index f63c228..22e4a39 100644
--- a/tools/lib/h5tools_type.c
+++ b/tools/lib/h5tools_type.c
@@ -26,7 +26,7 @@
hid_t
h5tools_get_little_endian_type(hid_t tid)
{
- hid_t p_type=-1;
+ hid_t p_type=H5I_INVALID_HID;
H5T_class_t type_class;
size_t size;
H5T_sign_t sign;
@@ -106,7 +106,7 @@ h5tools_get_little_endian_type(hid_t tid)
hid_t
h5tools_get_big_endian_type(hid_t tid)
{
- hid_t p_type = -1;
+ hid_t p_type = H5I_INVALID_HID;
H5T_class_t type_class;
size_t size;
H5T_sign_t sign;
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 7b47f4d..45e436c 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -53,11 +53,11 @@ unsigned outBuffOffset;
FILE* overflow_file = NULL;
/* local functions */
-static void init_table(table_t **tbl);
+static void init_table(hid_t fid, table_t **tbl);
#ifdef H5DUMP_DEBUG
-static void dump_table(char* tablename, table_t *table);
+static void dump_table(hid_t fid, char* tablename, table_t *table);
#endif /* H5DUMP_DEBUG */
-static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t recorded);
+static void add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool_t recorded);
/*-------------------------------------------------------------------------
* Function: parallel_print
@@ -599,10 +599,11 @@ print_version(const char *progname)
*-------------------------------------------------------------------------
*/
static void
-init_table(table_t **tbl)
+init_table(hid_t fid, table_t **tbl)
{
table_t *table = (table_t *)HDmalloc(sizeof(table_t));
+ table->fid = fid;
table->size = 20;
table->nobjs = 0;
table->objs = (obj_t *)HDmalloc(table->size * sizeof(obj_t));
@@ -644,15 +645,21 @@ free_table(table_t *table)
*-------------------------------------------------------------------------
*/
static void
-dump_table(char* tablename, table_t *table)
+dump_table(hid_t fid, char* tablename, table_t *table)
{
unsigned u;
+ char *obj_addr_str = NULL;
PRINTSTREAM(rawoutstream,"%s: # of entries = %d\n", tablename,table->nobjs);
- for (u = 0; u < table->nobjs; u++)
- PRINTSTREAM(rawoutstream,"%a %s %d %d\n", table->objs[u].objno,
+ for (u = 0; u < table->nobjs; u++) {
+ H5VLconnector_token_to_str(fid, table->objs[u].obj_token, &obj_addr_str);
+
+ PRINTSTREAM(rawoutstream,"%s %s %d %d\n", obj_addr_str,
table->objs[u].objname,
table->objs[u].displayed, table->objs[u].recorded);
+
+ H5VLfree_token_str(fid, obj_addr_str);
+ }
}
@@ -667,9 +674,9 @@ dump_table(char* tablename, table_t *table)
void
dump_tables(find_objs_t *info)
{
- dump_table("group_table", info->group_table);
- dump_table("dset_table", info->dset_table);
- dump_table("type_table", info->type_table);
+ dump_table(info->fid, "group_table", info->group_table);
+ dump_table(info->fid, "dset_table", info->dset_table);
+ dump_table(info->fid, "type_table", info->type_table);
}
#endif /* H5DUMP_DEBUG */
@@ -685,13 +692,17 @@ dump_tables(find_objs_t *info)
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE obj_t *
-search_obj(table_t *table, haddr_t objno)
+search_obj(table_t *table, const H5O_token_t *obj_token)
{
unsigned u;
+ int token_cmp;
- for(u = 0; u < table->nobjs; u++)
- if(table->objs[u].objno == objno)
+ for(u = 0; u < table->nobjs; u++) {
+ if(H5Otoken_cmp(table->fid, &table->objs[u].obj_token, obj_token, &token_cmp) < 0)
+ return NULL;
+ if(!token_cmp)
return &(table->objs[u]);
+ }
return NULL;
}
@@ -708,7 +719,7 @@ search_obj(table_t *table, haddr_t objno)
*-------------------------------------------------------------------------
*/
static herr_t
-find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen, void *op_data)
+find_objs_cb(const char *name, const H5O_info2_t *oinfo, const char *already_seen, void *op_data)
{
find_objs_t *info = (find_objs_t*)op_data;
herr_t ret_value = 0;
@@ -716,26 +727,26 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
switch(oinfo->type) {
case H5O_TYPE_GROUP:
if(NULL == already_seen)
- add_obj(info->group_table, oinfo->addr, name, TRUE);
+ add_obj(info->group_table, &oinfo->token, name, TRUE);
break;
case H5O_TYPE_DATASET:
if(NULL == already_seen) {
- hid_t dset = -1;
+ hid_t dset = H5I_INVALID_HID;
/* Add the dataset to the list of objects */
- add_obj(info->dset_table, oinfo->addr, name, TRUE);
+ add_obj(info->dset_table, &oinfo->token, name, TRUE);
/* Check for a dataset that uses a named datatype */
if((dset = H5Dopen2(info->fid, name, H5P_DEFAULT)) >= 0) {
hid_t type = H5Dget_type(dset);
if(H5Tcommitted(type) > 0) {
- H5O_info_t type_oinfo;
+ H5O_info2_t type_oinfo;
- H5Oget_info2(type, &type_oinfo, H5O_INFO_BASIC);
- if(search_obj(info->type_table, type_oinfo.addr) == NULL)
- add_obj(info->type_table, type_oinfo.addr, name, FALSE);
+ H5Oget_info3(type, &type_oinfo, H5O_INFO_BASIC);
+ if(search_obj(info->type_table, &type_oinfo.token) == NULL)
+ add_obj(info->type_table, &type_oinfo.token, name, FALSE);
} /* end if */
H5Tclose(type);
@@ -750,8 +761,8 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
if(NULL == already_seen) {
obj_t *found_obj;
- if((found_obj = search_obj(info->type_table, oinfo->addr)) == NULL)
- add_obj(info->type_table, oinfo->addr, name, TRUE);
+ if((found_obj = search_obj(info->type_table, &oinfo->token)) == NULL)
+ add_obj(info->type_table, &oinfo->token, name, TRUE);
else {
/* Use latest version of name */
HDfree(found_obj->objname);
@@ -791,9 +802,9 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
herr_t ret_value = SUCCEED;
/* Initialize the tables */
- init_table(group_table);
- init_table(dset_table);
- init_table(type_table);
+ init_table(fid, group_table);
+ init_table(fid, dset_table);
+ init_table(fid, type_table);
/* Init the find_objs_t */
info->fid = fid;
@@ -803,7 +814,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 */
@@ -829,7 +840,7 @@ done:
*-------------------------------------------------------------------------
*/
static void
-add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
+add_obj(table_t *table, const H5O_token_t *obj_token, const char *objname, hbool_t record)
{
size_t u;
@@ -843,7 +854,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
u = table->nobjs++;
/* Set information about object */
- table->objs[u].objno = objno;
+ HDmemcpy(&table->objs[u].obj_token, obj_token, sizeof(H5O_token_t));
table->objs[u].objname = HDstrdup(objname);
table->objs[u].recorded = record;
table->objs[u].displayed = 0;
@@ -893,7 +904,7 @@ int
H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
{
htri_t l_ret;
- H5O_info_t trg_oinfo;
+ H5O_info2_t trg_oinfo;
hid_t fapl = H5P_DEFAULT;
hid_t lapl = H5P_DEFAULT;
int ret_value = -1; /* init to fail */
@@ -904,39 +915,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(H5Lget_info2(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 +956,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,29 +975,29 @@ 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(H5Oget_info_by_name3(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 */
+ HDmemcpy(&link_info->obj_token, &trg_oinfo.token, sizeof(H5O_token_t));
link_info->trg_type = trg_oinfo.type;
- link_info->objno = trg_oinfo.addr;
link_info->fileno = trg_oinfo.fileno;
} /* end if */
else
@@ -1049,14 +1060,14 @@ h5tools_getenv_update_hyperslab_bufsize(void)
{
const char *env_str = NULL;
long hyperslab_bufsize_mb;
- int ret_value = 1;
+ int ret_value = 1;
/* check if environment variable is set for the hyperslab buffer size */
if (NULL != (env_str = HDgetenv ("H5TOOLS_BUFSIZE"))) {
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/h5tools_utils.h b/tools/lib/h5tools_utils.h
index 17c16bf..366800a 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -95,14 +95,15 @@ H5TOOLS_DLL int get_option(int argc, const char **argv, const char *opt, const s
/*struct taken from the dumper. needed in table struct*/
typedef struct obj_t {
- haddr_t objno;
- char *objname;
- hbool_t displayed; /* Flag to indicate that the object has been displayed */
- hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */
+ H5O_token_t obj_token;
+ char *objname;
+ hbool_t displayed; /* Flag to indicate that the object has been displayed */
+ hbool_t recorded; /* Flag for named datatypes to indicate they were found in the group hierarchy */
} obj_t;
/*struct for the tables that the find_objs function uses*/
typedef struct table_t {
+ hid_t fid;
size_t size;
size_t nobjs;
obj_t *objs;
@@ -131,7 +132,7 @@ H5TOOLS_DLL void free_table(table_t *table);
H5TOOLS_DLL void dump_tables(find_objs_t *info)
#endif /* H5DUMP_DEBUG */
H5TOOLS_DLL herr_t init_objs(hid_t fid, find_objs_t *info, table_t **group_table, table_t **dset_table, table_t **type_table);
-H5TOOLS_DLL obj_t *search_obj(table_t *temp, haddr_t objno);
+H5TOOLS_DLL obj_t *search_obj(table_t *temp, const H5O_token_t *obj_token);
#ifndef H5_HAVE_TMPFILE
H5TOOLS_DLL FILE *tmpfile(void);
#endif
@@ -158,9 +159,9 @@ typedef struct {
H5O_type_t trg_type; /* OUT: target type */
char *trg_path; /* OUT: target obj path. This must be freed
* when used with H5tools_get_symlink_info() */
- haddr_t objno; /* OUT: target object address */
+ H5O_token_t obj_token; /* OUT: target object token */
unsigned long fileno; /* OUT: File number that target object is located in */
- H5L_info_t linfo; /* OUT: link info */
+ H5L_info2_t linfo; /* OUT: link info */
h5tool_opt_t opt; /* IN: options */
} h5tool_link_info_t;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 4f4f42a..dc7e27d 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -21,7 +21,7 @@
*-------------------------------------------------------------------------
*/
typedef struct trav_addr_path_t {
- haddr_t addr;
+ H5O_token_t token;
char *path;
} trav_addr_path_t;
@@ -43,7 +43,7 @@ typedef struct {
hbool_t is_absolute; /* Whether the traversal has absolute paths */
const char *base_grp_name; /* Name of the group that serves as the base
* for iteration */
- unsigned fields; /* Fields needed in H5O_info_t struct */
+ unsigned fields; /* Fields needed in H5O_info2_t struct */
} trav_ud_traverse_t;
typedef struct {
@@ -65,10 +65,10 @@ typedef struct trav_path_op_data_t {
*/
static void trav_table_add(trav_table_t *table,
const char *objname,
- const H5O_info_t *oinfo);
+ const H5O_info2_t *oinfo);
static void trav_table_addlink(trav_table_t *table,
- haddr_t objno,
+ const H5O_token_t *obj_token,
const char *path);
/*-------------------------------------------------------------------------
@@ -114,17 +114,17 @@ h5trav_set_verbose(int print_verbose)
*-------------------------------------------------------------------------
*/
-
+
/*-------------------------------------------------------------------------
- * Function: trav_addr_add
+ * Function: trav_token_add
*
- * Purpose: Add a hardlink address to visited data structure
+ * Purpose: Add an object token to visited data structure
*
* Return: void
*-------------------------------------------------------------------------
*/
static void
-trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
+trav_token_add(trav_addr_t *visited, H5O_token_t *token, const char *path)
{
size_t idx; /* Index of address to use */
@@ -136,35 +136,39 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path)
/* Append it */
idx = visited->nused++;
- visited->objs[idx].addr = addr;
+ HDmemcpy(&visited->objs[idx].token, token, sizeof(H5O_token_t));
visited->objs[idx].path = HDstrdup(path);
-} /* end trav_addr_add() */
+} /* end trav_token_add() */
+
-
/*-------------------------------------------------------------------------
- * Function: trav_addr_visited
+ * Function: trav_token_visited
*
- * Purpose: Check if an address has already been visited
+ * Purpose: Check if an object token has already been seen
*
* Return: TRUE/FALSE
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE static const char *
-trav_addr_visited(trav_addr_t *visited, haddr_t addr)
+trav_token_visited(hid_t loc_id, trav_addr_t *visited, H5O_token_t *token)
{
size_t u; /* Local index variable */
+ int token_cmp;
/* Look for address */
- for(u = 0; u < visited->nused; u++)
+ for(u = 0; u < visited->nused; u++) {
/* Check for address already in array */
- if(visited->objs[u].addr == addr)
+ if(H5Otoken_cmp(loc_id, &visited->objs[u].token, token, &token_cmp) < 0)
+ return NULL;
+ if(!token_cmp)
return(visited->objs[u].path);
+ }
- /* Didn't find address */
+ /* Didn't find object token */
return(NULL);
-} /* end trav_addr_visited() */
+} /* end trav_token_visited() */
+
-
/*-------------------------------------------------------------------------
* Function: traverse_cb
*
@@ -172,7 +176,7 @@ trav_addr_visited(trav_addr_t *visited, haddr_t addr)
*-------------------------------------------------------------------------
*/
static herr_t
-traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
+traverse_cb(hid_t loc_id, const char *path, const H5L_info2_t *linfo,
void *_udata)
{
trav_ud_traverse_t *udata = (trav_ud_traverse_t *)_udata; /* User data */
@@ -199,10 +203,10 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
/* Perform the correct action for different types of links */
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Get information about the object */
- if(H5Oget_info_by_name2(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(loc_id, path, &oinfo, udata->fields, H5P_DEFAULT) < 0) {
if(new_name)
HDfree(new_name);
return(H5_ITER_ERROR);
@@ -212,8 +216,8 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
* already visited, if it isn't there already
*/
if(oinfo.rc > 1)
- if(NULL == (already_visited = trav_addr_visited(udata->seen, oinfo.addr)))
- trav_addr_add(udata->seen, oinfo.addr, full_name);
+ if(NULL == (already_visited = trav_token_visited(loc_id, udata->seen, &oinfo.token)))
+ trav_token_add(udata->seen, &oinfo.token, full_name);
/* Make 'visit object' callback */
if(udata->visitor->visit_obj)
@@ -239,7 +243,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
return(H5_ITER_CONT);
} /* end traverse_cb() */
-
+
/*-------------------------------------------------------------------------
* Function: traverse
*
@@ -254,12 +258,12 @@ static int
traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
hbool_t recurse, const trav_visitor_t *visitor, unsigned fields)
{
- H5O_info_t oinfo; /* Object info for starting group */
- int ret_value = SUCCEED;
+ H5O_info2_t oinfo; /* Object info for starting group */
+ int ret_value = 0;
/* 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");
+ if(H5Oget_info_by_name3(file_id, grp_name, &oinfo, fields, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Oget_info_by_name failed");
/* Visit the starting object */
if(visit_start && visitor->visit_obj)
@@ -276,7 +280,7 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
/* Check for multiple links to top group */
if(oinfo.rc > 1)
- trav_addr_add(&seen, oinfo.addr, grp_name);
+ trav_token_add(&seen, &oinfo.token, grp_name);
/* Set up user data structure */
udata.seen = &seen;
@@ -288,13 +292,13 @@ traverse(hid_t file_id, const char *grp_name, hbool_t visit_start,
/* Check for iteration of links vs. visiting all links recursively */
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");
+ if(H5Lvisit_by_name2(file_id, grp_name, trav_index_by, trav_index_order, traverse_cb, &udata, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "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");
+ if(H5Literate_by_name2(file_id, grp_name, trav_index_by, trav_index_order, NULL, traverse_cb, &udata, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Literate_by_name failed");
} /* end else */
/* Free visited addresses table */
@@ -312,7 +316,7 @@ done:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_add
*
@@ -338,7 +342,9 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
info->paths[idx].path = HDstrdup(path);
info->paths[idx].type = obj_type;
info->paths[idx].fileno = 0;
- info->paths[idx].objno = HADDR_UNDEF;
+
+ /* Set token to 'undefined' values */
+ info->paths[idx].obj_token = H5O_TOKEN_UNDEF;
}
} /* end trav_info_add() */
@@ -354,19 +360,19 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type)
void
trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
size_t idx = info->nused - 1;
- if ( info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
- H5Oget_info_by_name2(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ if(info->paths[idx].path && HDstrcmp(info->paths[idx].path, "."))
+ H5Oget_info_by_name3(loc_id, info->paths[idx].path, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
else
- H5Oget_info2(loc_id, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC);
- info->paths[idx].objno = oinfo.addr;
+ HDmemcpy(&info->paths[idx].obj_token, &oinfo.token, sizeof(H5O_token_t));
info->paths[idx].fileno = oinfo.fileno;
} /* end trav_fileinfo_add() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_visit_obj
*
@@ -377,7 +383,7 @@ trav_fileinfo_add(trav_info_t *info, hid_t loc_id)
*-------------------------------------------------------------------------
*/
int
-trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
+trav_info_visit_obj(const char *path, const H5O_info2_t *oinfo,
const char H5_ATTR_UNUSED *already_visited, void *udata)
{
size_t idx;
@@ -390,13 +396,13 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
/* set object addr and fileno. These are for checking same object */
info_p = (trav_info_t *) udata;
idx = info_p->nused - 1;
- info_p->paths[idx].objno = oinfo->addr;
+ HDmemcpy(&info_p->paths[idx].obj_token, &oinfo->token, sizeof(H5O_token_t));
info_p->paths[idx].fileno = oinfo->fileno;
return(0);
} /* end trav_info_visit_obj() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_visit_lnk
*
@@ -407,7 +413,7 @@ trav_info_visit_obj(const char *path, const H5O_info_t *oinfo,
*-------------------------------------------------------------------------
*/
int
-trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
+trav_info_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata)
{
/* Add the link to the 'info' struct */
trav_info_add((trav_info_t *)udata, path, ((linfo->type == H5L_TYPE_SOFT) ? H5TRAV_TYPE_LINK : H5TRAV_TYPE_UDLINK));
@@ -415,7 +421,7 @@ trav_info_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
return(0);
} /* end trav_info_visit_lnk() */
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_getinfo
*
@@ -430,7 +436,7 @@ int
h5trav_getinfo(hid_t file_id, trav_info_t *info)
{
trav_visitor_t info_visitor; /* Visitor structure for trav_info_t's */
- int ret_value = SUCCEED;
+ int ret_value = 0;
/* Init visitor structure */
info_visitor.visit_obj = trav_info_visit_obj;
@@ -439,7 +445,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((-1), "traverse failed");
done:
return ret_value;
@@ -501,7 +507,7 @@ trav_info_init(const char *filename, hid_t fileid, trav_info_t **_info)
*_info = info;
} /* end trav_info_init() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_info_free
*
@@ -536,7 +542,7 @@ trav_info_free(trav_info_t *info)
*-------------------------------------------------------------------------
*/
-
+
/*-------------------------------------------------------------------------
* Function: trav_table_visit_obj
*
@@ -547,7 +553,7 @@ trav_info_free(trav_info_t *info)
*-------------------------------------------------------------------------
*/
static int
-trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
+trav_table_visit_obj(const char *path, const H5O_info2_t *oinfo,
const char *already_visited, void *udata)
{
trav_table_t *table = (trav_table_t *)udata;
@@ -558,12 +564,12 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
trav_table_add(table, path, oinfo);
else
/* Add alias for object to table */
- trav_table_addlink(table, oinfo->addr, path);
+ trav_table_addlink(table, &oinfo->token, path);
return 0;
} /* end trav_table_visit_obj() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_table_visit_lnk
*
@@ -574,7 +580,7 @@ trav_table_visit_obj(const char *path, const H5O_info_t *oinfo,
*-------------------------------------------------------------------------
*/
static int
-trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, void *udata)
+trav_table_visit_lnk(const char *path, const H5L_info2_t H5_ATTR_UNUSED *linfo, void *udata)
{
/* Add the link to the 'table' struct */
trav_table_add((trav_table_t *)udata, path, NULL);
@@ -582,7 +588,7 @@ trav_table_visit_lnk(const char *path, const H5L_info_t H5_ATTR_UNUSED *linfo, v
return 0;
} /* end trav_table_visit_lnk() */
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_gettable
*
@@ -596,7 +602,7 @@ int
h5trav_gettable(hid_t fid, trav_table_t *table)
{
trav_visitor_t table_visitor; /* Visitor structure for trav_table_t's */
- int ret_value = SUCCEED;
+ int ret_value = 0;
/* Init visitor structure */
table_visitor.visit_obj = trav_table_visit_obj;
@@ -605,7 +611,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((-1), "traverse failed");
done:
return ret_value;
@@ -663,9 +669,7 @@ h5trav_getindext(const char *name, const trav_table_t *table)
*-------------------------------------------------------------------------
*/
static void
-trav_table_add(trav_table_t *table,
- const char *path,
- const H5O_info_t *oinfo)
+trav_table_add(trav_table_t *table, const char *path, const H5O_info2_t *oinfo)
{
size_t new_obj;
@@ -676,7 +680,11 @@ trav_table_add(trav_table_t *table,
} /* end if */
new_obj = table->nobjs++;
- table->objs[new_obj].objno = oinfo ? oinfo->addr : HADDR_UNDEF;
+ if(oinfo)
+ HDmemcpy(&table->objs[new_obj].obj_token, &oinfo->token, sizeof(H5O_token_t));
+ else
+ /* Set token to 'undefined' values */
+ table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF;
table->objs[new_obj].flags[0] = table->objs[new_obj].flags[1] = 0;
table->objs[new_obj].is_same_trgobj = 0;
table->objs[new_obj].name = (char *)HDstrdup(path);
@@ -696,13 +704,16 @@ trav_table_add(trav_table_t *table,
*-------------------------------------------------------------------------
*/
static void
-trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
+trav_table_addlink(trav_table_t *table, const H5O_token_t *obj_token, const char *path)
{
size_t i; /* Local index variable */
+ int token_cmp;
if(table) {
for(i = 0; i < table->nobjs; i++) {
- if(table->objs[i].objno == objno) {
+ if(H5Otoken_cmp(table->fid, &table->objs[i].obj_token, obj_token, &token_cmp) < 0)
+ return;
+ if(!token_cmp) {
size_t n;
/* already inserted? */
@@ -720,9 +731,9 @@ trav_table_addlink(trav_table_t *table, haddr_t objno, const char *path)
table->objs[i].links[n].new_name = (char *)HDstrdup(path);
return;
- } /* end for */
+ } /* end if */
} /* end for */
- }
+ } /* end if */
}
@@ -748,7 +759,10 @@ void trav_table_addflags(unsigned *flags,
} /* end if */
new_obj = table->nobjs++;
- table->objs[new_obj].objno = 0;
+
+ /* Set token to 'undefined' values */
+ table->objs[new_obj].obj_token = H5O_TOKEN_UNDEF;
+
table->objs[new_obj].flags[0] = flags[0];
table->objs[new_obj].flags[1] = flags[1];
table->objs[new_obj].is_same_trgobj = 0;
@@ -769,10 +783,11 @@ void trav_table_addflags(unsigned *flags,
* Return: void
*-------------------------------------------------------------------------
*/
-void trav_table_init(trav_table_t **tbl)
+void trav_table_init(hid_t fid, trav_table_t **tbl)
{
trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t));
if(table) {
+ table->fid = fid;
table->size = 0;
table->nobjs = 0;
table->objs = NULL;
@@ -834,8 +849,8 @@ trav_attr(hid_t
#ifdef H5TRAV_PRINT_SPACE
}
else {
- hid_t attr = -1;
- hid_t space = -1;
+ hid_t attr = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hsize_t size[H5S_MAX_RANK];
int ndims;
int i;
@@ -882,7 +897,7 @@ trav_attr(hid_t
return(0);
}
-
+
/*-------------------------------------------------------------------------
* Function: trav_print_visit_obj
*
@@ -893,8 +908,8 @@ trav_attr(hid_t
*-------------------------------------------------------------------------
*/
static int
-trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
- const char *already_visited, void *udata)
+trav_print_visit_obj(const char *path, const H5O_info2_t *oinfo,
+ const char *already_visited, void *udata)
{
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
/* Print the name of the object */
@@ -940,7 +955,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
return(0);
} /* end trav_print_visit_obj() */
-
+
/*-------------------------------------------------------------------------
* Function: trav_print_visit_lnk
*
@@ -951,7 +966,7 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo,
*-------------------------------------------------------------------------
*/
static int
-trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
+trav_print_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata)
{
trav_print_udata_t *print_udata = (trav_print_udata_t *)udata;
@@ -1004,7 +1019,7 @@ trav_print_visit_lnk(const char *path, const H5L_info_t *linfo, void *udata)
return(0);
} /* end trav_print_visit_lnk() */
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_print
*
@@ -1019,7 +1034,7 @@ h5trav_print(hid_t fid)
{
trav_print_udata_t print_udata; /* User data for traversal */
trav_visitor_t print_visitor; /* Visitor structure for printing objects */
- int ret_value = SUCCEED;
+ int ret_value = 0;
/* Init user data for printing */
print_udata.fid = fid;
@@ -1031,13 +1046,13 @@ 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;
}
-
+
/*-------------------------------------------------------------------------
* Function: h5trav_visit
*
@@ -1053,7 +1068,7 @@ h5trav_visit(hid_t fid, const char *grp_name, hbool_t visit_start,
void *udata, unsigned fields)
{
trav_visitor_t visitor; /* Visitor structure for objects */
- int ret_value = SUCCEED;
+ int ret_value = 0;
/* Init visitor structure */
visitor.visit_obj = visit_obj;
@@ -1062,7 +1077,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((-1), "traverse failed");
done:
return ret_value;
@@ -1080,8 +1095,8 @@ done:
herr_t
symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path)
{
- herr_t ret_value = SUCCEED;
- size_t idx; /* Index of address to use */
+ size_t idx; /* Index of address to use */
+ herr_t ret_value = SUCCEED;
/* Allocate space if necessary */
if(visited->nused == visited->nalloc) {
@@ -1089,7 +1104,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 +1118,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,14 +1126,14 @@ 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:
return ret_value;
} /* end symlink_visit_add() */
-
+
/*-------------------------------------------------------------------------
* Function: symlink_is_visited
*
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index a1d33b7..88473ad 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -17,9 +17,9 @@
#include "hdf5.h"
/* Typedefs for visiting objects */
-typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info_t *oinfo,
+typedef herr_t (*h5trav_obj_func_t)(const char *path_name, const H5O_info2_t *oinfo,
const char *first_seen, void *udata);
-typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info_t *linfo,
+typedef herr_t (*h5trav_lnk_func_t)(const char *path_name, const H5L_info2_t *linfo,
void *udata);
/*-------------------------------------------------------------------------
@@ -65,7 +65,7 @@ typedef struct symlink_trav_t {
typedef struct trav_path_t {
char *path;
h5trav_type_t type;
- haddr_t objno; /* object address */
+ H5O_token_t obj_token; /* object token */
unsigned long fileno; /* File number that object is located in */
} trav_path_t;
@@ -95,7 +95,7 @@ typedef struct trav_link_t {
*/
typedef struct trav_obj_t {
- haddr_t objno; /* object address */
+ H5O_token_t obj_token; /* object token */
unsigned flags[2]; /* h5diff.object is present or not in both files*/
hbool_t is_same_trgobj; /* same target object? no need to compare */
char *name; /* name */
@@ -112,6 +112,7 @@ typedef struct trav_obj_t {
*/
typedef struct trav_table_t {
+ hid_t fid;
size_t size;
size_t nobjs;
trav_obj_t *objs;
@@ -144,8 +145,8 @@ H5TOOLS_DLL hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type,
*/
H5TOOLS_DLL int h5trav_getinfo(hid_t file_id, trav_info_t *info);
H5TOOLS_DLL ssize_t h5trav_getindex(const trav_info_t *info, const char *obj);
-H5TOOLS_DLL int trav_info_visit_obj (const char *path, const H5O_info_t *oinfo, const char *already_visited, void *udata);
-H5TOOLS_DLL int trav_info_visit_lnk (const char *path, const H5L_info_t *linfo, void *udata);
+H5TOOLS_DLL int trav_info_visit_obj(const char *path, const H5O_info2_t *oinfo, const char *already_visited, void *udata);
+H5TOOLS_DLL int trav_info_visit_lnk(const char *path, const H5L_info2_t *linfo, void *udata);
/*-------------------------------------------------------------------------
* "h5trav table" public functions
@@ -184,7 +185,7 @@ H5TOOLS_DLL void trav_fileinfo_add(trav_info_t *info, hid_t loc_id);
*-------------------------------------------------------------------------
*/
-H5TOOLS_DLL void trav_table_init(trav_table_t **table);
+H5TOOLS_DLL void trav_table_init(hid_t fid, trav_table_t **table);
H5TOOLS_DLL void trav_table_free(trav_table_t *table);
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index cb89019..472824b 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -138,43 +138,43 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop)
switch(pt->type){
#ifdef H5_HAVE_PARALLEL
case MPI_CLOCK:
- if (start_stop == TSTART) {
- pt->mpi_timer[t] = MPI_Wtime();
-
- /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
- * we compute the time it took to only open the file */
- if(t == HDF5_FINE_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS];
- else if(t == HDF5_FINE_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS];
-
- } else {
- pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t];
- pt->mpi_timer[t] = MPI_Wtime();
-
- /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
- * we compute the time it took to close the file after the last read/write finished */
- if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS];
- else if(t == HDF5_GROSS_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS];
- }
- break;
+ if (start_stop == TSTART) {
+ pt->mpi_timer[t] = MPI_Wtime();
+
+ /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
+ * we compute the time it took to only open the file */
+ if(t == HDF5_FINE_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_WRITE_FIXED_DIMS];
+ else if(t == HDF5_FINE_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_OPEN] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_GROSS_READ_FIXED_DIMS];
+
+ } else {
+ pt->total_time[t] += MPI_Wtime() - pt->mpi_timer[t];
+ pt->mpi_timer[t] = MPI_Wtime();
+
+ /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
+ * we compute the time it took to close the file after the last read/write finished */
+ if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_WRITE_FIXED_DIMS];
+ else if(t == HDF5_GROSS_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_CLOSE] += pt->mpi_timer[t] - pt->mpi_timer[HDF5_FINE_READ_FIXED_DIMS];
+ }
+ break;
#else
case MPI_CLOCK:
- HDfprintf(stderr, "MPI clock set in serial library\n");
- return NULL;
+ HDfprintf(stderr, "MPI clock set in serial library\n");
+ return NULL;
#endif /* H5_HAVE_PARALLEL */
case SYS_CLOCK:
if (start_stop == TSTART) {
HDgettimeofday(&pt->sys_timer[t], NULL);
- /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
- * we compute the time it took to only open the file */
- if(t == HDF5_FINE_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS]));
- else if(t == HDF5_FINE_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS]));
+ /* When we start the timer for HDF5_FINE_WRITE_FIXED_DIMS or HDF5_FINE_READ_FIXED_DIMS
+ * we compute the time it took to only open the file */
+ if(t == HDF5_FINE_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_WRITE_FIXED_DIMS]));
+ else if(t == HDF5_FINE_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_OPEN] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_GROSS_READ_FIXED_DIMS]));
} else {
@@ -183,19 +183,19 @@ io_time_set(io_time_t *pt, timer_type t, int start_stop)
HDgettimeofday(&sys_t, NULL);
pt->total_time[t] += sub_time(&sys_t, &(pt->sys_timer[t]));
- /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
- * we compute the time it took to close the file after the last read/write finished */
- if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
- pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS]));
- else if(t == HDF5_GROSS_READ_FIXED_DIMS)
- pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS]));
+ /* When we stop the timer for HDF5_GROSS_WRITE_FIXED_DIMS or HDF5_GROSS_READ_FIXED_DIMS
+ * we compute the time it took to close the file after the last read/write finished */
+ if(t == HDF5_GROSS_WRITE_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_WRITE_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_WRITE_FIXED_DIMS]));
+ else if(t == HDF5_GROSS_READ_FIXED_DIMS)
+ pt->total_time[HDF5_FILE_READ_CLOSE] += sub_time(&(pt->sys_timer[t]), &(pt->sys_timer[HDF5_FINE_READ_FIXED_DIMS]));
}
- break;
+ break;
default:
- HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
- return NULL;
+ HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
+ return NULL;
} /* end switch */
#if 0
@@ -221,10 +221,3 @@ io_time_get(io_time_t *pt, timer_type t)
return pt->total_time[t];
}
-
-#if 0
-/* standalone is not working yet. Need fix later. -AKC- */
-#ifdef STANDALONE
-#include "pio_standalone.c"
-#endif
-#endif
diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h
index 78bf676..c1fa58e 100644
--- a/tools/lib/io_timer.h
+++ b/tools/lib/io_timer.h
@@ -28,6 +28,7 @@
#ifdef H5_HAVE_WINSOCK2_H
# include <winsock2.h>
#endif /* H5_HAVE_WINSOCK2_H */
+
/* The different types of timers we can have */
typedef enum timer_type_ {
HDF5_FILE_OPENCLOSE,
@@ -70,10 +71,19 @@ typedef struct io_time_t {
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
+
+#ifdef STANDALONE
+io_time_t *io_time_new(clock_type t);
+void io_time_destroy(io_time_t *pt);
+io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop);
+double io_time_get(io_time_t *pt, timer_type t);
+#else
H5TOOLS_DLL io_time_t *io_time_new(clock_type t);
H5TOOLS_DLL void io_time_destroy(io_time_t *pt);
H5TOOLS_DLL io_time_t *io_time_set(io_time_t *pt, timer_type t, int start_stop);
H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t);
+#endif
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/tools/libtest/CMakeLists.txt b/tools/libtest/CMakeLists.txt
index f3d28da..5f53272 100644
--- a/tools/libtest/CMakeLists.txt
+++ b/tools/libtest/CMakeLists.txt
@@ -15,4 +15,6 @@ else ()
endif ()
set_target_properties (h5tools_test_utils PROPERTIES FOLDER tools)
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c
index 120f803..726f4c4 100644
--- a/tools/libtest/h5tools_test_utils.c
+++ b/tools/libtest/h5tools_test_utils.c
@@ -1000,7 +1000,7 @@ test_set_configured_fapl(void)
* TEST-LOCAL VARIABLES *
************************/
- hid_t fapl_id = -1;
+ hid_t fapl_id = H5I_INVALID_HID;
other_fa_t wrong_fa = {0x432, 0xf82, 0x9093};
H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""};
H5FD_ros3_fapl_t ros3_auth_fa = {
@@ -1150,7 +1150,7 @@ test_set_configured_fapl(void)
int result;
testcase C = cases[i];
- fapl_id = -1;
+ fapl_id = H5I_INVALID_HID;
#if UTIL_TEST_DEBUG
HDfprintf(stderr, "setup test %d\t%s\n", i, C.message); fflush(stderr);
@@ -1183,7 +1183,7 @@ test_set_configured_fapl(void)
if (fapl_id > 0) {
FAIL_IF( FAIL == H5Pclose(fapl_id) )
}
- fapl_id = -1;
+ fapl_id = H5I_INVALID_HID;
#if UTIL_TEST_DEBUG
HDfprintf(stderr, "after cleanup\n"); fflush(stderr);
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index ffcd2b9..e1370e2 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -207,13 +207,12 @@ static int parse_flag(const char* s_flag, unsigned *flag)
int
main (int argc, const char *argv[])
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
H5E_auto2_t func;
H5E_auto2_t tools_func;
void *edata;
void *tools_edata;
- hid_t fid_src = -1;
- hid_t fid_dst = -1;
+ hid_t fid_src = H5I_INVALID_HID;
+ hid_t fid_dst = H5I_INVALID_HID;
unsigned flag = 0;
unsigned verbose = 0;
unsigned parents = 0;
@@ -222,6 +221,7 @@ main (int argc, const char *argv[])
int opt;
int li_ret;
h5tool_link_info_t linkinfo;
+ int ret_value = 0;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -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/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt
index 96ed6ad..c1021e4 100644
--- a/tools/src/h5diff/CMakeLists.txt
+++ b/tools/src/h5diff/CMakeLists.txt
@@ -10,6 +10,7 @@ if (NOT ONLY_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
)
target_include_directories (h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ #target_compile_definitions(h5diff PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5diff STATIC)
target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5diff PROPERTIES FOLDER tools)
@@ -23,6 +24,7 @@ if (BUILD_SHARED_LIBS)
${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c
)
target_include_directories (h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ #target_compile_definitions(h5diff-shared PRIVATE H5_TOOLS_DEBUG)
TARGET_C_PROPERTIES (h5diff-shared SHARED)
target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5diff-shared PROPERTIES FOLDER tools)
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/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index 380ab3b..5ba5fb3 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -126,7 +126,8 @@ int main(int argc, const char *argv[])
static void
ph5diff_worker(int nID)
{
- hid_t file1_id = -1, file2_id = -1;
+ hid_t file1_id = H5I_INVALID_HID;
+ hid_t file2_id = H5I_INVALID_HID;
while(1)
{
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index 0222c8b..d97fdc0 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -1393,12 +1393,12 @@ error:
int
main(int argc, const char *argv[])
{
- hid_t fid = -1;
- hid_t gid = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
hid_t fapl_id = H5P_DEFAULT;
H5E_auto2_t func;
H5E_auto2_t tools_func;
- H5O_info_t oi;
+ H5O_info2_t oi;
struct handler_t *hand = NULL;
int i;
unsigned u;
@@ -1567,7 +1567,7 @@ main(int argc, const char *argv[])
}
/* Get object info for root group */
- if(H5Oget_info_by_name2(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(fid, "/", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
h5tools_setstatus(EXIT_FAILURE);
goto done;
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index bc426f2..a410fda 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -31,7 +31,7 @@ typedef struct {
} trav_attr_udata_t;
/* callback function used by H5Literate() */
-static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void *op_data);
+static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void *op_data);
static int dump_extlink(hid_t group, const char *linkname, const char *objname);
/*-------------------------------------------------------------------------
@@ -152,7 +152,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
*-------------------------------------------------------------------------
*/
static herr_t
-dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
@@ -200,10 +200,10 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
HDstrcat(obj_path, name);
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
@@ -259,7 +259,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj == NULL) {
ctx.indent_level++;
@@ -596,9 +596,9 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
/* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group, then, sort by creation order, otherwise by name */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL);
}
/*-------------------------------------------------------------------------
@@ -612,9 +612,9 @@ link_iteration(hid_t gid, unsigned crt_order_flags)
void
dump_named_datatype(hid_t tid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
unsigned attr_crt_order_flags;
- hid_t tcpl_id = -1; /* datatype creation property list ID */
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -670,7 +670,7 @@ dump_named_datatype(hid_t tid, const char *name)
h5tools_dump_header_format->datatypeblockbegin);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
@@ -678,7 +678,7 @@ dump_named_datatype(hid_t tid, const char *name)
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(type_table, oinfo.addr);
+ found_obj = search_obj(type_table, &oinfo.token);
if (found_obj == NULL) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
@@ -739,7 +739,7 @@ done:
void
dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t dset;
hid_t type;
hid_t gcpl_id;
@@ -816,9 +816,15 @@ dump_group(hid_t gid, const char *name)
/* dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++)
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -830,7 +836,7 @@ dump_group(hid_t gid, const char *name)
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
- H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC);
/* Must check for uniqueness of all objects if we've traversed an elink,
* otherwise only check if the reference count > 1.
@@ -838,7 +844,7 @@ dump_group(hid_t gid, const char *name)
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(group_table, oinfo.addr);
+ found_obj = search_obj(group_table, &oinfo.token);
if (found_obj == NULL) {
error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
@@ -1251,8 +1257,13 @@ dump_fcontents(hid_t fid)
unsigned u;
for (u = 0; u < type_table->nobjs; u++) {
- if (!type_table->objs[u].recorded)
- PRINTSTREAM(rawoutstream, " %-10s /#"H5_PRINTF_HADDR_FMT"\n", "datatype", type_table->objs[u].objno);
+ if (!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
+ H5Otoken_to_str(fid, &type_table->objs[u].obj_token, &obj_addr_str);
+ PRINTSTREAM(rawoutstream, " %-10s /#%s\n", "datatype", obj_addr_str);
+ H5free_memory(obj_addr_str);
+ }
}
}
@@ -1319,7 +1330,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a
} /* end attr_search() */
static herr_t
-obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
+obj_search(const char *path, const H5O_info2_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data)
{
trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data;
const char *op_name = handle_data->op_name;
@@ -1356,7 +1367,7 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al
} /* end obj_search() */
static herr_t
-lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
+lnk_search(const char *path, const H5L_info2_t *li, void *_op_data)
{
size_t search_len;
size_t k;
@@ -1415,7 +1426,7 @@ lnk_search(const char *path, const H5L_info_t *li, void *_op_data)
void
handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- hid_t gid = -1;
+ hid_t gid = H5I_INVALID_HID;
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
@@ -1469,8 +1480,8 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H
void
handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- hid_t oid = -1;
- hid_t attr_id = -1;
+ hid_t oid = H5I_INVALID_HID;
+ hid_t attr_id = H5I_INVALID_HID;
char *obj_name = NULL;
char *attr_name = NULL;
int j;
@@ -1608,7 +1619,7 @@ error:
void
handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *display_name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t dsetid;
hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */
struct subset_t *sset = (struct subset_t *)data;
@@ -1719,11 +1730,11 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
} /* end if */
- H5Oget_info2(dsetid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(dsetid, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj) {
if (found_obj->displayed) {
@@ -1812,9 +1823,9 @@ handle_groups(hid_t fid, const char *group, void H5_ATTR_UNUSED *data, int pe, c
void
handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_ATTR_UNUSED pe, const char H5_ATTR_UNUSED *display_name)
{
- H5L_info_t linfo;
+ H5L_info2_t linfo;
- if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
+ if(H5Lget_info2(fid, links, &linfo, H5P_DEFAULT) < 0) {
error_msg("unable to get link info from \"%s\"\n", links);
h5tools_setstatus(EXIT_FAILURE);
}
@@ -1903,8 +1914,12 @@ handle_datatypes(hid_t fid, const char *type, void H5_ATTR_UNUSED * data, int pe
char name[128];
if(!type_table->objs[idx].recorded) {
+ char *obj_addr_string = NULL;
+
/* unamed datatype */
- HDsprintf(name, "/#"H5_PRINTF_HADDR_FMT, type_table->objs[idx].objno);
+ H5Otoken_to_str(fid, &type_table->objs[idx].obj_token, &obj_addr_string);
+ HDsprintf(name, "/#%s", obj_addr_string);
+ H5free_memory(obj_addr_string);
if(!HDstrcmp(name, real_name))
break;
@@ -1962,7 +1977,7 @@ static int
dump_extlink(hid_t group, const char *linkname, const char *objname)
{
hid_t oid;
- H5O_info_t oi;
+ H5O_info2_t oi;
table_t *old_group_table = group_table;
table_t *old_dset_table = dset_table;
table_t *old_type_table = type_table;
@@ -1974,7 +1989,7 @@ dump_extlink(hid_t group, const char *linkname, const char *objname)
goto fail;
/* Get object info */
- if (H5Oget_info2(oid, &oi, H5O_INFO_BASIC) < 0) {
+ if (H5Oget_info3(oid, &oi, H5O_INFO_BASIC) < 0) {
H5Oclose(oid);
goto fail;
}
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index b63e68d..7a3ad80 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -106,7 +106,7 @@ static h5tool_format_t xml_dataformat = {
/* internal functions */
-static int xml_name_to_XID(const char *, char *, int , int );
+static int xml_name_to_XID(hid_t, const char *, char *, int, int);
/* internal functions used by XML option */
static void xml_print_datatype(hid_t, unsigned);
@@ -130,7 +130,7 @@ static char *xml_escape_the_name(const char *);
*-------------------------------------------------------------------------
*/
static herr_t
-xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data)
+xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATTR_UNUSED *op_data)
{
hid_t obj;
herr_t ret = SUCCEED;
@@ -177,10 +177,10 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
HDstrcat(obj_path, name);
if(linfo->type == H5L_TYPE_HARD) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Stat the object */
- if(H5Oget_info_by_name2(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(group, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
error_msg("unable to get object information for \"%s\"\n", name);
h5tools_setstatus(EXIT_FAILURE);
ret = FAIL;
@@ -225,7 +225,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
if(oinfo.rc > 1 || hit_elink) {
obj_t *found_obj; /* Found object */
- found_obj = search_obj(dset_table, oinfo.addr);
+ found_obj = search_obj(dset_table, &oinfo.token);
if(found_obj == NULL) {
ctx.indent_level++;
@@ -272,8 +272,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char pointerxid[100];
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(obj_path, dsetxid, (int)sizeof(dsetxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(obj, obj_path, dsetxid, (int)sizeof(dsetxid), 1);
+ xml_name_to_XID(obj, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -290,7 +290,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
t_prefix); /* H5ParentPaths */
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+ xml_name_to_XID(obj, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
ctx.indent_level++;
@@ -393,11 +393,11 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
} /* end else */
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
/* Try to create an OBJ-XID for the object pointed to */
- res = xml_name_to_XID(t_link_path, targetxid, (int)sizeof(targetxid), 0);
+ res = xml_name_to_XID(group, t_link_path, targetxid, (int)sizeof(targetxid), 0);
if (res == 0) {
/* target obj found */
ctx.need_prefix = TRUE;
@@ -482,8 +482,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char *t_targname = xml_escape_the_name(targname);
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -528,8 +528,8 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_
char *t_obj_path = xml_escape_the_name(obj_path);
/* Create OBJ-XIDs for the parent and object */
- xml_name_to_XID(t_obj_path, linkxid, (int)sizeof(linkxid), 1);
- xml_name_to_XID(prefix, parentxid, (int)sizeof(parentxid), 1);
+ xml_name_to_XID(group, t_obj_path, linkxid, (int)sizeof(linkxid), 1);
+ xml_name_to_XID(group, prefix, parentxid, (int)sizeof(parentxid), 1);
ctx.need_prefix = TRUE;
@@ -575,20 +575,26 @@ done:
* 1 - generate a fake entry and return fake id.
*/
int
-xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
+xml_name_to_XID(hid_t loc_id, const char *str, char *outstr, int outlen, int gen)
{
- haddr_t objno; /* Object ID for object at path */
+ H5O_token_t obj_token;
+ char *obj_addr_str = NULL;
+ int lookup_ret;
if (outlen < 22) return 1;
- objno = ref_path_table_lookup(str);
- if (objno == HADDR_UNDEF) {
+ lookup_ret = ref_path_table_lookup(str, &obj_token);
+ if (lookup_ret < 0) {
if (HDstrlen(str) == 0) {
- objno = ref_path_table_lookup("/");
- if (objno == HADDR_UNDEF) {
+ lookup_ret = ref_path_table_lookup("/", &obj_token);
+ if (lookup_ret < 0) {
if (gen) {
- objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ ref_path_table_gen_fake(str, &obj_token);
+
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
return 0;
}
else {
@@ -598,8 +604,12 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
else {
if (gen) {
- objno = ref_path_table_gen_fake(str);
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ ref_path_table_gen_fake(str, &obj_token);
+
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
return 0;
}
else {
@@ -608,7 +618,9 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen)
}
}
- HDsprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, objno);
+ H5Otoken_to_str(loc_id, &obj_token, &obj_addr_str);
+ HDsprintf(outstr, "xid_%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
return 0;
}
@@ -878,12 +890,12 @@ xml_print_datatype(hid_t type, unsigned in_group)
outputformat = &string_dataformat;
if(!in_group && H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
obj_t *found_obj; /* Found object */
/* detect a shared datatype, output only once */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- found_obj = search_obj(type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ found_obj = search_obj(type_table, &oinfo.token);
if(found_obj) {
/* This should be defined somewhere else */
@@ -891,7 +903,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
probably will have something different eventually */
char * dtxid = (char *)HDmalloc((size_t)100);
- xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
/* 'anonymous' NDT. Use it's object num.
as it's name. */
@@ -1531,19 +1543,19 @@ xml_dump_datatype(hid_t type)
dump_indent += COL;
if(H5Tcommitted(type) > 0) {
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
obj_t *found_obj; /* Found object */
/* Datatype is a shared or named datatype */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
- found_obj = search_obj(type_table, oinfo.addr);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
+ found_obj = search_obj(type_table, &oinfo.token);
if(found_obj) {
/* Shared datatype, must be entered as an object */
/* These 2 cases are the same now, but may change */
char *dtxid = (char *)HDmalloc((size_t)100);
- xml_name_to_XID(found_obj->objname, dtxid, 100, 1);
+ xml_name_to_XID(type, found_obj->objname, dtxid, 100, 1);
if (!found_obj->recorded) {
/* anonymous stored datatype:
following the dumper's current
@@ -1783,9 +1795,9 @@ xml_dump_dataspace(hid_t space)
void
xml_dump_data(hid_t obj_id, int obj_data, struct subset_t H5_ATTR_UNUSED *sset, int H5_ATTR_UNUSED pindex)
{
- hid_t space = -1;
- hid_t type = -1;
- hid_t p_type = -1;
+ hid_t space = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t p_type = H5I_INVALID_HID;
hsize_t size[64];
hsize_t nelmts = 1;
int ndims;
@@ -1950,9 +1962,9 @@ herr_t
xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *info,
void H5_ATTR_UNUSED * op_data)
{
- hid_t attr_id = -1;
- hid_t type = -1;
- hid_t space = -1;
+ hid_t attr_id = H5I_INVALID_HID;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
H5S_class_t space_type;
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
@@ -2293,8 +2305,8 @@ xml_dump_named_datatype(hid_t type, const char *name)
t_prefix = xml_escape_the_name(prefix);
t_name = xml_escape_the_name(name);
- xml_name_to_XID(tmp, dtxid, 100, 1);
- xml_name_to_XID(prefix, parentxid, 100, 1);
+ xml_name_to_XID(type, tmp, dtxid, 100, 1);
+ xml_name_to_XID(type, prefix, parentxid, 100, 1);
if(HDstrncmp(name, "#", (size_t)1) == 0) {
/* Special: this is an 'anonymous' NDT, deleted but
still in use.
@@ -2317,7 +2329,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
}
else {
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
ctx.need_prefix = TRUE;
@@ -2331,12 +2343,12 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
/* Check uniqueness of named datatype */
- H5Oget_info2(type, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(type, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(type_table, oinfo.addr);
+ found_obj = search_obj(type_table, &oinfo.token);
if (found_obj == NULL) {
indentation(dump_indent);
@@ -2353,7 +2365,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
ctx.indent_level++;
- xml_name_to_XID(found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
+ xml_name_to_XID(type, found_obj->objname, pointerxid, (int)sizeof(pointerxid), 1);
ctx.need_prefix = TRUE;
@@ -2436,7 +2448,7 @@ done:
void
xml_dump_group(hid_t gid, const char *name)
{
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
hid_t gcpl_id;
hid_t dset, type;
unsigned crt_order_flags;
@@ -2517,13 +2529,13 @@ xml_dump_group(hid_t gid, const char *name)
}
}
- H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC);
+ H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC);
if(oinfo.rc > 1) {
obj_t *found_obj; /* Found object */
/* Group with more than one link to it... */
- found_obj = search_obj(group_table, oinfo.addr);
+ found_obj = search_obj(group_table, &oinfo.token);
if (found_obj == NULL) {
indentation(dump_indent);
@@ -2541,7 +2553,7 @@ xml_dump_group(hid_t gid, const char *name)
/* already seen: enter a groupptr */
if(isRoot) {
/* probably can't happen! */
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2554,8 +2566,8 @@ xml_dump_group(hid_t gid, const char *name)
else {
t_objname = xml_escape_the_name(found_obj->objname);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2573,8 +2585,8 @@ xml_dump_group(hid_t gid, const char *name)
t_objname = xml_escape_the_name(found_obj->objname);/* point to the NDT by name */
par_name = xml_escape_the_name(par);
- xml_name_to_XID(found_obj->objname, ptrstr, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, found_obj->objname, ptrstr, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2597,7 +2609,7 @@ xml_dump_group(hid_t gid, const char *name)
/* first time this group has been seen -- describe it */
if(isRoot) {
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2611,8 +2623,8 @@ xml_dump_group(hid_t gid, const char *name)
char *t_tmp = xml_escape_the_name(tmp);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
ctx.need_prefix = TRUE;
@@ -2652,9 +2664,15 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2665,9 +2683,9 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
dump_indent -= COL;
ctx.indent_level--;
@@ -2689,15 +2707,15 @@ xml_dump_group(hid_t gid, const char *name)
h5tools_str_reset(&buffer);
if(isRoot) {
- xml_name_to_XID("/", grpxid, 100, 1);
+ xml_name_to_XID(gid, "/", grpxid, 100, 1);
h5tools_str_append(&buffer, "<%sRootGroup OBJ-XID=\"%s\" H5Path=\"%s\">", xmlnsprefix, grpxid, "/");
}
else {
char *t_tmp = xml_escape_the_name(tmp);
par_name = xml_escape_the_name(par);
- xml_name_to_XID(tmp, grpxid, 100, 1);
- xml_name_to_XID(par, parentxid, 100, 1);
+ xml_name_to_XID(gid, tmp, grpxid, 100, 1);
+ xml_name_to_XID(gid, par, parentxid, 100, 1);
h5tools_str_append(&buffer, "<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" "
"Parents=\"%s\" H5ParentPaths=\"%s\" >",
xmlnsprefix, t_name, grpxid, t_tmp, parentxid, par_name);
@@ -2734,9 +2752,15 @@ xml_dump_group(hid_t gid, const char *name)
/* Very special case: dump unamed type in root group */
for(u = 0; u < type_table->nobjs; u++) {
if(!type_table->objs[u].recorded) {
+ char *obj_addr_str = NULL;
+
dset = H5Dopen2(gid, type_table->objs[u].objname, H5P_DEFAULT);
type = H5Dget_type(dset);
- HDsprintf(type_name, "#"H5_PRINTF_HADDR_FMT, type_table->objs[u].objno);
+
+ H5Otoken_to_str(dset, &type_table->objs[u].obj_token, &obj_addr_str);
+ HDsprintf(type_name, "#%s", obj_addr_str);
+ H5free_memory(obj_addr_str);
+
dump_function_table->dump_named_datatype_function(type, type_name);
H5Tclose(type);
H5Dclose(dset);
@@ -2747,9 +2771,9 @@ xml_dump_group(hid_t gid, const char *name)
/* iterate through all the links */
if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED))
- H5Literate(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, sort_by, sort_order, NULL, xml_dump_all_cb, NULL);
else
- H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
+ H5Literate2(gid, H5_INDEX_NAME, sort_order, NULL, xml_dump_all_cb, NULL);
dump_indent -= COL;
ctx.indent_level--;
@@ -2787,12 +2811,11 @@ static int
xml_print_refs(hid_t did, int source)
{
herr_t e;
- hid_t type = -1;
- hid_t space = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hssize_t ssiz = -1;
hsize_t i;
- size_t tsiz;
- hobj_ref_t *refbuf = NULL;
+ H5R_ref_t *refbuf = NULL;
char *buf = NULL;
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -2823,13 +2846,11 @@ xml_print_refs(hid_t did, int source)
space = H5Dget_space(did);
if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if ((tsiz = H5Tget_size(type)) == 0)
- goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t));
if (buf == NULL)
goto error;
- e = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
+ e = H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
/* need to check result here */
if (e < 0)
goto error;
@@ -2838,19 +2859,17 @@ xml_print_refs(hid_t did, int source)
space = H5Aget_space(did);
if ((ssiz = H5Sget_simple_extent_npoints(space)) < 0)
goto error;
- if ((tsiz = H5Tget_size(type)) == 0)
- goto error;
- buf = (char *) HDcalloc((size_t)ssiz, tsiz);
+ buf = (char *) HDcalloc((size_t)ssiz, sizeof(H5R_ref_t));
if (buf == NULL)
goto error;
- e = H5Aread(did, H5T_STD_REF_OBJ, buf);
+ e = H5Aread(did, H5T_STD_REF, buf);
/* need to check the result here */
if (e < 0)
goto error;
}
- refbuf = (hobj_ref_t *)((void *)buf);
+ refbuf = (H5R_ref_t *)((void *)buf);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -2901,6 +2920,8 @@ xml_print_refs(hid_t did, int source)
}
ctx.indent_level--;
+ H5Rdestroy(refbuf);
+
refbuf++;
}
@@ -2936,8 +2957,8 @@ static int
xml_print_strs(hid_t did, int source)
{
herr_t e;
- hid_t type = -1;
- hid_t space = -1;
+ hid_t type = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
hssize_t ssiz = -1;
htri_t is_vlstr = FALSE;
size_t tsiz = 0;
@@ -3290,7 +3311,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
H5Pget_fill_value(dcpl, type, buf);
if (H5Tget_class(type) == H5T_REFERENCE) {
- const char * path = lookup_ref_path(*(hobj_ref_t *) buf);
+ const char * path = lookup_ref_path(*(H5R_ref_t *) buf);
ctx.need_prefix = TRUE;
@@ -3324,6 +3345,8 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "</%sDataFromFile>", xmlnsprefix);
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
+
+ H5Rdestroy((H5R_ref_t *) buf);
}
else if (H5Tget_class(type) == H5T_STRING) {
/* ????? */
@@ -3610,8 +3633,8 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
string_dataformat.do_escape = display_escape;
outputformat = &string_dataformat;
- xml_name_to_XID(tmp, rstr, 100, 1);
- xml_name_to_XID(prefix, pstr, 100, 1);
+ xml_name_to_XID(did, tmp, rstr, 100, 1);
+ xml_name_to_XID(did, prefix, pstr, 100, 1);
ctx.need_prefix = TRUE;
@@ -4121,7 +4144,7 @@ xml_print_enum(hid_t type)
unsigned char *value = NULL; /*value array */
unsigned nmembs; /*number of members */
hid_t super; /*enum base integer type */
- hid_t native = -1; /*native integer datatype */
+ hid_t native = H5I_INVALID_HID; /*native integer datatype */
size_t dst_size; /*destination value type size */
unsigned i; /*miscellaneous counters */
size_t j;
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index 257a047..bb606ac 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -219,8 +219,8 @@ leave(int ret)
static int
convert(hid_t fid, const char *dname)
{
- hid_t dcpl = -1;
- hid_t did = -1;
+ hid_t dcpl = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
H5D_layout_t layout_type;
H5D_chunk_index_t idx_type;
@@ -362,7 +362,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-convert_dsets_cb(const char *path, const H5O_info_t *oi, const char *already_visited, void *_fid)
+convert_dsets_cb(const char *path, const H5O_info2_t *oi, const char *already_visited, void *_fid)
{
hid_t fid = *(hid_t *)_fid;
@@ -399,7 +399,7 @@ main(int argc, const char *argv[])
{
H5E_auto2_t func;
void *edata;
- hid_t fid = -1;
+ hid_t fid = H5I_INVALID_HID;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index bd1689f..81f9a32 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -1086,12 +1086,12 @@ out:
*/
static int processStrHDFData(FILE *strm, struct Input *in, hid_t file_id)
{
- hid_t group_id = -1;
- hid_t dset_id = -1;
- hid_t space_id = -1;
- hid_t mspace_id = -1;
- hid_t type_id = -1;
- hid_t handle = -1;
+ hid_t group_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t mspace_id = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ hid_t handle = H5I_INVALID_HID;
char *str1 = NULL;
char *str2 = NULL;
char *str3 = NULL;
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 8222e06..07797c8 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -197,8 +197,8 @@ main (int argc, const char *argv[])
int ofid = -1;
void *edata;
H5E_auto2_t func;
- hid_t ifile = -1;
- hid_t plist = -1;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
herr_t status;
htri_t testval;
hsize_t usize;
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index aa893f9..203522b 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -199,8 +199,8 @@ main(int argc, const char *argv[])
{
void *edata;
H5E_auto2_t func;
- hid_t ifile = -1;
- hid_t plist = -1;
+ hid_t ifile = H5I_INVALID_HID;
+ hid_t plist = H5I_INVALID_HID;
off_t fsize;
hsize_t usize;
htri_t testval;
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 6c21782..279a598 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -879,7 +879,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind)
if (nmembs > 0) {
char **name; /* member names */
unsigned char *value; /* value array */
- hid_t native = -1; /* native integer data type */
+ hid_t native = H5I_INVALID_HID; /* native integer data type */
size_t dst_size; /* destination value type size */
unsigned i; /* miscellaneous counters */
@@ -1260,10 +1260,17 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
/* Shared? If so then print the type's OID */
if (H5Tcommitted(type)) {
- H5O_info_t oi;
+ H5O_info2_t oi;
- if (H5Oget_info2(type, &oi, H5O_INFO_BASIC) >= 0)
- h5tools_str_append(buffer,"shared-%lu:"H5_PRINTF_HADDR_FMT" ", oi.fileno, oi.addr);
+ if (H5Oget_info3(type, &oi, H5O_INFO_BASIC) >= 0) {
+ char *type_string = NULL;
+
+ H5Otoken_to_str(type, &oi.token, &type_string);
+
+ h5tools_str_append(buffer,"shared-%lu:%s", oi.fileno, type_string);
+
+ H5free_memory(type_string);
+ } /* end if */
else
h5tools_str_append(buffer,"shared ");
} /* end if */
@@ -1291,7 +1298,6 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
static void
dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container, H5R_ref_t *ref_buf, int ndims)
{
- H5TOOLS_ERR_INIT(int, SUCCEED)
hid_t new_obj_id = H5I_INVALID_HID;
hid_t new_obj_sid = H5I_INVALID_HID;
hsize_t elmt_counter = 0; /*counts the # elements printed. */
@@ -1301,8 +1307,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t datactx; /* print context */
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
datactx = *ctx; /* print context */
/* Assume entire data space to be printed */
@@ -1313,21 +1318,21 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) {
- H5O_type_t obj_type; /* Object type */
+ 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 +1341,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_INFO("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_INFO("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_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed");
break;
case H5O_TYPE_GROUP:
@@ -1354,24 +1359,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_INFO("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_INFO("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_INFO("H5Rdestroy H5R_DATASET_REGION1 failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ H5TOOLS_INFO("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 +1388,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_INFO("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_INFO("H5Rdestroy H5R_OBJECT2 failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_object H5R_OBJECT2 failed");
+ H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed");
break;
case H5O_TYPE_NAMED_DATATYPE:
@@ -1402,22 +1407,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_INFO("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_INFO("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 +1445,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_INFO("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_INFO("H5Sclose H5R_DATASET_REGION2 failed");
}
else
- H5TOOLS_ERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Ropen_region H5R_DATASET_REGION2 failed");
+ H5TOOLS_INFO("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_INFO("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_INFO("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_INFO("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_INFO("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 +1497,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_INFO("H5Ropen_attr H5R_ATTR failed");
}
break;
case H5R_BADTYPE:
@@ -1502,15 +1506,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@@ -1524,7 +1527,6 @@ done:
static void
dump_dataset_values(hid_t dset)
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
hid_t f_type = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hsize_t total_size[H5S_MAX_RANK];
@@ -1540,8 +1542,7 @@ dump_dataset_values(hid_t dset)
h5tool_format_t *info = &ls_dataformat;
H5R_ref_t *ref_buf = NULL;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
f_type = H5Dget_type(dset);
space = H5Dget_space(dset);
@@ -1637,13 +1638,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_NO_RET();
}
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 +1657,11 @@ 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_INFO("H5Dread reference failed");
+ H5TOOLS_GOTO_DONE_NO_RET();
}
dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims);
HDfree(ref_buf);
@@ -1680,8 +1682,7 @@ done:
PRINTVALSTREAM(rawoutstream, "\n");
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
}
@@ -1696,7 +1697,6 @@ done:
static void
dump_attribute_values(hid_t attr, const char *attr_name)
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
hid_t f_type = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hsize_t total_size[H5S_MAX_RANK];
@@ -1712,8 +1712,7 @@ dump_attribute_values(hid_t attr, const char *attr_name)
h5tool_format_t *info = &ls_dataformat;
H5R_ref_t *ref_buf = NULL;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
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_NO_RET();
}
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,11 @@ 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_INFO("H5Aread reference failed");
+ H5TOOLS_GOTO_DONE_NO_RET();
}
ctx.indent_level++;
dump_reference(rawoutstream, info, &ctx, attr, ref_buf, ndims);
@@ -1841,7 +1841,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 +1849,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,8 +1859,7 @@ done:
PRINTVALSTREAM(rawoutstream, "\n");
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@@ -1876,7 +1875,6 @@ static herr_t
list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo,
void H5_ATTR_UNUSED *op_data)
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
hid_t attr = H5I_INVALID_HID;
hid_t space = H5I_INVALID_HID;
hid_t type = H5I_INVALID_HID;
@@ -1890,8 +1888,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -1904,7 +1901,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 +1909,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,11 +1959,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_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return 0;
}
@@ -2295,9 +2291,8 @@ datatype_list2(hid_t type, const char H5_ATTR_UNUSED *name)
*-------------------------------------------------------------------------
*/
static herr_t
-list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void *_iter)
+list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, void *_iter)
{
- H5TOOLS_ERR_INIT(herr_t, SUCCEED)
H5O_type_t obj_type = oinfo->type; /* Type of the object */
iter_t *iter = (iter_t*)_iter;
hsize_t curr_pos = 0; /* total data element position */
@@ -2305,15 +2300,14 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
- H5TOOLS_PUSH_STACK();
- H5TOOLS_DEBUG(H5E_tools_min_dbg_id_g, "enter");
+ H5TOOLS_START_DEBUG("");
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 +2339,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 +2348,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)) {
@@ -2368,19 +2362,24 @@ list_obj(const char *name, const H5O_info_t *oinfo, const char *first_seen, void
if (verbose_g > 0) {
size_t buf_size = 0;
char* comment = NULL;
+ char* obj_addr_str = NULL;
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);
/* Object location & reference count */
+ H5Otoken_to_str(obj, &oinfo->token, &obj_addr_str);
+
h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " %-10s %lu:"H5_PRINTF_HADDR_FMT"\n", "Location:", oinfo->fileno, oinfo->addr);
+ h5tools_str_append(&buffer, " %-10s %lu:%s\n", "Location:", oinfo->fileno, obj_addr_str);
h5tools_str_append(&buffer, " %-10s %u\n", "Links:", (unsigned)oinfo->rc);
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
+ H5free_memory(obj_addr_str);
+
/* Modification time */
if (oinfo->mtime > 0) {
char buf[256];
@@ -2439,8 +2438,7 @@ done:
}
h5tools_str_close(&buffer);
- H5TOOLS_ENDDEBUG(H5E_tools_min_dbg_id_g, "exit");
- H5TOOLS_POP_STACK();
+ H5TOOLS_ENDDEBUG("");
return 0;
} /* end list_obj() */
@@ -2456,7 +2454,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-list_lnk(const char *name, const H5L_info_t *linfo, void *_iter)
+list_lnk(const char *name, const H5L_info2_t *linfo, void *_iter)
{
char *buf = NULL;
iter_t *iter = (iter_t*)_iter;
@@ -2642,7 +2640,7 @@ static herr_t
visit_obj(hid_t file, const char *oname, iter_t *iter)
{
int retval = 0;
- H5O_info_t oi; /* Information for object */
+ H5O_info2_t oi; /* Information for object */
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -2654,7 +2652,7 @@ visit_obj(hid_t file, const char *oname, iter_t *iter)
h5tools_str_reset(&buffer);
/* Retrieve info for object to list */
- if (H5Oget_info_by_name2(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
+ if (H5Oget_info_by_name3(file, oname, &oi, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) {
if (iter->symlink_target) {
h5tools_str_append(&buffer, "{**NOT FOUND**}\n");
iter->symlink_target = FALSE;
@@ -2835,7 +2833,7 @@ leave(int ret)
int
main(int argc, const char *argv[])
{
- hid_t file = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
char *fname = NULL, *oname = NULL, *x;
const char *s = NULL;
char *rest;
@@ -3293,24 +3291,24 @@ main(int argc, const char *argv[])
* doesn't exist). */
show_file_name_g = (argc-argno > 1); /*show file names if more than one*/
while(argno < argc) {
- H5L_info_t li;
+ H5L_info2_t li;
iter_t iter;
symlink_trav_t symlink_list;
size_t u;
fname = HDstrdup(argv[argno++]);
oname = NULL;
- file = -1;
+ file_id = H5I_INVALID_HID;
while (fname && *fname) {
if (fapl_id != H5P_DEFAULT) {
- file = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id);
+ file_id = H5Fopen(fname, H5F_ACC_RDONLY, fapl_id);
}
else {
- file = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
+ file_id = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, preferred_driver, drivername, sizeof drivername);
}
- if (file >= 0) {
+ if (file_id >= 0) {
if (verbose_g)
PRINTSTREAM(rawoutstream, "Opened \"%s\" with %s driver.\n", fname, drivername);
break; /*success*/
@@ -3326,7 +3324,7 @@ main(int argc, const char *argv[])
*oname = '\0';
} /* end while */
- if (file < 0) {
+ if (file_id < 0) {
HDfprintf(rawerrorstream, "%s: unable to open file\n", argv[argno-1]);
HDfree(fname);
err_exit = 1;
@@ -3361,8 +3359,8 @@ main(int argc, const char *argv[])
/* Remember the file information for later */
iter.fname = fname;
- iter.fid = file;
- iter.gid = -1;
+ iter.fid = file_id;
+ iter.gid = H5I_INVALID_HID;
iter.symlink_target = FALSE;
iter.symlink_list = &symlink_list;
iter.symlink_list->dangle_link = FALSE;
@@ -3374,7 +3372,7 @@ main(int argc, const char *argv[])
/* Check for root group as object name */
if (HDstrcmp(oname, root_name)) {
/* Check the type of link given */
- if (H5Lget_info(file, oname, &li, H5P_DEFAULT) < 0) {
+ if (H5Lget_info2(file_id, oname, &li, H5P_DEFAULT) < 0) {
hsize_t curr_pos = 0; /* total data element position */
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t ctx; /* print context */
@@ -3395,18 +3393,18 @@ main(int argc, const char *argv[])
/* Open the object and display it's information */
if (li.type == H5L_TYPE_HARD) {
- if (visit_obj(file, oname, &iter) < 0) {
+ if (visit_obj(file_id, oname, &iter) < 0) {
H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(EXIT_FAILURE);
}
} /* end if(li.type == H5L_TYPE_HARD) */
else {
/* Specified name is not for object -- list that link */
- /* Use file ID for root group ID */
- iter.gid = file;
+ /* Use file_id ID for root group ID */
+ iter.gid = file_id;
list_lnk(oname, &li, &iter);
}
- H5Fclose(file);
+ H5Fclose(file_id);
HDfree(fname);
if (x)
HDfree(oname);
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 971589e..8eeaa0e 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -222,18 +222,27 @@ h5repack_addlayout(const char *str, pack_opt_t *options)
hid_t
copy_named_datatype(hid_t type_in, hid_t fidout, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
- named_dt_t *dt_ret = NULL; /* Datatype to return */
- H5O_info_t oinfo; /* Object info of input dtype */
- hid_t ret_value = -1; /* The identifier of the named dtype in the out file */
+ named_dt_t *dt = *named_dt_head_p; /* Stack pointer */
+ named_dt_t *dt_ret = NULL; /* Datatype to return */
+ H5O_info2_t oinfo; /* Object info of input dtype */
+ int token_cmp;
+ hid_t ret_value = H5I_INVALID_HID;
- if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
+ if (H5Oget_info3(type_in, &oinfo, H5O_INFO_BASIC) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "H5Oget_info failed");
if (*named_dt_head_p) {
+ if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+
/* Stack already exists, search for the datatype */
- while (dt && dt->addr_in != oinfo.addr)
+ while (dt && token_cmp) {
dt = dt->next;
+
+ if (H5Otoken_cmp(type_in, &dt->obj_token, &oinfo.token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+ }
+
dt_ret = dt;
}
else {
@@ -244,18 +253,19 @@ 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(H5I_INVALID_HID, "buffer allocation failed failed");
dt->next = *named_dt_head_p;
*named_dt_head_p = dt;
/* Update the address and id */
- dt->addr_in = travt->objs[i].objno;
- dt->id_out = -1;
+ HDmemcpy(&dt->obj_token, &travt->objs[i].obj_token, sizeof(H5O_token_t));
+ dt->id_out = H5I_INVALID_HID;
/* Check if this type is the one requested */
- if (oinfo.addr == dt->addr_in) {
+ if (H5Otoken_cmp(type_in, &oinfo.token, &dt->obj_token, &token_cmp) < 0)
+ H5TOOLS_GOTO_ERROR(H5I_INVALID_HID, "failed to compare object tokens");
+ if (!token_cmp)
dt_ret = dt;
- }
} /* end if named datatype */
} /* end for each object in traversal table */
} /* end else (create the stack) */
@@ -266,13 +276,13 @@ 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(H5I_INVALID_HID, "buffer allocation failed failed");
dt_ret->next = *named_dt_head_p;
*named_dt_head_p = dt_ret;
/* Update the address and id */
- dt_ret->addr_in = oinfo.addr;
- dt_ret->id_out = -1;
+ HDmemcpy(&dt_ret->obj_token, &oinfo.token, sizeof(H5O_token_t));
+ dt_ret->id_out = H5I_INVALID_HID;
} /* end if requested datatype not found */
/* If the requested datatype does not yet exist in the output file, copy it
@@ -284,9 +294,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(H5I_INVALID_HID, "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(H5I_INVALID_HID, "H5Tcommit_anon failed");
} /* end if named datatype not yet in output file */
/* Set return value */
@@ -296,7 +306,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(H5I_INVALID_HID, "H5Iinc_ref failed");
done:
return ret_value;
@@ -312,12 +322,12 @@ int
named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err)
{
named_dt_t *dt = *named_dt_head_p;
- int ret_value = -1;
+ int ret_value = -1;
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((-1), "H5Tclose failed");
dt = dt->next;
HDfree(*named_dt_head_p);
*named_dt_head_p = dt;
@@ -343,12 +353,11 @@ done:
int
copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_t *travt, pack_opt_t *options)
{
- int ret_value = 0;
- hid_t attr_id = -1; /* attr ID */
- hid_t attr_out = -1; /* attr ID */
- hid_t space_id = -1; /* space ID */
- hid_t ftype_id = -1; /* file type ID */
- hid_t wtype_id = -1; /* read/write type ID */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
size_t msize; /* size of type */
void *buf = NULL; /* data buffer */
hsize_t nelmts; /* number of elements in dataset */
@@ -356,14 +365,15 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
htri_t is_named; /* Whether the datatype is named */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* object info */
+ H5O_info2_t oinfo; /* object info */
int j;
unsigned u;
hbool_t is_ref = 0;
H5T_class_t type_class = -1;
+ int ret_value = 0;
- if (H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
+ if (H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Oget_info failed");
/*-------------------------------------------------------------------------
* copy all attributes
@@ -372,33 +382,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((-1), "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((-1), "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((-1), "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((-1), "H5Tcommitted failed");
if (is_named && travt) {
- hid_t fidout = -1;
+ hid_t fidout = H5I_INVALID_HID;
/* 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((-1), "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((-1), "copy_named_datatype failed");
}
if (H5Fclose(fidout) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Fclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Fclose failed");
} /* end if datatype is committed and we have a traversal table */
else {
if (options->use_native == 1)
@@ -409,18 +419,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((-1), "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((-1), "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((-1), "H5Tget_size failed");
/*---------------------------------------------------------------------
* object references are a special case. We cannot just copy the
@@ -432,12 +442,12 @@ copy_attr(hid_t loc_in, hid_t loc_out, named_dt_t **named_dt_head_p, trav_table_
type_class = H5Tget_class(wtype_id);
is_ref = (type_class == H5T_REFERENCE);
if (type_class == H5T_VLEN || type_class == H5T_ARRAY) {
- hid_t base_type = -1;
+ hid_t base_type = H5I_INVALID_HID;
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_ERROR((-1), "H5Tclose base_type failed");
} /* end if type_class is variable length or array */
if (type_class == H5T_COMPOUND) {
@@ -447,7 +457,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_ERROR((-1), "H5Tclose mtid failed");
if (mtclass == H5T_REFERENCE) {
is_ref = 1;
@@ -464,10 +474,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((-1), "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((-1), "H5Aread failed");
/*-----------------------------------------------------------------
* copy
@@ -475,13 +485,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((-1), "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((-1), "H5Awrite failed");
/*close*/
if (H5Aclose(attr_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
/* Check if we have VL data and string in the attribute's datatype that must
* be reclaimed */
@@ -499,17 +509,17 @@ 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");
- space_id = -1;
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
+ space_id = H5I_INVALID_HID;
if (H5Tclose(wtype_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
- wtype_id = -1;
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ wtype_id = H5I_INVALID_HID;
if (H5Tclose(ftype_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
- ftype_id = -1;
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ ftype_id = H5I_INVALID_HID;
if (H5Aclose(attr_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
- attr_id = -1;
+ H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
+ attr_id = H5I_INVALID_HID;
} /* for u (each attribute) */
done:
@@ -546,10 +556,10 @@ done:
static int
check_options(pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
unsigned int i;
int k, j, has_cp = 0, has_ck = 0;
char slayout[30];
+ int ret_value = 0;
/*-------------------------------------------------------------------------
* Objects to layout
@@ -573,10 +583,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((-1), "invalid layout");
+ break;
default:
strcpy(slayout, "invalid layout\n");
- HGOTO_DONE(FAIL);
+ H5TOOLS_GOTO_DONE((-1));
}
HDprintf(" Apply %s layout to all", slayout);
if (H5D_CHUNKED == options->layout_g) {
@@ -611,7 +622,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((-1), "invalid chunking input: 'all' option is present with other objects");
/*-------------------------------------------------------------------------
* Objects to filter
@@ -669,7 +680,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((-1), "invalid compression input: 'all' option is present with other objects");
/*-------------------------------------------------------------------------
* Check options for the latest format
@@ -677,14 +688,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((-1), "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((-1), "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((-1), "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((-1), "invalid shared message size");
/*------------------------------------------------------------------------
* Verify new user userblock options; file name must be present
@@ -698,7 +709,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((-1), "file name missing for user block", options->ublock_filename);
/*------------------------------------------------------------------------
* Verify alignment options; threshold is zero default but alignment not
@@ -706,7 +717,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((-1), "alignment for H5Pset_alignment missing");
done:
return ret_value;
@@ -724,24 +735,24 @@ done:
static int
check_objects(const char* fname, pack_opt_t *options)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t sid = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
unsigned int i;
- int ifil;
+ int ifil;
trav_table_t *travt = NULL;
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
+ int ret_value = 0;
/* 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((-1), "h5tools_fopen failed <%s>: %s", fname, H5FOPENERROR);
/*-------------------------------------------------------------------------
* get the list of objects in the file
@@ -751,11 +762,11 @@ check_objects(const char* fname, pack_opt_t *options)
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fid, &travt);
/* 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((-1), "h5trav_gettable failed");
/*-------------------------------------------------------------------------
* compare with user supplied list
@@ -774,14 +785,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((-1), "%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((-1), "invalid filter");
/* check for extra filter conditions */
switch (obj.filter[ifil].filtn) {
/* chunk size must be smaller than pixels per block */
@@ -800,25 +811,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((-1), "H5Dopen2 failed");
if ((sid = H5Dget_space(did)) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "H5Sclose failed");
if (H5Dclose(did) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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.h b/tools/src/h5repack/h5repack.h
index a0e0387..52ecb0e 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -131,7 +131,7 @@ typedef struct {
typedef struct named_dt_t {
- haddr_t addr_in; /* Address of the named dtype in the in file */
+ H5O_token_t obj_token; /* Object token for the named dtype in the in file */
hid_t id_out; /* Open identifier for the dtype in the out file */
struct named_dt_t *next; /* Next dtype */
} named_dt_t;
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 5d41908..1044244 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -61,12 +61,11 @@ static void print_user_block(const char *filename, hid_t fid);
int
copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
{
- int ret_value = 0;
- hid_t fidin = -1;
- hid_t fidout = -1;
- hid_t fcpl_in = -1; /* file creation property list ID for input file */
- hid_t grp_in = -1; /* group ID */
- hid_t gcpl_in = -1; /* group creation property list */
+ hid_t fidin = H5I_INVALID_HID;
+ hid_t fidout = H5I_INVALID_HID;
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property list ID for input file */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
hid_t fcpl = H5P_DEFAULT; /* file creation property list ID */
hid_t fapl = H5P_DEFAULT; /* file access property list ID */
trav_table_t *travt = NULL;
@@ -80,65 +79,66 @@ copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options)
hsize_t in_threshold; /* Free-space section threshold from input file */
hsize_t in_pagesize; /* File space page size from input file */
unsigned crt_order_flags; /* group creation order flag */
+ int ret_value = 0;
/*-------------------------------------------------------------------------
* open input file
*-------------------------------------------------------------------------
*/
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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "Could not copy user block. Exiting...");
/*-------------------------------------------------------------------------
* get list of objects
@@ -316,19 +316,19 @@ print_user_block(fnamein, fidin);
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fidin, &travt);
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((-1), "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((-1), "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((-1), "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((-1), "Could not copy user block. Exiting...");
done:
H5E_BEGIN_TRY {
@@ -402,7 +402,6 @@ int
get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
size_t size_datum, hsize_t dims_hslab[], hsize_t * hslab_nbytes_p)
{
- int ret_value = 0;
int k;
H5D_layout_t dset_layout;
int rank_chunk;
@@ -413,6 +412,7 @@ get_hyperslab(hid_t dcpl_id, int rank_dset, hsize_t dims_dset[],
hsize_t chunk_dims_map[H5S_MAX_RANK]; /* mapped chunk dimentions */
hsize_t hs_dims_map[H5S_MAX_RANK]; /* mapped hyperslab dimentions */
hsize_t hslab_nbytes; /* size of hyperslab in byte */
+ int ret_value = 0;
/* init to set as size of a data element */
hslab_nbytes = size_datum;
@@ -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((-1), "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((-1), "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((-1), "calculate total size for the hyperslab failed");
}
}
@@ -580,20 +580,19 @@ int
do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- int ret_value = 0;
- hid_t grp_in = -1; /* group ID */
- hid_t grp_out = -1; /* group ID */
- hid_t dset_in = -1; /* read dataset ID */
- hid_t dset_out = -1; /* write dataset ID */
- hid_t gcpl_in = -1; /* group creation property list */
- hid_t gcpl_out = -1; /* group creation property list */
- hid_t type_in = -1; /* named type ID */
- hid_t type_out = -1; /* named type ID */
- hid_t dcpl_in = -1; /* dataset creation property list ID */
- hid_t dcpl_out = -1; /* dataset creation property list ID */
- hid_t f_space_id = -1; /* file space ID */
- hid_t ftype_id = -1; /* file type ID */
- hid_t wtype_id = -1; /* read/write type ID */
+ hid_t grp_in = H5I_INVALID_HID; /* group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t gcpl_in = H5I_INVALID_HID; /* group creation property list */
+ hid_t gcpl_out = H5I_INVALID_HID; /* group creation property list */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t type_out = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_in = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl_out = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t f_space_id = H5I_INVALID_HID; /* file space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
+ hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
size_t msize; /* size of type */
hsize_t nelmts; /* number of elements in dataset */
@@ -617,6 +616,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
htri_t is_named;
hbool_t limit_maxdims;
hsize_t size_dset;
+ int ret_value = 0;
/*-------------------------------------------------------------------------
* copy the supplied object list
@@ -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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "copy_attr failed");
if (H5Pclose(gcpl_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Pclose(gcpl_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Gclose(grp_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
if (H5Gclose(grp_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "copy_named_datatype failed");
if (H5Tclose(ftype_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Pcreate failed");
}
else if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) {
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "apply_filters failed");
/* only if layout change requested for entire file or
* individual obj */
@@ -888,13 +888,13 @@ 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");
+ if (dset_out == H5I_INVALID_HID) {
+ 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((-1), "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((-1), "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((-1), "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((-1), "H5Treclaim failed");
if (buf != NULL) { /* TODO: is buf potentially released by H5Dvlen_reclaim()? */
HDfree(buf);
@@ -946,7 +946,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
hsize_t zero[8]; /*vector of zeros */
int k;
H5D_layout_t dset_layout;
- hid_t dcpl_tmp = -1; /* dataset creation property list ID */
+ hid_t dcpl_tmp = H5I_INVALID_HID; /* dataset creation property list ID */
/* check if we have VL data in the dataset's datatype */
if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE)
@@ -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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "copy_attr failed");
if (H5Dclose(dset_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
} /* end if not a reference */
} /* end if h5tools_canreadf (filter availability check) */
@@ -1078,32 +1078,32 @@ 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((-1), "H5Tclose failed");
if (H5Tclose(wtype_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
if (H5Pclose(dcpl_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Pclose(dcpl_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(f_space_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
}
/*-------------------------------------------------------------------------
* We do not have request for filter/chunking; use H5Ocopy instead
*-------------------------------------------------------------------------
*/
else {
- hid_t pid = -1;
+ hid_t pid = H5I_INVALID_HID;
/* 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((-1), "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((-1), "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((-1), "H5Ocopy failed");
if (H5Pclose(pid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "copy_attr failed");
if (H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if (H5Dclose(dset_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if (options->verbose)
HDprintf(FORMAT_OBJ, "dset", travt->objs[i].name);
@@ -1146,28 +1146,28 @@ 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((-1), "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((-1), "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((-1), "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((-1), "copy_attr failed");
if (H5Tclose(type_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
if (H5Tclose(type_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
- type_out = -1; /* named datatypes stack, named_dt_head, manages allocation */
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
+ type_out = H5I_INVALID_HID; /* 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((-1), "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((-1), "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((-1), "named_datatype_free failed");
}
else
H5E_BEGIN_TRY {
@@ -1354,16 +1354,16 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
static int
copy_user_block(const char *infile, const char *outfile, hsize_t size)
{
- int ret_value = 0;
int infid = -1, outfid = -1; /* File descriptors */
+ int ret_value = 0;
/* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
/* 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((-1), "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((-1), "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((-1), "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((-1), "HDwrite failed");
HDassert(nwritten > 0);
HDassert(nwritten <= nbytes);
@@ -1426,29 +1426,29 @@ static
void
print_user_block(const char *filename, hid_t fid)
{
- int ret_value = 0;
int fh = -1; /* file handle */
hsize_t ub_size; /* user block size */
hsize_t size; /* size read */
- hid_t fcpl = -1; /* file creation property list ID for HDF5 file */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list ID for HDF5 file */
int i;
+ int ret_value = 0;
/* 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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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 891de25..d1179fb 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -36,35 +36,35 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
const char* name, /* object name from traverse list */
pack_info_t *objout /*OUT*/) /* info about object to filter */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
int nfilters; /* number of filters in DCPL */
char f_objname[256]; /* filter objname */
H5D_layout_t layout;
int rank; /* rank of dataset */
hsize_t chsize[64]; /* chunk size in elements */
- int i;
- unsigned u;
+ int i;
+ unsigned u;
+ int ret_value = 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((-1), "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((-1), "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((-1), "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((-1), "H5Pget_chunk failed");
objout->chunk.rank = rank;
for (u = 0; u < (unsigned)rank; u++)
objout->chunk.chunk_lengths[u] = chsize[u];
@@ -238,18 +238,18 @@ int apply_filters(const char* name, /* object name from traverse list */
pack_opt_t *options, /* repack options */
int *has_filter) /* (OUT) object NAME has a filter */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
- int nfilters; /* number of filters in DCPL */
- hsize_t chsize[64]; /* chunk size in elements */
+ int nfilters; /* number of filters in DCPL */
+ hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
- int i;
- pack_info_t obj;
- pack_info_t filtobj;
+ int i;
+ pack_info_t obj;
+ pack_info_t filtobj;
+ int ret_value = 0;
*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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Pset_chunk failed");
if (H5Pset_shuffle(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_shuffle failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "H5Pset_chunk failed");
if (H5Pset_fletcher32(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_fletcher32 failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "H5Pset_chunk failed");
if (H5Pset_nbit(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pset_nbit failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "%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((-1), "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((-1), "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((-1), "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((-1), "H5Premove_filter failed");
}
}
diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c
index 9d35c4f..56fc12d 100644
--- a/tools/src/h5repack/h5repack_opttable.c
+++ b/tools/src/h5repack/h5repack_opttable.c
@@ -24,7 +24,8 @@
*-------------------------------------------------------------------------
*/
-void init_packobject(pack_info_t *obj) {
+void init_packobject(pack_info_t *obj)
+{
int j, k;
HDstrcpy(obj->path, "\0");
@@ -49,11 +50,12 @@ void init_packobject(pack_info_t *obj) {
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt) {
+static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_info_t filt)
+{
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");
}
/*-------------------------------------------------------------------------
@@ -64,7 +66,8 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, unsigned int I, filter_in
* Return: void
*-------------------------------------------------------------------------
*/
-static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack) {
+static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info_t *pack)
+{
int k;
table->objs[I].layout = pack->layout;
@@ -97,18 +100,20 @@ static int
aux_inctable(pack_opttbl_t *table, unsigned n_objs)
{
unsigned u;
+ int ret_value = 0;
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");
- return -1;
+ H5TOOLS_INFO("not enough memory for options table");
+ ret_value = -1;
+ }
+ else {
+ for (u = table->nelems; u < table->size; u++)
+ init_packobject(&table->objs[u]);
}
- for (u = table->nelems; u < table->size; u++)
- init_packobject(&table->objs[u]);
-
- return 0;
+ return ret_value;
}
@@ -123,25 +128,25 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs)
int options_table_init(pack_opttbl_t **tbl) {
unsigned int i;
pack_opttbl_t *table;
+ int ret_value = 0;
if (NULL == (table = (pack_opttbl_t *) HDmalloc(sizeof(pack_opttbl_t)))) {
- H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table");
- return -1;
+ 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)))) {
- H5TOOLS_INFO(H5E_tools_min_id_g, "not enough memory for options table");
HDfree(table);
- return -1;
+ H5TOOLS_GOTO_ERROR((-1), "not enough memory for options table");
}
for (i = 0; i < table->size; i++)
init_packobject(&table->objs[i]);
*tbl = table;
- return 0;
+done:
+ return ret_value;
}
@@ -174,6 +179,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
unsigned i, j, I;
unsigned added = 0;
hbool_t found = FALSE;
+ int ret_value = 0;
/* increase the size of the collection by N_OBJS if necessary */
if (table->nelems + n_objs >= table->size)
@@ -190,7 +196,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 */
@@ -237,7 +243,7 @@ options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pa
table->nelems += added;
- return 0;
+ return ret_value;
}
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 52917fb..e6a747d 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -42,16 +42,15 @@ int do_copy_refobjs(hid_t fidin,
trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
- hid_t grp_in = -1; /* read group ID */
- hid_t grp_out = -1; /* write group ID */
- hid_t dset_in = -1; /* read dataset ID */
- hid_t dset_out = -1; /* write dataset ID */
- hid_t type_in = -1; /* named type ID */
- hid_t dcpl_id = -1; /* dataset creation property list ID */
- hid_t space_id = -1; /* space ID */
- hid_t ftype_id = -1; /* file data type ID */
- hid_t mtype_id = -1; /* memory data type ID */
+ hid_t grp_in = H5I_INVALID_HID; /* read group ID */
+ hid_t grp_out = H5I_INVALID_HID; /* write group ID */
+ hid_t dset_in = H5I_INVALID_HID; /* read dataset ID */
+ hid_t dset_out = H5I_INVALID_HID; /* write dataset ID */
+ hid_t type_in = H5I_INVALID_HID; /* named type ID */
+ hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
size_t msize; /* memory size of memory type */
hsize_t nelmts; /* number of elements in dataset */
int rank; /* rank of dataset */
@@ -59,6 +58,7 @@ int do_copy_refobjs(hid_t fidin,
unsigned int i, j;
int k;
named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
+ int ret_value = 0;
/*-------------------------------------------------------------------------
* browse
@@ -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((-1), "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((-1), "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((-1), "copy_refs_attr failed");
if(H5Gclose(grp_out) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Gclose failed");
if(H5Gclose(grp_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Tget_size failed");
/*-------------------------------------------------------------------------
* check if the dataset creation property list has filters that
@@ -145,7 +145,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
if(H5Tequal(mtype_id, H5T_STD_REF_OBJ)) {
- hid_t refobj_id = -1;
+ hid_t refobj_id = H5I_INVALID_HID;
hobj_ref_t *refbuf = NULL; /* buffer for object references */
hobj_ref_t *buf = NULL;
const char* refname;
@@ -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((-1), "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((-1), "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((-1), "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((-1), "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_ERROR((-1), "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((-1), "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((-1), "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((-1), "copy_attr failed");
} /*H5T_STD_REF_OBJ*/
/*-------------------------------------------------------------------------
@@ -221,7 +221,7 @@ int do_copy_refobjs(hid_t fidin,
*-------------------------------------------------------------------------
*/
else if(H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) {
- hid_t refobj_id = -1;
+ hid_t refobj_id = H5I_INVALID_HID;
hdset_reg_ref_t *refbuf = NULL; /* input buffer for region references */
hdset_reg_ref_t *buf = NULL; /* output buffer */
const char* refname;
@@ -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((-1), "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((-1), "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((-1), "HDcalloc failed");
} /* end if */
for(u = 0; u < nelmts; u++) {
@@ -260,16 +260,16 @@ int do_copy_refobjs(hid_t fidin,
* in the second traversal of the file
*/
if((refname = MapIdToName(refobj_id, travt)) != NULL) {
- hid_t region_id = -1; /* region id of the referenced dataset */
+ hid_t region_id = H5I_INVALID_HID; /* 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((-1), "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((-1), "H5Rcreate failed");
if(H5Sclose(region_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Tclose failed");
if(H5Tclose(mtype_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
if(H5Pclose(dcpl_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if(H5Sclose(space_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
if(H5Dclose(dset_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "H5Topen2 failed");
if(H5Tclose(type_in) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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_ERROR((-1), "named_datatype_free failed");
return ret_value;
@@ -429,17 +430,16 @@ static int copy_refs_attr(hid_t loc_in,
trav_table_t *travt,
hid_t fidout) /* for saving references */
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
- hid_t attr_id = -1; /* attr ID */
- hid_t attr_out = -1; /* attr ID */
- hid_t space_id = -1; /* space ID */
- hid_t ftype_id = -1; /* file data type ID */
- hid_t mtype_id = -1; /* memory data type ID */
+ hid_t attr_id = H5I_INVALID_HID; /* attr ID */
+ hid_t attr_out = H5I_INVALID_HID; /* attr ID */
+ hid_t space_id = H5I_INVALID_HID; /* space ID */
+ hid_t ftype_id = H5I_INVALID_HID; /* file data type ID */
+ hid_t mtype_id = H5I_INVALID_HID; /* memory data type ID */
size_t msize; /* memory size of type */
hsize_t nelmts; /* number of elements in dataset */
hsize_t dims[H5S_MAX_RANK];/* dimensions of dataset */
char name[255];
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
unsigned u, i, j;
int rank;
H5T_class_t type_class = -1;
@@ -452,29 +452,29 @@ static int copy_refs_attr(hid_t loc_in,
unsigned *ref_comp_index = NULL;
size_t *ref_comp_size = NULL;
int ref_comp_field_n = 0;
+ int ret_value = 0;
-
- if(H5Oget_info2(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
+ if(H5Oget_info3(loc_in, &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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_ERROR((-1), "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((-1), "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((-1), "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_ERROR((-1), "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_ERROR((-1), "H5Tclose mtype_id failed");
if (H5Tclose(ftype_id) < 0)
- H5TOOLS_INFO(H5E_tools_min_id_g, "H5Tclose ftype_id failed");
+ H5TOOLS_ERROR((-1), "H5Tclose ftype_id failed");
if (H5Aclose(attr_id) < 0)
- H5TOOLS_INFO(H5E_tools_min_id_g, "H5Aclose attr_id failed");
+ H5TOOLS_ERROR((-1), "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((-1), "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((-1), "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((-1), "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_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Aclose failed");
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
if(H5Tclose(ftype_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
if(H5Tclose(mtype_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
if(H5Sclose(space_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
if(H5Aclose(attr_id) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Aclose failed");
} /* for(u = 0; u < (unsigned)oinfo.num_attrs; u++) */
done:
@@ -796,16 +796,19 @@ MapIdToName(hid_t refobj_id, trav_table_t *travt)
if(travt->objs[u].type == (h5trav_type_t)H5O_TYPE_DATASET ||
travt->objs[u].type == (h5trav_type_t)H5O_TYPE_GROUP ||
travt->objs[u].type == (h5trav_type_t)H5O_TYPE_NAMED_DATATYPE) {
- H5O_info_t ref_oinfo; /* Stat for the refobj id */
+ H5O_info2_t ref_oinfo; /* Stat for the refobj id */
+ int token_cmp;
/* obtain information to identify the referenced object uniquely */
- if(H5Oget_info2(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(refobj_id, &ref_oinfo, H5O_INFO_BASIC) < 0)
goto out;
- if(ref_oinfo.addr == travt->objs[u].objno) {
+ if(H5Otoken_cmp(refobj_id, &ref_oinfo.token, &travt->objs[u].obj_token, &token_cmp) < 0)
+ goto out;
+ if(!token_cmp) {
ret = travt->objs[u].name;
goto out;
- } /* end if */
+ }
} /* end if */
} /* u */
@@ -822,27 +825,27 @@ out:
static herr_t update_ref_value(hid_t obj_id, H5R_type_t ref_type, void *ref_in,
hid_t fid_out, void *ref_out, trav_table_t *travt)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
const char *ref_obj_name;
- hid_t space_id = -1;
- hid_t ref_obj_id = -1;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t ref_obj_id = H5I_INVALID_HID;
+ herr_t ret_value = SUCCEED;
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 30bd3f6..683988c 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -39,26 +39,26 @@ static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *fil
int
h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
- hid_t fidin = -1; /* file ID for input file*/
- hid_t fidout = -1; /* file ID for output file*/
- hid_t did = -1; /* dataset ID */
- hid_t pid = -1; /* dataset creation property list ID */
- hid_t sid = -1; /* space ID */
- hid_t tid = -1; /* type ID */
+ hid_t fidin = H5I_INVALID_HID; /* file ID for input file*/
+ hid_t fidout = H5I_INVALID_HID; /* file ID for output file*/
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t pid = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t sid = H5I_INVALID_HID; /* space ID */
+ hid_t tid = H5I_INVALID_HID; /* type ID */
int ok = 1; /* step results */
unsigned int i;
trav_table_t *travt = NULL;
- hid_t fcpl_in = -1; /* file creation property for input file */
- hid_t fcpl_out = -1; /* file creation property for output file */
+ hid_t fcpl_in = H5I_INVALID_HID; /* file creation property for input file */
+ hid_t fcpl_out = H5I_INVALID_HID; /* file creation property for output file */
H5F_fspace_strategy_t in_strategy, out_strategy; /* file space handling strategy for in/output file */
hbool_t in_persist, out_persist; /* free-space persist status for in/output file */
hsize_t in_threshold, out_threshold; /* free-space section threshold for in/output file */
hsize_t in_pagesize, out_pagesize; /* file space page size for input/output file */
+ int ret_value = 0;
/* 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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Dget_type failed");
/*-------------------------------------------------------------------------
* filter check
@@ -95,14 +95,14 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
* close
*-------------------------------------------------------------------------
*/
- if(H5Pclose(pid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ if (H5Pclose(pid) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
if (H5Dclose(did) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if (H5Tclose(tid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Tclose failed");
}
/*-------------------------------------------------------------------------
@@ -114,11 +114,11 @@ h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&travt);
+ trav_table_init(fidout, &travt);
/* 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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Pclose failed");
if (H5Sclose(sid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Sclose failed");
if (H5Dclose(did) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if (H5Tclose(tid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "file space page size not set as unexpected");
}
@@ -355,19 +355,19 @@ int verify_layout(hid_t pid, pack_info_t *obj)
int h5repack_cmp_pl(const char *fname1, const char *fname2)
{
- int ret_value = 1; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
- hid_t fid1 =-1; /* file ID */
- hid_t fid2 =-1; /* file ID */
- hid_t dset1 =-1; /* dataset ID */
- hid_t dset2 =-1; /* dataset ID */
- hid_t gid =-1; /* group ID */
- hid_t dcpl1 =-1; /* dataset creation property list ID */
- hid_t dcpl2 =-1; /* dataset creation property list ID */
- hid_t gcplid =-1; /* group creation property list */
+ hid_t fid1 =H5I_INVALID_HID; /* file ID */
+ hid_t fid2 =H5I_INVALID_HID; /* file ID */
+ hid_t dset1 =H5I_INVALID_HID; /* dataset ID */
+ hid_t dset2 =H5I_INVALID_HID; /* dataset ID */
+ hid_t gid =H5I_INVALID_HID; /* group ID */
+ hid_t dcpl1 =H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t dcpl2 =H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t gcplid =H5I_INVALID_HID; /* group creation property list */
unsigned crt_order_flag1; /* group creation order flag */
unsigned crt_order_flag2; /* group creation order flag */
- trav_table_t *trav = NULL;
+ trav_table_t *trav = NULL;
unsigned int i;
+ int ret_value = 1;
/*-------------------------------------------------------------------------
* open the files
@@ -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((-1), "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((-1), "h5tools_fopen failed <%s>: %s", fname2, H5FOPENERROR);
/*-------------------------------------------------------------------------
* get file table list of objects
@@ -386,9 +386,9 @@ int h5repack_cmp_pl(const char *fname1, const char *fname2)
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
/* init table */
- trav_table_init(&trav);
+ trav_table_init(fid1, &trav);
if(h5trav_gettable(fid1, trav) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5trav_gettable failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "H5Pget_link_creation_order failed");
if (H5Pclose(gcplid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Gclose(gid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "H5Pget_link_creation_order failed");
if (H5Pclose(gcplid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if (H5Gclose(gid) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "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((-1), "H5Pclose failed");
if(H5Pclose(dcpl2) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
if(H5Dclose(dset1) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
if(H5Dclose(dset2) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed");
+ H5TOOLS_GOTO_ERROR((-1), "H5Dclose failed");
} /*if*/
} /*for*/
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index dd1a9ce..adc905a 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -379,13 +379,13 @@ ceil_log10(unsigned long x)
*-------------------------------------------------------------------------
*/
static herr_t
-attribute_stats(iter_t *iter, const H5O_info_t *oi)
+attribute_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
/* Update dataset & attribute metadata info */
- iter->attrs_btree_storage_size += oi->meta_size.attr.index_size;
- iter->attrs_heap_storage_size += oi->meta_size.attr.heap_size;
+ iter->attrs_btree_storage_size += native_oi->meta_size.attr.index_size;
+ iter->attrs_heap_storage_size += native_oi->meta_size.attr.heap_size;
/* Update small # of attribute count & limits */
if(oi->num_attrs <= (hsize_t)sattrs_threshold)
@@ -440,22 +440,22 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
*-------------------------------------------------------------------------
*/
static herr_t
-group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+group_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
H5G_info_t ginfo; /* Group information */
unsigned bin; /* "bin" the number of objects falls in */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED;
/* Gather statistics about this type of object */
iter->uniq_groups++;
/* Get object header information */
- iter->group_ohdr_info.total_size += oi->hdr.space.total;
- iter->group_ohdr_info.free_size += oi->hdr.space.free;
+ iter->group_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->group_ohdr_info.free_size += native_oi->hdr.space.free;
/* 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)
@@ -484,12 +484,12 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
(iter->group_bins[bin])++;
/* Update group metadata info */
- iter->groups_btree_storage_size += oi->meta_size.obj.index_size;
- iter->groups_heap_storage_size += oi->meta_size.obj.heap_size;
+ iter->groups_btree_storage_size += native_oi->meta_size.obj.index_size;
+ iter->groups_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats failed");
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats failed");
done:
return ret_value;
@@ -510,7 +510,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
+dataset_stats(iter_t *iter, const char *name, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
unsigned bin; /* "bin" the number of objects falls in */
hid_t did; /* Dataset ID */
@@ -527,25 +527,25 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
int num_ext; /* Number of external files for a dataset */
int nfltr; /* Number of filters for a dataset */
H5Z_filter_t fltr; /* Filter identifier */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED;
/* Gather statistics about this type of object */
iter->uniq_dsets++;
/* Get object header information */
- iter->dset_ohdr_info.total_size += oi->hdr.space.total;
- iter->dset_ohdr_info.free_size += oi->hdr.space.free;
+ iter->dset_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dset_ohdr_info.free_size += native_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;
- iter->datasets_heap_storage_size += oi->meta_size.obj.heap_size;
+ iter->datasets_index_storage_size += native_oi->meta_size.obj.index_size;
+ iter->datasets_heap_storage_size += native_oi->meta_size.obj.heap_size;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed");
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
+ 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;
@@ -702,7 +702,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-datatype_stats(iter_t *iter, const H5O_info_t *oi)
+datatype_stats(iter_t *iter, const H5O_info2_t *oi, const H5O_native_info_t *native_oi)
{
herr_t ret_value = SUCCEED;
@@ -710,12 +710,12 @@ datatype_stats(iter_t *iter, const H5O_info_t *oi)
iter->uniq_dtypes++;
/* Get object header information */
- iter->dtype_ohdr_info.total_size += oi->hdr.space.total;
- iter->dtype_ohdr_info.free_size += oi->hdr.space.free;
+ iter->dtype_ohdr_info.total_size += native_oi->hdr.space.total;
+ iter->dtype_ohdr_info.free_size += native_oi->hdr.space.free;
/* Update attribute metadata info */
- if((ret_value = attribute_stats(iter, oi)) < 0)
- H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed");
+ if((ret_value = attribute_stats(iter, oi, native_oi)) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "attribute_stats() failed");
done:
return ret_value;
} /* end datatype_stats() */
@@ -735,32 +735,37 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
+obj_stats(const char *path, const H5O_info2_t *oi, const char *already_visited,
void *_iter)
{
+ H5O_native_info_t native_info;
iter_t *iter = (iter_t *)_iter;
herr_t ret_value = SUCCEED;
/* If the object has already been seen then just return */
if(NULL == already_visited) {
+ /* Retrieve the native info for the object */
+ if(H5Oget_native_info_by_name(iter->fid, path, &native_info, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_native_info_by_name failed");
+
/* Gather some general statistics about the object */
if(oi->rc > iter->max_links)
iter->max_links = oi->rc;
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");
+ if(group_stats(iter, path, oi, &native_info) < 0)
+ 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");
+ if(dataset_stats(iter, path, oi, &native_info) < 0)
+ 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");
+ if(datatype_stats(iter, oi, &native_info) < 0)
+ H5TOOLS_GOTO_ERROR(FAIL, "datatype_stats failed");
break;
case H5O_TYPE_MAP:
@@ -792,7 +797,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info_t *li, void *_iter)
+lnk_stats(const char H5_ATTR_UNUSED *path, const H5L_info2_t *li, void *_iter)
{
iter_t *iter = (iter_t *)_iter;
@@ -1853,7 +1858,7 @@ main(int argc, const char *argv[])
{
iter_t iter;
const char *fname = NULL;
- hid_t fid = -1;
+ hid_t fid = H5I_INVALID_HID;
H5E_auto2_t func;
H5E_auto2_t tools_func;
void *edata;
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index ae57031..927167b 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -252,8 +252,8 @@ int
main (int argc, const char *argv[])
{
char *fname = NULL; /* File name */
- hid_t fapl = -1; /* File access property list */
- hid_t fid = -1; /* File ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
haddr_t image_addr;
hsize_t image_len;
unsigned flags = H5F_ACC_RDWR; /* file access flags */
diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt
index 1130ea7..028935f 100644
--- a/tools/test/h5copy/CMakeLists.txt
+++ b/tools/test/h5copy/CMakeLists.txt
@@ -43,4 +43,6 @@ if (BUILD_SHARED_LIBS)
)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5copy/h5copygentest.c b/tools/test/h5copy/h5copygentest.c
index a3acdae..716b0d2 100644
--- a/tools/test/h5copy/h5copygentest.c
+++ b/tools/test/h5copy/h5copygentest.c
@@ -338,14 +338,14 @@ static void gent_att_compound_vlstr(hid_t loc_id)
const char *v;
} s1;
hsize_t dim[1] = {1}; /* Dimension size */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t did = -1; /* Dataset ID */
- hid_t gid = -1; /* Group ID */
- hid_t vl_str_tid = -1; /* Variable length datatype ID */
- hid_t cmpd_tid = -1; /* Compound datatype ID */
- hid_t null_sid = -1; /* Null dataspace ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t tid = H5I_INVALID_HID; /* Datatype ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t vl_str_tid = H5I_INVALID_HID; /* Variable length datatype ID */
+ hid_t cmpd_tid = H5I_INVALID_HID; /* Compound datatype ID */
+ hid_t null_sid = H5I_INVALID_HID; /* Null dataspace ID */
s1 buf; /* Buffer */
buf.i = 9;
@@ -725,7 +725,7 @@ out:
*------------------------------------------------------------------------*/
static void Test_Obj_Copy(void)
{
- hid_t fid = -1; /* File id */
+ hid_t fid = H5I_INVALID_HID; /* File id */
hid_t fapl_new = (-1); /* File access property id */
unsigned new_format; /* New format or old format */
diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt
index cb4397f..82e09c6 100644
--- a/tools/test/h5diff/CMakeLists.txt
+++ b/tools/test/h5diff/CMakeLists.txt
@@ -43,4 +43,6 @@ if (BUILD_SHARED_LIBS)
)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
index 57bcd12..88ed62c 100644
--- a/tools/test/h5diff/CMakeTests.cmake
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -94,6 +94,17 @@
${HDF5_TOOLS_DIR}/testfiles/vds/5_vds.h5
# tools/testfiles
${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5
+ #STD_REF_OBJ files
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_compat.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_ext1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_ext2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_grp.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_obj_del.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_obj.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_param.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5
)
set (LIST_OTHER_TEST_FILES
@@ -201,6 +212,7 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_56.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_57.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58_ref.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_59.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_500.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_501.txt
@@ -282,6 +294,7 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_reg.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt
@@ -363,35 +376,37 @@
##############################################################################
macro (ADD_H5_TEST resultfile resultcode)
- # If using memchecker add tests without using scripts
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> ${ARGN})
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (${resultcode})
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
- endif ()
- if (last_test)
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- else ()
- add_test (
- NAME H5DIFF-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_ext}>"
- -D "TEST_ARGS:STRING=${ARGN}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
- -D "TEST_OUTPUT=${resultfile}.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=${resultfile}.txt"
- -D "TEST_APPEND=EXIT CODE:"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- if (last_test)
- set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ if (HDF5_TEST_SERIAL)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff${tgt_ext}> ${ARGN})
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if (${resultcode})
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (last_test)
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else ()
+ add_test (
+ NAME H5DIFF-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_ext}>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.txt"
+ -D "TEST_APPEND=EXIT CODE:"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ if (last_test)
+ set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
endif ()
endif ()
- if (H5_HAVE_PARALLEL)
+ if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
ADD_PH5_TEST (${resultfile} ${resultcode} ${ARGN})
endif ()
endmacro ()
@@ -1044,7 +1059,10 @@ ADD_H5_TEST (h5diff_56 1 -v ${FILE4} ${FILE4} dset6a dset6b)
ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b)
# 5.8 (region reference)
-ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg)
+ADD_H5_TEST (h5diff_58 1 -v2 ${FILE7} ${FILE8} refreg)
+ADD_H5_TEST (h5diff_58_ref 1 -v2 ${FILE7} ${FILE8} /g1/reference2D)
+# STD_REF_OBJ
+ADD_H5_TEST (h5diff_reg 0 -v2 trefer_attr.h5 trefer_ext2.h5 Dataset3 Dataset3)
# test for both dset and attr with same type but with different size
# ( HDDFV-7942 )
@@ -1484,8 +1502,6 @@ ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5dif
ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5)
ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5)
-
-
# ##############################################################################
# # diff various multiple vlen and fixed strings in a compound type dataset
# ##############################################################################
@@ -1524,7 +1540,7 @@ ADD_H5_TEST (h5diff_800 1 -v ${FILE7} ${FILE8} /g1/array /g1/array)
ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array)
# ##############################################################################
-# VDS tests
+# # VDS tests
# ##############################################################################
ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2})
ADD_H5_TEST (h5diff_v2 0 -r ${FILEV1} ${FILEV2})
@@ -1533,7 +1549,7 @@ ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2})
##############################################################################
### P L U G I N T E S T S
##############################################################################
-if (BUILD_SHARED_LIBS)
+if (BUILD_SHARED_LIBS AND HDF5_TEST_SERIAL)
ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5)
ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5)
endif ()
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index c711013..05bad77 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -303,8 +303,8 @@ int main(void)
static
int test_basic(const char *fname1, const char *fname2, const char *fname3)
{
- hid_t fid1 = -1, fid2 = -1;
- hid_t gid1 = -1, gid2 = -1, gid3 = -1;
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID, gid3 = H5I_INVALID_HID;
hsize_t dims1[1] = { 6 };
hsize_t dims2[2] = { 3, 2 };
@@ -662,11 +662,11 @@ out:
static
int test_types(const char *fname)
{
- hid_t fid1 = -1;
- hid_t gid1 = -1;
- hid_t gid2 = -1;
- hid_t tid1 = -1;
- hid_t tid2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t tid1 = H5I_INVALID_HID;
+ hid_t tid2 = H5I_INVALID_HID;
herr_t status;
hsize_t dims[1] = { 1 };
typedef struct s1_t {
@@ -787,8 +787,8 @@ int test_types(const char *fname)
static
int test_datatypes(const char *fname)
{
- hid_t fid1 = -1;
- hid_t dset = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
hsize_t dims[2] = { 3, 2 };
herr_t status;
char buf1a[3][2] = { { 1, 1 }, { 1, 1 }, { 1, 1 } };
@@ -977,11 +977,11 @@ int test_datatypes(const char *fname)
static
int test_attributes(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t gid = -1;
- hid_t root_id = -1;
- hid_t sid = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t root_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims[1] = { 2 };
herr_t status;
@@ -1039,14 +1039,14 @@ int test_attributes(const char *file, int make_diffs /* flag to modify data buff
static int test_attributes_verbose_level(const char *fname1, const char *fname2)
{
herr_t status = SUCCEED;
- hid_t fid1 = -1, fid2 = -1;
- hid_t f1_gid = -1, f2_gid = -1;
- hid_t f1_gid2 = -1, f2_gid2 = -1;
- hid_t f1_gid3 = -1, f2_gid3 = -1;
- hid_t f1_gid4 = -1, f2_gid4 = -1;
- hid_t f1_did = -1, f2_did = -1;
- hid_t f1_sid = -1, f2_sid = -1;
- hid_t f1_tid = -1, f2_tid = -1;
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hid_t f1_gid = H5I_INVALID_HID, f2_gid = H5I_INVALID_HID;
+ hid_t f1_gid2 = H5I_INVALID_HID, f2_gid2 = H5I_INVALID_HID;
+ hid_t f1_gid3 = H5I_INVALID_HID, f2_gid3 = H5I_INVALID_HID;
+ hid_t f1_gid4 = H5I_INVALID_HID, f2_gid4 = H5I_INVALID_HID;
+ hid_t f1_did = H5I_INVALID_HID, f2_did = H5I_INVALID_HID;
+ hid_t f1_sid = H5I_INVALID_HID, f2_sid = H5I_INVALID_HID;
+ hid_t f1_tid = H5I_INVALID_HID, f2_tid = H5I_INVALID_HID;
/* dset */
hsize_t dset_dims[1] = { 3 };
int dset_data[3] = { 0, 1, 2 };
@@ -1304,10 +1304,10 @@ out:
static
int test_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t gid = -1;
- hid_t sid = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims[1] = { 2 };
herr_t status;
int buf[2] = { 1, 2 };
@@ -1357,10 +1357,10 @@ int test_datasets(const char *file, int make_diffs /* flag to modify data buffer
static
int test_special_datasets(const char *file, int make_diffs /* flag to modify data buffers */)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t sid0 = -1;
- hid_t sid = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid0 = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims0[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 };
hsize_t dims[SPACE1_RANK] = { SPACE1_DIM1, SPACE1_DIM2 };
herr_t status;
@@ -1413,9 +1413,9 @@ int test_special_datasets(const char *file, int make_diffs /* flag to modify dat
*-------------------------------------------------------------------------*/
static int test_link_name(const char *fname1)
{
- hid_t fid1 = -1;
- hid_t gid1 = -1;
- hid_t gid2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
herr_t status = SUCCEED;
/*-----------------------------------------------------------------------
@@ -1486,8 +1486,8 @@ out:
*-------------------------------------------------------------------------*/
static int test_soft_links(const char *fname1)
{
- hid_t fid1 = -1;
- hid_t gid1 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
@@ -1605,10 +1605,10 @@ out:
*-------------------------------------------------------------------------*/
static int test_linked_softlinks(const char *fname1)
{
- hid_t fid1 = -1;
- hid_t gid1 = -1;
- hid_t gid2 = -1;
- hid_t gid3 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t gid3 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
@@ -1786,10 +1786,10 @@ out:
*-------------------------------------------------------------------------*/
static int test_external_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t gid1 = -1;
- hid_t gid2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
@@ -1931,9 +1931,9 @@ out:
*-------------------------------------------------------------------------*/
static int test_ext2soft_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t gid2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
@@ -2060,12 +2060,12 @@ out:
static
int gen_dataset_idx(const char *file, int format)
{
- hid_t fid = -1; /* file id */
- hid_t did = -1;
- hid_t did2 = -1; /* dataset id */
- hid_t sid = -1; /* space id */
- hid_t fapl = -1; /* file access property id */
- hid_t dcpl = -1; /* dataset creation property id */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t did = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID; /* dataset id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t fapl = H5I_INVALID_HID; /* file access property id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
hsize_t dims[1] = { 10 }; /* dataset dimension */
hsize_t c_dims[1] = { 2 }; /* chunk dimension */
herr_t status; /* return status */
@@ -2146,8 +2146,8 @@ int gen_dataset_idx(const char *file, int format)
*-------------------------------------------------------------------------*/
static int test_dangle_links(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
int data2[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
@@ -2346,10 +2346,10 @@ out:
*-------------------------------------------------------------------------*/
static int test_group_recurse(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t gid1_f1 = -1, gid2_f1 = -1, gid3_f1 = -1, gid10_f1 = -1;
- hid_t gid1_f2 = -1, gid2_f2 = -1, gid3_f2 = -1, gid11_f2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1_f1 = H5I_INVALID_HID, gid2_f1 = H5I_INVALID_HID, gid3_f1 = H5I_INVALID_HID, gid10_f1 = H5I_INVALID_HID;
+ hid_t gid1_f2 = H5I_INVALID_HID, gid2_f2 = H5I_INVALID_HID, gid3_f2 = H5I_INVALID_HID, gid11_f2 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 1 }, { 0, 1 }, { 1, 0 }, { 1, 0 } };
int data2[4][2] = { { 0, 2 }, { 0, 2 }, { 2, 0 }, { 2, 0 } };
@@ -2758,18 +2758,18 @@ out:
#define GRP_R_DSETNAME2 "dset2"
static int test_group_recurse2(void)
{
- hid_t fileid1 = -1;
- hid_t grp1 = -1;
- hid_t grp2 = -1;
- hid_t grp3 = -1;
- hid_t grp4 = -1;
- hid_t dset1 = -1;
- hid_t dset2 = -1;
- hid_t datatype = -1;
- hid_t dataspace = -1;
- hid_t fileid2 = -1;
- hid_t fileid3 = -1;
- hid_t fileid4 = -1;
+ hid_t fileid1 = H5I_INVALID_HID;
+ hid_t grp1 = H5I_INVALID_HID;
+ hid_t grp2 = H5I_INVALID_HID;
+ hid_t grp3 = H5I_INVALID_HID;
+ hid_t grp4 = H5I_INVALID_HID;
+ hid_t dset1 = H5I_INVALID_HID;
+ hid_t dset2 = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dataspace = H5I_INVALID_HID;
+ hid_t fileid2 = H5I_INVALID_HID;
+ hid_t fileid3 = H5I_INVALID_HID;
+ hid_t fileid4 = H5I_INVALID_HID;
hsize_t dimsf[2]; /* dataset dimensions */
herr_t status = 0;
int data1[4][2] = { { 0, 0 }, { 1, 1 }, { 2, 2 }, { 3, 3 } };
@@ -3069,10 +3069,10 @@ out:
*-------------------------------------------------------------------------*/
static int test_exclude_obj1(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t gid1 = -1;
- hid_t gid2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
@@ -3189,11 +3189,11 @@ out:
*-------------------------------------------------------------------------*/
static int test_exclude_obj2(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t gid1 = -1;
- hid_t gid2 = -1;
- hid_t gid3 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t gid3 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
int data2[4][2] = { { 0, 1 }, { 2, 3 }, { 1, 2 }, { 3, 4 } };
@@ -3320,9 +3320,9 @@ out:
*-------------------------------------------------------------------------*/
static int test_exclude_obj3(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t gid1 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
hsize_t dims2[2] = { 2, 4 };
int data1[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } };
herr_t status = SUCCEED;
@@ -3416,8 +3416,8 @@ out:
static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new)
{
int i;
- hid_t fid1 = -1; /* file id */
- hid_t gid = -1;
+ hid_t fid1 = H5I_INVALID_HID; /* file id */
+ hid_t gid = H5I_INVALID_HID;
/* compound1 datatype */
typedef struct comp1_t {
@@ -3534,21 +3534,21 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
} comp9_t;
/* vlen string */
- hid_t sid_vlen_str = -1; /* dataspace ID */
- hid_t tid_vlen_str = -1; /* datatype ID */
+ hid_t sid_vlen_str = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_vlen_str = H5I_INVALID_HID; /* datatype ID */
char vlen_str_buf[] = { "Variable length string" };
hsize_t dims_vlen_str[] = { VLEN_STR_DIM };
/* fixlen string */
- hid_t sid_fixlen_str = -1; /* dataspace ID */
- hid_t tid_fixlen_str = -1; /* datatype ID */
+ hid_t sid_fixlen_str = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_fixlen_str = H5I_INVALID_HID; /* datatype ID */
const char fixlen_str_buf[FIXLEN_STR_SIZE] = { "Fixed length string" };
hsize_t dims_fixlen_str[] = { FIXLEN_STR_DIM };
/* vlen string array */
- hid_t sid_vlen_str_array = -1; /* dataspace ID */
- hid_t tid_vlen_str_array_pre = -1; /* datatype ID */
- hid_t tid_vlen_str_array = -1; /* datatype ID */
+ hid_t sid_vlen_str_array = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_vlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid_vlen_str_array = H5I_INVALID_HID; /* datatype ID */
const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM] =
{ "1 - Variable length string Array",
"2 - Testing variable length string array in compound type",
@@ -3556,9 +3556,9 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
hsize_t dims_vlen_str_array[] = { VLEN_STR_ARRY_DIM };
/* fixlen string array */
- hid_t sid_fixlen_str_array = -1; /* dataspace ID */
- hid_t tid_fixlen_str_array_pre = -1; /* datatype ID */
- hid_t tid_fixlen_str_array = -1; /* datatype ID */
+ hid_t sid_fixlen_str_array = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid_fixlen_str_array_pre = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid_fixlen_str_array = H5I_INVALID_HID; /* datatype ID */
const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM] = {
"1 - Fixed length string Array", "2 - Fixed length string Array",
"3 - Fixed length string Array" };
@@ -3567,17 +3567,17 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/*------------------------------------------
* compound dataset
*------------------------------------------*/
- hid_t sid_comp = -1; /* dataspace ID */
- hid_t tid1_comp = -1; /* datatype ID */
- hid_t tid2_comp = -1; /* datatype ID */
- hid_t tid3_comp = -1; /* datatype ID */
- hid_t tid4_comp = -1; /* datatype ID */
- hid_t tid5_comp = -1; /* datatype ID */
- hid_t tid6_comp = -1; /* datatype ID */
- hid_t tid7_comp = -1; /* datatype ID */
- hid_t tid8_comp = -1; /* datatype ID */
- hid_t tid9_comp = -1; /* datatype ID */
- hid_t did_comp = -1; /* dataset ID */
+ hid_t sid_comp = H5I_INVALID_HID; /* dataspace ID */
+ hid_t tid1_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid2_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid3_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid4_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid5_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid6_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid7_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid8_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t tid9_comp = H5I_INVALID_HID; /* datatype ID */
+ hid_t did_comp = H5I_INVALID_HID; /* dataset ID */
hsize_t dims_comp[] = { COMP_DIM };
herr_t status = SUCCEED;
@@ -4020,7 +4020,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
H5Dclose(did_comp);
- did_comp = -1;
+ did_comp = H5I_INVALID_HID;
out:
/*-----------------------------------------------------------------------
@@ -4091,9 +4091,9 @@ out:
static int test_enums(const char *fname)
{
- hid_t fid = -1;
+ hid_t fid = H5I_INVALID_HID;
- hid_t tid = -1;
+ hid_t tid = H5I_INVALID_HID;
int enum_val = -1;
/* The data in the two arrays cover the following cases:
@@ -4217,13 +4217,13 @@ static void test_comps_array(const char *fname, const char *dset, const char *at
cmpd1_t wdata[SDIM_DSET]; /* dataset with compound1 */
- hid_t fid = -1; /* HDF5 File IDs */
- hid_t did_dset = -1; /* Dataset ID */
- hid_t sid_dset = -1; /* Dataset space ID */
- hid_t tid_cmpd1 = -1; /* Compound1 type ID */
- hid_t tid_arry1 = -1; /* Array type ID in compound1 */
- hid_t tid_cmpd2 = -1; /* Compound2 type ID */
- hid_t tid_attr = -1;
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
+ hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* Dataset space ID */
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 type ID */
+ hid_t tid_arry1 = H5I_INVALID_HID; /* Array type ID in compound1 */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 type ID */
+ hid_t tid_attr = H5I_INVALID_HID;
hsize_t sdims_dset[] = { SDIM_DSET };
hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY };
int i, j;
@@ -4326,13 +4326,13 @@ static void test_comps_vlen(const char * fname, const char *dset, const char *at
cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
- hid_t fid = -1; /* HDF5 File ID */
- hid_t did_dset = -1; /* dataset ID */
- hid_t sid_dset = -1; /* dataset space ID */
- hid_t tid_attr = -1;
- hid_t tid_cmpd2 = -1; /* compound2 type ID */
- hid_t tid_cmpd1 = -1; /* compound1 type ID */
- hid_t tid_cmpd1_vlen = -1;
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
+ hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
hsize_t sdims_dset[] = { SDIM_DSET };
unsigned i, j; /* counting variables */
@@ -4442,15 +4442,15 @@ static void test_comps_array_vlen(const char * fname, const char *dset, const ch
} cmpd1_t;
cmpd1_t wdata[SDIM_DSET]; /* Information to write */
- hid_t fid = -1; /* HDF5 File IDs */
- hid_t did_dset = -1; /* Dataset ID */
- hid_t sid_dset = -1; /* Dataspace ID */
- hid_t tid_attr = -1;
- hid_t tid_cmpd1 = -1; /* Compound1 Datatype ID */
- hid_t tid_arry1 = -1; /* Array Datatype ID */
- hid_t tid_cmpd2 = -1; /* Compound2 Datatype ID */
- hid_t tid_cmpd2_vlen = -1;
- hid_t tid_cmpd3 = -1; /* Compound3 Datatype ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File IDs */
+ hid_t did_dset = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* Compound1 Datatype ID */
+ hid_t tid_arry1 = H5I_INVALID_HID; /* Array Datatype ID */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* Compound2 Datatype ID */
+ hid_t tid_cmpd2_vlen = H5I_INVALID_HID;
+ hid_t tid_cmpd3 = H5I_INVALID_HID; /* Compound3 Datatype ID */
hsize_t sdims_dset[] = { SDIM_DSET };
hsize_t sdims_arry[] = { SDIM_CMPD_ARRAY };
unsigned i, j, k; /* counting variables */
@@ -4584,15 +4584,15 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
cmpd1_t wdata[SDIM_DSET]; /* Dataset for compound1 */
- hid_t fid = -1; /* HDF5 File ID */
- hid_t did_dset = -1; /* dataset ID */
- hid_t sid_dset = -1; /* dataset space ID */
- hid_t tid_attr = -1;
- hid_t tid_cmpd3 = -1; /* compound3 type ID */
- hid_t tid_cmpd2 = -1; /* compound2 type ID */
- hid_t tid_cmpd2_arry = -1;
- hid_t tid_cmpd1 = -1; /* compound1 type ID */
- hid_t tid_cmpd1_vlen = -1;
+ hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */
+ hid_t did_dset = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid_dset = H5I_INVALID_HID; /* dataset space ID */
+ hid_t tid_attr = H5I_INVALID_HID;
+ hid_t tid_cmpd3 = H5I_INVALID_HID; /* compound3 type ID */
+ hid_t tid_cmpd2 = H5I_INVALID_HID; /* compound2 type ID */
+ hid_t tid_cmpd2_arry = H5I_INVALID_HID;
+ hid_t tid_cmpd1 = H5I_INVALID_HID; /* compound1 type ID */
+ hid_t tid_cmpd1_vlen = H5I_INVALID_HID;
hsize_t sdims_dset[] = { SDIM_DSET };
hsize_t sdims_cmpd_arry[] = { SDIM_CMPD_ARRAY };
@@ -4717,14 +4717,14 @@ static void test_comps_vlen_arry(const char * fname, const char *dset, const cha
#define DIM_ARRY 3
static void test_data_nocomparables(const char * fname, int make_diffs)
{
- hid_t fid = -1;
- hid_t gid1 = -1;
- hid_t gid2 = -1;
- hid_t did1 = -1;
- hid_t did2 = -1;
- hid_t sid1 = -1;
- hid_t tid_dset1 = -1;
- hid_t tid_attr1 = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t did1 = H5I_INVALID_HID;
+ hid_t did2 = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t tid_dset1 = H5I_INVALID_HID;
+ hid_t tid_attr1 = H5I_INVALID_HID;
hsize_t dims1_1[1] = { DIM_ARRY };
hsize_t dims1_2[1] = { DIM_ARRY + 1 };
hsize_t dims2[2] = { DIM_ARRY, 1 };
@@ -4913,14 +4913,14 @@ out:
static void
test_objs_nocomparables(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t topgid1 = -1;
- hid_t topgid2 = -1;
- hid_t gid1 = -1;
- hid_t tid1 = -1;
- hid_t gid2 = -1;
- hid_t tid2 = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t topgid1 = H5I_INVALID_HID;
+ hid_t topgid2 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID;
+ hid_t tid1 = H5I_INVALID_HID;
+ hid_t gid2 = H5I_INVALID_HID;
+ hid_t tid2 = H5I_INVALID_HID;
hsize_t dims[1] = { DIM_ARRY };
int data1[DIM_ARRY] = { 1, 1, 1 };
int data2[DIM_ARRY] = { 2, 2, 2 };
@@ -5039,12 +5039,12 @@ static hid_t mkstr(int size, H5T_str_t pad)
*-------------------------------------------------------------------------*/
static void test_objs_strings(const char *fname1, const char *fname2)
{
- hid_t fid1 = -1;
- hid_t fid2 = -1;
- hid_t dataset = -1;
- hid_t space = -1;
- hid_t f_type = -1;
- hid_t m_type = -1;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t dataset = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
+ hid_t m_type = H5I_INVALID_HID;
hsize_t dims1[] = { 3, 4 };
char string1A[12][3] = { "s1", "s2", "s3", "s4", "s5", "s6", "s", "s", "s9",
"s0", "s1", "s2" };
@@ -5211,9 +5211,9 @@ void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make
RED, GREEN
} e_t;
- hid_t aid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
herr_t status;
int val, i, j, k, l, n;
float f;
@@ -6202,9 +6202,9 @@ void write_attr_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
RED, GREEN
} e_t;
- hid_t aid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
herr_t status;
int val, i, j, k, l, n;
float f;
@@ -7193,10 +7193,10 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
RED, GREEN
} e_t;
- hid_t did = -1;
- hid_t sid = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
herr_t status;
int val, i, j, k, l, n;
float f;
@@ -7417,9 +7417,9 @@ void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int make_diff
{
double *dbuf; /* information to write */
- hid_t ldid = -1; /* dataset ID */
- hid_t lsid = -1; /* dataspace ID */
- hid_t ltid = -1; /* datatype ID */
+ hid_t ldid = H5I_INVALID_HID; /* dataset ID */
+ hid_t lsid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t ltid = H5I_INVALID_HID; /* datatype ID */
size_t size;
hsize_t sdims[] = { 1 };
hsize_t tdims[] = { H5TOOLS_MALLOCSIZE / sizeof(double) + 1 };
@@ -7820,13 +7820,13 @@ static
void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
{
/* data dataset */
- hid_t did1 = -1; /* dataset ID */
- hid_t sid1 = -1; /* dataspace ID */
+ hid_t did1 = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid1 = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims1[2] = { 10, 10 };/* dimensions */
int *buf; /* dataset buffer */
/* reference dataset */
- hid_t did2 = -1; /* dataset ID */
- hid_t sid2 = -1; /* dataspace ID */
+ hid_t did2 = H5I_INVALID_HID; /* dataset ID */
+ hid_t sid2 = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims2[] = { 2 }; /* 2 references */
hdset_reg_ref_t *rbuf; /* buffer for write the references */
hsize_t start[10]; /* starting location of hyperslab */
@@ -7931,12 +7931,12 @@ void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */)
static
int test_hyperslab(const char *fname, int make_diffs /* flag to modify data buffers */)
{
- hid_t did = -1;
- hid_t fid = -1;
- hid_t f_sid = -1;
- hid_t m_sid = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
hsize_t dims[1] = { GBLL }; /* dataset dimensions */
hsize_t hs_size[1] = { GBLL / (1024 * 1024) }; /* hyperslab dimensions */
hsize_t chunk_dims[1] = { GBLL / 1024 }; /* chunk dimensions */
@@ -8030,8 +8030,8 @@ out:
static
int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf)
{
- hid_t aid = -1;
- hid_t sid = -1;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
/* create a space */
if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
@@ -8070,8 +8070,8 @@ out:
static herr_t
write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf)
{
- hid_t did = -1;
- hid_t sid = -1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
/* create a space */
if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
diff --git a/tools/test/h5diff/testfiles/h5diff_58.txt b/tools/test/h5diff/testfiles/h5diff_58.txt
index d27a0c9..da147bc 100644
--- a/tools/test/h5diff/testfiles/h5diff_58.txt
+++ b/tools/test/h5diff/testfiles/h5diff_58.txt
@@ -1,3 +1,4 @@
+
dataset: </refreg> and </refreg>
Referenced dataset 10784 10784
------------------------------------------------------------
@@ -8,4 +9,7 @@ point #1 (2,2) (3,3)
point #3 (1,6) (2,5)
point #4 (2,8) (1,7)
4 differences found
+ obj1 obj2
+ --------------------------------------
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_58_ref.txt b/tools/test/h5diff/testfiles/h5diff_58_ref.txt
new file mode 100644
index 0000000..6fa2299
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_58_ref.txt
@@ -0,0 +1,37 @@
+
+dataset: </g1/reference2D> and </g1/reference2D>
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+size: [2] [2]
+position difference
+------------------------------------------------------------
+[ 0 ] 1 0 1
+[ 1 ] 2 0 2
+12 differences found
+ obj1 obj2
+ --------------------------------------
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_reg.txt b/tools/test/h5diff/testfiles/h5diff_reg.txt
new file mode 100644
index 0000000..d4f5415
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_reg.txt
@@ -0,0 +1,15 @@
+
+dataset: </Dataset3> and </Dataset3>
+attribute: <Attr1 of <(null)>> and <Attr1 of <(null)>>
+0 differences found
+Warning: Cannot open referenced attribute: attribute 1
+Warning: Cannot open referenced attribute: attribute 2
+attribute: <Attr2 of <(null)>> and <Attr2 of <(null)>>
+0 differences found
+attribute: <Attr3 of <(null)>> and <Attr3 of <(null)>>
+0 differences found
+0 differences found
+ obj1 obj2
+ --------------------------------------
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in
index 557d2ff..2d490a8 100644
--- a/tools/test/h5diff/testh5diff.sh.in
+++ b/tools/test/h5diff/testh5diff.sh.in
@@ -150,6 +150,19 @@ $SRC_TOOLS_TESTFILES/vds/5_c.h5
$SRC_TOOLS_TESTFILES/vds/5_vds.h5
"
+LIST_HDF5_STD_REF_OBJ_TEST_FILES="
+$SRC_TOOLS_TESTFILES/trefer_attr.h5
+$SRC_TOOLS_TESTFILES/trefer_compat.h5
+$SRC_TOOLS_TESTFILES/trefer_ext1.h5
+$SRC_TOOLS_TESTFILES/trefer_ext2.h5
+$SRC_TOOLS_TESTFILES/trefer_grp.h5
+$SRC_TOOLS_TESTFILES/trefer_obj_del.h5
+$SRC_TOOLS_TESTFILES/trefer_obj.h5
+$SRC_TOOLS_TESTFILES/trefer_param.h5
+$SRC_TOOLS_TESTFILES/trefer_reg_1d.h5
+$SRC_TOOLS_TESTFILES/trefer_reg.h5
+"
+
LIST_OTHER_TEST_FILES="
$SRC_H5DIFF_TESTFILES/h5diff_10.txt
$SRC_H5DIFF_TESTFILES/h5diff_100.txt
@@ -259,6 +272,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_55.txt
$SRC_H5DIFF_TESTFILES/h5diff_56.txt
$SRC_H5DIFF_TESTFILES/h5diff_57.txt
$SRC_H5DIFF_TESTFILES/h5diff_58.txt
+$SRC_H5DIFF_TESTFILES/h5diff_58_ref.txt
$SRC_H5DIFF_TESTFILES/h5diff_59.txt
$SRC_H5DIFF_TESTFILES/h5diff_500.txt
$SRC_H5DIFF_TESTFILES/h5diff_501.txt
@@ -338,6 +352,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_80.txt
$SRC_H5DIFF_TESTFILES/h5diff_90.txt
$SRC_H5DIFF_TESTFILES/h5diff_8625.txt
$SRC_H5DIFF_TESTFILES/h5diff_8639.txt
+$SRC_H5DIFF_TESTFILES/h5diff_reg.txt
$SRC_H5DIFF_TESTFILES/h5diff_v1.txt
$SRC_H5DIFF_TESTFILES/h5diff_v2.txt
$SRC_H5DIFF_TESTFILES/h5diff_v3.txt
@@ -347,7 +362,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_vlstr.txt
#
# copy test files and expected output files from source dirs to test dir
#
-COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_HDF5_VDS_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML"
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_HDF5_VDS_TEST_FILES $LIST_HDF5_STD_REF_OBJ_TEST_FILES $LIST_OTHER_TEST_FILES $LIST_HDF5_TEST_FILES_XML $LIST_OTHER_TEST_FILES_XML"
COPY_TESTFILES_TO_TESTDIR()
{
@@ -691,7 +706,10 @@ TOOLTEST h5diff_56.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset6a dset6b
TOOLTEST h5diff_57.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset7a dset7b
# 5.8 (region reference)
-TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg
+TOOLTEST h5diff_58.txt -v2 h5diff_dset1.h5 h5diff_dset2.h5 refreg
+TOOLTEST h5diff_58_ref.txt -v2 h5diff_dset1.h5 h5diff_dset2.h5 /g1/reference2D
+# STD_REF_OBJ
+TOOLTEST h5diff_reg.txt -v2 trefer_attr.h5 trefer_ext2.h5 Dataset3 Dataset3
# test for both dset and attr with same type but with different size
# ( HDDFV-7942 )
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
index 38f4118..b9e4ef5 100644
--- a/tools/test/h5dump/CMakeLists.txt
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -43,10 +43,12 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
#add_test (NAME h5dumpgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dumpgentest>)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
-include (CMakeTestsPBITS.cmake)
+ include (CMakeTestsPBITS.cmake)
-include (CMakeTestsVDS.cmake)
+ include (CMakeTestsVDS.cmake)
-include (CMakeTestsXML.cmake)
+ include (CMakeTestsXML.cmake)
+endif ()
diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index 62b2619..2e731f3 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -198,6 +198,16 @@
${HDF5_TOOLS_DIR}/testfiles/h5dump-help.txt
${HDF5_TOOLS_DIR}/testfiles/out3.h5import
${HDF5_TOOLS_DIR}/testfiles/zerodim.ddl
+ #STD_REF_OBJ files
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_attrR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_compatR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_extR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_grpR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_obj_delR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_objR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_paramR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1dR.ddl
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_regR.ddl
)
set (HDF5_N_REFERENCE_FILES
tall-3
@@ -322,6 +332,18 @@
${HDF5_TOOLS_DIR}/testfiles/tvms.h5
${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5
${HDF5_TOOLS_DIR}/testfiles/zerodim.h5
+ #STD_REF_OBJ files
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_attr.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_compat.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_ext1.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_ext2.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_grp.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_obj_del.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_obj.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_param.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_reg_1d.h5
+ ${HDF5_TOOLS_DIR}/testfiles/trefer_reg.h5
+
)
set (HDF5_ERROR_REFERENCE_TEST_FILES
${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err
@@ -1108,6 +1130,17 @@
ADD_H5ERR_MASK_TEST (tattrregR 0 "NULL token size" -R --enable-error-stack tattrreg.h5)
ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o)
+ # test for 1.12 region references
+ ADD_H5_TEST (trefer_attrR 0 --enable-error-stack -R trefer_attr.h5)
+ ADD_H5_TEST (trefer_compatR 0 --enable-error-stack -R trefer_compat.h5)
+ ADD_H5_TEST (trefer_extR 0 --enable-error-stack -R trefer_ext2.h5)
+ ADD_H5_TEST (trefer_grpR 0 --enable-error-stack -R trefer_grp.h5)
+ ADD_H5_TEST (trefer_obj_delR 0 --enable-error-stack -R trefer_obj_del.h5)
+ ADD_H5_TEST (trefer_objR 0 --enable-error-stack -R trefer_obj.h5)
+ ADD_H5_TEST (trefer_paramR 0 --enable-error-stack -R trefer_param.h5)
+ ADD_H5_TEST (trefer_regR 0 --enable-error-stack -R trefer_reg.h5)
+ ADD_H5_TEST (trefer_reg_1dR 0 --enable-error-stack -R trefer_reg_1d.h5)
+
# tests for group creation order
# "1" tracked, "2" name, root tracked
ADD_H5_TEST (tordergr1 0 --enable-error-stack --group=1 --sort_by=creation_order --sort_order=ascending tordergr.h5)
diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err
index 2d70b35..39bbb0e 100644
--- a/tools/test/h5dump/errfiles/tdset-2.err
+++ b/tools/test/h5dump/errfiles/tdset-2.err
@@ -27,7 +27,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ #000: (file name) line (number) in H5Lget_info2(): unable to get link info
major: Links
minor: Can't get value
#001: (file name) line (number) in H5VL_link_get(): link get failed
diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err
index b0b908b..e2f24c1 100644
--- a/tools/test/h5dump/errfiles/tperror.err
+++ b/tools/test/h5dump/errfiles/tperror.err
@@ -27,7 +27,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ #000: (file name) line (number) in H5Lget_info2(): unable to get link info
major: Links
minor: Can't get value
#001: (file name) line (number) in H5VL_link_get(): link get failed
diff --git a/tools/test/h5dump/errfiles/tqmarkfile.err b/tools/test/h5dump/errfiles/tqmarkfile.err
index 2c4f1ff..4c3b2ef 100644
--- a/tools/test/h5dump/errfiles/tqmarkfile.err
+++ b/tools/test/h5dump/errfiles/tqmarkfile.err
@@ -15,7 +15,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
- #000: (file name) line (number) in H5Lget_info(): unable to get link info
+ #000: (file name) line (number) in H5Lget_info2(): unable to get link info
major: Symbol table
minor: Object not found
#001: (file name) line (number) in H5L_get_info(): name doesn't exist
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index d0421d2..a686660 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -638,11 +638,11 @@ static void gent_softlink(void)
#define NY 2
static int gent_softlink2(void)
{
- hid_t fileid1 = -1;
- hid_t gid1 = -1, gid2 = -1;
- hid_t datatype = -1;
- hid_t dset1 = -1, dset2 = -1;
- hid_t dataspace = -1;
+ hid_t fileid1 = H5I_INVALID_HID;
+ hid_t gid1 = H5I_INVALID_HID, gid2 = H5I_INVALID_HID;
+ hid_t datatype = H5I_INVALID_HID;
+ hid_t dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID;
+ hid_t dataspace = H5I_INVALID_HID;
hsize_t dimsf[2]; /* dataset dimensions */
int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}};
int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}};
@@ -2548,7 +2548,7 @@ static void gent_opaque(void)
static void gent_bitfields(void)
{
- hid_t file, grp=-1, type=-1, space=-1, dset=-1;
+ hid_t file, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
size_t i;
hsize_t nelmts;
unsigned char buf[32];
@@ -3471,10 +3471,10 @@ static void gent_array7(void)
/* Test the boundary of the display output buffer at the reallocation event */
static void gent_array8(void)
{
- hid_t file = -1; /* Handles */
- hid_t filetype = -1; /* Handles */
- hid_t space = -1; /* Handles */
- hid_t dset = -1; /* Handles */
+ hid_t file = H5I_INVALID_HID; /* Handles */
+ hid_t filetype = H5I_INVALID_HID; /* Handles */
+ hid_t space = H5I_INVALID_HID; /* Handles */
+ hid_t dset = H5I_INVALID_HID; /* Handles */
herr_t status = -1;
hsize_t sdims[] = {F64_DIM0};
hsize_t tdims[] = {F64_DIM1};
@@ -6353,12 +6353,12 @@ gent_binary(void)
static void
gent_bigdims(void)
{
- hid_t fid = -1;
- hid_t did = -1;
- hid_t f_sid = -1;
- hid_t m_sid = -1;
- hid_t tid = -1;
- hid_t dcpl = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t f_sid = H5I_INVALID_HID;
+ hid_t m_sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */
hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
hsize_t hs_start[1];
@@ -6418,19 +6418,19 @@ gent_bigdims(void)
/* close */
if(H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
if(H5Sclose(f_sid) < 0)
goto out;
- f_sid = -1;
+ f_sid = H5I_INVALID_HID;
if(H5Sclose(m_sid) < 0)
goto out;
- m_sid = -1;
+ m_sid = H5I_INVALID_HID;
if(H5Pclose(dcpl) < 0)
goto out;
- dcpl = -1;
+ dcpl = H5I_INVALID_HID;
if(H5Dclose(did) < 0)
goto out;
- did = -1;
+ did = H5I_INVALID_HID;
ret = H5Fclose(fid);
HDassert(ret >= 0);
@@ -6494,10 +6494,10 @@ gent_hyperslab(void)
static void
gent_group_creation_order(void)
{
- hid_t fid = -1; /* file ID */
- hid_t gid = -1; /* group ID */
- hid_t gcpl_id = -1; /* group creation property list ID */
- hid_t fcpl_id = -1; /* file creation property list ID (to set root group order) */
+ hid_t fid = H5I_INVALID_HID; /* file ID */
+ hid_t gid = H5I_INVALID_HID; /* group ID */
+ hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
+ hid_t fcpl_id = H5I_INVALID_HID; /* file creation property list ID (to set root group order) */
if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto out;
@@ -6523,45 +6523,45 @@ gent_group_creation_order(void)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
@@ -6576,56 +6576,56 @@ gent_group_creation_order(void)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
if(H5Pclose(gcpl_id) < 0)
goto out;
- gcpl_id = -1;
+ gcpl_id = H5I_INVALID_HID;
if(H5Pclose(fcpl_id) < 0)
goto out;
- fcpl_id = -1;
+ fcpl_id = H5I_INVALID_HID;
if(H5Fclose(fid) < 0)
goto out;
- fid = -1;
+ fid = H5I_INVALID_HID;
return;
@@ -6653,15 +6653,15 @@ gent_group_creation_order(void)
static void
gent_attr_creation_order(void)
{
- hid_t fid = -1; /* file id */
- hid_t gid = -1; /* group id */
- hid_t did = -1; /* dataset id */
- hid_t sid = -1; /* space id */
- hid_t aid = -1; /* attribute id */
- hid_t tid = -1; /* datatype id */
- hid_t gcpl_id = -1; /* group creation property list ID */
- hid_t dcpl_id = -1; /* dataset creation property list ID */
- hid_t tcpl_id = -1; /* datatype creation property list ID */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t gid = H5I_INVALID_HID; /* group id */
+ hid_t did = H5I_INVALID_HID; /* dataset id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t aid = H5I_INVALID_HID; /* attribute id */
+ hid_t tid = H5I_INVALID_HID; /* datatype id */
+ hid_t gcpl_id = H5I_INVALID_HID; /* group creation property list ID */
+ hid_t dcpl_id = H5I_INVALID_HID; /* dataset creation property list ID */
+ hid_t tcpl_id = H5I_INVALID_HID; /* datatype creation property list ID */
int i;
const char *attr_name[3] = {"c", "b", "a" };
@@ -6714,12 +6714,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
} /* end for */
if(H5Dclose(did) < 0)
goto out;
- did = -1;
+ did = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
@@ -6740,12 +6740,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
} /* end for */
if(H5Dclose(did) < 0)
goto out;
- did = -1;
+ did = H5I_INVALID_HID;
@@ -6766,12 +6766,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
} /* end for */
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* create a group without creation order tracked for attributes and atributes in it
@@ -6790,12 +6790,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
} /* end for */
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* create a named datatype with creation order tracked for attributes and atributes in it
@@ -6817,12 +6817,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
} /* end for */
if(H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* create a named datatype without creation order tracked for attributes and atributes in it
@@ -6844,12 +6844,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
} /* end for */
if(H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* add some attributes to the root group
@@ -6867,12 +6867,12 @@ gent_attr_creation_order(void)
/* close attribute */
if(H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
} /* end for */
if(H5Gclose(gid) < 0)
goto out;
- gid = -1;
+ gid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* close
@@ -6880,19 +6880,19 @@ gent_attr_creation_order(void)
*/
if(H5Sclose(sid) < 0)
goto out;
- sid = -1;
+ sid = H5I_INVALID_HID;
if(H5Pclose(dcpl_id) < 0)
goto out;
- dcpl_id = -1;
+ dcpl_id = H5I_INVALID_HID;
if(H5Pclose(gcpl_id) < 0)
goto out;
- gcpl_id = -1;
+ gcpl_id = H5I_INVALID_HID;
if(H5Pclose(tcpl_id) < 0)
goto out;
- tcpl_id = -1;
+ tcpl_id = H5I_INVALID_HID;
if(H5Fclose(fid) < 0)
goto out;
- fid = -1;
+ fid = H5I_INVALID_HID;
@@ -9797,7 +9797,7 @@ static void gent_bitnopaquefields(void)
uint64_t d;
} s_t;
- hid_t file, grp=-1, type=-1, space=-1, dset=-1;
+ hid_t file_id=H5I_INVALID_HID, grp=H5I_INVALID_HID, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
size_t i;
hsize_t nelmts = F80_DIM32;
uint8_t buf[F80_DIM32]; /* bitfield, opaque */
@@ -9806,9 +9806,9 @@ static void gent_bitnopaquefields(void)
uint64_t buf4[F80_DIM32]; /* bitfield, opaque */
s_t buf5[F80_DIM32]; /* compound */
- file = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ file_id = H5Fcreate(FILE80, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- if ((grp = H5Gcreate2(file, "bittypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((grp = H5Gcreate2(file_id, "bittypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
/* bitfield_1 */
if ((type = H5Tcopy(H5T_STD_B8LE)) >= 0) {
if ((space = H5Screate_simple(1, &nelmts, NULL)) >= 0) {
@@ -9872,7 +9872,7 @@ static void gent_bitnopaquefields(void)
H5Gclose(grp);
}
- if ((grp = H5Gcreate2(file, "opaquetypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((grp = H5Gcreate2(file_id, "opaquetypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
/* opaque_1 */
if ((type = H5Tcreate(H5T_OPAQUE, 1)) >= 0) {
if ((H5Tset_tag(type, "1-byte opaque type")) >= 0) {
@@ -9908,7 +9908,7 @@ static void gent_bitnopaquefields(void)
H5Gclose(grp);
}
- if ((grp = H5Gcreate2(file, "cmpdtypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if ((grp = H5Gcreate2(file_id, "cmpdtypetests", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
/* compound_1 */
if ((type = H5Tcreate(H5T_COMPOUND, sizeof(s_t))) >= 0) {
H5Tinsert(type, "a", HOFFSET(s_t, a), H5T_STD_B8LE);
@@ -9934,7 +9934,7 @@ static void gent_bitnopaquefields(void)
H5Gclose(grp);
}
- H5Fclose(file);
+ H5Fclose(file_id);
}
/*-------------------------------------------------------------------------
@@ -10033,9 +10033,9 @@ static void gent_compound_complex2(void)
compound *buf; /* compound */
- hid_t file, type=-1, space=-1, dset=-1;
+ hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
hid_t dset_array_a, dset_array_b, dset_array_c;
- hid_t cmpd_tid1 = -1, cmpd_tid2 = -1, cmpd_tid3 = -1;
+ hid_t cmpd_tid1 = H5I_INVALID_HID, cmpd_tid2 = H5I_INVALID_HID, cmpd_tid3 = H5I_INVALID_HID;
size_t i;
size_t j, k;
unsigned dset_array_ndims;
@@ -10321,7 +10321,7 @@ static void gent_vlenstr_array(void)
};
const char *buffer[F83_DIM*F83_ARRAYDIM];
- hid_t file, type=-1, space=-1, dset=-1;
+ hid_t file, type=H5I_INVALID_HID, space=H5I_INVALID_HID, dset=H5I_INVALID_HID;
hid_t cmpd_tid1, array_tid;
int i, j;
@@ -10564,10 +10564,10 @@ static void gent_null_space_group(void)
static void
gent_err_attr_dspace(void)
{
- hid_t fid = -1; /* File identifier */
- hid_t fcpl = -1; /* File access property list */
- hid_t sid = -1; /* Dataspace identifier */
- hid_t aid = -1; /* Attribute identifier */
+ hid_t fid = H5I_INVALID_HID; /* File identifier */
+ hid_t fcpl = H5I_INVALID_HID; /* File access property list */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace identifier */
+ hid_t aid = H5I_INVALID_HID; /* Attribute identifier */
hsize_t dims = 2; /* Dimensino size */
int wdata[2] = {7, 42}; /* The buffer to write */
int fd = -1; /* The file descriptor */
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index dc7d999..53c8927 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -941,6 +941,42 @@ GREPTEST()
fi
}
+# Call the h5dump tool and grep for a value but disables plugin filter loading
+# txttype ERRTXT greps test error output, otherwise greps test output
+GREPTEST2()
+{
+ txttype=$1
+ expectdata=$2
+ actual=$TESTDIR/$3
+ actual_err="$TESTDIR/`basename $3 .ddl`.oerr"
+ shift
+ shift
+ shift
+
+ # Run test.
+ TESTING $DUMPER -p $@
+ (
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@"
+ ) >$actual 2>$actual_err
+ if [ "$txttype" = "ERRTXT" ]; then
+ $GREP "$expectdata" $actual_err > /dev/null
+ else
+ $GREP "$expectdata" $actual > /dev/null
+ fi
+ if [ $? -eq 0 ]; then
+ echo " PASSED"
+ else
+ echo " FAILED"
+ nerrors="`expr $nerrors + 1`"
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ fi
+}
+
# Print a "SKIP" message
SKIP() {
TESTING $DUMPER $@
@@ -1390,7 +1426,7 @@ TOOLTEST4 textlinkfar.ddl --enable-error-stack textlinkfar.h5
TOOLTEST4 textlink.ddl --enable-error-stack textlink.h5
# test for error stack display (BZ2048)
-TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5
+GREPTEST2 ERRTXT "filter plugins disabled" filter_fail.ddl --enable-error-stack filter_fail.h5
# test for -o -y for dataset with attributes
TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5
diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt
index 55d5623..9e49c4f 100644
--- a/tools/test/h5format_convert/CMakeLists.txt
+++ b/tools/test/h5format_convert/CMakeLists.txt
@@ -25,4 +25,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
#add_test (NAME h5fc_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5fc_gentest>)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5format_convert/h5fc_chk_idx.c b/tools/test/h5format_convert/h5fc_chk_idx.c
index 8369668..ad1742b 100644
--- a/tools/test/h5format_convert/h5fc_chk_idx.c
+++ b/tools/test/h5format_convert/h5fc_chk_idx.c
@@ -45,8 +45,8 @@ main(int argc, char *argv[])
{
char *fname = NULL;
char *dname = NULL;
- hid_t fid = -1;
- hid_t did = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
H5D_chunk_index_t idx_type;
/* h5fc_chk_idx fname dname */
diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c
index b482dee..1e9e2cf 100644
--- a/tools/test/h5format_convert/h5fc_gentest.c
+++ b/tools/test/h5format_convert/h5fc_gentest.c
@@ -77,12 +77,12 @@ const char *FILENAME[] = {
static void
gen_non(const char *fname)
{
- hid_t fid = -1; /* file id */
- hid_t fcpl = -1; /* file creation property list */
- hid_t gid = -1; /* group id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did1 = -1, did2 = -1; /* dataset id */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
+ hid_t gid = H5I_INVALID_HID; /* group id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did1 = -1, did2 = H5I_INVALID_HID; /* dataset id */
hsize_t dims1[1] = {10}; /* dataset dimension */
hsize_t dims2[2] = {4, 6}; /* dataset dimension */
hsize_t max_dims[2]; /* maximum dataset dimension */
@@ -307,11 +307,11 @@ error:
static void
gen_edge(const char *fname)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list */
- hid_t sid = -1; /* dataspace id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did = -1; /* dataset id */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t fapl = H5I_INVALID_HID; /* file access property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did = H5I_INVALID_HID; /* dataset id */
hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
float buf[12][6]; /* Buffer for writing data */
@@ -395,14 +395,14 @@ error:
static void
gen_err_level(const char *fname)
{
- hid_t fid = -1; /* file ID */
- hid_t fapl = -1; /* file access property list */
- hid_t fcpl = -1; /* file creation property list */
- hid_t sid = -1; /* dataspace id */
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t did = -1; /* dataset ID */
- hid_t fsid = -1; /* file dataspace ID */
- hid_t msid = -1; /* memory dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* file ID */
+ hid_t fapl = H5I_INVALID_HID; /* file access property list */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
unsigned char *buf = NULL; /* buffer for data */
hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
@@ -534,13 +534,13 @@ error:
static void
gen_ext(const char *fname, unsigned new_format, unsigned what)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list */
- hid_t fcpl = -1; /* file creation property list */
- hid_t gid = -1; /* group id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did1 = -1, did2 = -1; /* dataset id */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t fapl = H5I_INVALID_HID; /* file access property list */
+ hid_t fcpl = H5I_INVALID_HID; /* file creation property list */
+ hid_t gid = H5I_INVALID_HID; /* group id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did1 = H5I_INVALID_HID, did2 = H5I_INVALID_HID; /* dataset id */
hsize_t dims1[1] = {10}; /* dataset dimension */
hsize_t dims2[2] = {4, 6}; /* dataset dimension */
hsize_t max_dims[2]; /* maximum dataset dimension */
diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt
index 9364683..a77ba00 100644
--- a/tools/test/h5import/CMakeLists.txt
+++ b/tools/test/h5import/CMakeLists.txt
@@ -15,4 +15,6 @@ else ()
endif ()
set_target_properties (h5importtest PROPERTIES FOLDER tools)
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt
index 6fdf7b0..f00e781 100644
--- a/tools/test/h5jam/CMakeLists.txt
+++ b/tools/test/h5jam/CMakeLists.txt
@@ -36,4 +36,6 @@ else ()
endif ()
set_target_properties (tellub PROPERTIES FOLDER tools)
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c
index 26a427d..f496a7a 100644
--- a/tools/test/h5jam/getub.c
+++ b/tools/test/h5jam/getub.c
@@ -81,7 +81,7 @@ parse_command_line(int argc, const char *argv[])
int
main(int argc, const char *argv[])
{
- int fd = -1;
+ int fd = H5I_INVALID_HID;
unsigned size;
char *filename = NULL;
long res;
diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt
index 0da03c5..abbe6d0 100644
--- a/tools/test/h5ls/CMakeLists.txt
+++ b/tools/test/h5ls/CMakeLists.txt
@@ -30,6 +30,8 @@ if (BUILD_SHARED_LIBS)
)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
-include (CMakeTestsVDS.cmake)
+ include (CMakeTestsVDS.cmake)
+endif ()
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index f81ce4f..5722354 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -98,4 +98,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
#add_test (NAME h5repackgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repackgentest>)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index f3e6cd3..f32e87c 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -1779,9 +1779,9 @@ error:
static
int make_testfiles(void)
{
- hid_t fid = -1;
- hid_t fcpl = -1; /* File creation property list */
- hid_t fapl = -1; /* File access property list */
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
unsigned j; /* Local index variable */
/*-------------------------------------------------------------------------
@@ -2210,12 +2210,12 @@ out:
static
int make_all_objects(hid_t loc_id)
{
- hid_t did = -1;
- hid_t gid = -1;
- hid_t tid = -1;
- hid_t rid = -1;
- hid_t sid = -1;
- hid_t gcplid = -1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t rid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t gcplid = H5I_INVALID_HID;
hsize_t dims[1] = {2};
/* compound datatype */
typedef struct s_t
@@ -2332,10 +2332,10 @@ out:
static
int make_attributes(hid_t loc_id)
{
- hid_t did = -1;
- hid_t gid = -1;
- hid_t rid = -1;
- hid_t sid = -1;
+ hid_t did = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t rid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
hsize_t dims[1] = {2};
/*-------------------------------------------------------------------------
@@ -2403,8 +2403,8 @@ static
int make_hlinks(hid_t loc_id)
{
hid_t g1id =- 1;
- hid_t g2id = -1;
- hid_t g3id = -1;
+ hid_t g2id = H5I_INVALID_HID;
+ hid_t g3id = H5I_INVALID_HID;
hsize_t dims[2] = {3,2};
int buf[3][2] = {{1,1}, {1,2}, {2,2}};
@@ -2473,8 +2473,8 @@ out:
static
int make_szip(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
unsigned szip_options_mask = H5_SZIP_ALLOW_K13_OPTION_MASK | H5_SZIP_NN_OPTION_MASK;
unsigned szip_pixels_per_block = 8;
hsize_t dims[RANK] = {DIM1, DIM2};
@@ -2544,8 +2544,8 @@ out:
static
int make_deflate(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK] = {DIM1,DIM2};
hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
int buf[DIM1][DIM2];
@@ -2684,8 +2684,8 @@ out:
static
int make_fletcher32(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
@@ -2751,10 +2751,10 @@ out:
static
int make_nbit(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
- hid_t dtid = -1;
- hid_t dsid = -1;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
@@ -2832,10 +2832,10 @@ out:
static
int make_scaleoffset(hid_t loc_id)
{
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t sid = -1; /* dataspace ID */
- hid_t dtid = -1;
- hid_t dsid = -1;
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid = H5I_INVALID_HID; /* dataspace ID */
+ hid_t dtid = H5I_INVALID_HID;
+ hid_t dsid = H5I_INVALID_HID;
hsize_t dims[RANK] = {DIM1,DIM2};
hsize_t chunk_dims[RANK] = {CDIM1,CDIM2};
int buf[DIM1][DIM2];
@@ -3077,11 +3077,11 @@ int make_early(void)
{
hsize_t dims[1] ={3000};
hsize_t cdims[1]={30};
- hid_t fid=-1;
- hid_t did=-1;
- hid_t sid=-1;
- hid_t tid=-1;
- hid_t dcpl=-1;
+ hid_t fid=H5I_INVALID_HID;
+ hid_t did=H5I_INVALID_HID;
+ hid_t sid=H5I_INVALID_HID;
+ hid_t tid=H5I_INVALID_HID;
+ hid_t dcpl=H5I_INVALID_HID;
int i;
char name[16];
int iter=100;
@@ -3172,8 +3172,8 @@ out:
static
int make_layout(hid_t loc_id)
{
- hid_t dcpl=-1; /* dataset creation property list */
- hid_t sid=-1; /* dataspace ID */
+ hid_t dcpl=H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid=H5I_INVALID_HID; /* dataspace ID */
hsize_t dims[RANK]={DIM1,DIM2};
hsize_t chunk_dims[RANK]={CDIM1,CDIM2};
int buf[DIM1][DIM2];
@@ -3286,12 +3286,12 @@ static
int make_layout2(hid_t loc_id)
{
- hid_t contig_dcpl = -1; /* dataset creation property list */
- hid_t chunked_dcpl = -1; /* dataset creation property list */
+ hid_t contig_dcpl = H5I_INVALID_HID; /* dataset creation property list */
+ hid_t chunked_dcpl = H5I_INVALID_HID; /* dataset creation property list */
int i, j, n; /* Local index variables */
int ret_value = -1; /* Return value */
- hid_t s_sid = -1; /* dataspace ID */
+ hid_t s_sid = H5I_INVALID_HID; /* dataspace ID */
hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */
hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */
@@ -3361,11 +3361,11 @@ out:
static
int make_layout3(hid_t loc_id)
{
- hid_t dcpl1=-1; /* dataset creation property list */
- hid_t dcpl2=-1; /* dataset creation property list */
- hid_t dcpl3=-1; /* dataset creation property list */
- hid_t sid1=-1; /* dataspace ID */
- hid_t sid2=-1; /* dataspace ID */
+ hid_t dcpl1=H5I_INVALID_HID; /* dataset creation property list */
+ hid_t dcpl2=H5I_INVALID_HID; /* dataset creation property list */
+ hid_t dcpl3=H5I_INVALID_HID; /* dataset creation property list */
+ hid_t sid1=H5I_INVALID_HID; /* dataspace ID */
+ hid_t sid2=H5I_INVALID_HID; /* dataspace ID */
hsize_t dims1[RANK]={DIM1_L3,DIM2_L3};
hsize_t dims2[RANK]={SDIM1_L3,SDIM2_L3};
hsize_t maxdims[RANK]={H5S_UNLIMITED, H5S_UNLIMITED};
@@ -3494,8 +3494,8 @@ out:
static
int make_fill(hid_t loc_id)
{
- hid_t did=-1;
- hid_t sid=-1;
+ hid_t did=H5I_INVALID_HID;
+ hid_t sid=H5I_INVALID_HID;
hid_t dcpl;
hsize_t dims[2]={3,2};
int buf[3][2]= {{1,1},{1,2},{2,2}};
@@ -3547,9 +3547,9 @@ out:
static
int make_big(hid_t loc_id)
{
- hid_t did=-1;
- hid_t f_sid=-1;
- hid_t m_sid=-1;
+ hid_t did=H5I_INVALID_HID;
+ hid_t f_sid=H5I_INVALID_HID;
+ hid_t m_sid=H5I_INVALID_HID;
hid_t tid;
hid_t dcpl;
hsize_t dims[1]={ H5TOOLS_MALLOCSIZE + 1}; /* dataset dimensions */
@@ -3628,8 +3628,8 @@ out:
static
int make_external(hid_t loc_id)
{
- hid_t did=-1;
- hid_t sid=-1;
+ hid_t did=H5I_INVALID_HID;
+ hid_t sid=H5I_INVALID_HID;
hid_t dcpl;
int buf[2]={1,2};
hsize_t cur_size[1]; /* data space current size */
@@ -3682,8 +3682,8 @@ out:
static int
make_userblock(void)
{
- hid_t fid = -1;
- hid_t fcpl = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID;
int fd = -1; /* File descriptor for writing userblock */
char ub[USERBLOCK_SIZE]; /* User block data */
ssize_t nwritten; /* # of bytes written */
@@ -3744,8 +3744,8 @@ out:
static int
verify_userblock( const char* filename)
{
- hid_t fid = -1;
- hid_t fcpl = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fcpl = H5I_INVALID_HID;
int fd = -1; /* File descriptor for writing userblock */
char ub[USERBLOCK_SIZE]; /* User block data */
hsize_t ub_size = 0; /* User block size */
@@ -3874,10 +3874,10 @@ int write_dset_in(hid_t loc_id,
GREEN
} e_t;
- hid_t did=-1;
- hid_t sid=-1;
- hid_t tid=-1;
- hid_t pid=-1;
+ hid_t did=H5I_INVALID_HID;
+ hid_t sid=H5I_INVALID_HID;
+ hid_t tid=H5I_INVALID_HID;
+ hid_t pid=H5I_INVALID_HID;
unsigned i, j;
int val, k, n;
float f;
@@ -4620,10 +4620,10 @@ out:
static
int make_dset_reg_ref(hid_t loc_id)
{
- hid_t did1=-1; /* Dataset ID */
- hid_t did2=-1; /* Dereferenced dataset ID */
- hid_t sid1=-1; /* Dataspace ID #1 */
- hid_t sid2=-1; /* Dataspace ID #2 */
+ hid_t did1=H5I_INVALID_HID; /* Dataset ID */
+ hid_t did2=H5I_INVALID_HID; /* Dereferenced dataset ID */
+ hid_t sid1=H5I_INVALID_HID; /* Dataspace ID #1 */
+ hid_t sid2=H5I_INVALID_HID; /* Dataspace ID #2 */
hsize_t dims1[] = {SPACE1_DIM1};
hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
@@ -4739,9 +4739,9 @@ int write_attr_in(hid_t loc_id,
GREEN
} e_t;
- hid_t aid = -1;
- hid_t sid = -1;
- hid_t tid = -1;
+ hid_t aid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t tid = H5I_INVALID_HID;
int val, j, k, n;
unsigned i;
float f;
@@ -4824,7 +4824,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_BITFIELD
@@ -4854,7 +4854,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_OPAQUE
@@ -4881,7 +4881,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_COMPOUND
@@ -4919,7 +4919,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_REFERENCE
@@ -4968,7 +4968,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_VLEN
@@ -5013,13 +5013,13 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = -1;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_ARRAY
@@ -5054,7 +5054,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_INTEGER and H5T_FLOAT
@@ -5132,7 +5132,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_BITFIELD
@@ -5165,7 +5165,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_OPAQUE
@@ -5193,7 +5193,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_COMPOUND
@@ -5229,7 +5229,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_REFERENCE
@@ -5284,7 +5284,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_VLEN
@@ -5335,13 +5335,13 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = -1;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_ARRAY
@@ -5384,7 +5384,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_INTEGER and H5T_FLOAT
@@ -5504,7 +5504,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_BITFIELD
@@ -5558,7 +5558,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_OPAQUE
@@ -5572,7 +5572,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_COMPOUND
@@ -5658,7 +5658,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_REFERENCE
@@ -5743,7 +5743,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_VLEN
@@ -5797,13 +5797,13 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Aclose(aid) < 0)
goto out;
- aid = -1;
+ aid = H5I_INVALID_HID;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
if (H5Sclose(sid) < 0)
goto out;
- sid = -1;
+ sid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_ARRAY
@@ -5837,7 +5837,7 @@ int write_attr_in(hid_t loc_id,
goto out;
if (H5Tclose(tid) < 0)
goto out;
- tid = -1;
+ tid = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* H5T_INTEGER and H5T_FLOAT
@@ -5917,7 +5917,7 @@ int make_dset(hid_t loc_id,
hid_t dcpl,
void *buf)
{
- hid_t did=-1;
+ hid_t did=H5I_INVALID_HID;
if ((did = H5Dcreate2(loc_id, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
return -1;
@@ -5954,8 +5954,8 @@ int write_dset( hid_t loc_id,
hid_t tid,
void *buf )
{
- hid_t did=-1;
- hid_t sid=-1;
+ hid_t did=H5I_INVALID_HID;
+ hid_t sid=H5I_INVALID_HID;
if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
return -1;
@@ -6040,11 +6040,11 @@ static
int make_named_dtype(hid_t loc_id)
{
hsize_t dims[1] ={3};
- hid_t did=-1;
- hid_t aid=-1;
- hid_t sid=-1;
- hid_t tid=-1;
- hid_t gid=-1;
+ hid_t did=H5I_INVALID_HID;
+ hid_t aid=H5I_INVALID_HID;
+ hid_t sid=H5I_INVALID_HID;
+ hid_t tid=H5I_INVALID_HID;
+ hid_t gid=H5I_INVALID_HID;
if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
index 4e69148..9e83ff8 100644
--- a/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
@@ -44,4 +44,4 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
#000: (file name) line (number) in do_copy_objects(): H5Dcreate2 failed
major: Failure in tools library
- minor: error in function
+ minor: function info
diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt
index 5c17fd5..0e2ee5e 100644
--- a/tools/test/h5stat/CMakeLists.txt
+++ b/tools/test/h5stat/CMakeLists.txt
@@ -14,4 +14,6 @@ if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
#add_test (NAME h5stat_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5stat_gentest>)
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS AND HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c
index 2edfcf6..0bf1001 100644
--- a/tools/test/h5stat/h5stat_gentest.c
+++ b/tools/test/h5stat/h5stat_gentest.c
@@ -54,14 +54,14 @@
static void
gen_newgrat_file(const char *fname)
{
- hid_t fcpl = -1; /* File creation property */
- hid_t fapl = -1; /* File access property */
- hid_t fid = -1; /* File id */
- hid_t gid = -1; /* Group id */
- hid_t tid = -1; /* Datatype id */
- hid_t sid = -1; /* Dataspace id */
- hid_t attr_id = -1; /* Attribute id */
- hid_t did = -1; /* Dataset id */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property */
+ hid_t fapl = H5I_INVALID_HID; /* File access property */
+ hid_t fid = H5I_INVALID_HID; /* File id */
+ hid_t gid = H5I_INVALID_HID; /* Group id */
+ hid_t tid = H5I_INVALID_HID; /* Datatype id */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace id */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute id */
+ hid_t did = H5I_INVALID_HID; /* Dataset id */
char name[30]; /* Group name */
char attrname[30]; /* Attribute name */
int i; /* Local index variable */
@@ -139,15 +139,15 @@ error:
static void
gen_threshold_file(const char *fname)
{
- hid_t fid = -1; /* File ID */
- hid_t sid0 = -1; /* Dataspace IDs */
- hid_t sid1 = -1; /* Dataspace IDs */
- hid_t sid2 = -1; /* Dataspace IDs */
- hid_t sid3 = -1; /* Dataspace IDs */
- hid_t sid4 = -1; /* Dataspace IDs */
- hid_t did = -1; /* Dataset ID */
- hid_t attr_id = -1; /* Attribute ID */
- hid_t gid = -1; /* Group ID */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t sid0 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid1 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid2 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid3 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t sid4 = H5I_INVALID_HID; /* Dataspace IDs */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
+ hid_t attr_id = H5I_INVALID_HID; /* Attribute ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
hsize_t two_dims[] = {2, 5}; /* Dimension array */
hsize_t one_dims[] = {6}; /* Dimension array */
hsize_t zero_dims[] = {0}; /* Dimension array */
@@ -323,11 +323,11 @@ error:
static void
gen_idx_file(const char *fname)
{
- hid_t fapl = -1; /* file access property id */
- hid_t fid = -1; /* file id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did = -1, did2 = -1; /* dataset id */
+ hid_t fapl = H5I_INVALID_HID; /* file access property id */
+ hid_t fid = H5I_INVALID_HID; /* file id */
+ hid_t sid = H5I_INVALID_HID; /* space id */
+ hid_t dcpl = H5I_INVALID_HID; /* dataset creation property id */
+ hid_t did = -1, did2 = H5I_INVALID_HID; /* dataset id */
hsize_t dims[1] = {10}; /* dataset dimension */
hsize_t c_dims[1] = {2}; /* chunk dimension */
int i; /* local index variable */
@@ -413,12 +413,12 @@ error:
static void
gen_err_refcount(const char *fname)
{
- hid_t fid = -1; /* File identifier */
- hid_t sid = -1; /* Dataspace message */
- hid_t did = -1; /* Dataset identifier */
- hid_t gid = -1; /* Group identifier */
- hid_t aid1 = -1, aid2 = -1; /* Attribute identifier */
- hid_t tid = -1; /* Datatype identifier */
+ hid_t fid = H5I_INVALID_HID; /* File identifier */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace message */
+ hid_t did = H5I_INVALID_HID; /* Dataset identifier */
+ hid_t gid = H5I_INVALID_HID; /* Group identifier */
+ hid_t aid1 = -1, aid2 = H5I_INVALID_HID; /* Attribute identifier */
+ hid_t tid = H5I_INVALID_HID; /* Datatype identifier */
int i, n; /* Local index variables */
int buf[10]; /* Data buffer */
hsize_t dims[1]; /* Dimension size */
diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt
index a250222..089a302 100644
--- a/tools/test/misc/CMakeLists.txt
+++ b/tools/test/misc/CMakeLists.txt
@@ -55,6 +55,8 @@ else ()
endif ()
set_target_properties (clear_open_chk PROPERTIES FOLDER tools)
-include (CMakeTestsRepart.cmake)
-include (CMakeTestsClear.cmake)
-include (CMakeTestsMkgrp.cmake)
+if (HDF5_TEST_SERIAL)
+ include (CMakeTestsRepart.cmake)
+ include (CMakeTestsClear.cmake)
+ include (CMakeTestsMkgrp.cmake)
+endif ()
diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c
index 96d7e75e7..1411c21 100644
--- a/tools/test/misc/h5clear_gentest.c
+++ b/tools/test/misc/h5clear_gentest.c
@@ -56,10 +56,10 @@ const char *FILENAME_ENHANCE[] = {
static int
gen_cache_image_file(const char *fname)
{
- hid_t fid = -1; /* File ID */
- hid_t did = -1, sid = -1; /* Dataset ID, dataspace ID */
- hid_t fapl = -1; /* File access property list */
- hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t did = -1, sid = H5I_INVALID_HID; /* Dataset ID, dataspace ID */
+ hid_t fapl = H5I_INVALID_HID; /* File access property list */
+ hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[2]; /* Dimension sizes */
hsize_t chunks[2]; /* Chunked dimension sizes */
int buf[50][100]; /* Buffer for data to write */
@@ -164,10 +164,10 @@ error:
static int
gen_enhance_files(hbool_t user)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
hsize_t dim[1]; /* Dimension sizes */
int data[NUM_ELMTS]; /* Buffer for data */
int fd = -1; /* The file descriptor ID */
@@ -361,13 +361,13 @@ error:
int
main(void)
{
- hid_t fid = -1; /* File ID */
- hid_t fcpl = -1; /* File creation property list */
- hid_t fapl = -1, new_fapl = -1; /* File access property lists */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t fcpl = H5I_INVALID_HID; /* File creation property list */
+ hid_t fapl = -1, new_fapl = H5I_INVALID_HID; /* File access property lists */
char fname[512]; /* File name */
unsigned new_format; /* To use latest library format or not */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t did = H5I_INVALID_HID; /* Dataset ID */
hsize_t dim[1]; /* Dimension sizes */
int data[NUM_ELMTS]; /* Buffer for data */
int i; /* Local index variables */
diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c
index b8e0292..7227de0 100644
--- a/tools/test/misc/repart_test.c
+++ b/tools/test/misc/repart_test.c
@@ -47,8 +47,8 @@ herr_t test_single_h5repart_opens(void);
herr_t
test_family_h5repart_opens(void)
{
- hid_t fid = -1;
- hid_t fapl_id = -1;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
/* open 1st file(single member file) with correct family size(20000 byte) */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -102,7 +102,7 @@ error:
herr_t
test_single_h5repart_opens(void)
{
- hid_t fid = -1;
+ hid_t fid = H5I_INVALID_HID;
/* open the single file */
if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c
index 7f1f038..c69d1f7 100644
--- a/tools/test/misc/talign.c
+++ b/tools/test/misc/talign.c
@@ -32,11 +32,11 @@ const char *setname = "align";
int main(void)
{
- hid_t fil=-1, spc=-1, set=-1;
- hid_t cs6=-1, cmp=-1, fix=-1;
- hid_t cmp1=-1, cmp2=-1, cmp3=-1;
- hid_t plist=-1;
- hid_t array_dt=-1;
+ hid_t fil=H5I_INVALID_HID, spc=H5I_INVALID_HID, set=H5I_INVALID_HID;
+ hid_t cs6=H5I_INVALID_HID, cmp=H5I_INVALID_HID, fix=H5I_INVALID_HID;
+ hid_t cmp1=H5I_INVALID_HID, cmp2=H5I_INVALID_HID, cmp3=H5I_INVALID_HID;
+ hid_t plist=H5I_INVALID_HID;
+ hid_t array_dt=H5I_INVALID_HID;
hsize_t dim[2];
hsize_t cdim[4];
diff --git a/tools/test/misc/vds/UC_1_one_dim_gen.c b/tools/test/misc/vds/UC_1_one_dim_gen.c
index b997280..b5ddae3 100644
--- a/tools/test/misc/vds/UC_1_one_dim_gen.c
+++ b/tools/test/misc/vds/UC_1_one_dim_gen.c
@@ -59,16 +59,16 @@ static int UC_1_VDS_FILL_VALUE = -9;
int
main(void)
{
- hid_t src_sid = -1; /* source dataset's dataspace ID */
- hid_t src_dcplid = -1; /* source dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t vds_sid = -1; /* VDS dataspace ID */
- hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = -1; /* HDF5 file ID */
- hid_t did = -1; /* dataset ID */
- hid_t msid = -1; /* memory dataspace ID */
- hid_t fsid = -1; /* file dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
hsize_t extent[RANK]; /* dataset extents */
hsize_t start[RANK]; /* starting point for hyperslab */
diff --git a/tools/test/misc/vds/UC_2_two_dims_gen.c b/tools/test/misc/vds/UC_2_two_dims_gen.c
index bd70fda..8e1554b 100644
--- a/tools/test/misc/vds/UC_2_two_dims_gen.c
+++ b/tools/test/misc/vds/UC_2_two_dims_gen.c
@@ -68,16 +68,16 @@ static int UC_2_VDS_FILL_VALUE = -9;
int
main(void)
{
- hid_t src_sid = -1; /* source dataset's dataspace ID */
- hid_t src_dcplid = -1; /* source dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t vds_sid = -1; /* VDS dataspace ID */
- hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = -1; /* HDF5 file ID */
- hid_t did = -1; /* dataset ID */
- hid_t msid = -1; /* memory dataspace ID */
- hid_t fsid = -1; /* file dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
hsize_t start[RANK]; /* starting point for hyperslab */
hsize_t extent[RANK]; /* dataset extents */
diff --git a/tools/test/misc/vds/UC_3_gaps_gen.c b/tools/test/misc/vds/UC_3_gaps_gen.c
index e6e7226..74a23dc 100644
--- a/tools/test/misc/vds/UC_3_gaps_gen.c
+++ b/tools/test/misc/vds/UC_3_gaps_gen.c
@@ -29,12 +29,12 @@
static herr_t
create_3_1_vds(void)
{
- hid_t src_sid = -1; /* source dataset's dataspace ID */
- hid_t vds_sid = -1; /* VDS dataspace ID */
- hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = -1; /* HDF5 file ID */
- hid_t did = -1; /* dataset ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
hsize_t start[RANK]; /* source starting point for hyperslab */
hsize_t position[RANK]; /* vds mapping positions */
@@ -136,12 +136,12 @@ error:
static herr_t
create_3_2_vds(void)
{
- hid_t src_sid = -1; /* source dataset's dataspace ID */
- hid_t vds_sid = -1; /* VDS dataspace ID */
- hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = -1; /* HDF5 file ID */
- hid_t did = -1; /* dataset ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
hsize_t start[RANK]; /* source starting point for hyperslab */
diff --git a/tools/test/misc/vds/UC_4_printf_gen.c b/tools/test/misc/vds/UC_4_printf_gen.c
index b328046..24451e9 100644
--- a/tools/test/misc/vds/UC_4_printf_gen.c
+++ b/tools/test/misc/vds/UC_4_printf_gen.c
@@ -27,16 +27,16 @@
int
main(void)
{
- hid_t src_sid = -1; /* source dataset's dataspace ID */
- hid_t src_dcplid = -1; /* source dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t vds_sid = -1; /* VDS dataspace ID */
- hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = -1; /* HDF5 file ID */
- hid_t did = -1; /* dataset ID */
- hid_t msid = -1; /* memory dataspace ID */
- hid_t fsid = -1; /* file dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
/* Hyperslab arrays */
hsize_t start[RANK] = {0, 0, 0};
diff --git a/tools/test/misc/vds/UC_5_stride_gen.c b/tools/test/misc/vds/UC_5_stride_gen.c
index a105bbd..726ce6e 100644
--- a/tools/test/misc/vds/UC_5_stride_gen.c
+++ b/tools/test/misc/vds/UC_5_stride_gen.c
@@ -27,16 +27,16 @@
int
main(void)
{
- hid_t src_sid = -1; /* source dataset's dataspace ID */
- hid_t src_dcplid = -1; /* source dataset property list ID */
+ hid_t src_sid = H5I_INVALID_HID; /* source dataset's dataspace ID */
+ hid_t src_dcplid = H5I_INVALID_HID; /* source dataset property list ID */
- hid_t vds_sid = -1; /* VDS dataspace ID */
- hid_t vds_dcplid = -1; /* VDS dataset property list ID */
+ hid_t vds_sid = H5I_INVALID_HID; /* VDS dataspace ID */
+ hid_t vds_dcplid = H5I_INVALID_HID; /* VDS dataset property list ID */
- hid_t fid = -1; /* HDF5 file ID */
- hid_t did = -1; /* dataset ID */
- hid_t msid = -1; /* memory dataspace ID */
- hid_t fsid = -1; /* file dataspace ID */
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t did = H5I_INVALID_HID; /* dataset ID */
+ hid_t msid = H5I_INVALID_HID; /* memory dataspace ID */
+ hid_t fsid = H5I_INVALID_HID; /* file dataspace ID */
hsize_t extent[RANK]; /* source dataset extents */
hsize_t start[RANK]; /* starting point for hyperslab */
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
index 38dd605..d788ffa 100644
--- a/tools/test/perform/CMakeLists.txt
+++ b/tools/test/perform/CMakeLists.txt
@@ -21,20 +21,21 @@ endif ()
set_target_properties (h5perf_serial PROPERTIES FOLDER perform)
if (HDF5_BUILD_PERFORM_STANDALONE)
- #-- Adding test for h5perf_serial_alone
+ #-- Adding test for h5perf_serial_alone - io_timer.c includes
set (h5perf_serial_alone_SOURCES
+ ${HDF5_TOOLS_DIR}/lib/io_timer.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_perf.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_standalone.c
)
add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES})
- target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (h5perf_serial_alone STATIC)
- target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
else ()
TARGET_C_PROPERTIES (h5perf_serial_alone SHARED)
- target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
endif ()
set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform)
set_property (TARGET h5perf_serial_alone
@@ -132,7 +133,7 @@ else ()
endif ()
set_target_properties (zip_perf PROPERTIES FOLDER perform)
-if (H5_HAVE_PARALLEL AND BUILD_TESTING)
+if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
if (UNIX)
#-- Adding test for perf - only on unix systems
set (perf_SOURCES
@@ -169,18 +170,19 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING)
if (HDF5_BUILD_PERFORM_STANDALONE)
#-- Adding test for h5perf
set (h5perf_alone_SOURCES
+ ${HDF5_TOOLS_DIR}/lib/io_timer.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_perf.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_standalone.c
)
add_executable (h5perf_alone ${h5perf_alone_SOURCES})
- target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TOOLS_DIR}/lib;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (h5perf_alone STATIC)
- target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
else ()
TARGET_C_PROPERTIES (h5perf_alone SHARED)
- target_link_libraries (h5perf_alone PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
+ target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIBSH_TARGET} "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>")
endif ()
set_target_properties (h5perf_alone PROPERTIES FOLDER perform)
set_property (TARGET h5perf_alone
@@ -189,4 +191,6 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING)
endif ()
endif ()
-include (CMakeTests.cmake)
+if (HDF5_TEST_TOOLS)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake
index f0ae416..5d61f7b 100644
--- a/tools/test/perform/CMakeTests.cmake
+++ b/tools/test/perform/CMakeTests.cmake
@@ -22,175 +22,176 @@ add_custom_target(zip_perf_files ALL COMMENT "Copying files needed by zip_perf t
#-----------------------------------------------------------------------------
# Add Tests
#-----------------------------------------------------------------------------
+if (HDF5_TEST_SERIAL)
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME PERFORM_h5perform-clearall-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ chunk.h5
+ iopipe.h5
+ iopipe.raw
+ x-diag-rd.dat
+ x-diag-wr.dat
+ x-rowmaj-rd.dat
+ x-rowmaj-wr.dat
+ x-gnuplot
+ h5perf_serial.txt
+ h5perf_serial.txt.err
+ chunk.txt
+ chunk.txt.err
+ iopipe.txt
+ iopipe.txt.err
+ overhead.txt
+ overhead.txt.err
+ perf_meta.txt
+ perf_meta.txt.err
+ zip_perf-h.txt
+ zip_perf-h.txt.err
+ zip_perf.txt
+ zip_perf.txt.err
+ )
-# Remove any output file left over from previous test run
-add_test (
- NAME PERFORM_h5perform-clearall-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- chunk.h5
- iopipe.h5
- iopipe.raw
- x-diag-rd.dat
- x-diag-wr.dat
- x-rowmaj-rd.dat
- x-rowmaj-wr.dat
- x-gnuplot
- h5perf_serial.txt
- h5perf_serial.txt.err
- chunk.txt
- chunk.txt.err
- iopipe.txt
- iopipe.txt.err
- overhead.txt
- overhead.txt.err
- perf_meta.txt
- perf_meta.txt.err
- zip_perf-h.txt
- zip_perf-h.txt.err
- zip_perf.txt
- zip_perf.txt.err
-)
-
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial>)
-else ()
- add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5perf_serial>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=h5perf_serial.txt"
- #-D "TEST_REFERENCE=h5perf_serial.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_h5perf_serial COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial>)
+ else ()
+ add_test (NAME PERFORM_h5perf_serial COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5perf_serial>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=h5perf_serial.txt"
+ #-D "TEST_REFERENCE=h5perf_serial.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_h5perf_serial PROPERTIES
+ TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_h5perf_serial PROPERTIES
- TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_BUILD_PERFORM_STANDALONE)
- add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial_alone>)
-endif ()
+ if (HDF5_BUILD_PERFORM_STANDALONE)
+ add_test (NAME PERFORM_h5perf_serial_alone COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5perf_serial_alone>)
+ endif ()
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:chunk>)
-else ()
- add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:chunk>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=chunk.txt"
- #-D "TEST_REFERENCE=chunk.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_chunk COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:chunk>)
+ else ()
+ add_test (NAME PERFORM_chunk COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:chunk>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=chunk.txt"
+ #-D "TEST_REFERENCE=chunk.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_chunk PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_chunk PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:iopipe>)
-else ()
- add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:iopipe>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=iopipe.txt"
- #-D "TEST_REFERENCE=iopipe.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_iopipe COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:iopipe>)
+ else ()
+ add_test (NAME PERFORM_iopipe COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:iopipe>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=iopipe.txt"
+ #-D "TEST_REFERENCE=iopipe.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_iopipe PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_iopipe PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:overhead>)
-else ()
- add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:overhead>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=overhead.txt"
- #-D "TEST_REFERENCE=overhead.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_overhead COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:overhead>)
+ else ()
+ add_test (NAME PERFORM_overhead COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:overhead>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=overhead.txt"
+ #-D "TEST_REFERENCE=overhead.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_overhead PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_overhead PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:perf_meta>)
-else ()
- add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:perf_meta>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=perf_meta.txt"
- #-D "TEST_REFERENCE=perf_meta.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_perf_meta COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:perf_meta>)
+ else ()
+ add_test (NAME PERFORM_perf_meta COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:perf_meta>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=perf_meta.txt"
+ #-D "TEST_REFERENCE=perf_meta.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_perf_meta PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_perf_meta PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> "-h")
-else ()
- add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=zip_perf-h.txt"
- #-D "TEST_REFERENCE=zip_perf-h.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_zip_perf_help COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> "-h")
+ else ()
+ add_test (NAME PERFORM_zip_perf_help COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=zip_perf-h.txt"
+ #-D "TEST_REFERENCE=zip_perf-h.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_zip_perf_help PROPERTIES
+ DEPENDS "PERFORM_h5perform-clearall-objects"
)
-endif ()
-set_tests_properties (PERFORM_zip_perf_help PROPERTIES
- DEPENDS "PERFORM_h5perform-clearall-objects"
-)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> tfilters.h5)
-else ()
- add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=zip_perf.txt"
- #-D "TEST_REFERENCE=zip_perf.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME PERFORM_zip_perf COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:zip_perf> tfilters.h5)
+ else ()
+ add_test (NAME PERFORM_zip_perf COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:zip_perf>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=zip_perf.txt"
+ #-D "TEST_REFERENCE=zip_perf.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ set_tests_properties (PERFORM_zip_perf PROPERTIES
+ DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects"
)
endif ()
-set_tests_properties (PERFORM_zip_perf PROPERTIES
- DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects"
-)
-if (H5_HAVE_PARALLEL)
+if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
if (UNIX)
add_test (NAME MPI_TEST_PERFORM_perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:perf> ${MPIEXEC_POSTFLAGS})
endif ()
diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c
index 804f88e..3603c9b 100644
--- a/tools/test/perform/chunk.c
+++ b/tools/test/perform/chunk.c
@@ -72,7 +72,7 @@
/* #define DIAG_NRDCC 521 */
static size_t nio_g;
-static hid_t fapl_g = -1;
+static hid_t fapl_g = H5I_INVALID_HID;
/* Local function prototypes */
static size_t
diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c
index 2d9c44f..57c0d52 100644
--- a/tools/test/perform/iopipe.c
+++ b/tools/test/perform/iopipe.c
@@ -168,7 +168,7 @@ main (void)
static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
unsigned char *the_data = NULL;
- hid_t file, dset, file_space = -1;
+ hid_t file, dset, file_space = H5I_INVALID_HID;
herr_t status;
#ifdef H5_HAVE_GETRUSAGE
struct rusage r_start, r_stop;
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index 5d8474b..d000f60 100644
--- a/tools/test/perform/pio_engine.c
+++ b/tools/test/perform/pio_engine.c
@@ -557,16 +557,16 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = -1; /*dataset space ID */
- hid_t h5mem_space_id = -1; /*memory dataspace ID */
- hid_t h5ds_id = -1; /*dataset handle */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
hsize_t h5block[2]; /*dataspace selection */
hsize_t h5stride[2];
hsize_t h5count[2];
hsize_t h5start[2];
hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dcpl = -1; /* Dataset creation property list */
- hid_t h5dxpl = -1; /* Dataset transfer property list */
+ hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/* Get the parameters from the parameter block */
blk_size=parms->blk_size;
@@ -1402,7 +1402,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
} /* end for */
@@ -1458,7 +1458,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -1468,7 +1468,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -1478,7 +1478,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
@@ -1537,15 +1537,15 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* HDF5 variables */
herr_t hrc; /*HDF5 return code */
hsize_t h5dims[2]; /*dataset dim sizes */
- hid_t h5dset_space_id = -1; /*dataset space ID */
- hid_t h5mem_space_id = -1; /*memory dataspace ID */
- hid_t h5ds_id = -1; /*dataset handle */
+ hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+ hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+ hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
hsize_t h5block[2]; /*dataspace selection */
hsize_t h5stride[2];
hsize_t h5count[2];
hsize_t h5start[2];
hssize_t h5offset[2]; /* Selection offset within dataspace */
- hid_t h5dxpl = -1; /* Dataset transfer property list */
+ hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/* Get the parameters from the parameter block */
blk_size=parms->blk_size;
@@ -2357,7 +2357,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
} /* end for */
@@ -2413,7 +2413,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -2423,7 +2423,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -2433,7 +2433,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
@@ -2451,7 +2451,7 @@ done:
do_fopen(parameters *param, char *fname, file_descr *fd /*out*/, int flags)
{
int ret_code = SUCCESS, mrc;
- hid_t acc_tpl = -1; /* file access templates */
+ hid_t acc_tpl = H5I_INVALID_HID; /* file access templates */
switch (param->io_type) {
case POSIXIO:
diff --git a/tools/test/perform/pio_perf.h b/tools/test/perform/pio_perf.h
index 7605f20..55d721e 100644
--- a/tools/test/perform/pio_perf.h
+++ b/tools/test/perform/pio_perf.h
@@ -13,12 +13,13 @@
#ifndef PIO_PERF_H__
#define PIO_PERF_H__
-#include "io_timer.h"
#ifndef STANDALONE
+#include "io_timer.h"
#include "h5test.h"
#include "h5tools.h"
#include "h5tools_utils.h"
#else
+#include "io_timer.h"
#include "pio_standalone.h"
#endif
diff --git a/tools/test/perform/pio_standalone.c b/tools/test/perform/pio_standalone.c
index 0fba904..8cdca85 100644
--- a/tools/test/perform/pio_standalone.c
+++ b/tools/test/perform/pio_standalone.c
@@ -164,3 +164,135 @@ print_version(const char *progname)
progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
H5_VERS_SUBRELEASE[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
+
+#ifdef STANDALONE
+/*
+ * Function: h5_set_info_object
+ * Purpose: Process environment variables setting to set up MPI Info
+ * object.
+ * Return: 0 if all is fine; otherwise non-zero.
+ * Programmer: Albert Cheng, 2002/05/21.
+ * Modifications:
+ * Bill Wendling, 2002/05/31
+ * Modified so that the HDF5_MPI_INFO environment variable can
+ * be a semicolon separated list of "key=value" pairings. Most
+ * of the code is to remove any whitespaces which might be
+ * surrounding the "key=value" pairs.
+ */
+int
+h5_set_info_object(void)
+{
+ char *envp; /* environment pointer */
+ int ret_value=0;
+
+ /* handle any MPI INFO hints via $HDF5_MPI_INFO */
+ if ((envp = HDgetenv("HDF5_MPI_INFO")) != NULL){
+ char *next, *valp;
+
+ valp = envp = next = HDstrdup(envp);
+
+ if (!valp) return 0;
+
+ /* create an INFO object if not created yet */
+ if (h5_io_info_g == MPI_INFO_NULL)
+ MPI_Info_create(&h5_io_info_g);
+
+ do {
+ size_t len;
+ char *key_val, *endp, *namep;
+
+ if (*valp == ';')
+ valp++;
+
+ /* copy key/value pair into temporary buffer */
+ len = strcspn(valp, ";");
+ next = &valp[len];
+ key_val = (char *)HDcalloc(1, len + 1);
+
+ /* increment the next pointer past the terminating semicolon */
+ if (*next == ';')
+ ++next;
+
+ namep = HDstrncpy(key_val, valp, len);
+
+ /* pass up any beginning whitespaces */
+ while (*namep && (*namep == ' ' || *namep == '\t'))
+ namep++;
+
+ if (!*namep) continue; /* was all white space, so move to next k/v pair */
+
+ /* eat up any ending white spaces */
+ endp = &namep[HDstrlen(namep) - 1];
+
+ while (endp && (*endp == ' ' || *endp == '\t'))
+ *endp-- = '\0';
+
+ /* find the '=' */
+ valp = HDstrchr(namep, '=');
+
+ if (valp != NULL) { /* it's a valid key/value pairing */
+ char *tmp_val = valp + 1;
+
+ /* change '=' to \0, move valp down one */
+ *valp-- = '\0';
+
+ /* eat up ending whitespace on the "key" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp-- = '\0';
+
+ valp = tmp_val;
+
+ /* eat up beginning whitespace on the "value" part */
+ while (*valp == ' ' || *valp == '\t')
+ *valp++ = '\0';
+
+ /* actually set the darned thing */
+ if (MPI_SUCCESS != MPI_Info_set(h5_io_info_g, namep, valp)) {
+ HDprintf("MPI_Info_set failed\n");
+ ret_value = -1;
+ }
+ }
+
+ valp = next;
+ HDfree(key_val);
+ } while (next && *next);
+
+ HDfree(envp);
+ }
+
+ return ret_value;
+}
+
+
+/*
+ * Function: h5_dump_info_object
+ * Purpose: Display content of an MPI Info object
+ * Return: void
+ * Programmer: Albert Cheng 2002/05/21
+ * Modifications:
+ */
+void
+h5_dump_info_object(MPI_Info info)
+{
+ char key[MPI_MAX_INFO_KEY+1];
+ char value[MPI_MAX_INFO_VAL+1];
+ int flag;
+ int i, nkeys;
+
+ HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
+ if (info==MPI_INFO_NULL){
+ HDprintf("object is MPI_INFO_NULL\n");
+ }
+ else {
+ MPI_Info_get_nkeys(info, &nkeys);
+ HDprintf("object has %d items\n", nkeys);
+ for (i=0; i<nkeys; i++){
+ MPI_Info_get_nthkey(info, i, key);
+ MPI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+ HDprintf("%s=%s\n", key, value);
+ }
+
+ }
+}
+#endif /* STANDALONE */
+
diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h
index e6db2e8..cf6d980 100644
--- a/tools/test/perform/pio_standalone.h
+++ b/tools/test/perform/pio_standalone.h
@@ -483,8 +483,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#endif
#ifdef H5_HAVE_PARALLEL
-H5TEST_DLL int h5_set_info_object(void);
-H5TEST_DLL void h5_dump_info_object(MPI_Info info);
+int h5_set_info_object(void);
+void h5_dump_info_object(MPI_Info info);
#endif
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
index 4dc4d0b..69409bb 100644
--- a/tools/test/perform/sio_engine.c
+++ b/tools/test/perform/sio_engine.c
@@ -114,11 +114,11 @@ static const char *multi_letters = "msbrglo"; /* string for multi driver */
/* HDF5 global variables */
static hsize_t h5count[MAX_DIMS]; /*selection count */
static hssize_t h5offset[MAX_DIMS]; /* Selection offset within dataspace */
-static hid_t h5dset_space_id = -1; /*dataset space ID */
-static hid_t h5mem_space_id = -1; /*memory dataspace ID */
-static hid_t h5ds_id = -1; /*dataset handle */
-static hid_t h5dcpl = -1; /* Dataset creation property list */
-static hid_t h5dxpl = -1; /* Dataset transfer property list */
+static hid_t h5dset_space_id = H5I_INVALID_HID; /*dataset space ID */
+static hid_t h5mem_space_id = H5I_INVALID_HID; /*memory dataspace ID */
+static hid_t h5ds_id = H5I_INVALID_HID; /*dataset handle */
+static hid_t h5dcpl = H5I_INVALID_HID; /* Dataset creation property list */
+static hid_t h5dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
/*
* Function: do_sio
@@ -575,7 +575,7 @@ do_write(results *res, file_descr *fd, parameters *parms, void *buffer)
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
done:
@@ -587,7 +587,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -597,7 +597,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -607,7 +607,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
@@ -894,7 +894,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer)
GOTOERROR(FAIL);
}
- h5ds_id = -1;
+ h5ds_id = H5I_INVALID_HID;
} /* end if */
done:
@@ -906,7 +906,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Space Close failed\n");
ret_code = FAIL;
} else {
- h5dset_space_id = -1;
+ h5dset_space_id = H5I_INVALID_HID;
}
}
@@ -916,7 +916,7 @@ done:
HDfprintf(stderr, "HDF5 Memory Space Close failed\n");
ret_code = FAIL;
} else {
- h5mem_space_id = -1;
+ h5mem_space_id = H5I_INVALID_HID;
}
}
@@ -926,7 +926,7 @@ done:
HDfprintf(stderr, "HDF5 Dataset Transfer Property List Close failed\n");
ret_code = FAIL;
} else {
- h5dxpl = -1;
+ h5dxpl = H5I_INVALID_HID;
}
}
@@ -1137,7 +1137,7 @@ done:
hid_t
set_vfd(parameters *param)
{
- hid_t my_fapl = -1;
+ hid_t my_fapl = H5I_INVALID_HID;
vfdtype vfd;
vfd = param->vfd;
diff --git a/tools/test/perform/sio_perf.h b/tools/test/perform/sio_perf.h
index 83caf54..d26c78b 100644
--- a/tools/test/perform/sio_perf.h
+++ b/tools/test/perform/sio_perf.h
@@ -13,12 +13,13 @@
#ifndef SIO_PERF_H__
#define SIO_PERF_H__
-#include "io_timer.h"
#ifndef STANDALONE
+#include "io_timer.h"
#include "h5test.h"
#include "h5tools.h"
#include "h5tools_utils.h"
#else
+#include "io_timer.h"
#include "sio_standalone.h"
#endif
diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h
index 248ef9a..45f6d25 100644
--- a/tools/test/perform/sio_standalone.h
+++ b/tools/test/perform/sio_standalone.h
@@ -498,8 +498,8 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#endif
#ifdef H5_HAVE_PARALLEL
-H5TEST_DLL int h5_set_info_object(void);
-H5TEST_DLL void h5_dump_info_object(MPI_Info info);
+int h5_set_info_object(void);
+void h5_dump_info_object(MPI_Info info);
#endif
@@ -527,4 +527,10 @@ typedef struct long_options {
extern int get_option(int argc, const char **argv, const char *opt,
const struct long_options *l_opt);
+
+extern int nCols; /*max number of columns for outputting */
+
+/* Definitions of useful routines */
+extern void print_version(const char *progname);
+
#endif
diff --git a/tools/testfiles/trefer_attr.h5 b/tools/testfiles/trefer_attr.h5
new file mode 100644
index 0000000..3110ce3
--- /dev/null
+++ b/tools/testfiles/trefer_attr.h5
Binary files differ
diff --git a/tools/testfiles/trefer_attrR.ddl b/tools/testfiles/trefer_attrR.ddl
new file mode 100644
index 0000000..e64c8e6
--- /dev/null
+++ b/tools/testfiles/trefer_attrR.ddl
@@ -0,0 +1,76 @@
+HDF5 "trefer_attr.h5" {
+GROUP "/" {
+ DATASET "Dataset3" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ ATTRIBUTE "trefer_attr.h5/Group1/Dataset1/Attr1" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 3, 6, 9
+ }
+ }
+ ATTRIBUTE "trefer_attr.h5/Group1/Dataset2/Attr1" {
+ NULL
+ }
+ ATTRIBUTE "trefer_attr.h5/Group1/Attr2" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 1, 4, 7, 10
+ }
+ }
+ ATTRIBUTE "trefer_attr.h5/Group1/Datatype1/Attr3" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 2, 5, 8, 11
+ }
+ }
+ }
+ }
+ GROUP "Group1" {
+ ATTRIBUTE "Attr2" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 1, 4, 7, 10
+ }
+ }
+ DATASET "Dataset1" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 0, 0, 0
+ }
+ ATTRIBUTE "Attr1" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 3, 6, 9
+ }
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 0, 0, 0
+ }
+ }
+ DATATYPE "Datatype1" H5T_COMPOUND {
+ H5T_STD_I32LE "a";
+ H5T_STD_I32LE "b";
+ H5T_IEEE_F32LE "c";
+ }
+ ATTRIBUTE "Attr3" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 2, 5, 8, 11
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_compat.h5 b/tools/testfiles/trefer_compat.h5
new file mode 100644
index 0000000..5f6dd60
--- /dev/null
+++ b/tools/testfiles/trefer_compat.h5
Binary files differ
diff --git a/tools/testfiles/trefer_compatR.ddl b/tools/testfiles/trefer_compatR.ddl
new file mode 100644
index 0000000..97c7934
--- /dev/null
+++ b/tools/testfiles/trefer_compatR.ddl
@@ -0,0 +1,114 @@
+HDF5 "trefer_compat.h5" {
+GROUP "/" {
+ DATASET "Dataset3" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ DATASET "trefer_compat.h5/Group1/Dataset1"
+ DATA {
+ (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }
+ DATASET "trefer_compat.h5/Group1/Dataset2"
+ DATA {
+ (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }
+ GROUP "trefer_compat.h5/Group1"
+ DATATYPE "trefer_compat.h5/Group1/Datatype1"
+ }
+ }
+ DATASET "Dataset4" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "trefer_compat.h5/Group1/Dataset1" {
+ REGION_TYPE BLOCK (2,2)-(7,7)
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+ }
+ }
+ DATASET "trefer_compat.h5/Group1/Dataset2" {
+ REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (3,2),
+ (0,4), (9,0), (7,1), (3,3)
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ }
+ }
+ }
+ }
+ GROUP "Group1" {
+ DATASET "Dataset1" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ (9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }
+ }
+ DATATYPE "Datatype1" H5T_COMPOUND {
+ H5T_STD_I32LE "a";
+ H5T_STD_I32LE "b";
+ H5T_IEEE_F32LE "c";
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_ext1.h5 b/tools/testfiles/trefer_ext1.h5
new file mode 100644
index 0000000..9fc9741
--- /dev/null
+++ b/tools/testfiles/trefer_ext1.h5
Binary files differ
diff --git a/tools/testfiles/trefer_ext2.h5 b/tools/testfiles/trefer_ext2.h5
new file mode 100644
index 0000000..fcbb75d
--- /dev/null
+++ b/tools/testfiles/trefer_ext2.h5
Binary files differ
diff --git a/tools/testfiles/trefer_extR.ddl b/tools/testfiles/trefer_extR.ddl
new file mode 100644
index 0000000..3d4647d
--- /dev/null
+++ b/tools/testfiles/trefer_extR.ddl
@@ -0,0 +1,34 @@
+HDF5 "trefer_ext2.h5" {
+GROUP "/" {
+ DATASET "Dataset3" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ ATTRIBUTE "trefer_ext1.h5/Group1/Dataset1/Attr1" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 3, 6, 9
+ }
+ }
+ ATTRIBUTE "trefer_ext1.h5/Group1/Dataset2/Attr1" {
+ NULL
+ }
+ ATTRIBUTE "trefer_ext1.h5/Group1/Attr2" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 1, 4, 7, 10
+ }
+ }
+ ATTRIBUTE "trefer_ext1.h5/Group1/Datatype1/Attr3" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 2, 5, 8, 11
+ }
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_grp.h5 b/tools/testfiles/trefer_grp.h5
new file mode 100644
index 0000000..d846e75
--- /dev/null
+++ b/tools/testfiles/trefer_grp.h5
Binary files differ
diff --git a/tools/testfiles/trefer_grpR.ddl b/tools/testfiles/trefer_grpR.ddl
new file mode 100644
index 0000000..298b836
--- /dev/null
+++ b/tools/testfiles/trefer_grpR.ddl
@@ -0,0 +1,15 @@
+HDF5 "trefer_grp.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SCALAR
+ DATA {
+ GROUP "trefer_grp.h5/group"
+ }
+ }
+ GROUP "group" {
+ GROUP "group3" {
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_obj.h5 b/tools/testfiles/trefer_obj.h5
new file mode 100644
index 0000000..de4c19d
--- /dev/null
+++ b/tools/testfiles/trefer_obj.h5
Binary files differ
diff --git a/tools/testfiles/trefer_objR.ddl b/tools/testfiles/trefer_objR.ddl
new file mode 100644
index 0000000..0d5af28
--- /dev/null
+++ b/tools/testfiles/trefer_objR.ddl
@@ -0,0 +1,59 @@
+HDF5 "trefer_obj.h5" {
+GROUP "/" {
+ DATASET "Dataset3" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ DATASET "trefer_obj.h5/Group1/Dataset1"
+ DATA {
+ (0): 0
+ }
+ }
+ }
+ DATASET "Dataset4" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_OBJECT }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ DATASET "trefer_obj.h5/Group1/Dataset1"
+ DATA {
+ (0): 0
+ }
+ }
+ }
+ DATASET "Dataset5" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ DATASET "trefer_obj.h5/Group1/Dataset1"
+ }
+ }
+ DATASET "Dataset6" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF_DSETREG }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ DATASET "trefer_obj.h5/Group1/Dataset1"
+ }
+ }
+ GROUP "Group1" {
+ DATASET "Dataset1" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ (0): 0
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ (0): 0
+ }
+ }
+ DATATYPE "Datatype1" H5T_COMPOUND {
+ H5T_STD_I32LE "a";
+ H5T_STD_I32LE "b";
+ H5T_IEEE_F32LE "c";
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_obj_del.h5 b/tools/testfiles/trefer_obj_del.h5
new file mode 100644
index 0000000..c1710e8
--- /dev/null
+++ b/tools/testfiles/trefer_obj_del.h5
Binary files differ
diff --git a/tools/testfiles/trefer_obj_delR.ddl b/tools/testfiles/trefer_obj_delR.ddl
new file mode 100644
index 0000000..fa238a5
--- /dev/null
+++ b/tools/testfiles/trefer_obj_delR.ddl
@@ -0,0 +1,11 @@
+HDF5 "trefer_obj_del.h5" {
+GROUP "/" {
+ DATASET "Dataset2" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SCALAR
+ DATA {
+ UNKNOWN "trefer_obj_del.h5"
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_param.h5 b/tools/testfiles/trefer_param.h5
new file mode 100644
index 0000000..234629a
--- /dev/null
+++ b/tools/testfiles/trefer_param.h5
Binary files differ
diff --git a/tools/testfiles/trefer_paramR.ddl b/tools/testfiles/trefer_paramR.ddl
new file mode 100644
index 0000000..ce9fa86
--- /dev/null
+++ b/tools/testfiles/trefer_paramR.ddl
@@ -0,0 +1,43 @@
+HDF5 "trefer_param.h5" {
+GROUP "/" {
+ DATASET "Dataset3" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ NULL
+ NULL
+ NULL
+ NULL
+ }
+ }
+ GROUP "Group1" {
+ COMMENT "Foo!"
+ DATASET "Dataset1" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 3, 6, 9
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 0, 0, 0
+ }
+ ATTRIBUTE "Attr" {
+ DATATYPE H5T_STD_U32LE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): 0, 3, 6, 9
+ }
+ }
+ }
+ DATATYPE "Datatype1" H5T_COMPOUND {
+ H5T_STD_I32LE "a";
+ H5T_STD_I32LE "b";
+ H5T_IEEE_F32LE "c";
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_reg.h5 b/tools/testfiles/trefer_reg.h5
new file mode 100644
index 0000000..8ed9184
--- /dev/null
+++ b/tools/testfiles/trefer_reg.h5
Binary files differ
diff --git a/tools/testfiles/trefer_regR.ddl b/tools/testfiles/trefer_regR.ddl
new file mode 100644
index 0000000..683c196
--- /dev/null
+++ b/tools/testfiles/trefer_regR.ddl
@@ -0,0 +1,66 @@
+HDF5 "trefer_reg.h5" {
+GROUP "/" {
+ DATASET "DS_NA" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
+ DATA {
+ NULL
+ }
+ }
+ DATASET "Dataset1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ DATASET "trefer_reg.h5/Dataset2" {
+ REGION_TYPE BLOCK (2,2)-(7,7)
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ 66, 69, 72, 75, 78, 81,
+ 96, 99, 102, 105, 108, 111,
+ 126, 129, 132, 135, 138, 141,
+ 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201,
+ 216, 219, 222, 225, 228, 231
+ }
+ }
+ DATASET "trefer_reg.h5/Dataset2" {
+ REGION_TYPE POINT (6,9), (2,2), (8,4), (1,6), (2,8), (3,2),
+ (0,4), (9,0), (7,1), (3,3)
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ 207,
+ 66,
+ 252,
+ 48,
+ 84,
+ 96,
+ 12,
+ 14,
+ 213,
+ 99
+ }
+ }
+ DATASET "trefer_reg.h5/Dataset2"
+ DATASET "trefer_reg.h5/Dataset2"
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ (0,0): 0, 3, 6, 9, 12, 15, 18, 21, 24, 27,
+ (1,0): 30, 33, 36, 39, 42, 45, 48, 51, 54, 57,
+ (2,0): 60, 63, 66, 69, 72, 75, 78, 81, 84, 87,
+ (3,0): 90, 93, 96, 99, 102, 105, 108, 111, 114, 117,
+ (4,0): 120, 123, 126, 129, 132, 135, 138, 141, 144, 147,
+ (5,0): 150, 153, 156, 159, 162, 165, 168, 171, 174, 177,
+ (6,0): 180, 183, 186, 189, 192, 195, 198, 201, 204, 207,
+ (7,0): 210, 213, 216, 219, 222, 225, 228, 231, 234, 237,
+ (8,0): 240, 243, 246, 249, 252, 255, 2, 5, 8, 11,
+ (9,0): 14, 17, 20, 23, 26, 29, 32, 35, 38, 41
+ }
+ }
+}
+}
diff --git a/tools/testfiles/trefer_reg_1d.h5 b/tools/testfiles/trefer_reg_1d.h5
new file mode 100644
index 0000000..932454d
--- /dev/null
+++ b/tools/testfiles/trefer_reg_1d.h5
Binary files differ
diff --git a/tools/testfiles/trefer_reg_1dR.ddl b/tools/testfiles/trefer_reg_1dR.ddl
new file mode 100644
index 0000000..3e5f652
--- /dev/null
+++ b/tools/testfiles/trefer_reg_1dR.ddl
@@ -0,0 +1,66 @@
+HDF5 "trefer_reg_1d.h5" {
+GROUP "/" {
+ DATASET "Dataset1" {
+ DATATYPE H5T_REFERENCE { H5T_STD_REF }
+ DATASPACE SIMPLE { ( 2 ) / ( 2 ) }
+ DATA {
+ DATASET "trefer_reg_1d.h5/Dataset2" {
+ REGION_TYPE BLOCK (2)-(3), (7)-(8), (12)-(13), (17)-(18),
+ (22)-(23), (27)-(28), (32)-(33), (37)-(38), (42)-(43),
+ (47)-(48), (52)-(53), (57)-(58), (62)-(63), (67)-(68),
+ (72)-(73)
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 100 ) / ( 100 ) }
+ DATA {
+ 6, 9,
+ 21, 24,
+ 36, 39,
+ 51, 54,
+ 66, 69,
+ 81, 84,
+ 96, 99,
+ 111, 114,
+ 126, 129,
+ 141, 144,
+ 156, 159,
+ 171, 174,
+ 186, 189,
+ 201, 204,
+ 216, 219
+ }
+ }
+ DATASET "trefer_reg_1d.h5/Dataset2" {
+ REGION_TYPE POINT (16), (22), (38), (41), (52), (63), (70),
+ (89), (97), (3)
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 100 ) / ( 100 ) }
+ DATA {
+ 48,
+ 66,
+ 114,
+ 123,
+ 156,
+ 189,
+ 210,
+ 11,
+ 35,
+ 9
+ }
+ }
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SIMPLE { ( 100 ) / ( 100 ) }
+ DATA {
+ (0): 0, 3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48,
+ (17): 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96,
+ (33): 99, 102, 105, 108, 111, 114, 117, 120, 123, 126, 129, 132, 135,
+ (46): 138, 141, 144, 147, 150, 153, 156, 159, 162, 165, 168, 171, 174,
+ (59): 177, 180, 183, 186, 189, 192, 195, 198, 201, 204, 207, 210, 213,
+ (72): 216, 219, 222, 225, 228, 231, 234, 237, 240, 243, 246, 249, 252,
+ (85): 255, 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41
+ }
+ }
+}
+}