summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-03-29 21:44:23 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-03-29 21:44:23 (GMT)
commitba2cfde1fda880bf9d4b18dd439100ee5c4680bb (patch)
treeb071863eb782a1ad32e161a60197f33e30cdf5be /tools/lib
parent096aac122ed6b6e8d07a30330bd95992887cd2be (diff)
downloadhdf5-ba2cfde1fda880bf9d4b18dd439100ee5c4680bb.zip
hdf5-ba2cfde1fda880bf9d4b18dd439100ee5c4680bb.tar.gz
hdf5-ba2cfde1fda880bf9d4b18dd439100ee5c4680bb.tar.bz2
Merge/port changes from develop back to 1.8 for tools and cmake
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.c10
-rw-r--r--tools/lib/h5diff_attr.c6
-rw-r--r--tools/lib/io_timer.c5
3 files changed, 12 insertions, 9 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index d7f5cb5..b275ab8 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -659,7 +659,8 @@ hsize_t h5diff(const char *fname1,
{
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- HDasprintf(&obj1fullname, "/%s", objname1);
+ if(HDasprintf(&obj1fullname, "/%s", objname1) < 0)
+ goto out;
#else /* H5_HAVE_ASPRINTF */
/* (malloc 2 more for "/" and end-of-line) */
obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2);
@@ -1167,7 +1168,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* make full path for obj1 */
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name);
+ if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0)
+ goto out;
#else /* H5_HAVE_ASPRINTF */
obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1);
HDstrcpy(obj1_fullpath, grp1_path);
@@ -1177,7 +1179,8 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
/* make full path for obj2 */
#ifdef H5_HAVE_ASPRINTF
/* Use the asprintf() routine, since it does what we're trying to do below */
- HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name);
+ if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0)
+ goto out;
#else /* H5_HAVE_ASPRINTF */
obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1);
HDstrcpy(obj2_fullpath, grp2_path);
@@ -1471,6 +1474,7 @@ hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
}
#endif /* H5_HAVE_PARALLEL */
+out:
/* free table */
if (table)
trav_table_free(table);
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index c3c9269..3dd8208 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -106,11 +106,9 @@ static void table_attrs_free( table_attrs_t *table )
*------------------------------------------------------------------------*/
static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *table)
{
- size_t curr_val;
-
+ if(table->nattrs == table->size) {
match_attr_t *new_attrs;
- if(table->nattrs == table->size) {
table->size = MAX(1, table->size * 2);
new_attrs = (match_attr_t *)HDrealloc(table->attrs, table->size * sizeof(match_attr_t));
if(new_attrs)
@@ -118,6 +116,8 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
} /* end if */
if(table->nattrs < table->size) {
+ size_t curr_val;
+
curr_val = table->nattrs;
table->attrs[curr_val].exist[0] = exist[0];
table->attrs[curr_val].exist[1] = exist[1];
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index b8d44de..fc0c782 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -199,9 +199,8 @@ set_time(io_time_t *pt, timer_type t, int start_stop)
break;
default:
HDfprintf(stderr, "Unknown time clock type (%d)\n", pt->type);
- return (NULL);
- break;
- }
+ return NULL;
+ } /* end switch */
#if 0
/* this does not belong here. Need fix in h5perf code when set_time() is called. -AKC- */