Skip to content

Commit

Permalink
Consistent initialization of hid_t in the tests (HDFGroup#3521)
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld authored and qkoziol committed Sep 30, 2023
1 parent 3bb6f00 commit 7edb4e0
Show file tree
Hide file tree
Showing 106 changed files with 4,571 additions and 4,490 deletions.
10 changes: 5 additions & 5 deletions test/accum.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ main(void)
{
unsigned nerrors = 0; /* track errors */
bool api_ctx_pushed = false; /* Whether API context pushed */
hid_t fid = -1;
hid_t fapl = -1; /* File access property list */
hid_t fid = H5I_INVALID_HID;
hid_t fapl = H5I_INVALID_HID; /* File access property list */
char filename[1024];
H5F_t *f = NULL; /* File for all tests */

Expand Down Expand Up @@ -2050,9 +2050,9 @@ unsigned
test_swmr_write_big(bool newest_format)
{

hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
H5F_t *rf = NULL; /* File pointer */
hid_t fid = H5I_INVALID_HID; /* File ID */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
H5F_t *rf = NULL; /* File pointer */
char filename[1024];
uint8_t *wbuf2 = NULL, *rbuf = NULL; /* Buffers for reading & writing */
uint8_t wbuf[1024]; /* Buffer for reading & writing */
Expand Down
17 changes: 9 additions & 8 deletions test/big.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,12 @@ writer(char *filename, hid_t fapl, fsizes_t testsize, int wrt_n)
hsize_t size2[1] = {8LL * 1024LL * 1024LL * 1024LL};
hsize_t hs_start[1];
hsize_t hs_size[1];
hid_t file = -1, space1 = -1, space2 = -1, mem_space = -1, d1 = -1, d2 = -1;
int *buf = (int *)malloc(sizeof(int) * WRT_SIZE);
int i, j;
FILE *out = fopen(DNAME, "w");
hid_t dcpl;
hid_t file = H5I_INVALID_HID, space1 = H5I_INVALID_HID, space2 = H5I_INVALID_HID,
mem_space = H5I_INVALID_HID, d1 = H5I_INVALID_HID, d2 = H5I_INVALID_HID;
int *buf = (int *)malloc(sizeof(int) * WRT_SIZE);
int i, j;
FILE *out = fopen(DNAME, "w");
hid_t dcpl;

switch (testsize) {
case LFILE:
Expand Down Expand Up @@ -449,7 +450,7 @@ static int
reader(char *filename, hid_t fapl)
{
FILE *script = NULL;
hid_t file = -1, mspace = -1, fspace = -1, d2 = -1;
hid_t file = H5I_INVALID_HID, mspace = H5I_INVALID_HID, fspace = H5I_INVALID_HID, d2 = H5I_INVALID_HID;
char ln[128], *s;
hsize_t hs_offset[1];
hsize_t hs_size[1] = {WRT_SIZE};
Expand Down Expand Up @@ -705,8 +706,8 @@ int
main(int ac, char **av)
{
unsigned long seed = 0; /* Random # seed */
hid_t fapl = -1;
hid_t driver = -1;
hid_t fapl = H5I_INVALID_HID;
hid_t driver = H5I_INVALID_HID;

/* parameters setup */

Expand Down
938 changes: 469 additions & 469 deletions test/btree2.c

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between
* close.
*/

hid_t saved_fid = -1; /* store the file id here between cache setup
* and takedown.
*/
hid_t saved_fid = H5I_INVALID_HID; /* store the file id here between cache setup
* and takedown.
*/
bool write_permitted = true;
bool try_core_file_driver = false;
bool core_file_driver_failed = false;
Expand Down Expand Up @@ -33513,7 +33513,7 @@ setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged)
bool show_progress = false;
bool verbose = true;
int mile_stone = 1;
hid_t fid = -1;
hid_t fid = H5I_INVALID_HID;
H5F_t *file_ptr = NULL;
H5C_t *cache_ptr = NULL;
H5F_t *ret_val = NULL;
Expand Down
39 changes: 20 additions & 19 deletions test/cache_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
char filename[512];
herr_t result;
hid_t fapl_id = -1;
hid_t test_fapl_id = -1;
hid_t file_id = -1;
hid_t fapl_id = H5I_INVALID_HID;
hid_t test_fapl_id = H5I_INVALID_HID;
hid_t file_id = H5I_INVALID_HID;
H5F_t *file_ptr = NULL;
H5C_t *cache_ptr = NULL;
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
Expand Down Expand Up @@ -499,7 +499,7 @@ static bool
check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
{
char filename[512];
hid_t file_id = -1;
hid_t file_id = H5I_INVALID_HID;
size_t max_size;
size_t min_clean_size;
size_t cur_size;
Expand Down Expand Up @@ -827,12 +827,12 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
int64_t min_accesses = 1000;
double min_hit_rate = 0.90;
bool dump_cache_size = false;
hid_t file_id = -1;
hid_t dataspace_id = -1;
hid_t file_id = H5I_INVALID_HID;
hid_t dataspace_id = H5I_INVALID_HID;
hid_t filespace_ids[NUM_DSETS];
hid_t memspace_id = -1;
hid_t memspace_id = H5I_INVALID_HID;
hid_t dataset_ids[NUM_DSETS];
hid_t properties = -1;
hid_t properties = H5I_INVALID_HID;
char dset_name[64];
int i, j, k, l, m, n;
herr_t status;
Expand Down Expand Up @@ -1622,7 +1622,7 @@ check_fapl_mdc_api_errs(void)
static char msg[128];
int i;
herr_t result;
hid_t fapl_id = -1;
hid_t fapl_id = H5I_INVALID_HID;
H5AC_cache_config_t default_config = H5AC__DEFAULT_CACHE_CONFIG;
H5AC_cache_config_t scratch;

Expand All @@ -1638,7 +1638,7 @@ check_fapl_mdc_api_errs(void)

H5E_BEGIN_TRY
{
result = H5Pget_mdc_config((hid_t)-1, &scratch);
result = H5Pget_mdc_config((hid_t)H5I_INVALID_HID, &scratch);
}
H5E_END_TRY

Expand Down Expand Up @@ -1713,7 +1713,7 @@ check_fapl_mdc_api_errs(void)

H5E_BEGIN_TRY
{
result = H5Pset_mdc_config((hid_t)-1, &default_config);
result = H5Pset_mdc_config((hid_t)H5I_INVALID_HID, &default_config);
}
H5E_END_TRY

Expand Down Expand Up @@ -1803,7 +1803,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
bool show_progress = false;
int i;
herr_t result;
hid_t file_id = -1;
hid_t file_id = H5I_INVALID_HID;
size_t max_size;
size_t min_clean_size;
size_t cur_size;
Expand Down Expand Up @@ -1868,7 +1868,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)

H5E_BEGIN_TRY
{
result = H5Fget_mdc_config((hid_t)-1, &scratch);
result = H5Fget_mdc_config((hid_t)H5I_INVALID_HID, &scratch);
}
H5E_END_TRY

Expand Down Expand Up @@ -1932,7 +1932,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)

H5E_BEGIN_TRY
{
result = H5Fset_mdc_config((hid_t)-1, &default_config);
result = H5Fset_mdc_config((hid_t)H5I_INVALID_HID, &default_config);
}
H5E_END_TRY

Expand Down Expand Up @@ -2000,7 +2000,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)

H5E_BEGIN_TRY
{
result = H5Fget_mdc_hit_rate((hid_t)-1, &hit_rate);
result = H5Fget_mdc_hit_rate((hid_t)H5I_INVALID_HID, &hit_rate);
}
H5E_END_TRY

Expand Down Expand Up @@ -2041,7 +2041,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)

H5E_BEGIN_TRY
{
result = H5Freset_mdc_hit_rate_stats((hid_t)-1);
result = H5Freset_mdc_hit_rate_stats((hid_t)H5I_INVALID_HID);
}
H5E_END_TRY

Expand All @@ -2062,7 +2062,8 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)

H5E_BEGIN_TRY
{
result = H5Fget_mdc_size((hid_t)-1, &max_size, &min_clean_size, &cur_size, &cur_num_entries);
result = H5Fget_mdc_size((hid_t)H5I_INVALID_HID, &max_size, &min_clean_size, &cur_size,
&cur_num_entries);
}
H5E_END_TRY

Expand Down Expand Up @@ -2143,8 +2144,8 @@ main(void)
{
unsigned nerrs = 0;
int express_test;
hid_t fcpl_id = -1;
hid_t fcpl2_id = -1;
hid_t fcpl_id = H5I_INVALID_HID;
hid_t fcpl2_id = H5I_INVALID_HID;
unsigned paged;

H5open();
Expand Down
Loading

0 comments on commit 7edb4e0

Please sign in to comment.