From 35d6091ab7c09ec5d450860ba9795e6abe430c8c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 17 Mar 2021 12:22:02 -0700 Subject: [PATCH] Cleans up a couple of MSVC warnings in testhdf5 (#475) * Fixes a few testhdf5 warnings raised in Visual Studio Visual Studio is grumpier about treating pointers like integers than gcc. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/trefstr.c | 8 +++++--- test/tselect.c | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/test/trefstr.c b/test/trefstr.c index 74455dac9b8..a3f568a011d 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -265,7 +265,9 @@ test_refstr_wrap(void) /* Get pointer to raw string in ref-counted string */ s = H5RS_get_str(rs); CHECK_PTR(s, "H5RS_get_str"); - CHECK(s, buf, "wrapping"); + if (s == buf) + TestErrPrintf("%d: Should not have gotten the same pointer from reference-counted string!\n", + __LINE__); cmp = HDstrcmp(s, buf); if (cmp <= 0) TestErrPrintf("%d: string comparison incorrect!\n", __LINE__); @@ -375,7 +377,7 @@ test_refstr_acat(void) /* Append a large string to ref-counted string */ large_str = HDmalloc(1024); - CHECK(large_str, NULL, "HDmalloc"); + CHECK_PTR(large_str, "HDmalloc"); HDmemset(large_str, 'a', 1024); large_str[1023] = '\0'; ret = H5RS_acat(rs, large_str); @@ -386,7 +388,7 @@ test_refstr_acat(void) CHECK_PTR(s, "H5RS_get_str"); HDsprintf(buf, "%s", "foobar"); large_str2 = HDmalloc(1024 + 6); - CHECK(large_str2, NULL, "HDmalloc"); + CHECK_PTR(large_str2, "HDmalloc"); HDstrcpy(large_str2, "foobar"); HDmemset(&large_str2[6], 'a', 1024); large_str2[1029] = '\0'; diff --git a/test/tselect.c b/test/tselect.c index cea8301b5e1..1bfb663dbdb 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -5381,9 +5381,9 @@ test_select_hyper_union_3d(void) /* Allocate write & read buffers */ wbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE4_DIM1 * SPACE4_DIM2 * SPACE4_DIM3); - CHECK(wbuf, NULL, "HDmalloc"); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), SPACE3_DIM1 * SPACE3_DIM2); - CHECK(rbuf, NULL, "HDcalloc"); + CHECK_PTR(rbuf, "HDcalloc"); /* Initialize write buffer */ for (i = 0, tbuf = wbuf; i < SPACE4_DIM1; i++)