diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2016-06-01 17:02:30 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2016-06-01 17:02:30 (GMT) |
commit | fcaf9c483ac83f9cc6765b032022d56081942d37 (patch) | |
tree | 6a7bd1614e391c348a3def3db79149aa50ba696c /test | |
parent | 3384f4c0b9e4dffe183f5a6ee5ca29e40f29a7f8 (diff) | |
download | hdf5-fcaf9c483ac83f9cc6765b032022d56081942d37.zip hdf5-fcaf9c483ac83f9cc6765b032022d56081942d37.tar.gz hdf5-fcaf9c483ac83f9cc6765b032022d56081942d37.tar.bz2 |
[svn-r30002] Fixed some minor warnings in H5AC.c and H5C.c, cleaned up warnings
in the cache tests, and made some huge static arrays dynamic
in the cache tests.
Tested on: 64-bit Ubuntu Linux w/ gcc 5.3.1
Autotools serial
Diffstat (limited to 'test')
-rw-r--r-- | test/cache.c | 67 | ||||
-rw-r--r-- | test/cache_common.c | 249 | ||||
-rw-r--r-- | test/cache_common.h | 4 | ||||
-rw-r--r-- | test/cache_tagging.c | 167 |
4 files changed, 366 insertions, 121 deletions
diff --git a/test/cache.c b/test/cache.c index 88077e4..a5c8f93 100644 --- a/test/cache.c +++ b/test/cache.c @@ -9146,23 +9146,29 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, ( check[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) || ( check[i].entry_index < 0 ) || ( check[i].entry_index > max_indices[check[i].entry_type] ) || - ( check[i].expected_size <= (size_t)0 ) || - ( ( check[i].in_cache != TRUE ) && - ( check[i].in_cache != FALSE ) ) || - ( ( check[i].at_main_addr != TRUE ) && - ( check[i].at_main_addr != FALSE ) ) || - ( ( check[i].is_dirty != TRUE ) && - ( check[i].is_dirty != FALSE ) ) || - ( ( check[i].is_protected != TRUE ) && - ( check[i].is_protected != FALSE ) ) || - ( ( check[i].is_pinned != TRUE ) && - ( check[i].is_pinned != FALSE ) ) || - ( ( check[i].expected_deserialized != TRUE ) && - ( check[i].expected_deserialized != FALSE ) ) || - ( ( check[i].expected_serialized != TRUE ) && - ( check[i].expected_serialized != FALSE ) ) || - ( ( check[i].expected_destroyed != TRUE ) && - ( check[i].expected_destroyed != FALSE ) ) ) { +#ifndef H5_HAVE_STDBOOL_H + /* Check for nonsense values if hbool_t is an integral + * type instead of a real Boolean. + */ + ( ( check[i].in_cache != TRUE ) && + ( check[i].in_cache != FALSE ) ) || + ( ( check[i].at_main_addr != TRUE ) && + ( check[i].at_main_addr != FALSE ) ) || + ( ( check[i].is_dirty != TRUE ) && + ( check[i].is_dirty != FALSE ) ) || + ( ( check[i].is_protected != TRUE ) && + ( check[i].is_protected != FALSE ) ) || + ( ( check[i].is_pinned != TRUE ) && + ( check[i].is_pinned != FALSE ) ) || + ( ( check[i].expected_deserialized != TRUE ) && + ( check[i].expected_deserialized != FALSE ) ) || + ( ( check[i].expected_serialized != TRUE ) && + ( check[i].expected_serialized != FALSE ) ) || + ( ( check[i].expected_destroyed != TRUE ) && + ( check[i].expected_destroyed != FALSE ) ) || +#endif /* H5_HAVE_STDBOOL_H */ + ( check[i].expected_size <= (size_t)0 ) + ) { pass = FALSE; HDsnprintf(msg, (size_t)128, @@ -35044,19 +35050,13 @@ check_stats__smoke_check_1(H5F_t * file_ptr) /*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Run tests on the cache code contained in H5C.c - * - * Return: Success: + * Function: main * - * Failure: + * Return: EXIT_SUCCESS/EXIT_FAILURE * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -35075,6 +35075,12 @@ main(void) printf(" express_test = %d\n", express_test); printf("=========================================\n"); + if ( create_entry_arrays() < 0 ) { + + printf("ERROR: Unable to create entries arrays. Aborting.\n"); + return EXIT_FAILURE; + } /* end if */ + nerrs += smoke_check_1(express_test); nerrs += smoke_check_2(express_test); nerrs += smoke_check_3(express_test); @@ -35127,6 +35133,13 @@ main(void) nerrs += check_entry_deletions_during_scans(); nerrs += check_stats(); - return(nerrs > 0); + /* can't fail, returns void */ + free_entry_arrays(); + + if ( nerrs > 0 ) + return EXIT_FAILURE; + else + return EXIT_SUCCESS; + } /* main() */ diff --git a/test/cache_common.c b/test/cache_common.c index 924920b..3b075d4 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -62,17 +62,17 @@ hbool_t try_core_file_driver = FALSE; hbool_t core_file_driver_failed = FALSE; const char *failure_mssg = NULL; -static test_entry_t pico_entries[NUM_PICO_ENTRIES], orig_pico_entries[NUM_PICO_ENTRIES]; -static test_entry_t nano_entries[NUM_NANO_ENTRIES], orig_nano_entries[NUM_NANO_ENTRIES]; -static test_entry_t micro_entries[NUM_MICRO_ENTRIES], orig_micro_entries[NUM_MICRO_ENTRIES]; -static test_entry_t tiny_entries[NUM_TINY_ENTRIES], orig_tiny_entries[NUM_TINY_ENTRIES]; -static test_entry_t small_entries[NUM_SMALL_ENTRIES], orig_small_entries[NUM_SMALL_ENTRIES]; -static test_entry_t medium_entries[NUM_MEDIUM_ENTRIES], orig_medium_entries[NUM_MEDIUM_ENTRIES]; -static test_entry_t large_entries[NUM_LARGE_ENTRIES], orig_large_entries[NUM_LARGE_ENTRIES]; -static test_entry_t huge_entries[NUM_HUGE_ENTRIES], orig_huge_entries[NUM_HUGE_ENTRIES]; -static test_entry_t monster_entries[NUM_MONSTER_ENTRIES], orig_monster_entries[NUM_MONSTER_ENTRIES]; -static test_entry_t variable_entries[NUM_VARIABLE_ENTRIES], orig_variable_entries[NUM_VARIABLE_ENTRIES]; -static test_entry_t notify_entries[NUM_NOTIFY_ENTRIES], orig_notify_entries[NUM_NOTIFY_ENTRIES]; +static test_entry_t *pico_entries = NULL, *orig_pico_entries = NULL; +static test_entry_t *nano_entries = NULL, *orig_nano_entries = NULL; +static test_entry_t *micro_entries = NULL, *orig_micro_entries = NULL; +static test_entry_t *tiny_entries = NULL, *orig_tiny_entries = NULL; +static test_entry_t *small_entries = NULL, *orig_small_entries = NULL; +static test_entry_t *medium_entries = NULL, *orig_medium_entries = NULL; +static test_entry_t *large_entries = NULL, *orig_large_entries = NULL; +static test_entry_t *huge_entries = NULL, *orig_huge_entries = NULL; +static test_entry_t *monster_entries = NULL, *orig_monster_entries = NULL; +static test_entry_t *variable_entries = NULL, *orig_variable_entries = NULL; +static test_entry_t *notify_entries = NULL, *orig_notify_entries = NULL; hbool_t orig_entry_arrays_init = FALSE; @@ -225,36 +225,9 @@ static herr_t free_icr(test_entry_t *entry, int32_t entry_type); static void execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_op *op_ptr, unsigned *flags_ptr); +test_entry_t *entries[NUMBER_OF_ENTRY_TYPES]; -test_entry_t *entries[NUMBER_OF_ENTRY_TYPES] = -{ - pico_entries, - nano_entries, - micro_entries, - tiny_entries, - small_entries, - medium_entries, - large_entries, - huge_entries, - monster_entries, - variable_entries, - notify_entries -}; - -test_entry_t *orig_entries[NUMBER_OF_ENTRY_TYPES] = -{ - orig_pico_entries, - orig_nano_entries, - orig_micro_entries, - orig_tiny_entries, - orig_small_entries, - orig_medium_entries, - orig_large_entries, - orig_huge_entries, - orig_monster_entries, - orig_variable_entries, - orig_notify_entries -}; +test_entry_t *orig_entries[NUMBER_OF_ENTRY_TYPES]; const int32_t max_indices[NUMBER_OF_ENTRY_TYPES] = { @@ -1707,8 +1680,13 @@ add_flush_op(int target_type, ( type == VARIABLE_ENTRY_TYPE ) ); HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= idx ) && ( idx <= max_indices[type] ) ); - HDassert( ( flag == TRUE ) || ( flag == FALSE ) ); HDassert( new_size <= VARIABLE_ENTRY_SIZE ); +#ifndef H5_HAVE_STDBOOL_H + /* Check for TRUE or FALSE if we're using an integer type instead + * of a real Boolean type. + */ + HDassert( ( flag == TRUE ) || ( flag == FALSE ) ); +#endif /* H5_HAVE_STDBOOL_H */ if ( pass ) { @@ -1934,8 +1912,13 @@ execute_flush_op(H5F_t * file_ptr, ( op_ptr->type < NUMBER_OF_ENTRY_TYPES ) ); HDassert( ( 0 <= op_ptr->idx ) && ( op_ptr->idx <= max_indices[op_ptr->type] ) ); - HDassert( ( op_ptr->flag == FALSE ) || ( op_ptr->flag == TRUE ) ); HDassert( flags_ptr != NULL ); +#ifndef H5_HAVE_STDBOOL_H + /* Check for TRUE or FALSE if we're using an integer type instead + * of a real Boolean type. + */ + HDassert( ( op_ptr->flag == FALSE ) || ( op_ptr->flag == TRUE ) ); +#endif /* H5_HAVE_STDBOOL_H */ if ( pass ) { @@ -2098,6 +2081,188 @@ entry_in_cache(H5C_t * cache_ptr, /*------------------------------------------------------------------------- + * Function: create_entry_arrays + * + * Purpose: Create the entry arrays, both regular and original. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ + +herr_t +create_entry_arrays(void) + +{ + /* pico entries */ + if(NULL == (pico_entries = (test_entry_t *)HDcalloc(NUM_PICO_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_pico_entries = (test_entry_t *)HDcalloc(NUM_PICO_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* nano entries */ + if(NULL == (nano_entries = (test_entry_t *)HDcalloc(NUM_NANO_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_nano_entries = (test_entry_t *)HDcalloc(NUM_NANO_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* micro entries */ + if(NULL == (micro_entries = (test_entry_t *)HDcalloc(NUM_MICRO_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_micro_entries = (test_entry_t *)HDcalloc(NUM_MICRO_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* tiny entries */ + if(NULL == (tiny_entries = (test_entry_t *)HDcalloc(NUM_TINY_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_tiny_entries = (test_entry_t *)HDcalloc(NUM_TINY_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* small entries */ + if(NULL == (small_entries = (test_entry_t *)HDcalloc(NUM_SMALL_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_small_entries = (test_entry_t *)HDcalloc(NUM_SMALL_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* medium entries */ + if(NULL == (medium_entries = (test_entry_t *)HDcalloc(NUM_MEDIUM_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_medium_entries = (test_entry_t *)HDcalloc(NUM_MEDIUM_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* large entries */ + if(NULL == (large_entries = (test_entry_t *)HDcalloc(NUM_LARGE_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_large_entries = (test_entry_t *)HDcalloc(NUM_LARGE_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* huge entries */ + if(NULL == (huge_entries = (test_entry_t *)HDcalloc(NUM_HUGE_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_huge_entries = (test_entry_t *)HDcalloc(NUM_HUGE_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* monster entries */ + if(NULL == (monster_entries = (test_entry_t *)HDcalloc(NUM_MONSTER_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_monster_entries = (test_entry_t *)HDcalloc(NUM_MONSTER_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* variable entries */ + if(NULL == (variable_entries = (test_entry_t *)HDcalloc(NUM_VARIABLE_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_variable_entries = (test_entry_t *)HDcalloc(NUM_VARIABLE_ENTRIES, sizeof(test_entry_t)))) + goto error; + + /* notify entries */ + if(NULL == (notify_entries = (test_entry_t *)HDcalloc(NUM_NOTIFY_ENTRIES, sizeof(test_entry_t)))) + goto error; + if(NULL == (orig_notify_entries = (test_entry_t *)HDcalloc(NUM_NOTIFY_ENTRIES, sizeof(test_entry_t)))) + goto error; + + entries[0] = pico_entries; + entries[1] = nano_entries; + entries[2] = micro_entries; + entries[3] = tiny_entries; + entries[4] = small_entries; + entries[5] = medium_entries; + entries[6] = large_entries; + entries[7] = huge_entries; + entries[8] = monster_entries; + entries[9] = variable_entries; + entries[10] = notify_entries; + + orig_entries[0] = orig_pico_entries; + orig_entries[1] = orig_nano_entries; + orig_entries[2] = orig_micro_entries; + orig_entries[3] = orig_tiny_entries; + orig_entries[4] = orig_small_entries; + orig_entries[5] = orig_medium_entries; + orig_entries[6] = orig_large_entries; + orig_entries[7] = orig_huge_entries; + orig_entries[8] = orig_monster_entries; + orig_entries[9] = orig_variable_entries; + orig_entries[10] = orig_notify_entries; + + return SUCCEED; + +error: + free_entry_arrays(); + return FAIL; + +} /* create_entry_arrays() */ + + +/*------------------------------------------------------------------------- + * Function: free_entry_arrays + * + * Purpose: Free the entry arrays, both regular and original. + * + * Return: void + * + * Programmer: Dana Robinson + * Spring 2016 + * + *------------------------------------------------------------------------- + */ + +void +free_entry_arrays(void) + +{ + /* pico entries */ + HDfree(pico_entries); + HDfree(orig_pico_entries); + + /* nano entries */ + HDfree(nano_entries); + HDfree(orig_nano_entries); + + /* micro entries */ + HDfree(micro_entries); + HDfree(orig_micro_entries); + + /* tiny entries */ + HDfree(tiny_entries); + HDfree(orig_tiny_entries); + + /* small entries */ + HDfree(small_entries); + HDfree(orig_small_entries); + + /* medium entries */ + HDfree(medium_entries); + HDfree(orig_medium_entries); + + /* large entries */ + HDfree(large_entries); + HDfree(orig_large_entries); + + /* huge entries */ + HDfree(huge_entries); + HDfree(orig_huge_entries); + + /* monster entries */ + HDfree(monster_entries); + HDfree(orig_monster_entries); + + /* variable entries */ + HDfree(variable_entries); + HDfree(orig_variable_entries); + + /* notify entries */ + HDfree(notify_entries); + HDfree(orig_notify_entries); + + return; + +} /* free_entry_arrays() */ + + +/*------------------------------------------------------------------------- * Function: reset_entries * * Purpose: reset the contents of the entries arrays to known values. diff --git a/test/cache_common.h b/test/cache_common.h index 655e17e..0b22cf2 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -621,6 +621,10 @@ H5TEST_DLL void create_pinned_entry_dependency(H5F_t * file_ptr, int pinned_type, int pinned_idx); +H5TEST_DLL herr_t create_entry_arrays(void); + +H5TEST_DLL void free_entry_arrays(void); + H5TEST_DLL void reset_entries(void); H5TEST_DLL void resize_entry(H5F_t * file_ptr, diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 0cc200c..3bf8790 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -1649,8 +1649,8 @@ check_attribute_rename_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ int verbose = FALSE; /* verbose file outout */ - int data[DIMS][DIMS]; /* data buffer */ - int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ + int i,j,k = 0; /* iterators */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; haddr_t g_tag = 0; @@ -1664,6 +1664,9 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -1696,10 +1699,10 @@ check_attribute_rename_tags(hid_t fcpl, int type) if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0; i < DIMS; i++) { + for(j = 0; j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -1788,10 +1791,14 @@ check_attribute_rename_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_attribute_rename_tags */ @@ -1822,8 +1829,8 @@ check_attribute_delete_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ int verbose = FALSE; /* verbose file outout */ - int data[DIMS][DIMS]; /* data buffer */ - int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ + int i,j,k = 0; /* iterators */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; haddr_t g_tag = 0; @@ -1837,6 +1844,9 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -1869,10 +1879,10 @@ check_attribute_delete_tags(hid_t fcpl, int type) if ( (aid = H5Acreate2(gid, ATTRNAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR; /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0;i < DIMS; i++) { + for(j = 0;j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -1936,10 +1946,14 @@ check_attribute_delete_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_attribute_delete_tags */ @@ -2378,10 +2392,10 @@ check_dataset_write_tags(hid_t fcpl, int type) haddr_t root_tag = 0; haddr_t sbe_tag = 0; haddr_t d_tag = 0; - hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ - int i,j,k = 0; /* iterators */ - int data[DIMS][DIMS]; + int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ /* Testing Macro */ TESTING("tag application during dataset write"); @@ -2390,6 +2404,9 @@ check_dataset_write_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -2442,10 +2459,10 @@ check_dataset_write_tags(hid_t fcpl, int type) /* ============================== */ /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0;i < DIMS; i++) { + for(j = 0;j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS *i) + j] = k++; } /* end for */ } /* end for */ @@ -2480,10 +2497,14 @@ check_dataset_write_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_dataset_write_tags */ @@ -2512,8 +2533,8 @@ check_attribute_write_tags(hid_t fcpl, int type) hid_t aid = -1; /* Attribute Identifier */ hid_t sid = -1; /* Dataset Identifier */ int verbose = FALSE; /* verbose file outout */ - int data[DIMS][DIMS]; /* data buffer */ - int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ + int i,j,k = 0; /* iterators */ haddr_t root_tag = 0; haddr_t sbe_tag = 0; haddr_t g_tag = 0; @@ -2527,6 +2548,9 @@ check_attribute_write_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create a test file with provided fcpl_t */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -2574,10 +2598,10 @@ check_attribute_write_tags(hid_t fcpl, int type) /* =========================== */ /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0; i < DIMS; i++) { + for(j = 0;j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -2635,10 +2659,14 @@ check_attribute_write_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_attribute_write_tags */ @@ -2672,10 +2700,10 @@ check_dataset_read_tags(hid_t fcpl, int type) haddr_t root_tag = 0; haddr_t sbe_tag = 0; haddr_t d_tag = 0; - hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ - int i,j,k = 0; /* iterators */ - int data[DIMS][DIMS]; + int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ /* Testing Macro */ TESTING("tag application during dataset read"); @@ -2684,6 +2712,9 @@ check_dataset_read_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -2723,10 +2754,10 @@ check_dataset_read_tags(hid_t fcpl, int type) if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0; i < DIMS; i++) { + for(j = 0; j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -2773,10 +2804,14 @@ check_dataset_read_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_dataset_read_tags */ @@ -2810,10 +2845,10 @@ check_dataset_size_retrieval(hid_t fcpl, int type) haddr_t root_tag = 0; haddr_t sbe_tag = 0; haddr_t d_tag = 0; - hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ - int i,j,k = 0; /* iterators */ - int data[DIMS][DIMS]; + int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ hsize_t dsize = 0; /* Testing Macro */ @@ -2823,6 +2858,9 @@ check_dataset_size_retrieval(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -2862,10 +2900,10 @@ check_dataset_size_retrieval(hid_t fcpl, int type) if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0; i < DIMS; i++) { + for(j = 0; j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -2912,10 +2950,14 @@ check_dataset_size_retrieval(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_dataset_size_retrieval */ @@ -2950,11 +2992,11 @@ check_dataset_extend_tags(hid_t fcpl, int type) haddr_t root_tag = 0; haddr_t sbe_tag = 0; haddr_t d_tag = 0; - hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ - int i,j,k = 0; /* iterators */ - int data[DIMS][DIMS]; - hsize_t newdims[2] = {DIMS*2, DIMS}; /* dimensions */ + int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ + hsize_t newdims[2] = {DIMS*2, DIMS}; /* dimensions */ /* Testing Macro */ TESTING("tag application during dataset extend"); @@ -2963,6 +3005,9 @@ check_dataset_extend_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -3002,10 +3047,10 @@ check_dataset_extend_tags(hid_t fcpl, int type) if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0; i < DIMS; i++) { + for(j = 0; j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -3052,10 +3097,14 @@ check_dataset_extend_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_dataset_extend_tags */ @@ -3324,10 +3373,10 @@ check_link_removal_tags(hid_t fcpl, int type) haddr_t sbe_tag = 0; haddr_t d_tag = 0; haddr_t g_tag = 0; - hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ - int i,j,k = 0; /* iterators */ - int data[DIMS][DIMS]; + int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ /* Testing Macro */ TESTING("tag application during link removal"); @@ -3336,6 +3385,9 @@ check_link_removal_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -3384,10 +3436,10 @@ check_link_removal_tags(hid_t fcpl, int type) if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0; i < DIMS; i++) { + for(j = 0; j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -3444,10 +3496,14 @@ check_link_removal_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_link_removal_tags */ @@ -3484,10 +3540,10 @@ check_link_getname_tags(hid_t fcpl, int type) haddr_t sbe_tag = 0; haddr_t d_tag = 0; haddr_t g_tag = 0; - hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ + hsize_t dims1[2] = {DIMS, DIMS}; /* dimensions */ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dimensions */ - int i,j,k = 0; /* iterators */ - int data[DIMS][DIMS]; + int i,j,k = 0; /* iterators */ + int *data = NULL; /* data buffer */ /* Testing Macro */ TESTING("tag application during link name retrieval"); @@ -3496,6 +3552,9 @@ check_link_getname_tags(hid_t fcpl, int type) /* Setup */ /* ===== */ + /* Allocate array */ + if ( (NULL == (data = (int *)HDcalloc(DIMS * DIMS, sizeof(int)))) ) TEST_ERROR; + /* Create file */ if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0 ) TEST_ERROR; @@ -3544,10 +3603,10 @@ check_link_getname_tags(hid_t fcpl, int type) if ( get_new_object_header_tag(fid, &d_tag) < 0 ) TEST_ERROR; /* fill out data buffer */ - for(i=0;i<DIMS;i++) { - for(j=0;j<DIMS;j++) { + for(i = 0; i < DIMS; i++) { + for(j = 0; j < DIMS; j++) { - data[i][j] = k++; + data[(DIMS * i) + j] = k++; } /* end for */ } /* end for */ @@ -3596,10 +3655,14 @@ check_link_getname_tags(hid_t fcpl, int type) /* Finished Test. Print status and return. */ /* ========================================== */ + HDfree(data); + PASSED(); return 0; error: + if(data) + HDfree(data); return 1; } /* check_link_getname_tags */ |