summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5copy/h5copy.c2
-rw-r--r--tools/src/h5diff/CMakeLists.txt2
-rw-r--r--tools/src/h5repack/h5repack.c10
-rw-r--r--tools/src/h5repack/h5repack_copy.c10
-rw-r--r--tools/src/h5repack/h5repack_filters.c4
-rw-r--r--tools/src/h5repack/h5repack_opttable.c35
-rw-r--r--tools/src/h5repack/h5repack_refs.c6
-rw-r--r--tools/src/h5repack/h5repack_verify.c4
-rw-r--r--tools/src/h5stat/h5stat.c8
9 files changed, 45 insertions, 36 deletions
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index ffcd2b9..06240f5 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -207,7 +207,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 0)
H5E_auto2_t func;
H5E_auto2_t tools_func;
void *edata;
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/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index 971589e..4fb1507 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -222,10 +222,10 @@ 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)
{
+ H5TOOLS_ERR_INIT(hid_t, H5I_INVALID_HID)
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 */
if (H5Oget_info2(type_in, &oinfo, H5O_INFO_BASIC) < 0)
H5TOOLS_GOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Oget_info failed");
@@ -311,8 +311,8 @@ done:
int
named_datatype_free(named_dt_t **named_dt_head_p, int ignore_err)
{
+ H5TOOLS_ERR_INIT(int, -1)
named_dt_t *dt = *named_dt_head_p;
- int ret_value = -1;
while (dt) {
/* Pop the datatype off the stack and free it */
@@ -343,7 +343,7 @@ 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;
+ H5TOOLS_ERR_INIT(int, 0)
hid_t attr_id = -1; /* attr ID */
hid_t attr_out = -1; /* attr ID */
hid_t space_id = -1; /* space ID */
@@ -546,7 +546,7 @@ done:
static int
check_options(pack_opt_t *options)
{
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
+ H5TOOLS_ERR_INIT(int, 0)
unsigned int i;
int k, j, has_cp = 0, has_ck = 0;
char slayout[30];
@@ -724,13 +724,13 @@ done:
static int
check_objects(const char* fname, pack_opt_t *options)
{
+ H5TOOLS_ERR_INIT(int, 0)
hid_t fid = -1;
hid_t did = -1;
hid_t sid = -1;
unsigned int i;
int ifil;
trav_table_t *travt = NULL;
- int ret_value = 0; /*no need to LEAVE() on ERROR: H5TOOLS_ERR_INIT(int, SUCCEED) */
/* nothing to do */
if (options->op_tbl->nelems == 0)
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 5d41908..2c0af19 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -61,7 +61,7 @@ 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;
+ H5TOOLS_ERR_INIT(int, 0)
hid_t fidin = -1;
hid_t fidout = -1;
hid_t fcpl_in = -1; /* file creation property list ID for input file */
@@ -402,7 +402,7 @@ 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;
+ H5TOOLS_ERR_INIT(int, 0)
int k;
H5D_layout_t dset_layout;
int rank_chunk;
@@ -580,7 +580,7 @@ int
do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
pack_opt_t *options) /* repack options */
{
- int ret_value = 0;
+ H5TOOLS_ERR_INIT(int, 0)
hid_t grp_in = -1; /* group ID */
hid_t grp_out = -1; /* group ID */
hid_t dset_in = -1; /* read dataset ID */
@@ -1354,7 +1354,7 @@ 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;
+ H5TOOLS_ERR_INIT(int, 0)
int infid = -1, outfid = -1; /* File descriptors */
/* User block must be any power of 2 equal to 512 or greater (512, 1024, 2048, etc.) */
@@ -1426,7 +1426,7 @@ static
void
print_user_block(const char *filename, hid_t fid)
{
- int ret_value = 0;
+ H5TOOLS_ERR_INIT(int, 0)
int fh = -1; /* file handle */
hsize_t ub_size; /* user block size */
hsize_t size; /* size read */
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index 891de25..9eb7c89 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -36,7 +36,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 0)
int nfilters; /* number of filters in DCPL */
char f_objname[256]; /* filter objname */
H5D_layout_t layout;
@@ -238,7 +238,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 0)
int nfilters; /* number of filters in DCPL */
hsize_t chsize[64]; /* chunk size in elements */
H5D_layout_t layout;
diff --git a/tools/src/h5repack/h5repack_opttable.c b/tools/src/h5repack/h5repack_opttable.c
index 9d35c4f..0239f6c 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,7 +50,9 @@ 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)
+{
+ H5TOOLS_ERR_INIT(int, 0)
if (table->objs[I].nfilters < H5_REPACK_MAX_NFILTERS)
table->objs[I].filter[table->objs[I].nfilters++] = filt;
else
@@ -64,7 +67,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;
@@ -96,19 +100,21 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, unsigned int I, pack_info
static int
aux_inctable(pack_opttbl_t *table, unsigned n_objs)
{
+ H5TOOLS_ERR_INIT(int, 0)
unsigned u;
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;
+ 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;
}
@@ -121,27 +127,27 @@ aux_inctable(pack_opttbl_t *table, unsigned n_objs)
*-------------------------------------------------------------------------
*/
int options_table_init(pack_opttbl_t **tbl) {
+ H5TOOLS_ERR_INIT(int, 0)
unsigned int i;
pack_opttbl_t *table;
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, H5E_tools_min_id_g, "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, H5E_tools_min_id_g, "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;
}
@@ -171,6 +177,7 @@ int options_table_free(pack_opttbl_t *table) {
int
options_add_layout(obj_list_t *obj_list, unsigned n_objs, pack_info_t *pack, pack_opttbl_t *table)
{
+ H5TOOLS_ERR_INIT(herr_t, 0)
unsigned i, j, I;
unsigned added = 0;
hbool_t found = FALSE;
@@ -237,7 +244,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..02a2a6d 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -42,7 +42,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 0)
hid_t grp_in = -1; /* read group ID */
hid_t grp_out = -1; /* write group ID */
hid_t dset_in = -1; /* read dataset ID */
@@ -429,7 +429,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 0)
hid_t attr_id = -1; /* attr ID */
hid_t attr_out = -1; /* attr ID */
hid_t space_id = -1; /* space ID */
@@ -822,7 +822,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 0)
const char *ref_obj_name;
hid_t space_id = -1;
hid_t ref_obj_id = -1;
diff --git a/tools/src/h5repack/h5repack_verify.c b/tools/src/h5repack/h5repack_verify.c
index 30bd3f6..29ce5bd 100644
--- a/tools/src/h5repack/h5repack_verify.c
+++ b/tools/src/h5repack/h5repack_verify.c
@@ -39,7 +39,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 0)
hid_t fidin = -1; /* file ID for input file*/
hid_t fidout = -1; /* file ID for output file*/
hid_t did = -1; /* dataset ID */
@@ -355,7 +355,7 @@ 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) */
+ H5TOOLS_ERR_INIT(int, 1)
hid_t fid1 =-1; /* file ID */
hid_t fid2 =-1; /* file ID */
hid_t dset1 =-1; /* dataset ID */
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index 6ff1e8c..64053a8 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -442,9 +442,9 @@ 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)
{
+ H5TOOLS_ERR_INIT(herr_t, SUCCEED)
H5G_info_t ginfo; /* Group information */
unsigned bin; /* "bin" the number of objects falls in */
- herr_t ret_value = SUCCEED; /* Return value */
/* Gather statistics about this type of object */
iter->uniq_groups++;
@@ -512,6 +512,7 @@ done:
static herr_t
dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi)
{
+ H5TOOLS_ERR_INIT(herr_t, SUCCEED)
unsigned bin; /* "bin" the number of objects falls in */
hid_t did; /* Dataset ID */
hid_t sid; /* Dataspace ID */
@@ -527,7 +528,6 @@ 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 */
/* Gather statistics about this type of object */
iter->uniq_dsets++;
@@ -704,7 +704,7 @@ done:
static herr_t
datatype_stats(iter_t *iter, const H5O_info_t *oi)
{
- herr_t ret_value = SUCCEED;
+ H5TOOLS_ERR_INIT(herr_t, SUCCEED)
/* Gather statistics about this type of object */
iter->uniq_dtypes++;
@@ -738,8 +738,8 @@ static herr_t
obj_stats(const char *path, const H5O_info_t *oi, const char *already_visited,
void *_iter)
{
+ H5TOOLS_ERR_INIT(herr_t, SUCCEED)
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) {