summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-07-30 21:58:24 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-07-30 21:58:24 (GMT)
commita873d149e535a32cc1125fb744b0344112096d48 (patch)
tree4cf3224af16a9e1953c439ff6880a6b3076eb0c8 /tools
parent1b2941af4351b39f915efd158fdfdda2e70ba589 (diff)
downloadhdf5-a873d149e535a32cc1125fb744b0344112096d48.zip
hdf5-a873d149e535a32cc1125fb744b0344112096d48.tar.gz
hdf5-a873d149e535a32cc1125fb744b0344112096d48.tar.bz2
Cleanup when merging to other branches
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff.c1
-rw-r--r--tools/lib/h5diff_array.c19
-rw-r--r--tools/lib/h5tools.c6
-rw-r--r--tools/lib/h5tools_str.c6
-rw-r--r--tools/lib/h5tools_utils.c26
-rw-r--r--tools/lib/h5trav.c2
-rw-r--r--tools/src/h5dump/h5dump_xml.c4
-rw-r--r--tools/src/h5repack/h5repack.c14
-rw-r--r--tools/src/h5repack/h5repack_copy.c30
-rw-r--r--tools/src/h5repack/h5repack_filters.c10
-rw-r--r--tools/src/h5repack/h5repack_refs.c24
-rw-r--r--tools/test/h5diff/h5diffgentest.c162
-rw-r--r--tools/test/misc/h5clear_gentest.c2
-rw-r--r--tools/test/misc/talign.c8
14 files changed, 135 insertions, 179 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 594bf51..3ee5393 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1344,7 +1344,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
}
#endif /* H5_HAVE_PARALLEL */
-out:
opts->err_stat = opts->err_stat | ret_value;
/* free table */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 9d5f062..2a45913 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -516,14 +516,14 @@ static hsize_t diff_datum(
if (H5Tis_variable_str(m_type)) {
h5difftrace("diff_datum H5T_STRING variable\n");
/* Get pointer to first string */
- s1 = *(char**) mem1;
+ s1 = *(char **)((void *)mem1);
if (s1)
size1 = HDstrlen(s1);
else
size1 = 0;
/* Get pointer to second string */
- s2 = *(char**) mem2;
+ s2 = *(char **)((void *)mem2);
if (s2)
size2 = HDstrlen(s2);
else
@@ -783,12 +783,11 @@ static hsize_t diff_datum(
}
/* check object type */
- if (ret_value >= 0)
- 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);
- }
+ 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);
+ }
if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) {
opts->err_stat = 1;
@@ -829,10 +828,10 @@ static hsize_t diff_datum(
size = H5Tget_size(memb_type);
/* get the number of sequence elements */
- nelmts = ((hvl_t *) mem1)->len;
+ nelmts = ((hvl_t *)((void *)mem1))->len;
for (j = 0; j < nelmts; j++)
- nfound += diff_datum(((char *) (((hvl_t *) mem1)->p)) + j * size, ((char *) (((hvl_t *) mem2)->p)) + j * size, memb_type, index,
+ nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
H5Tclose(memb_type);
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index d93f7b0..f103647 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1283,7 +1283,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
mem = ((unsigned char*)_mem) + block_index * size;
if (H5Tis_variable_str(tid)) {
- s = *(char**) mem;
+ s = *(char **)((void *)mem);
if (s != NULL)
size = HDstrlen(s);
else
@@ -1375,10 +1375,10 @@ 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;
/* Get the number of sequence elements */
- nelmts = ((hvl_t *) mem)->len;
+ nelmts = ((hvl_t *)((void *)mem))->len;
/* dump the array element */
- if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
+ if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *)((void *)mem))->p)), nelmts) < 0) {
H5Tclose(memb);
H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed")
}
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 3e8f1fe..17e3f18 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -787,7 +787,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if(H5Tis_variable_str(type)) {
/* cp_vp is the pointer into the struct where a `char*' is stored. So we have
* to dereference the pointer to get the `char*' to pass to HDstrlen(). */
- s = *(char**) cp_vp;
+ s = *(char **)((void *)cp_vp);
if(s != NULL) size = HDstrlen(s);
}
else {
@@ -1240,7 +1240,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
h5tools_str_append(str, "%s", OPT(info->vlen_pre, "("));
/* Get the number of sequence elements */
- nelmts = ((hvl_t *) cp_vp)->len;
+ nelmts = ((hvl_t *)((void *)cp_vp))->len;
for(i = 0; i < nelmts; i++) {
if(i) h5tools_str_append(str, "%s", OPT(info->vlen_sep, "," OPTIONAL_LINE_BREAK));
@@ -1264,7 +1264,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
ctx->indent_level++;
/* Dump the array element */
- h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *) cp_vp)->p)) + i * size, ctx);
+ h5tools_str_sprint(str, info, container, memb, ((char *) (((hvl_t *)((void *)cp_vp))->p)) + i * size, ctx);
ctx->indent_level--;
} /* end for */
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index e7e017f..d97b5c9 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -97,7 +97,7 @@ parallel_print(const char* format, ...)
HDva_end(ap);
}
-
+
/*-------------------------------------------------------------------------
* Function: error_msg
*
@@ -122,7 +122,7 @@ error_msg(const char *fmt, ...)
HDva_end(ap);
}
-
+
/*-------------------------------------------------------------------------
* Function: warn_msg
*
@@ -161,7 +161,7 @@ help_ref_msg(FILE *output)
HDfprintf(output, "see the <%s> entry in the 'HDF5 Reference Manual'.\n",h5tools_getprogname());
}
-
+
/*-------------------------------------------------------------------------
* Function: get_option
*
@@ -344,7 +344,7 @@ indentation(unsigned x)
}
}
-
+
/*-------------------------------------------------------------------------
* Function: print_version
*
@@ -362,7 +362,7 @@ print_version(const char *progname)
((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE);
}
-
+
/*-------------------------------------------------------------------------
* Function: init_table
*
@@ -384,7 +384,7 @@ init_table(table_t **tbl)
*tbl = table;
}
-
+
/*-------------------------------------------------------------------------
* Function: free_table
*
@@ -408,7 +408,7 @@ free_table(table_t *table)
}
#ifdef H5DUMP_DEBUG
-
+
/*-------------------------------------------------------------------------
* Function: dump_table
*
@@ -429,7 +429,7 @@ dump_table(char* tablename, table_t *table)
table->objs[u].displayed, table->objs[u].recorded);
}
-
+
/*-------------------------------------------------------------------------
* Function: dump_tables
*
@@ -447,7 +447,7 @@ dump_tables(find_objs_t *info)
}
#endif /* H5DUMP_DEBUG */
-
+
/*-------------------------------------------------------------------------
* Function: search_obj
*
@@ -470,7 +470,7 @@ search_obj(table_t *table, haddr_t objno)
return NULL;
}
-
+
/*-------------------------------------------------------------------------
* Function: find_objs_cb
*
@@ -546,7 +546,7 @@ find_objs_cb(const char *name, const H5O_info_t *oinfo, const char *already_seen
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
* Function: init_objs
*
@@ -591,7 +591,7 @@ done:
return ret_value;
}
-
+
/*-------------------------------------------------------------------------
* Function: add_obj
*
@@ -622,7 +622,7 @@ add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record)
table->objs[u].displayed = 0;
}
-
+
#ifndef H5_HAVE_TMPFILE
/*-------------------------------------------------------------------------
* Function: tmpfile
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index 917d5f5..5519437 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -184,7 +184,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
if(udata->is_absolute) {
size_t base_len = HDstrlen(udata->base_grp_name);
size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1;
- size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1;
+ size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */
if(NULL == (new_name = (char*)HDmalloc(new_name_len)))
return(H5_ITER_ERROR);
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index ec76511..2fa9fd0 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -2881,7 +2881,7 @@ xml_print_refs(hid_t did, int source)
goto error;
}
- refbuf = (hobj_ref_t *) buf;
+ refbuf = (hobj_ref_t *)((void *)buf);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3057,7 +3057,7 @@ xml_print_strs(hid_t did, int source)
for (i = 0; i < (hsize_t)ssiz; i++) {
if (is_vlstr) {
- onestring = *(char **) bp;
+ onestring = *(char **)((void *)bp);
if (onestring)
str_size = HDstrlen(onestring);
}
diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c
index a63e56f..e96dea5 100644
--- a/tools/src/h5repack/h5repack.c
+++ b/tools/src/h5repack/h5repack.c
@@ -713,7 +713,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
hid_t did = -1;
hid_t sid = -1;
unsigned int i;
- unsigned int uf;
+ int ifil;
trav_table_t *travt = NULL;
/* nothing to do */
@@ -747,7 +747,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
*/
if (options->verbose)
- printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs);
+ printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs);
for (i = 0; i < options->op_tbl->nelems; i++) {
char* name = options->op_tbl->objs[i].path;
@@ -761,17 +761,17 @@ static int check_objects(const char* fname, pack_opt_t *options) {
if (options->verbose)
printf("...Found\n");
- for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) {
- if (options->op_tbl->objs[i].filter[uf].filtn < 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) {
+ if (options->op_tbl->objs[i].filter[ifil].filtn < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter");
/* check for extra filter conditions */
- switch (options->op_tbl->objs[i].filter[uf].filtn) {
+ switch (options->op_tbl->objs[i].filter[ifil].filtn) {
/* chunk size must be smaller than pixels per block */
case H5Z_FILTER_SZIP:
{
int j;
hsize_t csize = 1;
- unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0];
+ unsigned ppb = options->op_tbl->objs[i].filter[ifil].cd_values[0];
hsize_t dims[H5S_MAX_RANK];
int rank;
@@ -807,7 +807,7 @@ static int check_objects(const char* fname, pack_opt_t *options) {
default:
break;
}
- } /* for uf */
+ } /* for ifil */
} /* for i */
done:
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index 0567269..8122d6d 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -33,20 +33,6 @@
/* size of buffer/# of bytes to xfer at a time when copying userblock */
#define USERBLOCK_XFER_SIZE 512
-/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */
-#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \
- H5E_BEGIN_TRY { \
- if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \
- hid_t _err_num = 0; \
- char _msg[80]; \
- H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \
- H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \
- error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \
- HGOTO_DONE(_fail) \
- } \
- } H5E_END_TRY; \
-}
-
/*-------------------------------------------------------------------------
* local functions
*-------------------------------------------------------------------------
@@ -61,15 +47,7 @@ static int copy_user_block(const char *infile, const char *outfile,
#if defined (H5REPACK_DEBUG_USER_BLOCK)
static void print_user_block(const char *filename, hid_t fid);
#endif
-static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata);
-/* get the major number from the error stack. */
-static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) {
- if (err_desc)
- *((hid_t *) udata) = err_desc->maj_num;
-
- return 0;
-}
/*-------------------------------------------------------------------------
* Function: copy_objects
@@ -634,7 +612,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
unsigned crt_order_flags; /* group creation order flag */
unsigned i;
unsigned u;
- unsigned uf;
+ int ifil;
int is_ref = 0;
htri_t is_named;
hbool_t limit_maxdims;
@@ -740,8 +718,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if (options->op_tbl->objs) {
for (u = 0; u < options->op_tbl->nelems; u++) {
if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0)
- for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) {
- if (options->op_tbl->objs[u].filter[uf].filtn > 0)
+ for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) {
+ if (options->op_tbl->objs[u].filter[ifil].filtn > 0)
req_filter = 1;
}
}
@@ -1350,7 +1328,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr)
if (!pr)
printf(FORMAT_OBJ, "dset", objname);
else {
- char str[255], temp[28];
+ char str[512], temp[512];
HDstrcpy(str, "dset ");
HDstrcat(str, strfilter);
diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c
index 3d9472a..7e32def 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -42,7 +42,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
H5D_layout_t layout;
int rank; /* rank of dataset */
hsize_t chsize[64]; /* chunk size in elements */
- unsigned int i;
+ int i;
+ unsigned u;
/* get information about input filters */
if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0)
@@ -65,8 +66,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */
if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed");
objout->chunk.rank = rank;
- for (i = 0; i < rank; i++)
- objout->chunk.chunk_lengths[i] = chsize[i];
+ for (u = 0; u < (unsigned)rank; u++)
+ objout->chunk.chunk_lengths[u] = chsize[u];
}
done:
@@ -85,8 +86,7 @@ static int aux_find_obj(const char* name, /* object name from traverse list */
pack_info_t *obj /*OUT*/) /* info about object to filter */
{
char *pdest = NULL;
- char *pname = NULL;
- int result;
+ const char *pname = NULL;
unsigned int i;
for (i = 0; i < options->op_tbl->nelems; i++) {
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index a275443..f5846ba 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -22,7 +22,7 @@
*/
static const char* MapIdToName(hid_t refobj_id,trav_table_t *travt);
-static int copy_refs_attr(hid_t loc_in, hid_t loc_out, pack_opt_t *options,
+static int copy_refs_attr(hid_t loc_in, hid_t loc_out,
trav_table_t *travt, hid_t fidout);
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);
@@ -81,7 +81,7 @@ int do_copy_refobjs(hid_t fidin,
if((grp_in = H5Gopen2(fidin, travt->objs[i].name, H5P_DEFAULT)) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gopen2 failed");
- if(copy_refs_attr(grp_in, grp_out, options, travt, fidout) < 0)
+ if(copy_refs_attr(grp_in, grp_out, travt, fidout) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed");
if(H5Gclose(grp_out) < 0)
@@ -316,7 +316,7 @@ int do_copy_refobjs(hid_t fidin,
* copy referenced objects in attributes
*-------------------------------------------------------------------------
*/
- if(copy_refs_attr(dset_in, dset_out, options, travt, fidout) < 0)
+ if(copy_refs_attr(dset_in, dset_out, travt, fidout) < 0)
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "copy_refs_attr failed");
/*-------------------------------------------------------------------------
@@ -426,7 +426,6 @@ done:
static int copy_refs_attr(hid_t loc_in,
hid_t loc_out,
- pack_opt_t *options,
trav_table_t *travt,
hid_t fidout) /* for saving references */
{
@@ -450,7 +449,6 @@ static int copy_refs_attr(hid_t loc_in,
is_ref_comp = 0;
void *refbuf = NULL;
void *buf = NULL;
- const char *refname = NULL;
unsigned *ref_comp_index = NULL;
size_t *ref_comp_size = NULL;
int ref_comp_field_n = 0;
@@ -604,12 +602,9 @@ static int copy_refs_attr(hid_t loc_in,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++) {
- if (update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt)<0)
+ for(i = 0; i < (unsigned)nelmts; i++)
+ if(update_ref_value(attr_id, H5R_OBJECT, &((hobj_ref_t *)buf)[i], fidout, &((hobj_ref_t *)refbuf)[i], travt) < 0)
continue;
- if(options->verbose)
- printf("object <%s> reference created to <%s>\n", name, refname);
- } /* i */
} /* H5T_STD_REF_OBJ */
/* handle region references */
else if((is_ref || is_ref_array) && (H5R_DSET_REG_REF_BUF_SIZE == msize)) {
@@ -632,12 +627,9 @@ static int copy_refs_attr(hid_t loc_in,
HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDcalloc failed");
} /* end if */
- for(i = 0; i < (unsigned)nelmts; i++) {
- if (update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt)<0)
+ for(i = 0; i < (unsigned)nelmts; i++)
+ if(update_ref_value(attr_id, H5R_DATASET_REGION, &((hdset_reg_ref_t *)buf)[i], fidout, &((hdset_reg_ref_t *)refbuf)[i], travt) < 0)
continue;
- if(options->verbose)
- printf("object <%s> region reference created to <%s>\n", name, refname);
- }
} /* H5T_STD_REF_DSETREG */
else if (is_ref_vlen) {
/* handle VLEN of references */
@@ -700,7 +692,7 @@ static int copy_refs_attr(hid_t loc_in,
size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
hobj_ref_t ref_out;
- if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)(((char *)buf)+idx), fidout, &ref_out, travt)<0)
+ if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
continue;
HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
} /* if */
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index ac3bbee..4f92cae 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -108,6 +108,10 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define SPACE1_DIM1 0
#define SPACE1_DIM2 0
+/* Error macros */
+#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
+#define PROGRAM_ERROR {AT(); goto error;}
+
/* A UD link traversal function. Shouldn't actually be called. */
static hid_t
UD_traverse(H5_ATTR_UNUSED const char * link_name, H5_ATTR_UNUSED hid_t cur_group,
@@ -176,7 +180,7 @@ static void write_dset_in(hid_t loc_id, const char* dset_name, hid_t fid, int ma
static void gen_datareg(hid_t fid, int make_diffs);
/* utilities */
static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
-static int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
+static herr_t write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf);
static int gen_dataset_idx(const char *file, int format);
/*-------------------------------------------------------------------------
@@ -284,7 +288,7 @@ int main(void)
/* string dataset and attribute. HDFFV-10028 */
test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2);
- return 0;
+ return EXIT_SUCCESS;
}
/*-------------------------------------------------------------------------
@@ -4906,9 +4910,9 @@ out:
* types.
* h5diff should show non-comparable output from these common objects.
*-------------------------------------------------------------------------*/
-static void test_objs_nocomparables(const char *fname1, const char *fname2)
+static void
+test_objs_nocomparables(const char *fname1, const char *fname2)
{
- herr_t status = SUCCEED;
hid_t fid1 = -1;
hid_t fid2 = -1;
hid_t topgid1 = -1;
@@ -4925,110 +4929,90 @@ static void test_objs_nocomparables(const char *fname1, const char *fname2)
* Open file(s) to add objects
*------------------------------------------------------------------------*/
/* file1 */
- fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT);
- if (fid1 < 0) {
- fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1);
- status = FAIL;
- goto out;
- }
+ if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR
/* file2 */
- fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT);
- if (fid2 < 0) {
- fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname2);
- status = FAIL;
- goto out;
- }
+ if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR
/*-----------------------------------------------------------------------
* in file1 : add member objects
*------------------------------------------------------------------------*/
/* parent group */
- topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (topgid1 < 0) {
- fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
- status = FAIL;
- goto out;
- }
+ if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR
/* dataset */
- status = write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1);
- if (status == FAIL) {
- fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
- goto out;
- }
+ if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0)
+ PROGRAM_ERROR
/* group */
- gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid1 < 0) {
- fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
- status = FAIL;
- goto out;
- }
+ if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR
/* committed type */
- tid1 = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0) {
- fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname1);
- goto out;
- }
+ if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ PROGRAM_ERROR
+ if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ PROGRAM_ERROR
/*-----------------------------------------------------------------------
* in file2 : add member objects
*------------------------------------------------------------------------*/
/* parent group */
- topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (topgid2 < 0) {
- fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
- status = FAIL;
- goto out;
- }
+ if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR
/* group */
- gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (gid2 < 0) {
- fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname2);
- status = FAIL;
- goto out;
- }
+ if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR
/* committed type */
- tid2 = H5Tcopy(H5T_NATIVE_INT);
- status = H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- if (status < 0) {
- fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", fname2);
- goto out;
- }
+ if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ PROGRAM_ERROR
+ if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ PROGRAM_ERROR
/* dataset */
- status = write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2);
- if (status == FAIL) {
- fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
- goto out;
- }
+ if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0)
+ PROGRAM_ERROR
-out:
/*-----------------------------------------------------------------------
* Close IDs
*-----------------------------------------------------------------------*/
- if (fid1)
+ if(H5Fclose(fid1) < 0)
+ PROGRAM_ERROR
+ if(H5Fclose(fid2) < 0)
+ PROGRAM_ERROR
+ if(H5Gclose(topgid1) < 0)
+ PROGRAM_ERROR
+ if(H5Gclose(topgid2) < 0)
+ PROGRAM_ERROR
+ if(H5Gclose(gid1) < 0)
+ PROGRAM_ERROR
+ if(H5Gclose(gid2) < 0)
+ PROGRAM_ERROR
+ if(H5Tclose(tid1) < 0)
+ PROGRAM_ERROR
+ if(H5Tclose(tid2) < 0)
+ PROGRAM_ERROR
+
+ return;
+
+error:
+ H5E_BEGIN_TRY {
H5Fclose(fid1);
- if (fid2)
H5Fclose(fid2);
- if (topgid1)
H5Gclose(topgid1);
- if (topgid2)
H5Gclose(topgid2);
- if (gid1)
H5Gclose(gid1);
- if (gid2)
H5Gclose(gid2);
- if (tid1)
H5Tclose(tid1);
- if (tid2)
H5Tclose(tid2);
+ } H5E_END_TRY;
+ return;
}
static hid_t mkstr(int size, H5T_str_t pad)
@@ -8083,36 +8067,40 @@ out:
*
*-------------------------------------------------------------------------
*/
-static
-int write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, void *buf)
+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;
/* create a space */
- if ((sid = H5Screate_simple(rank, dims, NULL)) < 0)
- goto out;
+ if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
+ PROGRAM_ERROR
/* create the dataset */
- if ((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto out;
+ if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR
/* write */
- if (buf) {
- if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto out;
- }
+ if(buf)
+ if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ PROGRAM_ERROR
/* close */
- H5Dclose(did);
- H5Sclose(sid);
+ if(H5Dclose(did) < 0)
+ PROGRAM_ERROR
+ if(H5Sclose(sid) < 0)
+ PROGRAM_ERROR
return SUCCEED;
-out:
+error:
+
+ H5E_BEGIN_TRY {
+ H5Dclose(did);
+ H5Sclose(sid);
+ } H5E_END_TRY;
- H5Dclose(did);
- H5Sclose(sid);
return FAIL;
-}
+} /* end write_dset() */
diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c
index 88c8ea5..7f80c23 100644
--- a/tools/test/misc/h5clear_gentest.c
+++ b/tools/test/misc/h5clear_gentest.c
@@ -172,7 +172,7 @@ gen_enhance_files(hbool_t user)
int data[NUM_ELMTS]; /* Buffer for data */
int fd = -1; /* The file descriptor ID */
int64_t eoa; /* The EOA value */
- int32_t chksum; /* The chksum value */
+ uint32_t chksum; /* The chksum value */
int i = 0 , j = 0, u = 0; /* Local index variable */
/* Get a copy of the default file creation property */
diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c
index ce866b4..08ebfc7 100644
--- a/tools/test/misc/talign.c
+++ b/tools/test/misc/talign.c
@@ -130,7 +130,7 @@ int main(void)
set = H5Dopen2(fil, setname, H5P_DEFAULT);
H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data);
- fptr = (float *)(data + H5Tget_member_offset(fix, 1));
+ fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1)));
H5Dclose(set);
out:
@@ -151,7 +151,7 @@ out:
if(mname)
H5free_memory(mname);
- fptr = (float *)(data + H5Tget_member_offset(fix, 1));
+ fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1)));
mname = H5Tget_member_name(fix, 1);
printf("Data comparison:\n"
"%14s (%2d) %6f = %f\n"
@@ -162,7 +162,7 @@ out:
if(mname)
H5free_memory(mname);
- fptr = (float *)(data + H5Tget_member_offset(fix, 2));
+ fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 2)));
mname = H5Tget_member_name(fix, 2);
printf("%14s (%2d) %6f = %f\n"
" %6f = %6f\n",
@@ -172,7 +172,7 @@ out:
if(mname)
H5free_memory(mname);
- fptr = (float *)(data + H5Tget_member_offset(fix, 1));
+ fptr = (float *)((void *)(data + H5Tget_member_offset(fix, 1)));
printf("\n"
"Short circuit\n"
" %6f = %f\n"