diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2023-07-27 20:43:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 20:43:30 (GMT) |
commit | 1e91d96fa02466ffe451319bdac1005f84dc7993 (patch) | |
tree | 4de04ef502c313dfd766497b20235188761146c0 /hl/test/test_packet_vlen.c | |
parent | 95e5349089b95dfb95f0f8ce2d6db1bc04ba6c82 (diff) | |
download | hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.zip hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.gz hdf5-1e91d96fa02466ffe451319bdac1005f84dc7993.tar.bz2 |
Brings over most of the HD prefix removal (#3293)
Diffstat (limited to 'hl/test/test_packet_vlen.c')
-rw-r--r-- | hl/test/test_packet_vlen.c | 123 |
1 files changed, 61 insertions, 62 deletions
diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 5e06c85..bf95859 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -68,9 +68,9 @@ test_VLof_atomic(void) /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { - writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int)); + writeBuf[uu].p = malloc((uu + 1) * sizeof(unsigned int)); if (writeBuf[uu].p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -120,8 +120,8 @@ test_VLof_atomic(void) for (uu = 0; uu < NRECORDS; uu++) for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - HDprintf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - HDprintf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + printf("Packet %u's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + printf("Packet %u's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); } } @@ -188,9 +188,9 @@ test_VLof_comptype(void) /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { - writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t)); + writeBuf[uu].p = malloc((uu + 1) * sizeof(VLcomp_t)); if (writeBuf[uu].p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -257,16 +257,16 @@ test_VLof_comptype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { - HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", - __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len); + fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%d, readBuf[%u].len=%d\n", + __LINE__, uu, (int)writeBuf[uu].len, uu, (int)readBuf[uu].len); continue; } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv]) { - HDfprintf( - stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", vv, - (int)((unsigned int *)writeBuf[uu].p)[vv], vv, (int)((unsigned int *)readBuf[uu].p)[vv]); + fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%d]=%d, readBuf[uu].p[%d]=%d\n", + vv, (int)((unsigned int *)writeBuf[uu].p)[vv], vv, + (int)((unsigned int *)readBuf[uu].p)[vv]); continue; } /* write value != read value */ } @@ -344,16 +344,16 @@ test_compound_VL_VLtype(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].u = uu * 10; writeBuf[uu].f = (float)(uu * 20) / 3.0F; - writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t)); + writeBuf[uu].v.p = malloc((uu + L1_INCM) * sizeof(hvl_t)); if (writeBuf[uu].v.p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].v.len = uu + L1_INCM; for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) { - t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); + t1->p = malloc((vv + L2_INCM) * sizeof(unsigned int)); if (t1->p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv + L2_INCM; @@ -429,34 +429,34 @@ test_compound_VL_VLtype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].u != readBuf[uu].u) { - HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, - writeBuf[uu].u, uu, readBuf[uu].u); + fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, + writeBuf[uu].u, uu, readBuf[uu].u); continue; } /* end if */ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) { - HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, - (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); + fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, + (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); continue; } /* end if */ if (writeBuf[uu].v.len != readBuf[uu].v.len) { - HDfprintf(stderr, - "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", - __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); + fprintf(stderr, + "%d: VL data length don't match!, writeBuf[%d].v.len=%zu, readBuf[%d].v.len=%zu\n", + __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); continue; } /* end if */ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) { if (t1->len != t2->len) { - HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", - __LINE__, uu, vv, t1->len, t2->len); + fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", + __LINE__, uu, vv, t1->len, t2->len); continue; } /* end if */ for (ww = 0; (size_t)ww < t2->len; ww++) { if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww]) { - HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, - ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); + fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, + ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); continue; } /* end if */ } /* end for */ @@ -527,16 +527,16 @@ test_VLof_VLtype(void) /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { - writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t)); + writeBuf[uu].p = malloc((uu + 1) * sizeof(hvl_t)); if (writeBuf[uu].p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } /* end if */ writeBuf[uu].len = uu + 1; for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) { - t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); + t1->p = malloc((vv + 1) * sizeof(unsigned int)); if (t1->p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv + 1; @@ -655,7 +655,7 @@ verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expected_value) HDstrcpy(lenthtype, "fixed-length"); if (expected_value == 1) HDstrcpy(lenthtype, "variable-length"); - HDfprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); + fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); ret = FAIL; } @@ -1010,7 +1010,7 @@ verify_accessors(hid_t fid, const char *table_name, hbool_t uses_vlen_type) HDstrcpy(lenthtype, "variable-length"); else HDstrcpy(lenthtype, "fixed-length"); - HDfprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype); + fprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype); goto error; } @@ -1103,9 +1103,9 @@ testfl_VLof_atomic(void) /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { - writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(unsigned int)); + writeBuf[uu].p = malloc((uu + 1) * sizeof(unsigned int)); if (writeBuf[uu].p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -1155,8 +1155,8 @@ testfl_VLof_atomic(void) for (uu = 0; uu < NRECORDS; uu++) for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)readBuf[uu].p)[vv] != ((unsigned int *)writeBuf[uu].p)[vv]) { - HDprintf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); - HDprintf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); + printf("Packet %d's value should be %d\n", uu, ((unsigned int *)writeBuf[uu].p)[vv]); + printf("Packet %d's value in readBuf is %d\n", uu, ((unsigned int *)readBuf[uu].p)[vv]); } } @@ -1223,9 +1223,9 @@ testfl_VLof_comptype(void) /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { - writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(VLcomp_t)); + writeBuf[uu].p = malloc((uu + 1) * sizeof(VLcomp_t)); if (writeBuf[uu].p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].len = uu + 1; @@ -1292,16 +1292,15 @@ testfl_VLof_comptype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].len != readBuf[uu].len) { - HDfprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n", - __LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len); + fprintf(stderr, "%d: VL data length don't match!, writeBuf[%u].len=%zu, readBuf[%u].len=%zu\n", + __LINE__, uu, writeBuf[uu].len, uu, readBuf[uu].len); continue; } /* write len != read len */ for (vv = 0; vv < (uu + 1); vv++) { if (((unsigned int *)writeBuf[uu].p)[vv] != ((unsigned int *)readBuf[uu].p)[vv]) { - HDfprintf(stderr, - "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", vv, - ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]); + fprintf(stderr, "VL data values don't match!, writeBuf[uu].p[%u]=%u, readBuf[uu].p[%u]=%u\n", + vv, ((unsigned int *)writeBuf[uu].p)[vv], vv, ((unsigned int *)readBuf[uu].p)[vv]); continue; } /* write value != read value */ } @@ -1379,16 +1378,16 @@ testfl_compound_VL_VLtype(void) for (uu = 0; uu < NRECORDS; uu++) { writeBuf[uu].u = uu * 10; writeBuf[uu].f = (float)(uu * 20) / 3.0F; - writeBuf[uu].v.p = HDmalloc((uu + L1_INCM) * sizeof(hvl_t)); + writeBuf[uu].v.p = malloc((uu + L1_INCM) * sizeof(hvl_t)); if (writeBuf[uu].v.p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } writeBuf[uu].v.len = uu + L1_INCM; for (t1 = (hvl_t *)((writeBuf[uu].v).p), vv = 0; vv < (uu + L1_INCM); vv++, t1++) { - t1->p = HDmalloc((vv + L2_INCM) * sizeof(unsigned int)); + t1->p = malloc((vv + L2_INCM) * sizeof(unsigned int)); if (t1->p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv + L2_INCM; @@ -1464,34 +1463,34 @@ testfl_compound_VL_VLtype(void) /* Compare data read in */ for (uu = 0; uu < NRECORDS; uu++) { if (writeBuf[uu].u != readBuf[uu].u) { - HDfprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, - writeBuf[uu].u, uu, readBuf[uu].u); + fprintf(stderr, "Integer components don't match!, writeBuf[%u].u=%u, readBuf[%u].u=%u\n", uu, + writeBuf[uu].u, uu, readBuf[uu].u); continue; } /* end if */ if (!H5_FLT_ABS_EQUAL(writeBuf[uu].f, readBuf[uu].f)) { - HDfprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, - (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); + fprintf(stderr, "Float components don't match!, writeBuf[%u].f=%f, readBuf[%u].f=%f\n", uu, + (double)writeBuf[uu].f, uu, (double)readBuf[uu].f); continue; } /* end if */ if (writeBuf[uu].v.len != readBuf[uu].v.len) { - HDfprintf(stderr, - "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", - __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); + fprintf(stderr, + "%d: VL data length don't match!, writeBuf[%u].v.len=%zu, readBuf[%u].v.len=%zu\n", + __LINE__, uu, writeBuf[uu].v.len, uu, readBuf[uu].v.len); continue; } /* end if */ for (t1 = (hvl_t *)(writeBuf[uu].v.p), t2 = (hvl_t *)(readBuf[uu].v.p), vv = 0; (size_t)vv < readBuf[uu].v.len; vv++, t1++, t2++) { if (t1->len != t2->len) { - HDfprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", - __LINE__, uu, vv, t1->len, t2->len); + fprintf(stderr, "%d: VL data length don't match!, uu=%u, vv=%u, t1->len=%zu, t2->len=%zu\n", + __LINE__, uu, vv, t1->len, t2->len); continue; } /* end if */ for (ww = 0; (size_t)ww < t2->len; ww++) { if (((unsigned int *)t1->p)[ww] != ((unsigned int *)t2->p)[ww]) { - HDfprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, - ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); + fprintf(stderr, "VL data values don't match!, t1->p[%u]=%u, t2->p[%u]=%u\n", ww, + ((unsigned int *)t1->p)[ww], ww, ((unsigned int *)t2->p)[ww]); continue; } /* end if */ } /* end for */ @@ -1562,16 +1561,16 @@ testfl_VLof_VLtype(void) /* Allocate and initialize VL data to write (copied from C test) */ for (uu = 0; uu < NRECORDS; uu++) { - writeBuf[uu].p = HDmalloc((uu + 1) * sizeof(hvl_t)); + writeBuf[uu].p = malloc((uu + 1) * sizeof(hvl_t)); if (writeBuf[uu].p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } /* end if */ writeBuf[uu].len = uu + 1; for (t1 = (hvl_t *)(writeBuf[uu].p), vv = 0; vv < (uu + 1); vv++, t1++) { - t1->p = HDmalloc((vv + 1) * sizeof(unsigned int)); + t1->p = malloc((vv + 1) * sizeof(unsigned int)); if (t1->p == NULL) { - HDfprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); + fprintf(stderr, "Cannot allocate memory for VL data! uu=%u\n", uu); goto error; } t1->len = vv + 1; |