summaryrefslogtreecommitdiffstats
path: root/hl/test
diff options
context:
space:
mode:
Diffstat (limited to 'hl/test')
-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
3 files changed, 14 insertions, 13 deletions
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 */