summaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-03-04 22:06:47 (GMT)
committerGitHub <noreply@github.com>2021-03-04 22:06:47 (GMT)
commit583e9d5c323996ffdcf9534302e865d30f871da4 (patch)
tree9b1188a9b1784b488aa105748505aeba9f405177 /tools/lib
parent7b23ce1686cf3383bb8666f133cf5fa4f6282096 (diff)
downloadhdf5-583e9d5c323996ffdcf9534302e865d30f871da4.zip
hdf5-583e9d5c323996ffdcf9534302e865d30f871da4.tar.gz
hdf5-583e9d5c323996ffdcf9534302e865d30f871da4.tar.bz2
1 10 Merges from develop (#424)
* HDFFV-10865 - merge from dev, HDFArray perf fix. * Remove duplicate setting * Whitespace changes after clang format * Undo version 11 clang format changes * Merge CMake changes from develop * test testing script merge from develop * Update supported platforms * PR#3 merge from develop * Merge gcc 10 diagnostics option from develop * Merge #318 OSX changes from develop * Merge small changes from develop * Minor non-space formatting changes * #386 copyright corrections for java folder * Merges from develop #358 patches from vtk #361 fix header guard spelling * Merge updates #358 patches from vtk #361 fix header guard spelling * format fix * Fix missing underscore and make H5public.h closer to dev * Merges from develop #340 clang -Wformat-security warnings #360 Fixed uninitialized warnings header guard underscore cleanup JNI cleanup * format alignment * Add missing test ref file
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/h5diff.h6
-rw-r--r--tools/lib/h5diff_array.c92
-rw-r--r--tools/lib/h5tools.c2
-rw-r--r--tools/lib/h5tools.h6
-rw-r--r--tools/lib/h5tools_dump.h6
-rw-r--r--tools/lib/h5tools_error.h6
-rw-r--r--tools/lib/h5tools_ref.h4
-rw-r--r--tools/lib/h5tools_str.c2
-rw-r--r--tools/lib/h5tools_str.h6
-rw-r--r--tools/lib/h5tools_utils.c12
-rw-r--r--tools/lib/h5tools_utils.h6
-rw-r--r--tools/lib/h5trav.h6
-rw-r--r--tools/lib/io_timer.h6
-rw-r--r--tools/lib/ph5diff.h6
14 files changed, 94 insertions, 72 deletions
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index d518675..f14bcda 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -11,8 +11,8 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5DIFF_H__
-#define H5DIFF_H__
+#ifndef H5DIFF_H
+#define H5DIFF_H
#include "hdf5.h"
#include "h5tools.h"
@@ -159,4 +159,4 @@ int print_objname(diff_opt_t *opts, hsize_t nfound);
void do_print_objname(const char *OBJ, const char *path1, const char *path2, diff_opt_t *opts);
void do_print_attrname(const char *attr, const char *path1, const char *path2);
-#endif /* H5DIFF_H__ */
+#endif /* H5DIFF_H */
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 9db045f..bd4470b 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -3133,48 +3133,66 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
hsize_t curr_pos = idx;
parallel_print("[ ");
- H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", i, opts->hs_nelmts, opts->err_stat);
+ H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", idx, opts->hs_nelmts,
+ opts->err_stat);
if (opts->sset[0] != NULL) {
/* Subsetting is used - calculate total position */
- hsize_t elmnt_cnt = 1;
- hsize_t dim_cnt = 0; /* previous dim size */
- hsize_t str_cnt = 0; /* previous dim stride */
- hsize_t curr_idx = idx; /* calculated running position */
- hsize_t str_idx = 0;
- hsize_t blk_idx = 0;
- hsize_t cnt_idx = 0;
- hsize_t hs_idx = 0;
- j = opts->rank - 1;
+ hsize_t prev_dim_size = 0; /* previous dim size */
+ hsize_t prev_str = 0; /* previouw stride idx*/
+ hsize_t str_cnt = 0; /* stride multiplier*/
+ hsize_t curr_idx = 0; /* calculated running position */
+ hsize_t str_idx = 0;
+ hsize_t blk_idx = 0;
+ hsize_t cnt_idx = 0;
+ hsize_t dim_size = 0; /* current dim size */
+ hsize_t elmnt_cnt = 1;
+ hsize_t next_idx = idx;
+ hsize_t data_idx = 0;
+ j = opts->rank - 1;
+ H5TOOLS_DEBUG("...begin:%ld=> opts->rank:%ld (idx:%ld)", j, opts->rank, idx);
do {
- cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - count:%ld", j,
- curr_pos, curr_idx, cnt_idx);
- blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - block:%ld", j,
- curr_pos, curr_idx, blk_idx);
- hs_idx = cnt_idx * blk_idx; /* hyperslab area value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - hs:%ld", j, curr_pos,
- curr_idx, hs_idx);
- str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */
- H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - stride:%ld", j,
- curr_pos, curr_idx, str_idx);
- elmnt_cnt *= opts->dims[j]; /* Total number of elements in dimension */
- H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld", j, elmnt_cnt);
- if (str_idx > blk_idx)
- curr_idx += dim_cnt * (str_idx - blk_idx); /* */
- else if (curr_idx >= hs_idx)
- curr_idx += dim_cnt * str_cnt;
- H5TOOLS_DEBUG("... sset loop:%d with idx:%ld (curr_idx:%ld) - stride:%ld", j, idx,
- curr_idx, str_idx);
- dim_cnt = elmnt_cnt; /* */
- if (str_idx > blk_idx)
- str_cnt = str_idx - blk_idx; /* */
- else
- str_cnt = str_idx; /* */
- H5TOOLS_DEBUG("... sset loop:%d with dim_cnt:%ld - str_cnt:%ld", j, dim_cnt, str_cnt);
+ curr_idx = next_idx; /* New current data position */
+ cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */
+ blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */
+ str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - c:%ld b:%ld s:%ld", j,
+ curr_pos, curr_idx, cnt_idx, blk_idx, str_idx);
+ dim_size = opts->dims[j]; /* Current dimension size */
+ // elmnt_cnt *= dim_size; /* Total number of elements in dimension */
+ H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld - (prev_dim_size:%ld - dim_size:%ld) "
+ "- str_cnt:%ld",
+ j, elmnt_cnt, prev_dim_size, dim_size, str_cnt);
+ data_idx = elmnt_cnt * dim_size;
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (data_idx:%ld)", j, curr_pos, data_idx);
+ for (i = 0; i < cnt_idx; i++) {
+ H5TOOLS_DEBUG("... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld (curr_idx:%ld - "
+ "data_idx:%ld)",
+ i, cnt_idx, str_cnt, curr_idx, data_idx);
+ if (curr_idx >= data_idx) {
+ /* get to next block */
+ data_idx += str_idx * dim_size;
+ /* get next block */
+ str_cnt++;
+ H5TOOLS_DEBUG(
+ "... ... data loop:%d with cnt_idx:%ld - str_cnt:%ld - data_idx:%ld", i,
+ cnt_idx, str_cnt, data_idx);
+ }
+ H5TOOLS_DEBUG("... ... end data loop:%d with dim_cnt:%ld - str_cnt:%ld - "
+ "(curr_idx:%ld - data_idx:%ld)",
+ i, dim_size, str_cnt, curr_idx, data_idx);
+ }
+ next_idx += dim_size * str_cnt; // + prev_dim_size;
+ H5TOOLS_DEBUG("... sset loop:%d with curr_idx:%ld (next_idx:%ld)", j, curr_idx, next_idx);
+ str_cnt = 0;
+ prev_str = str_idx;
+ prev_dim_size = dim_size;
+ H5TOOLS_DEBUG("... end sset loop:%d with prev_dim_size:%ld (curr_idx:%ld - data_idx:%ld) "
+ "- str_cnt:%ld",
+ j, prev_dim_size, curr_idx, data_idx, str_cnt);
+ elmnt_cnt *= dim_size; /* Total number of elements in dimension */
j--;
- } while (curr_idx >= elmnt_cnt && j >= 0);
+ } while (next_idx >= elmnt_cnt && j >= 0);
curr_pos = curr_idx; /* New current position */
H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos);
} /* if (opts->sset[0] != NULL) */
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 90c6de5..baaf665 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1599,7 +1599,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
} break;
case H5T_ARRAY: {
int k, ndims;
- hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
+ hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts = 0;
hid_t memb = H5I_INVALID_HID;
H5TOOLS_DEBUG("H5T_ARRAY");
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 99a7500..53f16cf 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -17,8 +17,8 @@
*
* Purpose: Support functions for the various tools.
*/
-#ifndef H5TOOLS_H__
-#define H5TOOLS_H__
+#ifndef H5TOOLS_H
+#define H5TOOLS_H
#include "hdf5.h"
#include "h5tools_error.h"
@@ -684,4 +684,4 @@ H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_for
}
#endif
-#endif /* H5TOOLS_H__ */
+#endif /* H5TOOLS_H */
diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h
index 9cebdc3..9b47789 100644
--- a/tools/lib/h5tools_dump.h
+++ b/tools/lib/h5tools_dump.h
@@ -14,8 +14,8 @@
/*
* Purpose: Support h5dump functions for the various tools.
*/
-#ifndef H5TOOLS_DUMP_H__
-#define H5TOOLS_DUMP_H__
+#ifndef H5TOOLS_DUMP_H
+#define H5TOOLS_DUMP_H
#include "h5tools_utils.h"
@@ -94,4 +94,4 @@ H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer /*in,out*/, hid
}
#endif
-#endif /* H5TOOLS_DUMP_H__ */
+#endif /* H5TOOLS_DUMP_H */
diff --git a/tools/lib/h5tools_error.h b/tools/lib/h5tools_error.h
index b8e5339..8fd33bb 100644
--- a/tools/lib/h5tools_error.h
+++ b/tools/lib/h5tools_error.h
@@ -14,8 +14,8 @@
/*
* Header file for error values, etc.
*/
-#ifndef H5TOOLS_ERROR_H_
-#define H5TOOLS_ERROR_H_
+#ifndef H5TOOLS_ERROR_H
+#define H5TOOLS_ERROR_H
#include "H5Epublic.h"
#include "H5Eprivate.h" /* Error handling */
@@ -250,4 +250,4 @@ H5TOOLS_DLLVAR hid_t H5E_tools_min_dbg_id_g;
H5_LEAVE(ret_val) \
} while (0)
-#endif /* H5TOOLS_ERROR_H_ */
+#endif /* H5TOOLS_ERROR_H */
diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h
index 2720620..e3d55c6 100644
--- a/tools/lib/h5tools_ref.h
+++ b/tools/lib/h5tools_ref.h
@@ -11,8 +11,8 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5TOOLS_REF_H__
-#define H5TOOLS_REF_H__
+#ifndef H5TOOLS_REF_H
+#define H5TOOLS_REF_H
#include "hdf5.h"
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 7995d22..41a12d7 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -705,7 +705,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
long double templdouble;
HDmemcpy(&templdouble, vp, sizeof(long double));
- h5tools_str_append(str, OPT(info->fmt_double, "%Lf"), templdouble);
+ h5tools_str_append(str, "%Lg", templdouble);
#endif
}
break;
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 1c3301a..3bbf6b1 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -15,8 +15,8 @@
* Programmer: Bill Wendling
* Monday, 19. February 2001
*/
-#ifndef H5TOOLS_STR_H__
-#define H5TOOLS_STR_H__
+#ifndef H5TOOLS_STR_H
+#define H5TOOLS_STR_H
typedef struct h5tools_str_t {
char * s; /*allocate string */
@@ -46,4 +46,4 @@ H5TOOLS_DLL char *h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *
hid_t type, void *vp, h5tools_context_t *ctx);
H5TOOLS_DLL char *h5tools_str_replace(const char *string, const char *substr, const char *replacement);
-#endif /* H5TOOLS_STR_H__ */
+#endif /* H5TOOLS_STR_H */
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 3a68abe..108cd4f 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -196,7 +196,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
/* long command line option */
int i;
const char ch = '=';
- char * arg = &argv[opt_ind][2];
+ char * arg = HDstrdup(&argv[opt_ind][2]);
size_t arg_len = 0;
opt_arg = strchr(&argv[opt_ind][2], ch);
@@ -251,6 +251,8 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti
opt_ind++;
sp = 1;
+
+ HDfree(arg);
}
else {
register char *cp; /* pointer into current token */
@@ -1077,12 +1079,14 @@ h5tools_parse_ros3_fapl_tuple(const char *tuple_str, int delim, H5FD_ros3_fapl_t
ccred[1] = (const char *)s3cred[1];
ccred[2] = (const char *)s3cred[2];
- if (h5tools_populate_ros3_fapl(fapl_config_out, ccred) < 0)
+ if (0 == h5tools_populate_ros3_fapl(fapl_config_out, ccred))
H5TOOLS_GOTO_ERROR(FAIL, "failed to populate S3 VFD FAPL config");
done:
- HDfree(s3cred);
- HDfree(s3cred_src);
+ if (s3cred)
+ HDfree(s3cred);
+ if (s3cred_src)
+ HDfree(s3cred_src);
return ret_value;
}
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index d38abce..34ac89b 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -17,8 +17,8 @@
*
* Purpose: Support functions for the various tools.
*/
-#ifndef H5TOOLS_UTILS_H__
-#define H5TOOLS_UTILS_H__
+#ifndef H5TOOLS_UTILS_H
+#define H5TOOLS_UTILS_H
#include "hdf5.h"
@@ -190,4 +190,4 @@ H5TOOLS_DLL herr_t h5tools_parse_hdfs_fapl_tuple(const char *tuple_str, int deli
}
#endif
-#endif /* H5TOOLS_UTILS_H__ */
+#endif /* H5TOOLS_UTILS_H */
diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h
index 32cd270..cda27a2 100644
--- a/tools/lib/h5trav.h
+++ b/tools/lib/h5trav.h
@@ -11,8 +11,8 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef H5TRAV_H__
-#define H5TRAV_H__
+#ifndef H5TRAV_H
+#define H5TRAV_H
#include "hdf5.h"
@@ -188,4 +188,4 @@ H5TOOLS_DLL void trav_table_free(trav_table_t *table);
H5TOOLS_DLL void trav_table_addflags(unsigned *flags, char *objname, h5trav_type_t type, trav_table_t *table);
-#endif /* H5TRAV_H__ */
+#endif /* H5TRAV_H */
diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h
index 96ea05e..0269b93 100644
--- a/tools/lib/io_timer.h
+++ b/tools/lib/io_timer.h
@@ -11,8 +11,8 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef IO_TIMER__
-#define IO_TIMER__
+#ifndef IO_TIMER
+#define IO_TIMER
#include "hdf5.h"
@@ -88,4 +88,4 @@ H5TOOLS_DLL double io_time_get(io_time_t *pt, timer_type t);
}
#endif /* __cplusplus */
-#endif /* IO_TIMER__ */
+#endif /* IO_TIMER */
diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h
index 8e884dd..7dce495 100644
--- a/tools/lib/ph5diff.h
+++ b/tools/lib/ph5diff.h
@@ -11,8 +11,8 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#ifndef _PH5DIFF_H__
-#define _PH5DIFF_H__
+#ifndef PH5DIFF_H
+#define PH5DIFF_H
/* Send from manager to workers */
#define MPI_TAG_ARGS 1
@@ -40,4 +40,4 @@ struct diffs_found {
int not_cmp;
};
-#endif /* _PH5DIFF_H__ */
+#endif /* PH5DIFF_H */