diff options
Diffstat (limited to 'hl')
-rw-r--r-- | hl/test/test_ds.c | 9 | ||||
-rw-r--r-- | hl/tools/gif2h5/CMakeTests.cmake | 5 | ||||
-rw-r--r-- | hl/tools/gif2h5/h52gifgentst.c | 8 |
3 files changed, 20 insertions, 2 deletions
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 47929e6..091a98b 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -389,7 +389,7 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int int rank = 4; int rankds = 1; hsize_t dims[4] = {DIM1_SIZE,DIM2_SIZE,DIM3_SIZE,DIM4_SIZE}; - long buf[DIM1_SIZE*DIM2_SIZE*DIM3_SIZE*DIM4_SIZE]; + long *buf; hsize_t s1_dim[1] = {DIM1_SIZE}; hsize_t s2_dim[1] = {DIM2_SIZE}; hsize_t s3_dim[1] = {DIM3_SIZE}; @@ -409,6 +409,10 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int long s43_wbuf[DIM4_SIZE] = {180,180}; long s44_wbuf[DIM4_SIZE] = {280,280}; + /* Allocate buffer */ + if(NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE))) + return FAIL; + /* make a dataset */ if(H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) { if(fulldims==0) { @@ -444,6 +448,9 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int } else return FAIL; + + HDfree(buf); + return SUCCEED; } diff --git a/hl/tools/gif2h5/CMakeTests.cmake b/hl/tools/gif2h5/CMakeTests.cmake index 1cffe55..1dda0f5 100644 --- a/hl/tools/gif2h5/CMakeTests.cmake +++ b/hl/tools/gif2h5/CMakeTests.cmake @@ -26,16 +26,21 @@ add_test ( image.gif image24.gif ) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_gif2h5 COMMAND $<TARGET_FILE:gif2h5> testfiles/image1.gif image1.h5) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_h52gif COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image1.gif -i image) +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) add_test (NAME HL_TOOLS_h52gif_none COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i nosuch_image) set_tests_properties (HL_TOOLS_h52gif_none PROPERTIES WILL_FAIL "true") +set_tests_properties (HL_TOOLS-clear-objects PROPERTIES DEPENDS HL_TOOLS-clear-objects) #add_test (NAME HL_TOOLS_h52gifpal COMMAND $<TARGET_FILE:h52gif> testfiles/h52giftst.h5 image.gif -i palette) #set_tests_properties (HL_TOOLS_h52gifpal PROPERTIES WILL_FAIL "true") add_test (NAME HL_TOOLS_h52gif24bits COMMAND $<TARGET_FILE:h52gif> testfiles/ex_image2.h5 image24.gif -i image24bitpixel) set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES WILL_FAIL "true") +set_tests_properties (HL_TOOLS_h52gif24bits PROPERTIES DEPENDS HL_TOOLS-clear-objects) diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c index 3433d0a..39e950b 100644 --- a/hl/tools/gif2h5/h52gifgentst.c +++ b/hl/tools/gif2h5/h52gifgentst.c @@ -13,6 +13,7 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include "hdf5.h" @@ -49,12 +50,15 @@ int main(void) { hid_t fid; int i, j, n, space; - unsigned char buf [ WIDTH*HEIGHT ]; + unsigned char *buf; unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */ hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */ hsize_t width = WIDTH; hsize_t height = HEIGHT; + /* Allocate buffer */ + if(NULL == (buf = (unsigned char *)malloc(WIDTH * HEIGHT))) + return EXIT_FAILURE; /* create a file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) @@ -99,6 +103,8 @@ int main(void) if(H5Fclose(fid)<0) return EXIT_FAILURE; + free(buf); + return EXIT_SUCCESS; } |