summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
Diffstat (limited to 'hl')
-rw-r--r--hl/c++/test/ptableTest.cpp6
-rw-r--r--hl/test/test_file_image.c5
-rw-r--r--hl/test/test_image.c6
-rw-r--r--hl/test/test_packet_vlen.c16
-rw-r--r--hl/tools/gif2h5/writehdf.c2
-rw-r--r--hl/tools/h5watch/h5watch.c4
6 files changed, 20 insertions, 19 deletions
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp
index 2600367..9616c1b 100644
--- a/hl/c++/test/ptableTest.cpp
+++ b/hl/c++/test/ptableTest.cpp
@@ -620,9 +620,9 @@ TestHDFFV_9758()
for (hsize_t i = 0; i < NUM_PACKETS; i++) {
s1[i].a = static_cast<int>(i);
- s1[i].b = 1.f * static_cast<float>(i * i);
- s1[i].c = 1. / (i + 1);
- HDsprintf(s1[i].d, "string%d", (int)i);
+ s1[i].b = 1.0F * static_cast<float>(i * i);
+ s1[i].c = 1.0 / static_cast<double>(i + 1);
+ HDsnprintf(s1[i].d, STRING_LENGTH, "string%" PRIuHSIZE "", i);
s1[i].e = static_cast<int>(100 + i);
}
diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c
index bde8adc..36d4db3 100644
--- a/hl/test/test_file_image.c
+++ b/hl/test/test_file_image.c
@@ -109,12 +109,13 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
input_flags[i] = flags[(nflags + i) % nflags];
/* allocate name buffer for image i */
- filename[i] = (char *)HDmalloc(sizeof(char) * 32);
+ size_t filenamelength = sizeof(char) * 32;
+ filename[i] = (char *)HDmalloc(filenamelength);
if (!filename[i])
FAIL_PUTS_ERROR("HDmalloc() failed");
/* create file name */
- HDsprintf(filename[i], "image_file%d.h5", (int)i);
+ HDsnprintf(filename[i], filenamelength, "image_file%d.h5", (int)i);
/* create file */
if ((file_id[i] = H5Fcreate(filename[i], H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
diff --git a/hl/test/test_image.c b/hl/test/test_image.c
index 81340c1..e54875e 100644
--- a/hl/test/test_image.c
+++ b/hl/test/test_image.c
@@ -650,7 +650,7 @@ test_generate(void)
HL_TESTING2("make indexed image from land data");
for (i = 0; i < n_elements; i++) {
- if (data[i] < 0.0f)
+ if (data[i] < 0.0F)
image_data[i] = 0;
else
image_data[i] = (unsigned char)((255 * data[i]) / xmax);
@@ -671,10 +671,10 @@ test_generate(void)
HL_TESTING2("make indexed image from sea data");
for (i = 0; i < n_elements; i++) {
- if (data[i] > 0.0f)
+ if (data[i] > 0.0F)
image_data[i] = 0;
else {
- image_data[i] = (unsigned char)((255.0f * (data[i] - xmin)) / (xmax - xmin));
+ image_data[i] = (unsigned char)((255.0F * (data[i] - xmin)) / (xmax - xmin));
}
}
diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c
index 6d6bf34..c33479e 100644
--- a/hl/test/test_packet_vlen.c
+++ b/hl/test/test_packet_vlen.c
@@ -109,7 +109,7 @@ test_VLof_atomic(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
@@ -246,7 +246,7 @@ test_VLof_comptype(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
@@ -418,7 +418,7 @@ test_compound_VL_VLtype(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
@@ -582,7 +582,7 @@ test_VLof_VLtype(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
@@ -1144,7 +1144,7 @@ testfl_VLof_atomic(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
@@ -1281,7 +1281,7 @@ testfl_VLof_comptype(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
@@ -1453,7 +1453,7 @@ testfl_compound_VL_VLtype(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
@@ -1617,7 +1617,7 @@ testfl_VLof_VLtype(void)
if (ret < 0)
goto error;
- HDsprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS);
+ HDsnprintf(msg, sizeof(msg), "The number of packets in the packet table must be %u\n", NRECORDS);
VERIFY(count == NRECORDS, msg);
/* Read all five packets back */
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index 6ec6af4..a444cf7 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -100,7 +100,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
dims[1] = gifImageDesc->ImageWidth;
/* create the image name */
- sprintf(ImageName, "Image%d", i);
+ snprintf(ImageName, sizeof(ImageName), "Image%d", i);
/* write image */
if (H5IMmake_image_8bit(file_id, ImageName, dims[1], dims[0], (gifImageDesc->Image)) < 0)
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index aae670a..ce4a112 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -174,9 +174,9 @@ doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
} /* end else */
/* Floating point types should display full precision */
- sprintf(fmt_float, "%%1.%dg", FLT_DIG);
+ snprintf(fmt_float, sizeof(fmt_float), "%%1.%dg", FLT_DIG);
info.fmt_float = fmt_float;
- sprintf(fmt_double, "%%1.%dg", DBL_DIG);
+ snprintf(fmt_double, sizeof(fmt_double), "%%1.%dg", DBL_DIG);
info.fmt_double = fmt_double;
info.dset_format = "DSET-%s ";