summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-27 15:50:27 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-04-27 15:50:27 (GMT)
commitc03ee563f46013d22f36a1895664a9ba876558e9 (patch)
tree147990d80682a724e79481a9ddef1df3f157c259 /tools
parentde3bfa697a9fcb4fabf755b2bda7fa553abfcebb (diff)
downloadhdf5-c03ee563f46013d22f36a1895664a9ba876558e9.zip
hdf5-c03ee563f46013d22f36a1895664a9ba876558e9.tar.gz
hdf5-c03ee563f46013d22f36a1895664a9ba876558e9.tar.bz2
Further updates to the tools warnings fixes from code review.
Diffstat (limited to 'tools')
-rw-r--r--tools/src/h5dump/h5dump_xml.c10
-rw-r--r--tools/test/misc/h5clear_gentest.c5
2 files changed, 11 insertions, 4 deletions
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index bd822bc..07cff6a 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -738,9 +738,9 @@ 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)
@@ -793,18 +793,22 @@ xml_escape_the_string(const char *str, int slen)
}
else if (*cp == '\'') {
HDstrncpy(ncp, apos, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(apos);
}
else if (*cp == '<') {
HDstrncpy(ncp, lt, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(lt);
}
else if (*cp == '>') {
HDstrncpy(ncp, gt, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(gt);
}
else if (*cp == '&') {
HDstrncpy(ncp, amp, ncp_len);
+ ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(amp);
}
else {
diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c
index 06ba473..8d6883c 100644
--- a/tools/test/misc/h5clear_gentest.c
+++ b/tools/test/misc/h5clear_gentest.c
@@ -62,6 +62,7 @@ gen_cache_image_file(const char *fname)
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
hsize_t dims[2]; /* Dimension sizes */
hsize_t chunks[2]; /* Chunked dimension sizes */
+ int i, j; /* Local index variables */
int **buf = NULL; /* Buffer for data to write */
H5AC_cache_image_config_t cache_image_config = /* Cache image input configuration */
{ H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION,
@@ -72,7 +73,9 @@ gen_cache_image_file(const char *fname)
H5TEST_ALLOCATE_2D_ARRAY(buf, int, 50, 100);
if (NULL == buf)
goto error;
- H5TEST_FILL_2D_ARRAY(buf, int, 50, 100);
+ for(i = 0; i < 50; i++)
+ for(j = 0; j < 100; j++)
+ buf[i][j] = i * j;
/* Create a copy of file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)