summaryrefslogtreecommitdiffstats
path: root/test/error_test.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-15 17:32:01 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:31:50 (GMT)
commit0585e6fb342014ac83598137f9bf0e946c701cd5 (patch)
treef8d126f92281c133aeb7fd4cba853d8ef68442d5 /test/error_test.c
parentd11be7974e5253715bc6cb9e6cc58cbaf9281971 (diff)
downloadhdf5-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/error_test.c')
-rw-r--r--test/error_test.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/test/error_test.c b/test/error_test.c
index 1de9065..e99a82f 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -38,7 +38,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;
hid_t ERR_CLS;
hid_t ERR_CLS2;
@@ -679,6 +682,7 @@ main(void)
hid_t estack_id = -1;
char filename[1024];
const char *FUNC_main = "main";
+ int i;
HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n");
@@ -689,6 +693,21 @@ main(void)
if ((fapl = h5_fileaccess()) < 0)
TEST_ERROR;
+ /* 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;
@@ -755,10 +774,20 @@ main(void)
h5_clean_files(FILENAME, fapl);
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDfprintf(stderr, "\nAll error API tests passed.\n");
return 0;
error:
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDfprintf(stderr, "\n***** ERROR TEST FAILED (real problem)! *****\n");
return 1;
}