summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-05-24 13:26:19 (GMT)
committerGitHub <noreply@github.com>2021-05-24 13:26:19 (GMT)
commit2142359709a65de6669d76c33c7574202e6909c8 (patch)
treef748e895474159132b47a10d81d1b97d0ec15f91 /test
parent02de350b396bfc378bfb4b4382e176b21bf379d5 (diff)
downloadhdf5-2142359709a65de6669d76c33c7574202e6909c8.zip
hdf5-2142359709a65de6669d76c33c7574202e6909c8.tar.gz
hdf5-2142359709a65de6669d76c33c7574202e6909c8.tar.bz2
Brings chunk_info valgrind fix from 1.12 (#677)
* Committing clang-format changes * Fixes a minor valgrind issue in the chunk_info test (#675) * Fixes a minor valgrind issue in the chunk_info test The chunk_info test incorrectly set the number of bytes in a compressed buffer, which caused valgrind to complain about writing uninitialized bytes. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r--test/chunk_info.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/chunk_info.c b/test/chunk_info.c
index c84f500..7104941 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -449,7 +449,7 @@ error:
* Return: Success: SUCCEED
* Failure: FAIL
*
- * Note: Note that the dataspace argument in these new functions are
+ * Note: Note that the dataspace argument in these new functions is
* currently not used. The functionality involved the dataspace
* will be implemented in the next version.
*
@@ -486,10 +486,10 @@ test_get_chunk_info_highest_v18(hid_t fapl)
hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
#ifdef H5_HAVE_FILTER_DEFLATE
const Bytef *z_src = (const Bytef *)(direct_buf);
- Bytef * z_dst; /*destination buffer */
+ Bytef * z_dst; /* Destination buffer */
uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE);
uLong z_src_nbytes = (uLong)CHK_SIZE;
-#endif /* end H5_HAVE_FILTER_DEFLATE */
+#endif
void * inbuf = NULL; /* Pointer to new buffer */
hsize_t chunk_size = CHK_SIZE; /* Size of a chunk, can be compressed or not */
hsize_t ii, jj; /* Array indices */
@@ -544,14 +544,15 @@ test_get_chunk_info_highest_v18(hid_t fapl)
/* Allocate input (compressed) buffer */
inbuf = HDcalloc(1, z_dst_nbytes);
- /* Set chunk size to the compressed chunk size and the chunk point
- to the compressed data chunk */
- chunk_size = (hsize_t)z_dst_nbytes;
- z_dst = (Bytef *)inbuf;
+ /* zlib-friendly alias for the input buffer */
+ z_dst = (Bytef *)inbuf;
/* Perform compression from the source to the destination buffer */
ret = compress2(z_dst, &z_dst_nbytes, z_src, z_src_nbytes, aggression);
+ /* Set the chunk size to the compressed chunk size */
+ chunk_size = (hsize_t)z_dst_nbytes;
+
/* Check for various zlib errors */
if (Z_BUF_ERROR == ret) {
HDfprintf(stderr, "overflow");