summaryrefslogtreecommitdiffstats
path: root/test/err_compat.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-15 17:32:01 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-15 17:32:01 (GMT)
commit1f8f6f019c85df6c031a32f6bf703fa18e225973 (patch)
tree29e642ec8de803f102bb0a593c86368e786b1a4b /test/err_compat.c
parentd14b96e95976967c03c7623f6800506b89292656 (diff)
downloadhdf5-1f8f6f019c85df6c031a32f6bf703fa18e225973.zip
hdf5-1f8f6f019c85df6c031a32f6bf703fa18e225973.tar.gz
hdf5-1f8f6f019c85df6c031a32f6bf703fa18e225973.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.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/test/err_compat.c b/test/err_compat.c
index d2d039a..eb86760 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
@@ -465,13 +468,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 ;
@@ -500,10 +519,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;
}