summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5diff_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5diff_attr.c')
-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';
}
/*---------------------------------------------------------------------