summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-08-06 00:15:57 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-08-06 00:15:57 (GMT)
commit65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849 (patch)
treef0382ca8b00fb2c158da2cb502ee3f6d3cdf1106 /tools/lib
parentf59bb712dec221a076728b6c582818bcf814d71a (diff)
downloadhdf5-65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849.zip
hdf5-65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849.tar.gz
hdf5-65e92e1d56dd2e04ebe7b7713fee9e9e38cd8849.tar.bz2
Warning fixes in tools and h5test.c
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff_attr.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index b7ec2e8..48663e2 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -333,7 +333,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */
hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
hsize_t nfound = 0;
- int j;
+ size_t sz;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
@@ -384,19 +384,19 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
H5TOOLS_DEBUG("attr_names: %s - %s", name1, name2);
if (name1) {
- j = (int)HDstrlen(name1);
- H5TOOLS_DEBUG("attr1_name: %s - %d", name1, j);
- if (j > 0) {
- opts->obj_name[0] = (char *)HDmalloc((size_t)j + 1);
- HDstrncpy(opts->obj_name[0], name1, (size_t)j + 1);
+ sz = HDstrlen(name1);
+ H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz);
+ if (sz > 0) {
+ opts->obj_name[0] = (char *)HDmalloc(sz + 1);
+ HDstrncpy(opts->obj_name[0], name1, sz + 1);
}
}
if (name2) {
- j = (int)HDstrlen(name2);
- H5TOOLS_DEBUG("attr2_name: %s - %d", name2, j);
- if (j > 0) {
- opts->obj_name[1] = (char *)HDmalloc((size_t)j + 1);
- HDstrncpy(opts->obj_name[1], name2, (size_t)j + 1);
+ sz = HDstrlen(name2);
+ H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz);
+ if (sz > 0) {
+ opts->obj_name[1] = (char *)HDmalloc(sz + 1);
+ HDstrncpy(opts->obj_name[1], name2, sz + 1);
}
}
H5TOOLS_DEBUG("attr_names: %s - %s", opts->obj_name[0], opts->obj_name[1]);
@@ -404,6 +404,9 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
/* 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, opts, 0) == 1) {
+
+ int j;
+
/*-----------------------------------------------------------------
* "upgrade" the smaller memory size
*------------------------------------------------------------------
@@ -461,22 +464,18 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
H5TOOLS_DEBUG("attr_names: %s - %s : %s - %s", name1, name2, path1, path2);
if (name1) {
- j = (int)HDstrlen(name1) + (int)HDstrlen(path1) + 7;
- H5TOOLS_DEBUG("attr1_name: %s - %d", name1, j);
- if (j > 0) {
- opts->obj_name[0] = (char *)HDcalloc((size_t)j + 1, sizeof(char));
- HDsnprintf(opts->obj_name[0], j, "%s of <%s>", name1, path1);
- opts->obj_name[0][j] = '\0';
- }
+ sz = HDstrlen(name1) + HDstrlen(path1) + 7;
+ H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz);
+ opts->obj_name[0] = (char *)HDcalloc(sz + 1, sizeof(char));
+ HDsnprintf(opts->obj_name[0], sz, "%s of <%s>", name1, path1);
+ opts->obj_name[0][sz] = '\0';
}
if (name2) {
- j = (int)HDstrlen(name2) + (int)HDstrlen(path2) + 7;
- H5TOOLS_DEBUG("attr2_name: %s - %d", name2, j);
- if (j > 0) {
- opts->obj_name[1] = (char *)HDcalloc((size_t)j + 1, sizeof(char));
- HDsnprintf(opts->obj_name[1], j, "%s of <%s>", name2, path2);
- opts->obj_name[1][j] = '\0';
- }
+ sz = HDstrlen(name2) + HDstrlen(path2) + 7;
+ H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz);
+ opts->obj_name[1] = (char *)HDcalloc(sz + 1, sizeof(char));
+ HDsnprintf(opts->obj_name[1], sz, "%s of <%s>", name2, path2);
+ opts->obj_name[1][sz] = '\0';
}
/*---------------------------------------------------------------------