diff options
Diffstat (limited to 'hl')
-rw-r--r-- | hl/c++/test/ptableTest.cpp | 2 | ||||
-rw-r--r-- | hl/test/test_file_image.c | 5 | ||||
-rw-r--r-- | hl/test/test_packet_vlen.c | 16 |
3 files changed, 12 insertions, 11 deletions
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 9db56e0..33199f1 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -622,7 +622,7 @@ TestHDFFV_9758() s1[i].a = static_cast<int>(i); s1[i].b = 1.0F * static_cast<float>(i * i); s1[i].c = 1.0 / static_cast<double>(i + 1); - HDsprintf(s1[i].d, "string%" PRIuHSIZE "", i); + 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 6bb36e4..4448e41 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_packet_vlen.c b/hl/test/test_packet_vlen.c index e704944..aa88a6c 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 */ |