diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-01-15 17:32:01 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-05-20 14:31:50 (GMT) |
commit | 0585e6fb342014ac83598137f9bf0e946c701cd5 (patch) | |
tree | f8d126f92281c133aeb7fd4cba853d8ef68442d5 /test/err_compat.c | |
parent | d11be7974e5253715bc6cb9e6cc58cbaf9281971 (diff) | |
download | hdf5-0585e6fb342014ac83598137f9bf0e946c701cd5.zip hdf5-0585e6fb342014ac83598137f9bf0e946c701cd5.tar.gz hdf5-0585e6fb342014ac83598137f9bf0e946c701cd5.tar.bz2 |
Fixed stack and frame size warnings. Not complete, but fixes most of
the easier cases.
Diffstat (limited to 'test/err_compat.c')
-rw-r--r-- | test/err_compat.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/test/err_compat.c b/test/err_compat.c index f2a51a3..bd317bf 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -35,7 +35,10 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int **ipoints2 = NULL; +int **icheck2 = NULL; +int *ipoints2_data = NULL; +int *icheck2_data = NULL; #define DSET_NAME "a_dataset" #define FAKE_ID (hid_t)-1 @@ -466,13 +469,29 @@ dump_error(void) int main(void) { - hid_t file, fapl; + hid_t file, fapl; char filename[1024]; - const char *FUNC_main="main"; + const char *FUNC_main="main"; + int i; HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n"); fapl = h5_fileaccess(); + /* Set up data arrays */ + if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + ipoints2[i] = ipoints2_data + (i * DIM1); + + if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int)))) + TEST_ERROR; + if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data)))) + TEST_ERROR; + for (i = 0; i < DIM0; i++) + icheck2[i] = icheck2_data + (i * DIM1); + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR ; @@ -502,10 +521,20 @@ main(void) if(H5Fclose(file) < 0) TEST_ERROR ; h5_clean_files(FILENAME, fapl); + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDprintf("All error API tests passed.\n"); return 0; error: + HDfree(ipoints2); + HDfree(ipoints2_data); + HDfree(icheck2); + HDfree(icheck2_data); + HDprintf("***** ERROR TEST FAILED! *****\n"); return 1; } |