From de2440ae5f5227a8f513c4fef4c963990d6bb90f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 27 Jun 2019 22:38:20 -0700 Subject: Warning fixes: * fix for static/const flipped in H5Dint.c * Removed missing done target in H5Rint.c * Fixed misleading indentation in h5format_convert.c --- src/H5Dint.c | 4 ++-- src/H5Rint.c | 3 +-- tools/src/h5format_convert/h5format_convert.c | 10 ++++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index cd120d0..b517f8b 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -114,8 +114,8 @@ static hbool_t H5D_top_package_initialize_s = FALSE; /* Prefixes of VDS and external file from the environment variables * HDF5_EXTFILE_PREFIX and HDF5_VDS_PREFIX */ -const static char *H5D_prefix_ext_env = NULL; -const static char *H5D_prefix_vds_env = NULL; +static const char *H5D_prefix_ext_env = NULL; +static const char *H5D_prefix_vds_env = NULL; /*------------------------------------------------------------------------- diff --git a/src/H5Rint.c b/src/H5Rint.c index 8109ac0..2355ec1 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -84,12 +84,11 @@ H5R__init_package(void) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_NOAPI_NOINIT_NOERR /* Mark "top" of interface as initialized */ H5R_top_package_initialize_s = TRUE; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__init_package() */ diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c index b9ed9ce..5fb02f4 100644 --- a/tools/src/h5format_convert/h5format_convert.c +++ b/tools/src/h5format_convert/h5format_convert.c @@ -260,8 +260,9 @@ convert(hid_t fid, const char *dname) h5tools_setstatus(EXIT_FAILURE); goto error; } - else if(verbose_g) + else if(verbose_g) { HDfprintf(stdout, "Retrieve the dataset's chunk indexing type\n"); + } if(idx_type == H5D_CHUNK_IDX_BTREE) { if(verbose_g) @@ -269,8 +270,9 @@ convert(hid_t fid, const char *dname) h5tools_setstatus(EXIT_SUCCESS); goto done; } - else if (verbose_g) + else if(verbose_g) { HDfprintf(stdout, "Dataset's chunk indexing type is not version 1 B-tree\n"); + } break; @@ -302,8 +304,8 @@ convert(hid_t fid, const char *dname) if(noop_g) { if(verbose_g) HDfprintf(stdout, "Not converting the dataset\n"); - h5tools_setstatus(EXIT_SUCCESS); - goto done; + h5tools_setstatus(EXIT_SUCCESS); + goto done; } if(verbose_g) -- cgit v0.12 From 1c4101c6a77dd9223483dd9e3f7bec0f9e92f435 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 28 Jun 2019 00:17:33 -0700 Subject: Fixed various warnings in testhdf5 files. --- test/titerate.c | 2 +- test/tselect.c | 1 - test/tsohm.c | 80 +++++++++++++++++++++++++++++++++------------------------ 3 files changed, 47 insertions(+), 36 deletions(-) diff --git a/test/titerate.c b/test/titerate.c index 54e9b5e..716654d 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -939,7 +939,7 @@ static void test_links(hid_t fapl) *------------------------------------------------------------------------- */ static int -find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data) +find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_client_data) { int status = H5_ITER_CONT; searched_err_t *searched_err = (searched_err_t *)_client_data; diff --git a/test/tselect.c b/test/tselect.c index ad435cb..bbab868 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -14925,7 +14925,6 @@ test_sel_iter(void) hid_t sid; /* Dataspace ID */ hid_t iter_id; /* Dataspace selection iterator ID */ hsize_t dims1[] = {6, 12}; /* 2-D Dataspace dimensions */ - hsize_t dims2[] = {32}; /* 1-D dataspace dimensions */ hsize_t coord1[POINT1_NPOINTS][2]; /* Coordinates for point selection */ hsize_t start[2]; /* Hyperslab start */ hsize_t stride[2]; /* Hyperslab stride */ diff --git a/test/tsohm.c b/test/tsohm.c index 5c3707f..ef031c1 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -11,13 +11,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*********************************************************** -* -* Test program: tsohm -* -* Test Shared Object Header Messages -* -*************************************************************/ +/* + * Purpose: Test Shared Object Header Messages + */ #include "testhdf5.h" @@ -582,12 +578,12 @@ error: * * Purpose: Creates object headers that use a large datatype message. * - * Set test_file_closing to 1 to add file closing and reopening + * Set test_file_closing to TRUE to add file closing and reopening * whenever possible (to test that SOHMs are written correctly * on disk and not just in memory). * - * Return: Success: file ID (may not be the same one passed in) - * Failure: Negative + * Return: Success: file ID (may not be the same one passed in) + * Failure: H5I_INVALID_HID * * Programmer: James Laird * Monday, April 10, 2006 @@ -595,13 +591,13 @@ error: *------------------------------------------------------------------------- */ static hid_t -size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_closing) +size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_closing) { dtype1_struct wdata; dtype1_struct rdata; - hid_t dtype1_id = -1; - hid_t space_id = -1; - hid_t dset_id = -1; + hid_t dtype1_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; hsize_t dim1[1]; int x; @@ -635,7 +631,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos * local disks. Don't close and reopen if express testing is enabled. */ if(GetTestExpress() > 1) - test_file_closing = 0; + test_file_closing = FALSE; /* Intialize wdata */ HDmemset(&wdata, 0, sizeof(wdata)); @@ -718,6 +714,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos if(H5Dclose(dset_id) < 0) TEST_ERROR if(H5Tclose(dtype1_id) < 0) TEST_ERROR + return file; error: @@ -727,7 +724,8 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos H5Dclose(dset_id); H5Fclose(file); } H5E_END_TRY - return -1; + + return H5I_INVALID_HID; #undef TSOHM_S1H_VERIFY_DATA /* macro is exclusive to this function */ } /* size1_helper */ @@ -744,25 +742,29 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_clos *---------------------------------------------------------------------------- */ static h5_stat_size_t -getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned open_close, H5O_info_t *oinfo) +getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, hbool_t test_file_closing, H5O_info_t *oinfo) { - hid_t file = -1; + hid_t fid = H5I_INVALID_HID; herr_t ret; - file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id); - CHECK_I(file, "H5Fcreate"); + fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); - file = size1_helper(file, FILENAME, fapl_id, open_close); - CHECK_I(file, "size1_helper"); + /* If test_file_closing is TRUE, you will get back a different ID, + * which will need to be closed. The helper will close your passed-in + * ID. + */ + fid = size1_helper(fid, filename, fapl_id, test_file_closing); + CHECK(fid, H5I_INVALID_HID, "size1_helper"); - ret = H5Oget_info_by_name2(file, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); - CHECK_I(ret, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name2(fid, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); - ret = H5Fclose(file); - CHECK_I(ret, "H5Fclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - return h5_get_file_size(FILENAME, fapl_id); -} /* getsize_testsize1 */ + return h5_get_file_size(filename, fapl_id); +} /* getsize_testsize1() */ /*------------------------------------------------------------------------- @@ -784,13 +786,14 @@ test_sohm_size1(void) unsigned use_shared = 0; unsigned use_btree = 0; - unsigned open_close = 0; h5_stat_size_t file_sizes[9]; unsigned size_index = 0; hsize_t oh_sizes[3]; unsigned oh_size_index = 0; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ hsize_t norm_oh_size; +#endif /* Jira HDFFV-10646 */ hsize_t sohm_oh_size; hsize_t sohm_btree_oh_size; h5_stat_size_t norm_empty_filesize; @@ -826,6 +829,8 @@ test_sohm_size1(void) for (use_shared = 0; use_shared < 2; use_shared++) { for (use_btree = 0; use_btree < 2; use_btree++) { + hbool_t test_open_close; + /* cannot use btree indexing without shared messages; skip case */ if (use_btree && !use_shared) continue; @@ -860,8 +865,10 @@ test_sohm_size1(void) file_sizes[size_index++] = h5_get_file_size(FILENAME, fapl_id); /* size of populated file, with different populating behaviors */ - for (open_close = 0; open_close < 2; open_close++) - file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, open_close, &oinfo); + test_open_close = TRUE; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); + test_open_close = FALSE; + file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo); oh_sizes[oh_size_index++] = oinfo.hdr.space.total; ret = H5Pclose(fcpl_id); @@ -886,7 +893,9 @@ test_sohm_size1(void) norm_empty_filesize = file_sizes[0]; norm_final_filesize = file_sizes[1]; norm_final_filesize2 = file_sizes[2]; +#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */ norm_oh_size = oh_sizes[0]; +#endif /* Jira HDFFV-10646 */ sohm_empty_filesize = file_sizes[3]; sohm_final_filesize = file_sizes[4]; @@ -955,6 +964,7 @@ test_sohm_size1(void) * *--------------------------------------------------------------------------- */ +#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */ static void test_sohm_size_consistency_open_create(void) { @@ -1045,6 +1055,7 @@ test_sohm_size_consistency_open_create(void) ret = H5Pclose(fapl_id); CHECK_I(ret, "H5Pclose"); } /* test_sohm_size_consistency_open_create */ +#endif /* Jira HDFFV-10645 */ /*------------------------------------------------------------------------- @@ -1175,7 +1186,8 @@ sohm_attr_helper(hid_t fcpl_id) static void test_sohm_attrs(void) { - hid_t fcpl_id; + hid_t bad_fid = H5I_INVALID_HID; + hid_t fcpl_id = H5I_INVALID_HID; unsigned i = 0; #define TSOHM_TSA_NFLAGS_1 7 unsigned flags1[TSOHM_TSA_NFLAGS_1] = { @@ -1293,8 +1305,8 @@ test_sohm_attrs(void) ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2); CHECK_I(ret, "H5Pset_shared_mesg_nindexes"); - ret = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); - VERIFY(ret, -1, "H5Fcreate"); + bad_fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT); + VERIFY(bad_fid, H5I_INVALID_HID, "H5Fcreate"); ret = H5Pclose(fcpl_id); CHECK_I(ret, "H5Pclose"); -- cgit v0.12