From a4c82ed0491ce7e28079cdde9745b8ddfa9d60bc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 28 Aug 2008 12:29:11 -0500 Subject: [svn-r15550] Description: Clean up compiler warnings and code a bit. Tested on: Mac OS X/32 10.5.4 (amazon) Too minor to require h5committest --- test/fheap.c | 339 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 189 insertions(+), 150 deletions(-) diff --git a/test/fheap.c b/test/fheap.c index bee98b7..c8d43ee 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -416,11 +416,11 @@ add_obj(H5HF_t *fh, hid_t dxpl, size_t obj_off, /* Check for needing to increase size of heap ID array */ if(keep_ids->num_ids + 1 > keep_ids->alloc_ids) { keep_ids->alloc_ids = MAX(1024, (keep_ids->alloc_ids * 2)); - if(NULL == (keep_ids->ids = H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids))) + if(NULL == (keep_ids->ids = (unsigned char *)H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids))) TEST_ERROR - if(NULL == (keep_ids->lens = H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids))) + if(NULL == (keep_ids->lens = (size_t *)H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids))) TEST_ERROR - if(NULL == (keep_ids->offs = H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids))) + if(NULL == (keep_ids->offs = (size_t *)H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids))) TEST_ERROR } /* end if */ @@ -535,7 +535,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc, */ del_str = get_del_string(tparam); HDassert(del_str); - test_desc = H5MM_malloc(HDstrlen(del_str) + HDstrlen(base_desc)); + test_desc = (char *)H5MM_malloc(HDstrlen(del_str) + HDstrlen(base_desc)); sprintf(test_desc, base_desc, del_str); TESTING(test_desc); H5MM_xfree(del_str); @@ -1057,11 +1057,11 @@ fill_heap(H5HF_t *fh, hid_t dxpl, unsigned block_row, size_t obj_size, /* Check for needing to increase size of heap ID array */ if(num_ids > shared_alloc_ids_g) { shared_alloc_ids_g = MAX(1024, (shared_alloc_ids_g * 2)); - if(NULL == (shared_ids_g = H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g))) + if(NULL == (shared_ids_g = (unsigned char *)H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g))) TEST_ERROR - if(NULL == (shared_lens_g = H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g))) + if(NULL == (shared_lens_g = (size_t *)H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g))) TEST_ERROR - if(NULL == (shared_offs_g = H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g))) + if(NULL == (shared_offs_g = (size_t *)H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g))) TEST_ERROR curr_id_ptr = &shared_ids_g[(num_ids - 1) * id_len]; curr_len_ptr = &shared_lens_g[(num_ids - 1)]; @@ -1108,11 +1108,11 @@ fill_heap(H5HF_t *fh, hid_t dxpl, unsigned block_row, size_t obj_size, /* Check for needing to increase size of heap ID array */ if(num_ids > shared_alloc_ids_g) { shared_alloc_ids_g = MAX(1024, (shared_alloc_ids_g * 2)); - if(NULL == (shared_ids_g = H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g))) + if(NULL == (shared_ids_g = (unsigned char *)H5MM_realloc(shared_ids_g, id_len * shared_alloc_ids_g))) TEST_ERROR - if(NULL == (shared_lens_g = H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g))) + if(NULL == (shared_lens_g = (size_t *)H5MM_realloc(shared_lens_g, sizeof(size_t) * shared_alloc_ids_g))) TEST_ERROR - if(NULL == (shared_offs_g = H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g))) + if(NULL == (shared_offs_g = (size_t *)H5MM_realloc(shared_offs_g, sizeof(size_t) * shared_alloc_ids_g))) TEST_ERROR curr_id_ptr = &shared_ids_g[(num_ids - 1) * id_len]; curr_len_ptr = &shared_lens_g[(num_ids - 1)]; @@ -1164,11 +1164,11 @@ fill_heap(H5HF_t *fh, hid_t dxpl, unsigned block_row, size_t obj_size, /* Check for needing to increase size of heap ID array */ if(keep_ids->num_ids + num_ids > keep_ids->alloc_ids) { keep_ids->alloc_ids = MAX(1024, (keep_ids->alloc_ids * 2)); - if(NULL == (keep_ids->ids = H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids))) + if(NULL == (keep_ids->ids = (unsigned char *)H5MM_realloc(keep_ids->ids, id_len * keep_ids->alloc_ids))) TEST_ERROR - if(NULL == (keep_ids->lens = H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids))) + if(NULL == (keep_ids->lens = (size_t *)H5MM_realloc(keep_ids->lens, sizeof(size_t) * keep_ids->alloc_ids))) TEST_ERROR - if(NULL == (keep_ids->offs = H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids))) + if(NULL == (keep_ids->offs = (size_t *)H5MM_realloc(keep_ids->offs, sizeof(size_t) * keep_ids->alloc_ids))) TEST_ERROR } /* end if */ @@ -1797,7 +1797,6 @@ error: * Purpose: Create fractal heap * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol @@ -1805,7 +1804,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam) { hid_t file = -1; /* File ID */ @@ -1911,7 +1910,6 @@ error: * Purpose: Create & reopen a fractal heap * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol @@ -1919,7 +1917,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam) { hid_t file = -1; /* File ID */ @@ -1928,6 +1926,8 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam H5HF_create_t test_cparam; /* Creation parameters for heap */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ haddr_t fh_addr; /* Address of fractal heap */ + h5_stat_size_t empty_size; /* File size, w/o heap */ + h5_stat_size_t file_size; /* File size, after deleting heap */ size_t id_len; /* Size of fractal heap IDs */ fheap_heap_state_t state; /* State of fractal heap */ @@ -1938,12 +1938,24 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + /* Get the size of a file w/empty heap*/ + if((empty_size = h5_get_file_size(filename)) < 0) + TEST_ERROR + + /* Re-open the file */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + /* Get a pointer to the internal file object */ if(NULL == (f = (H5F_t *)H5I_object(file))) STACK_ERROR /* - * Test fractal heap creation + * Display testing message */ TESTING("create, close & reopen fractal heap"); @@ -1967,11 +1979,26 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) FAIL_STACK_ERROR + /* Check for closing & re-opening the file */ + if(tparam->reopen_heap) { + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + /* Re-open the file */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + } /* end if */ + /* Re-open the heap */ if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) FAIL_STACK_ERROR - /* Query the type of address mapping */ + /* Query the creation parameters */ HDmemset(&test_cparam, 0, sizeof(H5HF_create_t)); if(H5HF_get_cparam_test(fh, &test_cparam) < 0) FAIL_STACK_ERROR @@ -1983,10 +2010,22 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam FAIL_STACK_ERROR fh = NULL; + /* Delete heap */ + if(H5HF_delete(f, H5P_DATASET_XFER_DEFAULT, fh_addr) < 0) + FAIL_STACK_ERROR + /* Close the file */ if(H5Fclose(file) < 0) FAIL_STACK_ERROR + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename)) < 0) + TEST_ERROR + + /* Verify the file is correct size */ + if(file_size != empty_size) + TEST_ERROR + /* All tests passed */ PASSED() @@ -2015,7 +2054,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam) { hid_t file = -1; /* File ID */ @@ -2149,7 +2188,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t UNUSED *tparam) { hid_t file = -1; /* File ID */ @@ -2298,7 +2337,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_id_limits(hid_t fapl, H5HF_create_t *cparam) { hid_t file = -1; /* File ID */ @@ -2639,7 +2678,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_filtered_create(hid_t fapl, H5HF_create_t *cparam) { hid_t file = -1; /* File ID */ @@ -2758,7 +2797,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_size(hid_t fapl, H5HF_create_t *cparam) { hid_t file = -1; /* File ID */ @@ -2892,7 +2931,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3000,7 +3039,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3097,7 +3136,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3189,7 +3228,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3284,7 +3323,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3386,7 +3425,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3489,7 +3528,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3596,7 +3635,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3688,7 +3727,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3787,7 +3826,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3884,7 +3923,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -3990,7 +4029,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4084,7 +4123,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4176,7 +4215,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4274,7 +4313,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4380,7 +4419,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4479,7 +4518,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4586,7 +4625,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4690,7 +4729,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4788,7 +4827,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4893,7 +4932,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -4992,7 +5031,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5098,7 +5137,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5205,7 +5244,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5308,7 +5347,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5412,7 +5451,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5523,7 +5562,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5639,7 +5678,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5747,7 +5786,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5858,7 +5897,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -5983,7 +6022,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -6050,7 +6089,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); /* Set heap ID to random (non-null) value */ heap_id[0] = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN; for(u = 1; u < HEAP_ID_LEN; u++) - heap_id[u] = HDrandom() + 1; + heap_id[u] = (unsigned char)(HDrandom() + 1); /* Try removing bogus heap ID from empty heap */ H5E_BEGIN_TRY { @@ -6072,7 +6111,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); /* Set heap ID to random (non-null) value */ heap_id[0] = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_MAN; for(u = 1; u < HEAP_ID_LEN; u++) - heap_id[u] = HDrandom() + 1; + heap_id[u] = (unsigned char)(HDrandom() + 1); /* Get offset of random heap ID */ if(H5HF_get_id_off_test(fh, heap_id, &obj_off) < 0) @@ -6133,7 +6172,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -6209,7 +6248,7 @@ test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara /* Initialize the buffer for objects to insert */ for(u = 0; u < sizeof(obj); u++) - obj[u] = u; + obj[u] = (unsigned char)u; /* Insert object into heap */ if(H5HF_insert(fh, dxpl, sizeof(obj), obj, &heap_id) < 0) @@ -6288,7 +6327,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -6365,7 +6404,7 @@ test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpara /* Initialize the buffer for objects to insert */ for(u = 0; u < sizeof(obj); u++) - obj[u] = u; + obj[u] = (unsigned char)u; /* Insert first object into heap */ if(H5HF_insert(fh, dxpl, sizeof(obj), obj, &heap_id1) < 0) @@ -6473,7 +6512,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -6633,7 +6672,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -6868,7 +6907,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7165,7 +7204,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7239,7 +7278,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7328,7 +7367,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7399,7 +7438,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_first_two_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7472,7 +7511,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_first_four_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7549,7 +7588,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7620,7 +7659,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_2nd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7695,7 +7734,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_remove_3rd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7779,7 +7818,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7857,7 +7896,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -7956,7 +7995,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8066,7 +8105,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8163,7 +8202,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8308,7 +8347,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8474,7 +8513,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8601,7 +8640,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8728,7 +8767,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8852,7 +8891,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -8981,7 +9020,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -9127,7 +9166,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -9297,7 +9336,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -9451,7 +9490,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -9631,7 +9670,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -9760,7 +9799,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -9898,7 +9937,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -10050,7 +10089,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -10213,7 +10252,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -10376,7 +10415,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -10543,7 +10582,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -10705,7 +10744,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -10885,7 +10924,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -11100,7 +11139,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -11297,7 +11336,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -11525,7 +11564,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -11657,7 +11696,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -11829,7 +11868,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -11943,7 +11982,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_man_frag_3rd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -12058,7 +12097,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -12087,7 +12126,7 @@ test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar TEST_ERROR /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'huge' object's heap IDs are correct size */ @@ -12211,7 +12250,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -12241,9 +12280,9 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar TEST_ERROR /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id2 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'huge' object's heap IDs are correct size */ @@ -12444,7 +12483,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -12475,11 +12514,11 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp TEST_ERROR /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id2 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id3 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'huge' object's heap IDs are correct size */ @@ -12752,7 +12791,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -12785,15 +12824,15 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar TEST_ERROR /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id2 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id3 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id4 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id4 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id5 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id5 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'huge' object's heap IDs are correct size */ @@ -13178,7 +13217,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -13226,7 +13265,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'huge' object's heap IDs are correct form */ @@ -13390,7 +13429,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -13419,7 +13458,7 @@ test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar TEST_ERROR /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'tiny' object's heap IDs are correct size */ @@ -13543,7 +13582,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -13573,9 +13612,9 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar TEST_ERROR /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id2 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'tiny' object's heap IDs are correct size */ @@ -13777,7 +13816,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -13812,19 +13851,19 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar TEST_ERROR /* Allocate heap ID(s) */ - if(NULL == (heap_id = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id2 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id2 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id3 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id3 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id4 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id4 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id5 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id5 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id6 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id6 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR - if(NULL == (heap_id7 = H5MM_malloc(tparam->actual_id_len))) + if(NULL == (heap_id7 = (unsigned char *)H5MM_malloc(tparam->actual_id_len))) TEST_ERROR /* Make certain that 'tiny' object's heap IDs are correct size */ @@ -14388,7 +14427,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -14559,7 +14598,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -14873,7 +14912,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -14948,7 +14987,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); total_obj_added = 0; while(total_obj_added < size_limit) { /* Choose a random size of object (from 1 up to above standalone block size limit) */ - obj_size = (HDrandom() % (tmp_cparam.max_man_size + 255)) + 1; + obj_size = (size_t)((HDrandom() % (tmp_cparam.max_man_size + 255)) + 1); obj_loc = (tmp_cparam.max_man_size + 255) - obj_size; /* Insert object */ @@ -14972,7 +15011,7 @@ HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = % /* Choose a position to swap with */ /* (0 is current position) */ - pos = HDrandom() % (keep_ids.num_ids - u); + pos = (size_t)(HDrandom() % (keep_ids.num_ids - u)); /* If we chose a different position, swap with it */ if(pos > 0) { @@ -15077,7 +15116,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -15164,7 +15203,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed); size_range = tmp_cparam.max_man_size + 255; /* Choose a random size of object (from 1 up to stand alone block size) */ - obj_size = (HDrandom() % (size_range - 1)) + 1; + obj_size = (size_t)((HDrandom() % (size_range - 1)) + 1); obj_loc = (tmp_cparam.max_man_size + 255) - obj_size; /* Insert object */ @@ -15188,7 +15227,7 @@ HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = % /* Choose a position to swap with */ /* (0 is current position) */ - pos = HDrandom() % (keep_ids.num_ids - u); + pos = (size_t)(HDrandom() % (keep_ids.num_ids - u)); /* If we chose a different position, swap with it */ if(pos > 0) { @@ -15291,7 +15330,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -15381,9 +15420,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) TEST_ERROR /* Initialize data to overwrite with */ - rewrite_obj = H5MM_malloc(shared_obj_size_g); + rewrite_obj = (unsigned char *)H5MM_malloc(shared_obj_size_g); for(u = 0; u < shared_obj_size_g; u++) - rewrite_obj[u] = shared_wobj_g[u] * 2; + rewrite_obj[u] = (unsigned char)(shared_wobj_g[u] * 2); /* Insert different sized objects, but stay out of "tiny" and "huge" zones */ obj_size = 20; @@ -15411,9 +15450,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size *= 1.3; + obj_size = (size_t)(obj_size * 1.3); else - obj_size /= 1.3; + obj_size = (size_t)(obj_size / 1.3); } /* end for */ /* Close the fractal heap */ @@ -15451,9 +15490,9 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) /* Change size of data to write */ if(u < 20) - obj_size *= 1.3; + obj_size = (size_t)(obj_size * 1.3); else - obj_size /= 1.3; + obj_size = (size_t)(obj_size / 1.3); } /* end for */ /* Close the fractal heap */ @@ -15508,7 +15547,7 @@ error: * *------------------------------------------------------------------------- */ -static int +static unsigned test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ @@ -15715,8 +15754,8 @@ main(void) /* Allocate space for the shared objects */ shared_obj_size_g = large_cparam.max_man_size + 256; - shared_wobj_g = H5MM_malloc(shared_obj_size_g); - shared_robj_g = H5MM_malloc(shared_obj_size_g); + shared_wobj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g); + shared_robj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g); /* Initialize the shared write buffer for objects */ for(u = 0; u < shared_obj_size_g; u++) @@ -15984,7 +16023,7 @@ HDfprintf(stderr, "Uncomment tests!\n"); /* Test "normal" & "direct" storage of 'huge' & 'tiny' heap IDs */ for(id_len = 0; id_len < 3; id_len++) { /* Set the ID length for this test */ - small_cparam.id_len = id_len; + small_cparam.id_len = (uint16_t)id_len; /* Print information about each test */ switch(id_len) { -- cgit v0.12