diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2022-07-09 10:05:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-09 10:05:53 (GMT) |
commit | 1227bc041118e1c9fb3fdd48c083186f5deb4676 (patch) | |
tree | 0cddd12b3652faaf7adf242b2ed936d127fae454 /test/stab.c | |
parent | 57cc499009f49b40505b8b3c1ca3e405c6447a16 (diff) | |
download | hdf5-feature/onion_vfd.zip hdf5-feature/onion_vfd.tar.gz hdf5-feature/onion_vfd.tar.bz2 |
Sync with develop (#1863)feature/onion_vfd
Diffstat (limited to 'test/stab.c')
-rw-r--r-- | test/stab.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/test/stab.c b/test/stab.c index d08ebca..b4c92a4 100644 --- a/test/stab.c +++ b/test/stab.c @@ -219,8 +219,9 @@ test_long(hid_t fcpl, hid_t fapl, hbool_t new_format) for (i = 0; i < LONG_NAME_LEN; i++) name1[i] = (char)('A' + i % 26); name1[LONG_NAME_LEN - 1] = '\0'; - name2 = (char *)HDmalloc((size_t)((2 * LONG_NAME_LEN) + 2)); - HDsprintf(name2, "%s/%s", name1, name1); + size_t name2Len = (2 * LONG_NAME_LEN) + 2; + name2 = (char *)HDmalloc(name2Len); + HDsnprintf(name2, name2Len, "%s/%s", name1, name1); /* Create groups */ if ((g1 = H5Gcreate2(fid, name1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -310,7 +311,7 @@ test_large(hid_t fcpl, hid_t fapl, hbool_t new_format) if (H5G__has_stab_test(cwg) != FALSE) TEST_ERROR; for (i = 0; i < LARGE_NOBJS; i++) { - HDsprintf(name, "%05d%05d", (HDrandom() % 100000), i); + HDsnprintf(name, sizeof(name), "%05d%05d", (HDrandom() % 100000), i); if ((dir = H5Gcreate2(cwg, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Gclose(dir) < 0) @@ -452,7 +453,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Create first "bottom" group */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, (unsigned)0); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, (unsigned)0); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -475,7 +476,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) /* Create several more bottom groups, to push the top group almost to a symbol table */ /* (Start counting at '1', since we've already created one bottom group */ for (u = 1; u < LIFECYCLE_MAX_COMPACT; u++) { - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -511,7 +512,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Create one more "bottom" group, which should push top group into using a symbol table */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -545,7 +546,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) /* Unlink objects from top group */ while (u >= LIFECYCLE_MIN_DENSE) { - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; @@ -562,7 +563,7 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Unlink one more object from the group, which should transform back to using links */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; u--; @@ -576,11 +577,11 @@ lifecycle(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Unlink last two objects from top group */ - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; u--; - HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u); + HDsnprintf(objname, sizeof(objname), LIFECYCLE_BOTTOM_GROUP, u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; @@ -841,7 +842,7 @@ read_old(void) /* Create a bunch of objects in the group */ for (u = 0; u < READ_OLD_NGROUPS; u++) { - HDsprintf(objname, "Group %u", u); + HDsnprintf(objname, sizeof(objname), "Group %u", u); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -865,7 +866,7 @@ read_old(void) /* Delete new objects from old group */ for (u = 0; u < READ_OLD_NGROUPS; u++) { - HDsprintf(objname, "Group %u", u); + HDsnprintf(objname, sizeof(objname), "Group %u", u); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; } /* end for */ @@ -977,7 +978,7 @@ no_compact(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Create first "bottom" group */ - HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsnprintf(objname, sizeof(objname), NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if ((gid2 = H5Gcreate2(gid, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -998,7 +999,7 @@ no_compact(hid_t fcpl, hid_t fapl2) TEST_ERROR; /* Unlink object from top group */ - HDsprintf(objname, NO_COMPACT_BOTTOM_GROUP, (unsigned)0); + HDsnprintf(objname, sizeof(objname), NO_COMPACT_BOTTOM_GROUP, (unsigned)0); if (H5Ldelete(gid, objname, H5P_DEFAULT) < 0) FAIL_STACK_ERROR; |