summaryrefslogtreecommitdiffstats
path: root/test/tchecksum.c
diff options
context:
space:
mode:
authorQuincey Koziol <quincey@koziol.cc>2016-09-27 17:29:16 (GMT)
committerQuincey Koziol <quincey@koziol.cc>2016-09-27 17:29:16 (GMT)
commitfa66428a6dd3e9250497618afa6402008c7ed409 (patch)
tree33d2e0c499f90fbd137607a01ae35d9058d058a3 /test/tchecksum.c
parent6d5ee49ff3a33b30b9a7baf0af4f1929ad8d3b72 (diff)
downloadhdf5-fa66428a6dd3e9250497618afa6402008c7ed409.zip
hdf5-fa66428a6dd3e9250497618afa6402008c7ed409.tar.gz
hdf5-fa66428a6dd3e9250497618afa6402008c7ed409.tar.bz2
Description:
Further warning cleanups: from 667 warnings to 503.
Diffstat (limited to 'test/tchecksum.c')
-rw-r--r--test/tchecksum.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/test/tchecksum.c b/test/tchecksum.c
index ca6c227..cf519c0 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -37,7 +37,6 @@
/*******************/
/* Local variables */
/*******************/
-uint8_t large_buf[BUF_LEN];
/****************************************************************
@@ -184,33 +183,41 @@ test_chksum_size_four(void)
static void
test_chksum_large(void)
{
+ uint8_t *large_buf; /* Buffer for checksum calculations */
uint32_t chksum; /* Checksum value */
size_t u; /* Local index variable */
+ /* Allocate the buffer */
+ large_buf = (uint8_t *)HDmalloc((size_t)BUF_LEN);
+ CHECK(large_buf, NULL, "HDmalloc");
+
/* Initialize buffer w/known data */
for(u = 0; u < BUF_LEN; u++)
large_buf[u] = (uint8_t)(u * 3);
/* Buffer w/real data */
- chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf));
+ chksum = H5_checksum_fletcher32(large_buf, (size_t)BUF_LEN);
VERIFY(chksum, 0x85b4e2a, "H5_checksum_fletcher32");
- chksum = H5_checksum_crc(large_buf, sizeof(large_buf));
+ chksum = H5_checksum_crc(large_buf, (size_t)BUF_LEN);
VERIFY(chksum, 0xfbd0f7c0, "H5_checksum_crc");
- chksum = H5_checksum_lookup3(large_buf, sizeof(large_buf), 0);
+ chksum = H5_checksum_lookup3(large_buf, (size_t)BUF_LEN, 0);
VERIFY(chksum, 0x1bd2ee7b, "H5_checksum_lookup3");
/* Buffer w/zero(s) for data */
- HDmemset(large_buf, 0, sizeof(large_buf));
- chksum = H5_checksum_fletcher32(large_buf, sizeof(large_buf));
+ HDmemset(large_buf, 0, (size_t)BUF_LEN);
+ chksum = H5_checksum_fletcher32(large_buf, (size_t)BUF_LEN);
VERIFY(chksum, 0, "H5_checksum_fletcher32");
- chksum = H5_checksum_crc(large_buf, sizeof(large_buf));
+ chksum = H5_checksum_crc(large_buf, (size_t)BUF_LEN);
VERIFY(chksum, 0xfac8b4c4, "H5_checksum_crc");
- chksum = H5_checksum_lookup3(large_buf, sizeof(large_buf), 0);
+ chksum = H5_checksum_lookup3(large_buf, (size_t)BUF_LEN, 0);
VERIFY(chksum, 0x930c7afc, "H5_checksum_lookup3");
+
+ /* Release memory for buffer */
+ HDfree(large_buf);
} /* test_chksum_large() */