summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
commita8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba (patch)
treee10dce719d3ddb94a1a89c9c498a2df23f2df2b2 /tools/src
parente54f5a14d28cf9eb1226ce7feab2e2600d3984b4 (diff)
downloadhdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.zip
hdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.tar.gz
hdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.tar.bz2
Fixes for warnings in the tools code.
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5diff/h5diff_common.c18
-rw-r--r--tools/src/h5dump/h5dump_xml.c6
-rw-r--r--tools/src/h5jam/h5jam.c2
3 files changed, 15 insertions, 11 deletions
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index 771b20f..e0e6f8c 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -197,7 +197,7 @@ void parse_command_line(int argc,
}
/* init */
- exclude_node->obj_path = (char*)opt_arg;
+ exclude_node->obj_path = opt_arg;
exclude_node->obj_type = H5TRAV_TYPE_UNKNOWN;
exclude_prev = exclude_head;
@@ -207,7 +207,7 @@ void parse_command_line(int argc,
}
else {
while(NULL != exclude_prev->next)
- exclude_prev=exclude_prev->next;
+ exclude_prev = exclude_prev->next;
exclude_node->next = NULL;
exclude_prev->next = exclude_node;
@@ -215,14 +215,14 @@ void parse_command_line(int argc,
break;
case 'd':
- opts->d=1;
+ opts->d = 1;
if (check_d_input(opt_arg) == - 1) {
HDprintf("<-d %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- opts->delta = atof(opt_arg);
+ opts->delta = HDatof(opt_arg);
/* -d 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
@@ -230,13 +230,13 @@ void parse_command_line(int argc,
break;
case 'p':
- opts->p=1;
+ opts->p = 1;
if (check_p_input(opt_arg) == -1) {
HDprintf("<-p %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
- opts->percent = atof(opt_arg);
+ opts->percent = HDatof(opt_arg);
/* -p 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
@@ -244,7 +244,7 @@ void parse_command_line(int argc,
break;
case 'n':
- opts->n=1;
+ opts->n = 1;
if ( check_n_input(opt_arg) == -1) {
HDprintf("<-n %s> is not a valid option\n", opt_arg);
usage();
@@ -427,7 +427,7 @@ check_p_input( const char *str )
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
- x = atof(str);
+ x = HDatof(str);
if (x < 0)
return -1;
@@ -461,7 +461,7 @@ check_d_input( const char *str )
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
- x = atof(str);
+ x = HDatof(str);
if (x < 0)
return -1;
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 4f58b73..7edd962 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -732,7 +732,7 @@ xml_escape_the_name(const char *str)
* Programmer: REMcG
*-------------------------------------------------------------------------
*/
-static char *
+static char *
xml_escape_the_string(const char *str, int slen)
{
size_t extra;
@@ -794,18 +794,22 @@ xml_escape_the_string(const char *str, int slen)
else if (*cp == '\'') {
esc_len = HDstrlen(apos);
HDstrncpy(ncp, apos, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '<') {
esc_len = HDstrlen(lt);
HDstrncpy(ncp, lt, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '>') {
esc_len = HDstrlen(gt);
HDstrncpy(ncp, gt, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '&') {
esc_len = HDstrlen(amp);
HDstrncpy(ncp, amp, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else {
*ncp = *cp;
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 07797c8..009e527 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -148,7 +148,7 @@ parse_command_line (int argc, const char *argv[])
int opt = FALSE;
/* parse command line options */
- while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
switch ((char) opt)
{