summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-08-15 19:14:50 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-08-15 19:14:50 (GMT)
commit59316d1327380e619f7a7e4d215d55e88f8c1c74 (patch)
tree066066b97503dd384913e4927b1c626fe6a0bc74 /tools/lib
parent8e7c24f5148e91335bf744583a6a407014014391 (diff)
downloadhdf5-59316d1327380e619f7a7e4d215d55e88f8c1c74.zip
hdf5-59316d1327380e619f7a7e4d215d55e88f8c1c74.tar.gz
hdf5-59316d1327380e619f7a7e4d215d55e88f8c1c74.tar.bz2
HDFFV-9984 Add merge/prune h5repack options for ext links
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff_array.c7
-rw-r--r--tools/lib/h5diff_attr.c49
2 files changed, 27 insertions, 29 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index b4d4fa0..9efec66 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -756,15 +756,14 @@ diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t co
hid_t obj2_id = H5I_INVALID_HID;
diff_opt_t ref_opts;
- ref_opts = *opts;
- ref_opts.obj_name[0] = NULL;
- ref_opts.obj_name[1] = NULL;
-
/*-------------------------------------------------------------------------
* H5T_STD_REF_OBJ
* Object references. get the type and OID of the referenced object
*-------------------------------------------------------------------------
*/
+ ref_opts = *opts;
+ ref_opts.obj_name[0] = NULL;
+ ref_opts.obj_name[1] = NULL;
if (type_size == H5R_OBJ_REF_BUF_SIZE) {
H5O_type_t obj1_type;
H5O_type_t obj2_type;
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 2e903be..1473146 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);
@@ -372,19 +372,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]);
@@ -392,6 +392,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
*------------------------------------------------------------------
@@ -449,22 +452,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';
}
/*---------------------------------------------------------------------