diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-20 21:37:12 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-20 21:37:12 (GMT) |
commit | 47c3bc7540869f53f0b734c68d3289835f0a546d (patch) | |
tree | 90e688dc21b095d9d3d36e944465ac79eff05348 /test/hyperslab.c | |
parent | b2012d9f74843ec87b31b7aca0c3ad8b6b6fe448 (diff) | |
download | hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.zip hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.tar.gz hdf5-47c3bc7540869f53f0b734c68d3289835f0a546d.tar.bz2 |
[svn-r19272] Description:
Close out various resource leaks and usages of uninitialized memory that
were flagged by valgrind. [There's still some more valgrind warnings, but
it's better now... :-/ ]
Also clean up warnings and code formatting.
Tested on:
Mac OS X/32 10.6.4 (amazon) w/debug & valgrind
(h5committest forthcoming)
Diffstat (limited to 'test/hyperslab.c')
-rw-r--r-- | test/hyperslab.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/test/hyperslab.c b/test/hyperslab.c index e216b95..fdeaffd 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -125,7 +125,7 @@ print_ref(size_t nx, size_t ny, size_t nz) { uint8_t *array; - if(NULL != (array = HDmalloc(nx * ny * nz))) { + if(NULL != (array = (uint8_t *)HDmalloc(nx * ny * nz))) { printf("Reference array:\n"); init_full(array, nx, ny, nz); print_array(array, nx, ny, nz); @@ -190,7 +190,7 @@ test_fill(size_t nx, size_t ny, size_t nz, fflush(stdout); /* Allocate array */ - if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz))) + if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz))) TEST_ERROR init_full(dst, nx, ny, nz); @@ -387,9 +387,9 @@ test_copy(int mode, /* * Allocate arrays */ - if(NULL == (src = HDcalloc((size_t)1, nx * ny * nz))) + if(NULL == (src = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz))) TEST_ERROR - if(NULL == (dst = HDcalloc((size_t)1, nx * ny * nz))) + if(NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz))) TEST_ERROR init_full(src, nx, ny, nz); @@ -602,9 +602,9 @@ test_multifill(size_t nx) fflush(stdout); /* Initialize the source and destination */ - if(NULL == (src = HDmalloc(nx * sizeof(*src)))) + if(NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src)))) TEST_ERROR - if(NULL == (dst = HDmalloc(nx * sizeof(*dst)))) + if(NULL == (dst = (struct a_struct *)HDmalloc(nx * sizeof(*dst)))) TEST_ERROR for(i = 0; i < nx; i++) { @@ -717,9 +717,9 @@ test_endian(size_t nx) fflush(stdout); /* Initialize arrays */ - if(NULL == (src = HDmalloc(nx * 4))) + if(NULL == (src = (uint8_t *)HDmalloc(nx * 4))) TEST_ERROR - if(NULL == (dst = HDcalloc(nx , (size_t)4))) + if(NULL == (dst = (uint8_t *)HDcalloc(nx , (size_t)4))) TEST_ERROR init_full(src, nx, (size_t)4,(size_t)1); @@ -805,9 +805,9 @@ test_transpose(size_t nx, size_t ny) fflush(stdout); /* Initialize */ - if(NULL == (src = HDmalloc(nx * ny * sizeof(*src)))) + if(NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src)))) TEST_ERROR - if(NULL == (dst = HDcalloc(nx * ny, sizeof(*dst)))) + if(NULL == (dst = (int *)HDcalloc(nx * ny, sizeof(*dst)))) TEST_ERROR for(i = 0; i < nx; i++) @@ -911,11 +911,11 @@ test_sub_super(size_t nx, size_t ny) fflush(stdout); /* Initialize */ - if(NULL == (full = HDmalloc(4 * nx * ny))) + if(NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny))) TEST_ERROR - if(NULL == (half = HDcalloc((size_t)1, nx * ny))) + if(NULL == (half = (uint8_t *)HDcalloc((size_t)1, nx * ny))) TEST_ERROR - if(NULL == (twice = HDcalloc((size_t)4, nx * ny))) + if(NULL == (twice = (uint8_t *)HDcalloc((size_t)4, nx * ny))) TEST_ERROR init_full(full, 2 * nx, 2 * ny, (size_t)1); @@ -1063,7 +1063,7 @@ test_array_fill(size_t lo, size_t hi) TESTING(s); /* Initialize */ - if(NULL == (dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi))) + if(NULL == (dst = (int *)HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi))) TEST_ERROR /* Setup */ @@ -1128,7 +1128,7 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) TESTING(s); /* Initialize */ - if(NULL == (a = HDmalloc(sizeof(hsize_t) * x * y *z))) + if(NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y *z))) TEST_ERROR dims[0] = z; |