summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5diff/h5diff_common.c18
-rw-r--r--tools/src/h5dump/h5dump_xml.c20
-rw-r--r--tools/src/h5jam/h5jam.c2
3 files changed, 22 insertions, 18 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..07cff6a 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -732,15 +732,15 @@ 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;
size_t len;
size_t i;
- const char *cp;
- char *ncp;
- char *rcp;
+ const char *cp = NULL;
+ char *ncp = NULL;
+ char *rcp = NULL;
size_t ncp_len;
if (!str)
@@ -792,20 +792,24 @@ xml_escape_the_string(const char *str, int slen)
esc_len = 1;
}
else if (*cp == '\'') {
+ HDstrncpy(ncp, apos, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(apos);
- HDstrncpy(ncp, apos, esc_len);
}
else if (*cp == '<') {
+ HDstrncpy(ncp, lt, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(lt);
- HDstrncpy(ncp, lt, esc_len);
}
else if (*cp == '>') {
+ HDstrncpy(ncp, gt, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(gt);
- HDstrncpy(ncp, gt, esc_len);
}
else if (*cp == '&') {
+ HDstrncpy(ncp, amp, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(amp);
- HDstrncpy(ncp, amp, esc_len);
}
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)
{