From 65d8c9347010771473b53c91adcec2f281772213 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 19 Jun 2023 01:13:38 -0400 Subject: Many fixes to various compiler warnings (#3124) * Fixed various -Wmissing-variable-declarations by adding static keyword * In a few cases, renamed the variable suffix from _g to _s. * Fixed some -Wmissing-variable-declarations by using different declaration macros * Fixed various -Wconditional-uninitialized warnings by just initializing variable to zero * Fixed various -Wcomma warnings * Fixed clang -Wstrict-prototypes warnings * Fixed various -Wunused-variable warnings * Updated some casts to fix the only 3 -Wcast-qual warnings * Fixed the only -Wsometimes-uninitialized warning --- c++/examples/h5tutr_extend.cpp | 13 +- c++/examples/readdata.cpp | 4 +- c++/test/ttypes.cpp | 43 +-- config/cmake/ConfigureChecks.cmake | 2 +- config/cmake/HDFTests.c | 4 +- doxygen/examples/H5Fclose.c | 2 +- doxygen/examples/H5Fcreate.c | 2 +- doxygen/examples/hello_hdf5.c | 2 +- examples/h5_cmprss.c | 2 +- examples/h5_crtatt.c | 2 +- examples/h5_crtdat.c | 2 +- examples/h5_crtgrp.c | 2 +- examples/h5_crtgrpar.c | 2 +- examples/h5_crtgrpd.c | 2 +- examples/h5_extlink.c | 6 +- examples/h5_rdwt.c | 2 +- examples/h5_vds-exc.c | 2 +- examples/h5_vds-exclim.c | 2 +- examples/h5_vds.c | 2 +- hl/examples/ex_image1.c | 2 +- hl/examples/ex_image2.c | 4 +- hl/src/H5DS.c | 10 +- hl/test/test_ld.c | 17 +- hl/test/test_packet_vlen.c | 2 +- hl/tools/gif2h5/decompress.c | 4 +- hl/tools/gif2h5/hdf2gif.c | 2 +- hl/tools/h5watch/h5watch.c | 2 +- src/H5.c | 4 +- src/H5Dbtree.c | 2 +- src/H5Dchunk.c | 8 +- src/H5EA.c | 2 +- src/H5FDint.c | 20 +- src/H5FL.c | 2 +- src/H5Fsfile.c | 16 +- src/H5HFiter.c | 2 +- src/H5HFsection.c | 2 +- src/H5Iint.c | 10 +- src/H5MFsection.c | 2 +- src/H5Ocache_image.c | 2 +- src/H5Pdxpl.c | 4 +- src/H5VLpassthru.c | 2 +- test/accum.c | 2 +- test/accum_swmr_reader.c | 2 +- test/app_ref.c | 10 +- test/btree2.c | 2 +- test/cache.c | 58 ++--- test/cache_api.c | 2 +- test/cache_common.c | 16 +- test/cache_image.c | 2 +- test/cache_logging.c | 2 +- test/cache_tagging.c | 10 +- test/chunk_info.c | 14 +- test/cmpd_dset.c | 2 +- test/cross_read.c | 2 +- test/dangle.c | 2 +- test/del_many_dense_attrs.c | 2 +- test/direct_chunk.c | 4 +- test/dsets.c | 60 ++--- test/dt_arith.c | 2 +- test/dtypes.c | 37 ++- test/earray.c | 2 +- test/efc.c | 2 +- test/enum.c | 2 +- test/err_compat.c | 10 +- test/error_test.c | 32 +-- test/event_set.c | 4 +- test/extend.c | 2 +- test/farray.c | 2 +- test/fheap.c | 2 +- test/file_image.c | 18 +- test/fillval.c | 8 +- test/filter_fail.c | 2 +- test/filter_plugin.c | 18 +- test/flush1.c | 6 +- test/flush2.c | 6 +- test/flushrefresh.c | 2 +- test/freespace.c | 2 +- test/gen_bad_compound.c | 2 +- test/gen_mergemsg.c | 2 +- test/genall5.c | 4 +- test/getname.c | 2 +- test/gheap.c | 2 +- test/istore.c | 2 +- test/lheap.c | 2 +- test/links.c | 110 ++++---- test/links_env.c | 8 +- test/mdset.c | 2 +- test/mf.c | 6 +- test/mount.c | 5 +- test/mtime.c | 2 +- test/ntypes.c | 2 +- test/objcopy.c | 4 +- test/objcopy_ref.c | 14 +- test/ohdr.c | 2 +- test/onion.c | 13 +- test/page_buffer.c | 2 +- test/reserved.c | 2 +- test/set_extent.c | 4 +- test/stab.c | 2 +- test/swmr.c | 8 +- test/tattr.c | 405 +++++++++++++++-------------- test/tcheck_version.c | 6 +- test/tcoords.c | 2 +- test/testframe.c | 2 +- test/tfile.c | 8 +- test/tgenprop.c | 14 +- test/th5s.c | 12 +- test/tid.c | 2 +- test/tmeta.c | 4 +- test/tsohm.c | 57 ++-- test/unlink.c | 6 +- test/unregister.c | 4 +- test/use_disable_mdc_flushes.c | 18 +- test/vds.c | 6 +- test/vds_env.c | 2 +- test/vfd.c | 34 +-- test/vol.c | 2 +- testpar/t_filters_parallel.c | 4 +- testpar/t_init_term.c | 2 +- testpar/t_pflush1.c | 2 +- testpar/t_pflush2.c | 2 +- testpar/t_prestart.c | 2 +- testpar/t_pshutdown.c | 2 +- tools/lib/h5diff_array.c | 2 +- tools/lib/h5tools.c | 1 - tools/lib/h5tools_ref.c | 4 +- tools/lib/io_timer.c | 2 +- tools/src/h5copy/h5copy.c | 10 +- tools/src/h5import/h5import.h | 30 +-- tools/src/h5jam/h5jam.c | 8 +- tools/src/h5repack/h5repack_main.c | 8 +- tools/src/h5stat/h5stat.c | 12 +- tools/src/misc/h5mkgrp.c | 2 +- tools/test/h5copy/dynlib_copy.c | 2 +- tools/test/h5format_convert/h5fc_gentest.c | 18 +- tools/test/h5jam/getub.c | 2 +- tools/test/h5repack/dynlib_rpk.c | 2 +- tools/test/h5repack/h5repacktst.c | 40 ++- tools/test/misc/h5clear_gentest.c | 2 +- tools/test/misc/repart_test.c | 4 +- tools/test/perform/chunk.c | 2 +- tools/test/perform/chunk_cache.c | 2 +- tools/test/perform/direct_write_perf.c | 2 +- tools/test/perform/perf_meta.c | 30 +-- 144 files changed, 798 insertions(+), 757 deletions(-) diff --git a/c++/examples/h5tutr_extend.cpp b/c++/examples/h5tutr_extend.cpp index ff5ddab..3916f9a 100644 --- a/c++/examples/h5tutr_extend.cpp +++ b/c++/examples/h5tutr_extend.cpp @@ -99,7 +99,7 @@ main(void) // --------------------------------------- int rdata[10][3]; - int i, j, rank, rank_chunk; + int i, j, rank; hsize_t chunk_dimsr[2], dimsr[2]; // Open the file and dataset. @@ -111,12 +111,13 @@ main(void) prop = dataset->getCreatePlist(); // Get information to obtain memory dataspace. - rank = filespace->getSimpleExtentNdims(); - herr_t status_n = filespace->getSimpleExtentDims(dimsr); + rank = filespace->getSimpleExtentNdims(); + (void)filespace->getSimpleExtentDims(dimsr); - if (H5D_CHUNKED == prop.getLayout()) - rank_chunk = prop.getChunk(rank, chunk_dimsr); - cout << "rank chunk = " << rank_chunk << endl; + if (H5D_CHUNKED == prop.getLayout()) { + int rank_chunk = prop.getChunk(rank, chunk_dimsr); + cout << "rank chunk = " << rank_chunk << endl; + } memspace = new DataSpace(rank, dimsr, NULL); dataset->read(rdata, PredType::NATIVE_INT, *memspace, *filespace); diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp index 1deed36..bfc03ee 100644 --- a/c++/examples/readdata.cpp +++ b/c++/examples/readdata.cpp @@ -84,7 +84,7 @@ main(void) * Get order of datatype and print message if it's a little endian. */ H5std_string order_string; - H5T_order_t order = intype.getOrder(order_string); + (void)intype.getOrder(order_string); cout << order_string << endl; /* @@ -109,7 +109,7 @@ main(void) * display them. */ hsize_t dims_out[2]; - int ndims = dataspace.getSimpleExtentDims(dims_out, NULL); + (void)dataspace.getSimpleExtentDims(dims_out, NULL); cout << "rank " << rank << ", dimensions " << (unsigned long)(dims_out[0]) << " x " << (unsigned long)(dims_out[1]) << endl; diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index ff86213..16ed192 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -44,8 +44,8 @@ using namespace H5; /* #include "H5Tpkg.h" */ -const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", - "encode_decode.h5", "h5_type_operators.h5", NULL}; +static const char *FILENAME[] = {"dtypes1.h5", "dtypes2.h5", "dtypes3.h5", "dtypes4.h5", + "encode_decode.h5", "h5_type_operators.h5", NULL}; typedef enum flt_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER } flt_t; @@ -462,11 +462,16 @@ test_query() // Create a enumerate datatype EnumType tid2(sizeof(short)); - tid2.insert("RED", (enum_val = 0, &enum_val)); - tid2.insert("GREEN", (enum_val = 1, &enum_val)); - tid2.insert("BLUE", (enum_val = 2, &enum_val)); - tid2.insert("ORANGE", (enum_val = 3, &enum_val)); - tid2.insert("YELLOW", (enum_val = 4, &enum_val)); + enum_val = 0; + tid2.insert("RED", &enum_val); + enum_val = 1; + tid2.insert("GREEN", &enum_val); + enum_val = 2; + tid2.insert("BLUE", &enum_val); + enum_val = 3; + tid2.insert("ORANGE", &enum_val); + enum_val = 4; + tid2.insert("YELLOW", &enum_val); // Query member number and member index by name, for compound type int nmembs = tid1.getNmembers(); @@ -859,11 +864,16 @@ test_encode_decode() // Create a enumerate datatype EnumType enumtyp(sizeof(short)); - enumtyp.insert("RED", (enum_val = 0, &enum_val)); - enumtyp.insert("GREEN", (enum_val = 1, &enum_val)); - enumtyp.insert("BLUE", (enum_val = 2, &enum_val)); - enumtyp.insert("ORANGE", (enum_val = 3, &enum_val)); - enumtyp.insert("YELLOW", (enum_val = 4, &enum_val)); + enum_val = 0; + enumtyp.insert("RED", &enum_val); + enum_val = 1; + enumtyp.insert("GREEN", &enum_val); + enum_val = 2; + enumtyp.insert("BLUE", &enum_val); + enum_val = 3; + enumtyp.insert("ORANGE", &enum_val); + enum_val = 4; + enumtyp.insert("YELLOW", &enum_val); // Encode compound type in a buffer enumtyp.encode(); @@ -1060,9 +1070,12 @@ test_operators() // Create an enumerate datatype EnumType enumtyp(sizeof(short)); - enumtyp.insert("RED", (enum_val = 0, &enum_val)); - enumtyp.insert("GREEN", (enum_val = 1, &enum_val)); - enumtyp.insert("BLUE", (enum_val = 2, &enum_val)); + enum_val = 0; + enumtyp.insert("RED", &enum_val); + enum_val = 1; + enumtyp.insert("GREEN", &enum_val); + enum_val = 2; + enumtyp.insert("BLUE", &enum_val); // Verify that operator== and operator!= work properly verify_val(cmptyp == enumtyp, false, "DataType::operator==", __LINE__, __FILE__); diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8c401d9..1fe5be4 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -831,7 +831,7 @@ if (HDF5_BUILD_FORTRAN) #define C_LDBL_DIG DECIMAL_DIG\n\ #else\n\ #define C_LDBL_DIG LDBL_DIG\n\ -#endif\n\nint main() {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n +#endif\n\nint main(void) {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n " ) diff --git a/config/cmake/HDFTests.c b/config/cmake/HDFTests.c index 96460d7..3897390 100644 --- a/config/cmake/HDFTests.c +++ b/config/cmake/HDFTests.c @@ -12,7 +12,7 @@ /* A simple test program to see if a function "works" */ -#define SIMPLE_TEST(x) int main(){ x; return 0; } +#define SIMPLE_TEST(x) int main(void){ x; return 0; } #ifdef HAVE_ATTRIBUTE @@ -93,7 +93,7 @@ int main () #include -int main() +int main(void) { off64_t n = 0; return (int)n; diff --git a/doxygen/examples/H5Fclose.c b/doxygen/examples/H5Fclose.c index 525bad3..8c2ef08 100644 --- a/doxygen/examples/H5Fclose.c +++ b/doxygen/examples/H5Fclose.c @@ -1,7 +1,7 @@ #include "hdf5.h" int -main() +main(void) { hid_t file; if ((file = H5Fcreate("foo.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) diff --git a/doxygen/examples/H5Fcreate.c b/doxygen/examples/H5Fcreate.c index 525bad3..8c2ef08 100644 --- a/doxygen/examples/H5Fcreate.c +++ b/doxygen/examples/H5Fcreate.c @@ -1,7 +1,7 @@ #include "hdf5.h" int -main() +main(void) { hid_t file; if ((file = H5Fcreate("foo.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) diff --git a/doxygen/examples/hello_hdf5.c b/doxygen/examples/hello_hdf5.c index a37d39f..f078090 100644 --- a/doxygen/examples/hello_hdf5.c +++ b/doxygen/examples/hello_hdf5.c @@ -1,7 +1,7 @@ #include "hdf5.h" int -main() +main(void) { herr_t retval; unsigned majnum, minnum, relnum; diff --git a/examples/h5_cmprss.c b/examples/h5_cmprss.c index 9aefe32..ffd3191 100644 --- a/examples/h5_cmprss.c +++ b/examples/h5_cmprss.c @@ -23,7 +23,7 @@ #define DIM1 20 int -main() +main(void) { hid_t file_id, dataset_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_crtatt.c b/examples/h5_crtatt.c index f33e1f1..8534703f 100644 --- a/examples/h5_crtatt.c +++ b/examples/h5_crtatt.c @@ -19,7 +19,7 @@ #define FILE "dset.h5" int -main() +main(void) { hid_t file_id, dataset_id, attribute_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_crtdat.c b/examples/h5_crtdat.c index 8de9077..d8ac072 100644 --- a/examples/h5_crtdat.c +++ b/examples/h5_crtdat.c @@ -19,7 +19,7 @@ #define FILE "dset.h5" int -main() +main(void) { hid_t file_id, dataset_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_crtgrp.c b/examples/h5_crtgrp.c index f9066f4..3517bf3 100644 --- a/examples/h5_crtgrp.c +++ b/examples/h5_crtgrp.c @@ -19,7 +19,7 @@ #define FILE "group.h5" int -main() +main(void) { hid_t file_id, group_id; /* identifiers */ diff --git a/examples/h5_crtgrpar.c b/examples/h5_crtgrpar.c index f397155..1b47429 100644 --- a/examples/h5_crtgrpar.c +++ b/examples/h5_crtgrpar.c @@ -19,7 +19,7 @@ #define FILE "groups.h5" int -main() +main(void) { hid_t file_id, group1_id, group2_id, group3_id; /* identifiers */ diff --git a/examples/h5_crtgrpd.c b/examples/h5_crtgrpd.c index 364a3b9..f1750d6 100644 --- a/examples/h5_crtgrpd.c +++ b/examples/h5_crtgrpd.c @@ -19,7 +19,7 @@ #define FILE "groups.h5" int -main() +main(void) { hid_t file_id, group_id, dataset_id, dataspace_id; /* identifiers */ diff --git a/examples/h5_extlink.c b/examples/h5_extlink.c index 8d3fc8c..e1f02cf 100644 --- a/examples/h5_extlink.c +++ b/examples/h5_extlink.c @@ -411,7 +411,7 @@ UD_hard_create(const char *link_name, hid_t loc_group, const void *udata, size_t goto done; } - token = *((H5O_token_t *)udata); + token = *((const H5O_token_t *)udata); //! [H5Oopen_by_token_snip] @@ -459,7 +459,7 @@ UD_hard_delete(const char *link_name, hid_t loc_group, const void *udata, size_t goto done; } - token = *((H5O_token_t *)udata); + token = *((const H5O_token_t *)udata); /* Open the object this link points to */ target_obj = H5Oopen_by_token(loc_group, token); @@ -498,7 +498,7 @@ UD_hard_traverse(const char *link_name, hid_t cur_group, const void *udata, size if (udata_size != sizeof(H5O_token_t)) return H5I_INVALID_HID; - token = *((H5O_token_t *)udata); + token = *((const H5O_token_t *)udata); /* Open the object by token. If H5Oopen_by_token fails, ret_value will * be negative to indicate that the traversal function failed. diff --git a/examples/h5_rdwt.c b/examples/h5_rdwt.c index 679dc46..9947f59 100644 --- a/examples/h5_rdwt.c +++ b/examples/h5_rdwt.c @@ -19,7 +19,7 @@ #define FILE "dset.h5" int -main() +main(void) { hid_t file_id, dataset_id; /* identifiers */ diff --git a/examples/h5_vds-exc.c b/examples/h5_vds-exc.c index fa6b720..01597cc 100644 --- a/examples/h5_vds-exc.c +++ b/examples/h5_vds-exc.c @@ -49,7 +49,7 @@ main(void) kdims[3] = {KDIM0, KDIM1, KDIM2}, kdims_max[3] = {H5S_UNLIMITED, KDIM1, KDIM2}, ndims[3] = {NDIM0, NDIM1, NDIM2}, ndims_max[3] = {H5S_UNLIMITED, NDIM1, NDIM2}, start[3], /* Hyperslab parameters */ - stride[3], count[3], block[3]; + count[3], block[3]; hsize_t start_out[3], stride_out[3], count_out[3], block_out[3]; int k = 2; int n = 3; diff --git a/examples/h5_vds-exclim.c b/examples/h5_vds-exclim.c index 58ed1f8..4fb5536 100644 --- a/examples/h5_vds-exclim.c +++ b/examples/h5_vds-exclim.c @@ -48,7 +48,7 @@ main(void) herr_t status; hsize_t vdsdims[3] = {VDSDIM0, VDSDIM1, VDSDIM2}, kdims[3] = {KDIM0, KDIM1, KDIM2}, ndims[3] = {NDIM0, NDIM1, NDIM2}, start[3], /* Hyperslab parameters */ - stride[3], count[3], block[3]; + count[3], block[3]; hsize_t start_out[3], stride_out[3], count_out[3], block_out[3]; int k = 2; int n = 3; diff --git a/examples/h5_vds.c b/examples/h5_vds.c index ceb4956..96bd8a2 100644 --- a/examples/h5_vds.c +++ b/examples/h5_vds.c @@ -55,7 +55,7 @@ main(void) hsize_t vdsdims[2] = {VDSDIM0, VDSDIM1}, /* Virtual datasets dimension */ dims[1] = {DIM0}, /* Source datasets dimensions */ start[2], /* Hyperslab parameters */ - stride[2], count[2], block[2]; + count[2], block[2]; hsize_t start_out[2], stride_out[2], count_out[2], block_out[2]; int wdata[DIM0], /* Write buffer for source dataset */ rdata[VDSDIM0][VDSDIM1], /* Read buffer for virtual dataset */ diff --git a/hl/examples/ex_image1.c b/hl/examples/ex_image1.c index d9080cb..49a9093 100644 --- a/hl/examples/ex_image1.c +++ b/hl/examples/ex_image1.c @@ -16,7 +16,7 @@ #define WIDTH 400 #define HEIGHT 200 #define PAL_ENTRIES 9 -unsigned char buf[WIDTH * HEIGHT]; +static unsigned char buf[WIDTH * HEIGHT]; int main(void) diff --git a/hl/examples/ex_image2.c b/hl/examples/ex_image2.c index 579b126..9ce1746 100644 --- a/hl/examples/ex_image2.c +++ b/hl/examples/ex_image2.c @@ -22,8 +22,8 @@ #define PAL_NAME "palette" #define PAL_ENTRIES 256 -static int read_data(const char *file_name, hsize_t *width, hsize_t *height); -unsigned char *gbuf = NULL; /* global buffer for image data */ +static int read_data(const char *file_name, hsize_t *width, hsize_t *height); +static unsigned char *gbuf = NULL; /* global buffer for image data */ int main(void) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 87973fa..c576573 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -152,14 +152,14 @@ H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx) ds_list_t *dsbuf = NULL; /* array of attribute data in the DS pointing to the dataset */ ds_list_t *dsbuf_w = NULL; /* array of "REFERENCE_LIST" attribute data to write when adding new reference to a dataset */ - hobj_ref_t ref_to_ds; /* reference to the DS */ - hobj_ref_t ref_j; /* iterator reference */ + hobj_ref_t ref_to_ds = HADDR_UNDEF; /* reference to the DS */ + hobj_ref_t ref_j; /* iterator reference */ /* Variables to be used when new references are used */ nds_list_t ndsl; - nds_list_t *ndsbuf = NULL; - nds_list_t *ndsbuf_w = NULL; - H5R_ref_t nref_to_ds; + nds_list_t *ndsbuf = NULL; + nds_list_t *ndsbuf_w = NULL; + H5R_ref_t nref_to_ds = {0}; H5R_ref_t nref_j; hbool_t is_new_ref; diff --git a/hl/test/test_ld.c b/hl/test/test_ld.c index b056225..78af519 100644 --- a/hl/test/test_ld.c +++ b/hl/test/test_ld.c @@ -52,7 +52,7 @@ * Varies from 10->13; 10->9, 10->10, 10->1, 10->11 */ #define ONE_NTESTS 5 -int one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1}; +static int one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1}; /* * Test variations (retained original) for two-dimensional dataset: @@ -61,7 +61,8 @@ int one_tests[ONE_NTESTS] = {3, -1, 0, -9, 1}; * {4,10}->{4,12}; {4,10}->{4,9}; {4,10}->{4,10} */ #define TWO_NTESTS 9 -int two_tests[TWO_NTESTS][2] = {{2, 2}, {2, -1}, {2, 0}, {-1, 2}, {-1, -1}, {-1, 0}, {0, 2}, {0, -1}, {0, 0}}; +static int two_tests[TWO_NTESTS][2] = {{2, 2}, {2, -1}, {2, 0}, {-1, 2}, {-1, -1}, + {-1, 0}, {0, 2}, {0, -1}, {0, 0}}; /* Verify that the two input values are the same */ #define VERIFY_EQUAL(_x, _y) \ @@ -210,12 +211,12 @@ typedef struct test_valid_fields2 { /* Temporary buffers for tests: test_LD_elmts_one() & test_LD_elmts_two() */ #define TEST_BUF_SIZE 100 -int *iibuf; /* buffer for storing retrieved elements */ -int *ibuf; /* buffer for storing retrieved elements (integer) */ -set_t *cbuf; /* buffer for storing retrieved elements (compound) */ -set_t *ccbuf; /* buffer for storing retrieved elements (compound) */ -test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */ -test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */ +static int *iibuf; /* buffer for storing retrieved elements */ +static int *ibuf; /* buffer for storing retrieved elements (integer) */ +static set_t *cbuf; /* buffer for storing retrieved elements (compound) */ +static set_t *ccbuf; /* buffer for storing retrieved elements (compound) */ +static test_valid_fields1 *vbuf1; /* buffer for storing retrieved elements (FIELDS1) */ +static test_valid_fields2 *vbuf2; /* buffer for storing retrieved elements (FIELDS2) */ /* ********************************************************************************* diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 5e06c85..1d6195d 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -763,7 +763,7 @@ error: /* An error has occurred. Clean up and exit. */ */ #define ATTR_RANK 1 #define ATTR_DIM 3 -int attr_data[ATTR_DIM] = {256, 11945, -22107}; /* values to be written to attr */ +static int attr_data[ATTR_DIM] = {256, 11945, -22107}; /* values to be written to attr */ static int adding_attribute(hid_t fid, const char *table_name, const char *attr_name) diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index dabadf5..e87a60c 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -54,8 +54,8 @@ GIFBYTE *Raster; /* The raster data stream, unblocked */ /* The hash table used by the decompressor */ -int *Prefix; -int *Suffix; +static int *Prefix; +static int *Suffix; /* An output array used by the decompressor */ diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 2fd9756..8805c80 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -49,7 +49,7 @@ leave(int ret) HDexit(ret); } -FILE *fpGif = NULL; +static FILE *fpGif = NULL; int main(int argc, char **argv) { diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c index 248fb90..102ff93 100644 --- a/hl/tools/h5watch/h5watch.c +++ b/hl/tools/h5watch/h5watch.c @@ -27,7 +27,7 @@ * This tool uses H5LD_memb_t data structure declared in H5LDprivate.h */ -const char *progname = "h5watch"; /* tool name */ +static const char *progname = "h5watch"; /* tool name */ static char *g_list_of_fields = NULL; /* command line input for "list_of_fields" */ static char *g_dup_fields = NULL; /* copy of "list_of_fields" */ static H5LD_memb_t **g_listv = NULL; /* vector info for "list_of_fields" */ diff --git a/src/H5.c b/src/H5.c index daaaf66..12c162a 100644 --- a/src/H5.c +++ b/src/H5.c @@ -70,8 +70,8 @@ static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *fla /*****************************/ /* Library incompatible release versions, develop releases are incompatible by design */ -const unsigned VERS_RELEASE_EXCEPTIONS[] = {0}; -const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 1; +static const unsigned VERS_RELEASE_EXCEPTIONS[] = {0}; +static const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 1; /* statically initialize block for pthread_once call used in initializing */ /* the first global mutex */ diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 7da6b90..a1eb7ca 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -157,7 +157,7 @@ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{ /*****************************/ /* inherits B-tree like properties from H5B */ -H5B_class_t H5B_BTREE[1] = {{ +static H5B_class_t H5B_BTREE[1] = {{ H5B_CHUNK_ID, /*id */ sizeof(H5D_btree_key_t), /*sizeof_nkey */ H5D__btree_get_shared, /*get_shared */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 840b1ce..a26eb04 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -346,7 +346,7 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ /*******************/ /* "nonexistent" storage layout I/O ops */ -const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = { +static const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = { {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5D__nonexistent_readvv, NULL, NULL, NULL, NULL}}; /* Declare a free list to manage the H5F_rdcc_ent_ptr_t sequence information */ @@ -356,7 +356,7 @@ H5FL_SEQ_DEFINE_STATIC(H5D_rdcc_ent_ptr_t); H5FL_DEFINE_STATIC(H5D_rdcc_ent_t); /* Declare a free list to manage the H5D_chunk_info_t struct */ -H5FL_DEFINE(H5D_chunk_map_t); +H5FL_DEFINE_STATIC(H5D_chunk_map_t); /* Declare a free list to manage the H5D_piece_info_t struct */ H5FL_DEFINE(H5D_piece_info_t); @@ -2700,7 +2700,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info) /* Different blocks depending on whether we're using selection I/O */ if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) { - size_t num_chunks; + size_t num_chunks = 0; size_t element_sizes[2] = {dset_info->type_info.src_type_size, 0}; void *bufs[2] = {dset_info->buf.vp, NULL}; @@ -3021,7 +3021,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info) /* Different blocks depending on whether we're using selection I/O */ if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) { - size_t num_chunks; + size_t num_chunks = 0; size_t element_sizes[2] = {dset_info->type_info.dst_type_size, 0}; const void *bufs[2] = {dset_info->buf.cvp, NULL}; diff --git a/src/H5EA.c b/src/H5EA.c index 15b0407..d29f9ce 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -97,7 +97,7 @@ const H5EA_class_t *const H5EA_client_class_g[] = { H5FL_DEFINE_STATIC(H5EA_t); /* Declare a PQ free list to manage the element */ -H5FL_BLK_DEFINE(ea_native_elmt); +H5FL_BLK_DEFINE_STATIC(ea_native_elmt); /*------------------------------------------------------------------------- * Function: H5EA__new diff --git a/src/H5FDint.c b/src/H5FDint.c index 41096ab..847941f 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -357,8 +357,8 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs hbool_t extend_sizes = FALSE; hbool_t extend_types = FALSE; uint32_t i; - size_t size; - H5FD_mem_t type; + size_t size = 0; + H5FD_mem_t type = H5FD_MEM_DEFAULT; hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */ herr_t ret_value = SUCCEED; /* Return value */ @@ -573,8 +573,8 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr hbool_t extend_sizes = FALSE; hbool_t extend_types = FALSE; uint32_t i; - size_t size; - H5FD_mem_t type; + size_t size = 0; + H5FD_mem_t type = H5FD_MEM_DEFAULT; hid_t dxpl_id; /* DXPL for operation */ haddr_t eoa = HADDR_UNDEF; /* EOA for file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -761,9 +761,9 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin hbool_t extend_sizes = FALSE; hbool_t extend_bufs = FALSE; uint32_t i; - size_t element_size; - void *buf; - hbool_t use_vector = FALSE; + size_t element_size = 0; + void *buf = NULL; + hbool_t use_vector = FALSE; haddr_t addrs_local[H5FD_LOCAL_VECTOR_LEN]; haddr_t *addrs = addrs_local; size_t sizes_local[H5FD_LOCAL_VECTOR_LEN]; @@ -1408,9 +1408,9 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui hbool_t extend_sizes = FALSE; hbool_t extend_bufs = FALSE; uint32_t i; - size_t element_size; - const void *buf; - hbool_t use_vector = FALSE; + size_t element_size = 0; + const void *buf = NULL; + hbool_t use_vector = FALSE; haddr_t addrs_local[H5FD_LOCAL_VECTOR_LEN]; haddr_t *addrs = addrs_local; size_t sizes_local[H5FD_LOCAL_VECTOR_LEN]; diff --git a/src/H5FL.c b/src/H5FL.c index 9cc8dd2..e68f33e 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -149,7 +149,7 @@ static int H5FL__fac_term_all(void); H5FL_DEFINE(H5FL_blk_node_t); /* Declare a free list to manage the H5FL_fac_gc_node_t struct */ -H5FL_DEFINE(H5FL_fac_gc_node_t); +H5FL_DEFINE_STATIC(H5FL_fac_gc_node_t); /* Declare a free list to manage the H5FL_fac_head_t struct */ H5FL_DEFINE(H5FL_fac_head_t); diff --git a/src/H5Fsfile.c b/src/H5Fsfile.c index 978d4dc..2cf75d0 100644 --- a/src/H5Fsfile.c +++ b/src/H5Fsfile.c @@ -35,7 +35,7 @@ typedef struct H5F_sfile_node_t { H5FL_DEFINE_STATIC(H5F_sfile_node_t); /* Declare a local variable to track the shared file information */ -H5F_sfile_node_t *H5F_sfile_head_g = NULL; +static H5F_sfile_node_t *H5F_sfile_head_s = NULL; /*------------------------------------------------------------------------- * Function: H5F_sfile_assert_num @@ -56,14 +56,14 @@ H5F_sfile_assert_num(unsigned n) if (n == 0) { /* Sanity checking */ - HDassert(H5F_sfile_head_g == NULL); + HDassert(H5F_sfile_head_s == NULL); } /* end if */ else { unsigned count; /* Number of open shared files */ H5F_sfile_node_t *curr; /* Current shared file node */ /* Iterate through low-level files for matching low-level file info */ - curr = H5F_sfile_head_g; + curr = H5F_sfile_head_s; count = 0; while (curr) { /* Increment # of open shared file structs */ @@ -111,8 +111,8 @@ H5F__sfile_add(H5F_shared_t *shared) new_shared->shared = shared; /* Prepend to list of shared files open */ - new_shared->next = H5F_sfile_head_g; - H5F_sfile_head_g = new_shared; + new_shared->next = H5F_sfile_head_s; + H5F_sfile_head_s = new_shared; done: FUNC_LEAVE_NOAPI(ret_value) @@ -143,7 +143,7 @@ H5F__sfile_search(H5FD_t *lf) HDassert(lf); /* Iterate through low-level files for matching low-level file info */ - curr = H5F_sfile_head_g; + curr = H5F_sfile_head_s; while (curr) { /* Check for match */ if (0 == H5FD_cmp(curr->shared->lf, lf)) @@ -183,7 +183,7 @@ H5F__sfile_remove(H5F_shared_t *shared) /* Locate shared file node with correct shared file */ last = NULL; - curr = H5F_sfile_head_g; + curr = H5F_sfile_head_s; while (curr && curr->shared != shared) { /* Advance to next node */ last = curr; @@ -200,7 +200,7 @@ H5F__sfile_remove(H5F_shared_t *shared) last->next = curr->next; else /* Removing head node in list */ - H5F_sfile_head_g = curr->next; + H5F_sfile_head_s = curr->next; /* Release the shared file node struct */ /* (the shared file info itself is freed elsewhere) */ diff --git a/src/H5HFiter.c b/src/H5HFiter.c index 6d40979..7794eaf 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -64,7 +64,7 @@ /*******************/ /* Declare a free list to manage the H5HF_block_loc_t struct */ -H5FL_DEFINE(H5HF_block_loc_t); +H5FL_DEFINE_STATIC(H5HF_block_loc_t); /*------------------------------------------------------------------------- * Function: H5HF__man_iter_init diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 8ec3d35..fae6f1d 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -265,7 +265,7 @@ H5FS_section_class_t H5HF_FSPACE_SECT_CLS_INDIRECT[1] = {{ }}; /* Declare a free list to manage the H5HF_free_section_t struct */ -H5FL_DEFINE(H5HF_free_section_t); +H5FL_DEFINE_STATIC(H5HF_free_section_t); /*****************************/ /* Library Private Variables */ diff --git a/src/H5Iint.c b/src/H5Iint.c index 6bf32d7..ca54af7 100644 --- a/src/H5Iint.c +++ b/src/H5Iint.c @@ -92,7 +92,7 @@ int H5I_next_type_g = (int)H5I_NTYPES; H5FL_DEFINE_STATIC(H5I_id_info_t); /* Whether deletes are actually marks (for mark-and-sweep) */ -hbool_t H5I_marking_g = FALSE; +static hbool_t H5I_marking_s = FALSE; /*****************************/ /* Library Private Variables */ @@ -323,7 +323,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) */ /* Set marking flag */ - H5I_marking_g = TRUE; + H5I_marking_s = TRUE; /* Mark nodes for deletion */ HASH_ITER(hh, udata.type_info->hash_table, item, tmp) @@ -334,7 +334,7 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) } /* Unset marking flag */ - H5I_marking_g = FALSE; + H5I_marking_s = FALSE; /* Perform sweep */ HASH_ITER(hh, udata.type_info->hash_table, item, tmp) @@ -916,7 +916,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id) HASH_FIND(hh, type_info->hash_table, &id, sizeof(hid_t), info); if (info) { HDassert(!info->marked); - if (!H5I_marking_g) + if (!H5I_marking_s) HASH_DELETE(hh, type_info->hash_table, info); else info->marked = TRUE; @@ -932,7 +932,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id) ret_value = (void *)info->object; H5_GCC_CLANG_DIAG_ON("cast-qual") - if (!H5I_marking_g) + if (!H5I_marking_s) info = H5FL_FREE(H5I_id_info_t, info); /* Decrement the number of IDs in the type */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index cfab485..8107ad3 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -166,7 +166,7 @@ const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ /*******************/ /* Declare a free list to manage the H5MF_free_section_t struct */ -H5FL_DEFINE(H5MF_free_section_t); +H5FL_DEFINE_STATIC(H5MF_free_section_t); /* * "simple/small/large" section callbacks diff --git a/src/H5Ocache_image.c b/src/H5Ocache_image.c index 77aa618..30725ad 100644 --- a/src/H5Ocache_image.c +++ b/src/H5Ocache_image.c @@ -71,7 +71,7 @@ const H5O_msg_class_t H5O_MSG_MDCI[1] = {{ #define H5O_MDCI_VERSION_0 0 /* Declare the free list for H5O_mdci_t's */ -H5FL_DEFINE(H5O_mdci_t); +H5FL_DEFINE_STATIC(H5O_mdci_t); /*------------------------------------------------------------------------- * Function: H5O__mdci_decode diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 2ad8b02..1983898 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -2399,8 +2399,8 @@ herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { - H5P_genplist_t *plist = NULL; /* Property list pointer */ - H5S_t *space; /* Dataspace to hold selection */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + H5S_t *space = NULL; /* Dataspace to hold selection */ hbool_t space_created = FALSE; /* Whether a new dataspace has been created */ hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */ herr_t ret_value = SUCCEED; /* return value */ diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 4ceac7a..a2cedfb 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -1796,7 +1796,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid H5VL_pass_through_t *new_o; H5VL_file_specific_args_t my_args; H5VL_file_specific_args_t *new_args; - H5VL_pass_through_info_t *info; + H5VL_pass_through_info_t *info = NULL; hid_t under_vol_id = -1; herr_t ret_value; diff --git a/test/accum.c b/test/accum.c index 816d9c0..e85586a 100644 --- a/test/accum.c +++ b/test/accum.c @@ -27,7 +27,7 @@ /* Filename */ /* (The file names are the same as the define in accum_swmr_reader.c) */ -const char *FILENAME[] = {"accum", "accum_swmr_big", NULL}; +static const char *FILENAME[] = {"accum", "accum_swmr_big", NULL}; /* The reader forked by test_swmr_write_big() */ #define SWMR_READER "accum_swmr_reader" diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c index 10698c1..7ab9ab9 100644 --- a/test/accum_swmr_reader.c +++ b/test/accum_swmr_reader.c @@ -23,7 +23,7 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ /* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */ -const char *FILENAME[] = {"accum", "accum_swmr_big", NULL}; +static const char *FILENAME[] = {"accum", "accum_swmr_big", NULL}; /*------------------------------------------------------------------------- * Function: main diff --git a/test/app_ref.c b/test/app_ref.c index 9b08650..68b4e5b 100644 --- a/test/app_ref.c +++ b/test/app_ref.c @@ -54,13 +54,13 @@ typedef enum { T_NUMCLASSES } id_class_t; -const char *FILENAME[] = {"app_ref", NULL}; +static const char *FILENAME[] = {"app_ref", NULL}; -const char *IDNAME[T_NUMCLASSES] = {"File", "Property List", "Property Class", "Datatype", - "Dataspace", "Dataset", "Attribute", "Group", - "Error Class", "Error Message", "Error Stack"}; +static const char *IDNAME[T_NUMCLASSES] = {"File", "Property List", "Property Class", "Datatype", + "Dataspace", "Dataset", "Attribute", "Group", + "Error Class", "Error Message", "Error Stack"}; -int rc[T_NUMCLASSES]; +static int rc[T_NUMCLASSES]; void Abrt_Handler(int sig); diff --git a/test/btree2.c b/test/btree2.c index 36182f2..2a38675 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -27,7 +27,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5VLprivate.h" /* Virtual Object Layer */ -const char *FILENAME[] = {"btree2", "btree2_tmp", NULL}; +static const char *FILENAME[] = {"btree2", "btree2_tmp", NULL}; #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 diff --git a/test/cache.c b/test/cache.c index fce0ef1..80052a4 100644 --- a/test/cache.c +++ b/test/cache.c @@ -53,7 +53,7 @@ hbool_t core_file_driver_failed = FALSE; /* global variable declarations: */ -const char *FILENAME[] = {"cache_test", NULL}; +static const char *FILENAME[] = {"cache_test", NULL}; /* private typedef declarations: */ @@ -11290,7 +11290,7 @@ check_expunge_entry(unsigned paged) size_t entry_size; H5F_t *file_ptr = NULL; test_entry_t *base_addr; - test_entry_t *entry_ptr; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("H5C_expunge_entry() functionality (paged aggregation)"); @@ -11563,7 +11563,7 @@ check_multiple_read_protect(unsigned paged) #if H5C_COLLECT_CACHE_STATS H5C_t *cache_ptr = NULL; #endif /* H5C_COLLECT_CACHE_STATS */ - test_entry_t *entry_ptr; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("multiple read only protects on a single entry (paged aggr)"); @@ -14156,8 +14156,8 @@ static unsigned check_double_pin_err(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("pin a pinned entry error (paged aggregation)"); @@ -14241,8 +14241,8 @@ static unsigned check_double_unpin_err(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("unpin an unpinned entry error (paged aggregation)"); @@ -14335,8 +14335,8 @@ static unsigned check_pin_entry_errs(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("pin entry related errors (paged aggregation)"); @@ -14442,8 +14442,8 @@ check_pin_entry_errs(unsigned paged) static unsigned check_double_protect_err(unsigned paged) { - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; H5C_cache_entry_t *cache_entry_ptr; if (paged) @@ -14525,8 +14525,8 @@ static unsigned check_double_unprotect_err(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("unprotect an unprotected entry error (paged aggregation)"); @@ -14606,8 +14606,8 @@ static unsigned check_mark_entry_dirty_errs(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("mark entry dirty related errors (paged aggregation)"); @@ -14685,8 +14685,8 @@ static unsigned check_expunge_entry_errs(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("expunge entry related errors (paged aggregation)"); @@ -14797,12 +14797,12 @@ static unsigned check_move_entry_errs(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - H5C_t *cache_ptr = NULL; - test_entry_t *entry_ptr = NULL; - test_entry_t *entry_0_0_ptr; - test_entry_t *entry_0_1_ptr; - test_entry_t *entry_1_0_ptr; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; + test_entry_t *entry_ptr = NULL; + test_entry_t *entry_0_0_ptr = NULL; + test_entry_t *entry_0_1_ptr = NULL; + test_entry_t *entry_1_0_ptr = NULL; if (paged) TESTING("move entry related errors (paged aggregation)"); @@ -14914,8 +14914,8 @@ static unsigned check_resize_entry_errs(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("resize entry related errors (paged aggregation)"); @@ -15015,8 +15015,8 @@ static unsigned check_unprotect_ro_dirty_err(unsigned paged) { herr_t result; - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; if (paged) TESTING("unprotect a read only entry dirty error (paged aggregation)"); @@ -15135,8 +15135,8 @@ check_unprotect_ro_dirty_err(unsigned paged) static unsigned check_protect_ro_rw_err(unsigned paged) { - H5F_t *file_ptr = NULL; - test_entry_t *entry_ptr; + H5F_t *file_ptr = NULL; + test_entry_t *entry_ptr = NULL; void *thing_ptr = NULL; if (paged) diff --git a/test/cache_api.c b/test/cache_api.c index b596534..9e09b86 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -23,7 +23,7 @@ /* global variable declarations: */ -const char *FILENAME[] = {"cache_api_test", NULL}; +static const char *FILENAME[] = {"cache_api_test", NULL}; /* macro definitions */ diff --git a/test/cache_common.c b/test/cache_common.c index d755e1e..82ef9e4 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3024,7 +3024,7 @@ mark_entry_dirty(int32_t type, int32_t idx) void move_entry(H5C_t *cache_ptr, int32_t type, int32_t idx, hbool_t main_addr) { - herr_t result; + herr_t result = 0; hbool_t done = TRUE; /* will set to FALSE if we have work to do */ haddr_t old_addr = HADDR_UNDEF; haddr_t new_addr = HADDR_UNDEF; @@ -4946,7 +4946,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t d int64_t cache_hits = 0; int64_t cache_accesses = 0; double expected_hit_rate; - double hit_rate; + double hit_rate = 0.0; H5F_t *file_ptr = NULL; H5C_t *cache_ptr = NULL; @@ -5059,15 +5059,15 @@ check_and_validate_cache_size(hid_t file_id, size_t *max_size_ptr, size_t *min_c { herr_t result; size_t expected_max_size; - size_t max_size; + size_t max_size = 0; size_t expected_min_clean_size; - size_t min_clean_size; + size_t min_clean_size = 0; size_t expected_cur_size; - size_t cur_size; + size_t cur_size = 0; uint32_t expected_cur_num_entries; - int cur_num_entries; - H5F_t *file_ptr = NULL; - H5C_t *cache_ptr = NULL; + int cur_num_entries = 0; + H5F_t *file_ptr = NULL; + H5C_t *cache_ptr = NULL; /* get a pointer to the files internal data structure */ if (pass) { diff --git a/test/cache_image.c b/test/cache_image.c index 8072eda..b9b5a29 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -21,7 +21,7 @@ /* global variable declarations: */ -const char *FILENAMES[] = {"cache_image_test", NULL}; +static const char *FILENAMES[] = {"cache_image_test", NULL}; /* local utility function declarations */ static void create_datasets(hid_t file_id, int min_dset, int max_dset); diff --git a/test/cache_logging.c b/test/cache_logging.c index 7092110..42427c7 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -16,7 +16,7 @@ #define LOG_LOCATION "cache_logging.out" -const char *FILENAME[] = {"cache_logging", NULL}; +static const char *FILENAME[] = {"cache_logging", NULL}; #define N_GROUPS 100 diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 71260a8..e1656a2 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -547,11 +547,11 @@ check_file_open_tags(hid_t fcpl, int type) /* Variable Declarations */ hid_t fid = -1; /* File Identifier */ #ifndef NDEBUG - int verbose = FALSE; /* verbose file output */ -#endif /* NDEBUG */ - hid_t fapl = -1; /* File access prop list */ - haddr_t root_tag; /* Root Group Tag */ - haddr_t sbe_tag; /* Sblock Extension Tag */ + int verbose = FALSE; /* verbose file output */ +#endif /* NDEBUG */ + hid_t fapl = -1; /* File access prop list */ + haddr_t root_tag; /* Root Group Tag */ + haddr_t sbe_tag = HADDR_UNDEF; /* Sblock Extension Tag */ /* Testing Macro */ TESTING("tag application during file open"); diff --git a/test/chunk_info.c b/test/chunk_info.c index 5a53d92..1018132 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -47,13 +47,13 @@ #endif /* Test file names, using H5F_libver_t as indices */ -const char *FILENAME[] = {"tchunk_info_earliest", - "tchunk_info_v18", - "tchunk_info_v110", - "tchunk_info_v112", - "tchunk_info_v114", - "tchunk_info_v116", - NULL}; +static const char *FILENAME[] = {"tchunk_info_earliest", + "tchunk_info_v18", + "tchunk_info_v110", + "tchunk_info_v112", + "tchunk_info_v114", + "tchunk_info_v116", + NULL}; /* File to be used in test_failed_attempts */ #define FILTERMASK_FILE "tflt_msk" diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 73d0459..226b526 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -24,7 +24,7 @@ #include "h5test.h" -const char *FILENAME[] = {"cmpd_dset", "src_subset", "dst_subset", NULL}; +static const char *FILENAME[] = {"cmpd_dset", "src_subset", "dst_subset", NULL}; const char *DSET_NAME[] = {"contig_src_subset", "chunk_src_subset", "contig_dst_subset", "chunk_dst_subset", NULL}; diff --git a/test/cross_read.c b/test/cross_read.c index 2c82306..8e9bff0 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -21,7 +21,7 @@ #include "h5test.h" #include "H5srcdir.h" -const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL}; +static const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL}; #define DATASETNAME "Array_le" #define DATASETNAME1 "Array_be" diff --git a/test/dangle.c b/test/dangle.c index 05d7110..a51e347 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -18,7 +18,7 @@ */ #include "h5test.h" -const char *FILENAME[] = {"dangle", NULL}; +static const char *FILENAME[] = {"dangle", NULL}; #define MAX_DANGLE 1000 diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c index 806c25f..9ef4447 100644 --- a/test/del_many_dense_attrs.c +++ b/test/del_many_dense_attrs.c @@ -19,7 +19,7 @@ #include "h5test.h" /* The test file name */ -const char *FILENAME[] = {"del_many_dense_attrs", NULL}; +static const char *FILENAME[] = {"del_many_dense_attrs", NULL}; #define ATTR_COUNT 64 /* The number of attributes */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index c3037a7..58e76a3 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -86,7 +86,7 @@ static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts, const unsigned size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_BOGUS1[1] = {{ +static const H5Z_class2_t H5Z_BOGUS1[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_BOGUS1, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ @@ -96,7 +96,7 @@ const H5Z_class2_t H5Z_BOGUS1[1] = {{ filter_bogus1, /* The actual filter function */ }}; -const H5Z_class2_t H5Z_BOGUS2[1] = {{ +static const H5Z_class2_t H5Z_BOGUS2[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_BOGUS2, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/test/dsets.c b/test/dsets.c index 63ceb4d..c4693d1 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -55,36 +55,36 @@ #include "szlib.h" #endif -const char *FILENAME[] = {"dataset", /* 0 */ - "compact_dataset", /* 1 */ - "dset_offset", /* 2 */ - "max_compact_dataset", /* 3 */ - "simple", /* 4 */ - "set_local", /* 5 */ - "random_chunks", /* 6 */ - "huge_chunks", /* 7 */ - "chunk_cache", /* 8 */ - "big_chunk", /* 9 */ - "chunk_fast", /* 10 */ - "chunk_expand", /* 11 */ - "chunk_fixed", /* 12 */ - "copy_dcpl_newfile", /* 13 */ - "partial_chunks", /* 14 */ - "layout_extend", /* 15 */ - "zero_chunk", /* 16 */ - "chunk_single", /* 17 */ - "swmr_non_latest", /* 18 */ - "earray_hdr_fd", /* 19 */ - "farray_hdr_fd", /* 20 */ - "bt2_hdr_fd", /* 21 */ - "storage_size", /* 22 */ - "dls_01_strings", /* 23 */ - "power2up", /* 24 */ - "version_bounds", /* 25 */ - "alloc_0sized", /* 26 */ - "h5s_block", /* 27 */ - "h5s_plist", /* 28 */ - NULL}; +static const char *FILENAME[] = {"dataset", /* 0 */ + "compact_dataset", /* 1 */ + "dset_offset", /* 2 */ + "max_compact_dataset", /* 3 */ + "simple", /* 4 */ + "set_local", /* 5 */ + "random_chunks", /* 6 */ + "huge_chunks", /* 7 */ + "chunk_cache", /* 8 */ + "big_chunk", /* 9 */ + "chunk_fast", /* 10 */ + "chunk_expand", /* 11 */ + "chunk_fixed", /* 12 */ + "copy_dcpl_newfile", /* 13 */ + "partial_chunks", /* 14 */ + "layout_extend", /* 15 */ + "zero_chunk", /* 16 */ + "chunk_single", /* 17 */ + "swmr_non_latest", /* 18 */ + "earray_hdr_fd", /* 19 */ + "farray_hdr_fd", /* 20 */ + "bt2_hdr_fd", /* 21 */ + "storage_size", /* 22 */ + "dls_01_strings", /* 23 */ + "power2up", /* 24 */ + "version_bounds", /* 25 */ + "alloc_0sized", /* 26 */ + "h5s_block", /* 27 */ + "h5s_plist", /* 28 */ + NULL}; #define OHMIN_FILENAME_A "ohdr_min_a" diff --git a/test/dt_arith.c b/test/dt_arith.c index b9b8830..5a25b64 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -45,7 +45,7 @@ #endif #define SET_ALIGNMENT(TYPE, VAL) H5T_NATIVE_##TYPE##_ALIGN_g = MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL) -const char *FILENAME[] = {"dt_arith1", "dt_arith2", NULL}; +static const char *FILENAME[] = {"dt_arith1", "dt_arith2", NULL}; /* * Count up or down depending on whether the machine is big endian or little diff --git a/test/dtypes.c b/test/dtypes.c index c7d845d..ead76de 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -76,8 +76,8 @@ } \ } while (0) -const char *FILENAME[] = {"dtypes0", "dtypes1", "dtypes2", "dtypes3", "dtypes4", "dtypes5", - "dtypes6", "dtypes7", "dtypes8", "dtypes9", "dtypes10", NULL}; +static const char *FILENAME[] = {"dtypes0", "dtypes1", "dtypes2", "dtypes3", "dtypes4", "dtypes5", + "dtypes6", "dtypes7", "dtypes8", "dtypes9", "dtypes10", NULL}; #define TESTFILE "bad_compound.h5" @@ -3953,27 +3953,32 @@ test_query(void) HDprintf("Can't create enumerate type\n"); goto error; } /* end if */ - if (H5Tenum_insert(tid2, "RED", (enum_val = 10, &enum_val)) < 0) { + enum_val = 10; + if (H5Tenum_insert(tid2, "RED", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if (H5Tenum_insert(tid2, "GREEN", (enum_val = 11, &enum_val)) < 0) { + enum_val = 11; + if (H5Tenum_insert(tid2, "GREEN", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if (H5Tenum_insert(tid2, "BLUE", (enum_val = 12, &enum_val)) < 0) { + enum_val = 12; + if (H5Tenum_insert(tid2, "BLUE", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if (H5Tenum_insert(tid2, "ORANGE", (enum_val = 13, &enum_val)) < 0) { + enum_val = 13; + if (H5Tenum_insert(tid2, "ORANGE", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - if (H5Tenum_insert(tid2, "YELLOW", (enum_val = 14, &enum_val)) < 0) { + enum_val = 14; + if (H5Tenum_insert(tid2, "YELLOW", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; @@ -5267,7 +5272,8 @@ test_conv_enum_1(void) for (i = 0; i < 26; i++) { s[0] = (char)('A' + i); H5Tenum_insert(t1, s, &i); - H5Tenum_insert(t2, s, (val = i * 1000 + i, &val)); + val = i * 1000 + i; + H5Tenum_insert(t2, s, &val); } /* end for */ /* Initialize the buffer */ @@ -6043,27 +6049,32 @@ test_encode(void) HDprintf("Can't create enumerate type\n"); goto error; } - if (H5Tenum_insert(tid2, "RED", (enum_val = 0, &enum_val)) < 0) { + enum_val = 0; + if (H5Tenum_insert(tid2, "RED", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } - if (H5Tenum_insert(tid2, "GREEN", (enum_val = 1, &enum_val)) < 0) { + enum_val = 1; + if (H5Tenum_insert(tid2, "GREEN", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } - if (H5Tenum_insert(tid2, "BLUE", (enum_val = 2, &enum_val)) < 0) { + enum_val = 2; + if (H5Tenum_insert(tid2, "BLUE", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } - if (H5Tenum_insert(tid2, "ORANGE", (enum_val = 3, &enum_val)) < 0) { + enum_val = 3; + if (H5Tenum_insert(tid2, "ORANGE", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; } - if (H5Tenum_insert(tid2, "YELLOW", (enum_val = 4, &enum_val)) < 0) { + enum_val = 4; + if (H5Tenum_insert(tid2, "YELLOW", &enum_val) < 0) { H5_FAILED(); HDprintf("Can't insert field into enumeration type\n"); goto error; diff --git a/test/earray.c b/test/earray.c index 1f82058..5e0fdef 100644 --- a/test/earray.c +++ b/test/earray.c @@ -161,7 +161,7 @@ typedef struct earray_test_t { /* Local prototypes */ /* Local variables */ -const char *FILENAME[] = {"earray", "earray_tmp", NULL}; +static const char *FILENAME[] = {"earray", "earray_tmp", NULL}; /* Filename to use for all tests */ char filename_g[EARRAY_FILENAME_LEN]; diff --git a/test/efc.c b/test/efc.c index c29cddb..1033469 100644 --- a/test/efc.c +++ b/test/efc.c @@ -22,7 +22,7 @@ #include "H5Iprivate.h" #include "H5Pprivate.h" /* Property lists */ -const char *FILENAME[] = {"efc0", "efc1", "efc2", "efc3", "efc4", "efc5", NULL}; +static const char *FILENAME[] = {"efc0", "efc1", "efc2", "efc3", "efc4", "efc5", NULL}; /* Windows doesn't have PATH_MAX */ #ifndef PATH_MAX diff --git a/test/enum.c b/test/enum.c index 24f8160..0798e6c 100644 --- a/test/enum.c +++ b/test/enum.c @@ -19,7 +19,7 @@ /* Convenience macro for inserting enum values */ #define CPTR(VAR, CONST) ((VAR) = (CONST), &(VAR)) -const char *FILENAME[] = {"enum1", NULL}; +static const char *FILENAME[] = {"enum1", NULL}; typedef enum { E1_RED, E1_GREEN, E1_BLUE, E1_WHITE, E1_BLACK } c_e1; diff --git a/test/err_compat.c b/test/err_compat.c index 500b69f..b550b84 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -27,15 +27,15 @@ main(void) } #else /* H5_NO_DEPRECATED_SYMBOLS */ -const char *FILENAME[] = {"errors_compat", NULL}; +static const char *FILENAME[] = {"errors_compat", NULL}; #define DIM0 100 #define DIM1 200 -int **ipoints2 = NULL; -int **icheck2 = NULL; -int *ipoints2_data = NULL; -int *icheck2_data = NULL; +static int **ipoints2 = NULL; +static int **icheck2 = NULL; +static int *ipoints2_data = NULL; +static int *icheck2_data = NULL; #define DSET_NAME "a_dataset" diff --git a/test/error_test.c b/test/error_test.c index 1bcbcd4..97802a3 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -28,31 +28,31 @@ main(void) } #else /* H5_USE_16_API */ -const char *FILENAME[] = {"errors", NULL}; +static const char *FILENAME[] = {"errors", NULL}; #define DATAFILE "filter_error" #define DIM0 100 #define DIM1 200 -int **ipoints2 = NULL; -int **icheck2 = NULL; -int *ipoints2_data = NULL; -int *icheck2_data = NULL; +static int **ipoints2 = NULL; +static int **icheck2 = NULL; +static int *ipoints2_data = NULL; +static int *icheck2_data = NULL; -hid_t ERR_CLS; -hid_t ERR_CLS2; -hid_t ERR_STACK; +static hid_t ERR_CLS; +static hid_t ERR_CLS2; +static hid_t ERR_STACK; -hid_t ERR_MAJ_TEST; -hid_t ERR_MAJ_IO; -hid_t ERR_MAJ_API; +static hid_t ERR_MAJ_TEST; +static hid_t ERR_MAJ_IO; +static hid_t ERR_MAJ_API; -hid_t ERR_MIN_SUBROUTINE; -hid_t ERR_MIN_ERRSTACK; -hid_t ERR_MIN_CREATE; -hid_t ERR_MIN_WRITE; -hid_t ERR_MIN_GETNUM; +static hid_t ERR_MIN_SUBROUTINE; +static hid_t ERR_MIN_ERRSTACK; +static hid_t ERR_MIN_CREATE; +static hid_t ERR_MIN_WRITE; +static hid_t ERR_MIN_GETNUM; #define DSET_NAME "a_dataset" #define FAKE_ID (hid_t)0 diff --git a/test/event_set.c b/test/event_set.c index e9bd070..134002e 100644 --- a/test/event_set.c +++ b/test/event_set.c @@ -21,9 +21,9 @@ #define EVENT_SET_NUM_CONNECTOR_IDS 2 -const char *FILENAME[] = {"event_set_1", NULL}; +static const char *FILENAME[] = {"event_set_1", NULL}; -hid_t connector_ids_g[EVENT_SET_NUM_CONNECTOR_IDS]; +static hid_t connector_ids_g[EVENT_SET_NUM_CONNECTOR_IDS]; herr_t fake_wait_request_wait(void *req, uint64_t timeout, H5VL_request_status_t *status); herr_t fake_wait_request_free(void *req); diff --git a/test/extend.c b/test/extend.c index 33d68b7..f4ce116 100644 --- a/test/extend.c +++ b/test/extend.c @@ -19,7 +19,7 @@ #include "h5test.h" -const char *FILENAME[] = {"extend", NULL}; +static const char *FILENAME[] = {"extend", NULL}; #define N1X 100 /* USE AN EVEN NUMBER! */ #define N1Y 100 /* USE AN EVEN NUMBER! */ diff --git a/test/farray.c b/test/farray.c index 0f522fb..5448865 100644 --- a/test/farray.c +++ b/test/farray.c @@ -95,7 +95,7 @@ struct farray_test_param_t { }; /* Local variables */ -const char *FILENAME[] = {"farray", "farray_tmp", NULL}; +static const char *FILENAME[] = {"farray", "farray_tmp", NULL}; /* Filename to use for all tests */ char filename_g[FARRAY_FILENAME_LEN]; diff --git a/test/fheap.c b/test/fheap.c index f256ec9..fb1c569 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -89,7 +89,7 @@ #define NUM_PB_FS 6 #define PAGE_BUFFER_PAGE_SIZE 4096 -const char *FILENAME[] = {"fheap", NULL}; +static const char *FILENAME[] = {"fheap", NULL}; /* Types of tests to perform */ typedef enum { diff --git a/test/file_image.c b/test/file_image.c index 638ec8d..60cd186 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -43,19 +43,19 @@ #define USERBLOCK_SIZE 512 -const char *FILENAME[] = {"file_image_core_test", NULL}; +static const char *FILENAME[] = {"file_image_core_test", NULL}; /* need a second file name array, as the first file name array contains * files we don't want to delete on cleanup. */ -const char *FILENAME2[] = {"sec2_get_file_image_test", - "stdio_get_file_image_test", - "core_get_file_image_test", - "family_get_file_image_test", - "multi_get_file_image_test", - "split_get_file_image_test", - "get_file_image_error_rejection_test", - NULL}; +static const char *FILENAME2[] = {"sec2_get_file_image_test", + "stdio_get_file_image_test", + "core_get_file_image_test", + "family_get_file_image_test", + "multi_get_file_image_test", + "split_get_file_image_test", + "get_file_image_error_rejection_test", + NULL}; typedef struct { unsigned char used_callbacks; /* Bitfield for tracking callbacks */ diff --git a/test/fillval.c b/test/fillval.c index a9f4297..52b15ff 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -25,8 +25,8 @@ */ /* #define NO_FILLING */ -const char *FILENAME[] = {"fillval_1", "fillval_2", "fillval_3", "fillval_4", "fillval_5", - "fillval_6", "fillval_7", "fillval_8", "fillval_9", NULL}; +static const char *FILENAME[] = {"fillval_1", "fillval_2", "fillval_3", "fillval_4", "fillval_5", + "fillval_6", "fillval_7", "fillval_8", "fillval_9", NULL}; /* Common type for compound datatype operations */ typedef struct { @@ -873,8 +873,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f int i, j, *buf = NULL, odd; unsigned u; comp_datatype rd_c, fill_c, should_be_c; - comp_datatype *buf_c = NULL; - H5D_space_status_t allocation; + comp_datatype *buf_c = NULL; + H5D_space_status_t allocation = H5D_SPACE_STATUS_ERROR; fill_c.a = 0; fill_c.x = 0; diff --git a/test/filter_fail.c b/test/filter_fail.c index f2f1c3d..c58731e 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -25,7 +25,7 @@ #define DIM 10 #define FILTER_CHUNK_DIM 2 -const char *FILENAME[] = {"filter_fail_with_cache", "filter_fail_without_cache", NULL}; +static const char *FILENAME[] = {"filter_fail_with_cache", "filter_fail_without_cache", NULL}; static size_t filter_fail(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); diff --git a/test/filter_plugin.c b/test/filter_plugin.c index 1e853e7..c09d196 100644 --- a/test/filter_plugin.c +++ b/test/filter_plugin.c @@ -30,7 +30,7 @@ #define FILTER3_ID 259 #define FILTER4_ID 260 -const char *FILENAME[] = {"filter_plugin", NULL}; +static const char *FILENAME[] = {"filter_plugin", NULL}; #define FILENAME_BUF_SIZE 1024 /* Dataset names */ @@ -50,10 +50,10 @@ const char *FILENAME[] = {"filter_plugin", NULL}; #define HYPERSLAB_SIZE2 50 /* Global size arrays */ -const hsize_t sizes_g[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */ -const hsize_t hs_sizes_g[2] = {HYPERSLAB_SIZE1, HYPERSLAB_SIZE2}; /* Hyperslab sizes */ -const hsize_t hs_offsets_g[2] = {HYPERSLAB_OFFSET1, HYPERSLAB_OFFSET2}; /* Hyperslab offsets */ -const hsize_t chunk_sizes_g[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */ +static const hsize_t sizes_g[2] = {DSET_DIM1, DSET_DIM2}; /* Dataset dimensions */ +static const hsize_t hs_sizes_g[2] = {HYPERSLAB_SIZE1, HYPERSLAB_SIZE2}; /* Hyperslab sizes */ +static const hsize_t hs_offsets_g[2] = {HYPERSLAB_OFFSET1, HYPERSLAB_OFFSET2}; /* Hyperslab offsets */ +static const hsize_t chunk_sizes_g[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */ /* Limit random number within 20000 */ #define RANDOM_LIMIT 20000 @@ -64,10 +64,10 @@ const hsize_t chunk_sizes_g[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chun #define TOP_LEVEL_GROUP_NAME "top-level group" /* Global arrays in which to save data */ -int **orig_deflate_g = NULL; -int **orig_dynlib1_g = NULL; -int **orig_dynlib2_g = NULL; -int **orig_dynlib4_g = NULL; +static int **orig_deflate_g = NULL; +static int **orig_dynlib1_g = NULL; +static int **orig_dynlib2_g = NULL; +static int **orig_dynlib4_g = NULL; /*------------------------------------------------------------------------- * Function: free_2D_array diff --git a/test/flush1.c b/test/flush1.c index f9fcf9c..f64dfac 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -27,9 +27,9 @@ #define H5FD_TESTING #include "H5FDpkg.h" /* File drivers */ -const char *FILENAME[] = {"flush", "flush-swmr", "noflush", - "noflush-swmr", "flush_extend", "flush_extend-swmr", - "noflush_extend", "noflush_extend-swmr", NULL}; +static const char *FILENAME[] = {"flush", "flush-swmr", "noflush", + "noflush-swmr", "flush_extend", "flush_extend-swmr", + "noflush_extend", "noflush_extend-swmr", NULL}; /* Number and size of dataset dims, chunk size, etc. */ #define NDIMS 1 diff --git a/test/flush2.c b/test/flush2.c index bc5d409..48c3247 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -30,9 +30,9 @@ /* This is used in the helper routine clear_status_flags() */ #define H5F_ACS_CLEAR_STATUS_FLAGS_NAME "clear_status_flags" -const char *FILENAME[] = {"flush", "flush-swmr", "noflush", - "noflush-swmr", "flush_extend", "flush_extend-swmr", - "noflush_extend", "noflush_extend-swmr", NULL}; +static const char *FILENAME[] = {"flush", "flush-swmr", "noflush", + "noflush-swmr", "flush_extend", "flush_extend-swmr", + "noflush_extend", "noflush_extend-swmr", NULL}; /* Number and size of dataset dims, chunk size, etc. */ #define NELEMENTS 10000 diff --git a/test/flushrefresh.c b/test/flushrefresh.c index 5201404..1f5ee89 100644 --- a/test/flushrefresh.c +++ b/test/flushrefresh.c @@ -66,7 +66,7 @@ For errors occurring in the spawned process (from the test script), use the PROCESS_ERROR macro, which will send a signal to the main process so the main process can propagate errors correctly. */ -FILE *errorfile; +static FILE *errorfile; #define ERRFILE "flushrefresh_ERROR" #define PROCESS_ERROR \ { \ diff --git a/test/freespace.c b/test/freespace.c index e163152..bd1737a 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -58,7 +58,7 @@ #define FSPACE_THRHD_DEF 1 /* Default: no alignment threshold */ #define FSPACE_ALIGN_DEF 1 /* Default: no alignment */ -const char *FILENAME[] = {"frspace", NULL}; +static const char *FILENAME[] = {"frspace", NULL}; typedef struct frspace_state_t { hsize_t tot_space; /* Total amount of space tracked */ diff --git a/test/gen_bad_compound.c b/test/gen_bad_compound.c index e103aa2..500cb47 100644 --- a/test/gen_bad_compound.c +++ b/test/gen_bad_compound.c @@ -26,7 +26,7 @@ #define FILENAME "bad_compound.h5" int -main() +main(void) { hid_t file; hid_t cmpd_dt; diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c index b8d5e99..932c054 100644 --- a/test/gen_mergemsg.c +++ b/test/gen_mergemsg.c @@ -36,7 +36,7 @@ #define ATTR3_LEN 1 int -main() +main(void) { hid_t fid; /* File ID */ hid_t gid, gid2, gid3; /* Group IDs */ diff --git a/test/genall5.c b/test/genall5.c index ea96d32..648dc92 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -1067,7 +1067,7 @@ os_grp_0(hid_t fid, const char *group_name) { hid_t gid = -1; hid_t fapl = -1; - H5F_libver_t low, high; + H5F_libver_t low = H5F_LIBVER_ERROR, high = H5F_LIBVER_ERROR; herr_t ret; @@ -1273,7 +1273,7 @@ os_grp_n(hid_t fid, const char *group_name, int proc_num, unsigned nlinks) hid_t gid = -1; unsigned u; hid_t fapl = -1; - H5F_libver_t low, high; + H5F_libver_t low = H5F_LIBVER_ERROR, high = H5F_LIBVER_ERROR; herr_t ret; if (pass) { /* get the file's file access property list */ diff --git a/test/getname.c b/test/getname.c index 7900279..5960e5c 100644 --- a/test/getname.c +++ b/test/getname.c @@ -35,7 +35,7 @@ typedef struct s1_t { float c; } s1_t; -const char *FILENAME[] = {"getname", "getname1", "getname2", "getname3", NULL}; +static const char *FILENAME[] = {"getname", "getname1", "getname2", "getname3", NULL}; #define NAME_BUF_SIZE 64 #define SMALL_NAME_BUF_SIZE 2 diff --git a/test/gheap.c b/test/gheap.c index 5a37f9e..f8766df 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -47,7 +47,7 @@ } /* end if */ \ } while (0) /* end GHEAP_REPEATED_ERR */ -const char *FILENAME[] = {"gheap1", "gheap2", "gheap3", "gheap4", "gheapooo", NULL}; +static const char *FILENAME[] = {"gheap1", "gheap2", "gheap3", "gheap4", "gheapooo", NULL}; /*------------------------------------------------------------------------- * Function: test_1 diff --git a/test/istore.c b/test/istore.c index b688acd..98ef839 100644 --- a/test/istore.c +++ b/test/istore.c @@ -28,7 +28,7 @@ #include "H5Oprivate.h" #include "H5VMprivate.h" -const char *FILENAME[] = {"istore", NULL}; +static const char *FILENAME[] = {"istore", NULL}; #define TEST_SMALL 0x0001 #define TEST_MEDIUM 0x0002 diff --git a/test/lheap.c b/test/lheap.c index c527fe2..e8e7724 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -24,7 +24,7 @@ #include "H5Iprivate.h" #include "H5VLprivate.h" /* Virtual Object Layer */ -const char *FILENAME[] = {"lheap", NULL}; +static const char *FILENAME[] = {"lheap", NULL}; #define TESTFILE "tsizeslheap.h5" diff --git a/test/links.c b/test/links.c index 2ab7f59..b865275 100644 --- a/test/links.c +++ b/test/links.c @@ -46,61 +46,61 @@ #define SYMLINK1 TMPDIR "sym1.h5" #define SYMLINK2 TMPDIR2 "sym2.h5" -const char *FILENAME[] = {"links0", - "links1", - "links2", - "links3", - "links4a", /* 4 */ - "links4b", /* 5 */ - "links4c", /* 6 */ - "links4d", /* 7 */ - "links5", /* 8 */ - "links6", /* 9 */ - "links7", /* 10 */ - "links8", /* 11 */ - "extlinks0", /* 12: main files */ - TMPDIR "extlinks0", /* 13: */ - "extlinks1", /* 14: target files */ - TMPDIR "extlinks1", /* 15: */ - "extlinks2", /* 16: */ - TMPDIR "extlinks2", /* 17: */ - "extlinks3", /* 18: */ - TMPDIR "extlinks3", /* 19: */ - "extlinks4", /* 20: */ - TMPDIR "extlinks4", /* 21: */ - "extlinks5", /* 22: */ - TMPDIR "extlinks6", /* 23: */ - "extlinks7", /* 24: */ - TMPDIR "extlinks7", /* 25: */ - TMPDIR "extlinks8", /* 26: */ - "extlinks9", /* 27: */ - TMPDIR "extlinks9", /* 28: */ - "extlinks10", - /* 29: */ /* TESTS for windows */ - TMPDIR "extlinks10", /* 30: */ - TMPDIR "extlinks11", /* 31: */ - TMPDIR "extlinks12", /* 32: */ - "extlinks13", /* 33: */ - TMPDIR "extlinks13", /* 34: */ - TMPDIR "extlinks14", /* 35: */ - TMPDIR "extlinks15", /* 36: */ - "extlinks16A", - /* 37: */ /* TESTS for H5P_set_elink_fapl */ - "extlinks16B", /* 38: */ - "extlinks17", /* 39: */ - "extlinks18A", /* 40: */ - "extlinks18B", /* 41: */ - "extlinks19A", /* 42: */ - "extlinks19B", /* 43: */ - "extlinks20", /* 44: */ - "extlinks21A", /* 45: Files for symlink() tests*/ - TMPDIR2 "extlinks21B", /* 46: */ - TMPDIR2 "extlinks21C", /* 47: */ - "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ - TMPDIR "extlinks21D", /* 49: */ - TMPDIR "extlinks21E", /* 50: */ - "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ - NULL}; +static const char *FILENAME[] = {"links0", + "links1", + "links2", + "links3", + "links4a", /* 4 */ + "links4b", /* 5 */ + "links4c", /* 6 */ + "links4d", /* 7 */ + "links5", /* 8 */ + "links6", /* 9 */ + "links7", /* 10 */ + "links8", /* 11 */ + "extlinks0", /* 12: main files */ + TMPDIR "extlinks0", /* 13: */ + "extlinks1", /* 14: target files */ + TMPDIR "extlinks1", /* 15: */ + "extlinks2", /* 16: */ + TMPDIR "extlinks2", /* 17: */ + "extlinks3", /* 18: */ + TMPDIR "extlinks3", /* 19: */ + "extlinks4", /* 20: */ + TMPDIR "extlinks4", /* 21: */ + "extlinks5", /* 22: */ + TMPDIR "extlinks6", /* 23: */ + "extlinks7", /* 24: */ + TMPDIR "extlinks7", /* 25: */ + TMPDIR "extlinks8", /* 26: */ + "extlinks9", /* 27: */ + TMPDIR "extlinks9", /* 28: */ + "extlinks10", + /* 29: */ /* TESTS for windows */ + TMPDIR "extlinks10", /* 30: */ + TMPDIR "extlinks11", /* 31: */ + TMPDIR "extlinks12", /* 32: */ + "extlinks13", /* 33: */ + TMPDIR "extlinks13", /* 34: */ + TMPDIR "extlinks14", /* 35: */ + TMPDIR "extlinks15", /* 36: */ + "extlinks16A", + /* 37: */ /* TESTS for H5P_set_elink_fapl */ + "extlinks16B", /* 38: */ + "extlinks17", /* 39: */ + "extlinks18A", /* 40: */ + "extlinks18B", /* 41: */ + "extlinks19A", /* 42: */ + "extlinks19B", /* 43: */ + "extlinks20", /* 44: */ + "extlinks21A", /* 45: Files for symlink() tests*/ + TMPDIR2 "extlinks21B", /* 46: */ + TMPDIR2 "extlinks21C", /* 47: */ + "extlinks21C", /* 48: (same as #47, only without the TMPDIR2 prefix) */ + TMPDIR "extlinks21D", /* 49: */ + TMPDIR "extlinks21E", /* 50: */ + "extlinks21E", /* 51: (same as #50, only without the TMPDIR prefix) */ + NULL}; #define FAMILY_SIZE 1024 #define CORE_INCREMENT 1024 diff --git a/test/links_env.c b/test/links_env.c index 69a35f6..db10269 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -25,10 +25,10 @@ #define TMPDIR "tmp_links_env/" #define NAME_BUF_SIZE 1024 -const char *FILENAME[] = {"extlinks_env0", /* 0: main file */ - "extlinks_env1", /* 1: target file */ - TMPDIR "extlinks_env1", /* 2 */ - NULL}; +static const char *FILENAME[] = {"extlinks_env0", /* 0: main file */ + "extlinks_env1", /* 1: target file */ + TMPDIR "extlinks_env1", /* 2 */ + NULL}; static int external_link_env(hid_t fapl, hbool_t new_format); diff --git a/test/mdset.c b/test/mdset.c index 06e7af2..ceeea1a 100644 --- a/test/mdset.c +++ b/test/mdset.c @@ -47,7 +47,7 @@ (MDSET_FLAG_CHUNK | MDSET_FLAG_MLAYOUT | MDSET_FLAG_SHAPESAME | MDSET_FLAG_MDSET | MDSET_FLAG_TCONV | \ MDSET_FLAG_FILTER) -const char *FILENAME[] = {"mdset", "mdset1", "mdset2", NULL}; +static const char *FILENAME[] = {"mdset", "mdset1", "mdset2", NULL}; /* Names for datasets */ char dset_name[MAX_DSETS][DSET_MAX_NAME_LEN]; diff --git a/test/mf.c b/test/mf.c index a154c42..69caf25 100644 --- a/test/mf.c +++ b/test/mf.c @@ -98,7 +98,7 @@ #define TEST_THRESHOLD10 10 #define TEST_THRESHOLD3 3 -const char *FILENAME[] = {"mf", NULL}; +static const char *FILENAME[] = {"mf", NULL}; typedef enum { TEST_NORMAL, /* size of aggregator is >= alignment size */ @@ -367,8 +367,8 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) char filename[FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t file_size = 0, new_file_size; /* file size */ - H5FD_mem_t type; - haddr_t addr = 0; + H5FD_mem_t type = H5FD_MEM_DEFAULT; + haddr_t addr = 0; haddr_t ma_addr = HADDR_UNDEF, new_ma_addr = HADDR_UNDEF; hsize_t ma_size = 0, new_ma_size = 0; hbool_t suitable_vfd; diff --git a/test/mount.c b/test/mount.c index 8ea5fe9..9cb65c9 100644 --- a/test/mount.c +++ b/test/mount.c @@ -20,14 +20,15 @@ #include "H5Fprivate.h" /* File access */ #include "H5Iprivate.h" /* IDs */ -const char *FILENAME[] = {"mount_1", "mount_2", "mount_3", "mount_4", "mount_5", "mount_6", "mount_7", NULL}; +static const char *FILENAME[] = {"mount_1", "mount_2", "mount_3", "mount_4", + "mount_5", "mount_6", "mount_7", NULL}; /* For "mount_after_close" test */ #define RANK 2 #define NX 4 #define NY 5 #define NAME_BUF_SIZE 40 -int bm[NX][NY], bm_out[NX][NY]; /* Data buffers */ +static int bm[NX][NY]; /* Data buffers */ /*------------------------------------------------------------------------- * Function: setup diff --git a/test/mtime.c b/test/mtime.c index 882189e..5b5fc4e 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -22,7 +22,7 @@ #include "h5test.h" #include "H5srcdir.h" -const char *FILENAME[] = {"mtime", NULL}; +static const char *FILENAME[] = {"mtime", NULL}; #define TESTFILE1 "tmtimeo.h5" #define MTIME1 1055531866 diff --git a/test/ntypes.c b/test/ntypes.c index decd1c2..aa90828 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -19,7 +19,7 @@ #include "h5test.h" -const char *FILENAME[] = {"ntypes", NULL}; +static const char *FILENAME[] = {"ntypes", NULL}; #define DIM0 100 #define DIM1 200 diff --git a/test/objcopy.c b/test/objcopy.c index d5c4947..187b04a 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -60,8 +60,8 @@ #define H5O_TESTING #include "H5Opkg.h" /* Object header */ -const char *FILENAME[] = {"objcopy_src", "objcopy_dst", "objcopy_ext", "objcopy_src2", - "verbound_src", "verbound_dst", NULL}; +static const char *FILENAME[] = {"objcopy_src", "objcopy_dst", "objcopy_ext", "objcopy_src2", + "verbound_src", "verbound_dst", NULL}; /* Configuration, really a series of bit flags. Maximum value is all three * bit flags enabled. diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c index 3ad5091..73c611e 100644 --- a/test/objcopy_ref.c +++ b/test/objcopy_ref.c @@ -23,13 +23,13 @@ #define H5F_TESTING #include "H5Fpkg.h" /* File access */ -const char *FILENAME[] = {"objcopy_ref_src", - "objcopy_ref_dst", - "objcopy_ref_ext", - "objcopy_ref_src2", - "verbound_ref_src", - "verbound_ref_dst", - NULL}; +static const char *FILENAME[] = {"objcopy_ref_src", + "objcopy_ref_dst", + "objcopy_ref_ext", + "objcopy_ref_src2", + "verbound_ref_src", + "verbound_ref_dst", + NULL}; /* Configuration, really a series of bit flags. Maximum value is all three * bit flags enabled. diff --git a/test/ohdr.c b/test/ohdr.c index b62f391..a15b8a0 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -40,7 +40,7 @@ #define H5FD_TESTING #include "H5FDpkg.h" -const char *FILENAME[] = {"ohdr", "ohdr_min_a", "ohdr_min_b", NULL}; +static const char *FILENAME[] = {"ohdr", "ohdr_min_a", "ohdr_min_b", NULL}; /* used for object header size comparison */ #define EQ 1 diff --git a/test/onion.c b/test/onion.c index 830220d..da1eb12 100644 --- a/test/onion.c +++ b/test/onion.c @@ -91,18 +91,18 @@ static unsigned int flags_create_s = 0; */ /* twenty-six four-character words beginning with 'a' -> 104 bytes */ -const unsigned char *a_list_s = +static const unsigned char *a_list_s = (const unsigned char *)"abetableacedacesacheacidacneadzeafaragedagesaidsairsajarallyalum" "amokantsapesarcsareaartsasksaspsavidaxes"; uint64_t a_list_size_s = 104; /* fifty-three four-character words beginning with 'b' -> 212 bytes */ -const unsigned char *b_list_s = +static const unsigned char *b_list_s = (const unsigned char *)"badebailbaitbalebanebarebaskbeambeanbearbeenbeerbeltbentbestbide" "bikebilebindbirdbiteblipblueboarboatbobsbodyboilboldbollboltbond" "boneboobboorboosbootbradbragbratbraybrewbritbrowbuckbudsbunkbunt" "buoyburnburybustbuys"; -uint64_t b_list_size_s = 212; +static uint64_t b_list_size_s = 212; /* Allocate and populate filepaths with h5_fixname'd strings as appropriate. * Should be released with onion_filepaths_destroy() when done. @@ -912,9 +912,10 @@ test_header_encode_decode(void) ptr = exp + H5FD_ONION_ENCODED_SIZE_HEADER - 4; UINT32ENCODE(ptr, checksum); - hdr.version = H5FD_ONION_HEADER_VERSION_CURR; - hdr.flags = 12; - hdr.origin_eof = 8589934609ull, hdr.page_size = 4096; + hdr.version = H5FD_ONION_HEADER_VERSION_CURR; + hdr.flags = 12; + hdr.origin_eof = 8589934609ull; + hdr.page_size = 4096; hdr.history_addr = 123456; hdr.history_size = 88; diff --git a/test/page_buffer.c b/test/page_buffer.c index b15aff5..16fcfd5 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -56,7 +56,7 @@ static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl); static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size); #endif /* H5_HAVE_PARALLEL */ -const char *FILENAME[] = {"filepaged", NULL}; +static const char *FILENAME[] = {"filepaged", NULL}; #ifndef H5_HAVE_PARALLEL diff --git a/test/reserved.c b/test/reserved.c index a820344..7ebe60c 100644 --- a/test/reserved.c +++ b/test/reserved.c @@ -13,7 +13,7 @@ #include "h5test.h" #ifdef BROKEN -const char *FILENAME[] = {"rsrv_heap", "rsrv_ohdr", "rsrv_vlen", NULL}; +static const char *FILENAME[] = {"rsrv_heap", "rsrv_ohdr", "rsrv_vlen", NULL}; /*------------------------------------------------------------------------- * Function: rsrv_heap diff --git a/test/set_extent.c b/test/set_extent.c index 4dc5d7c..f4758b5 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -26,8 +26,8 @@ *------------------------------------------------------------------------- */ -const char *FILENAME[] = {"set_extent1", "set_extent2", "set_extent3", "set_extent4", - "set_extent5", "set_extent6", NULL}; +static const char *FILENAME[] = {"set_extent1", "set_extent2", "set_extent3", "set_extent4", + "set_extent5", "set_extent6", NULL}; #define NAME_BUF_SIZE 1024 #define EXT_FILE_NAME1 "ext1.bin" diff --git a/test/stab.c b/test/stab.c index 45010d5..dcd2791 100644 --- a/test/stab.c +++ b/test/stab.c @@ -23,7 +23,7 @@ #include "h5test.h" #include "H5Gpkg.h" /* Groups */ -const char *FILENAME[] = {"stab", NULL}; +static const char *FILENAME[] = {"stab", NULL}; #define NAME_BUF_SIZE 1024 diff --git a/test/swmr.c b/test/swmr.c index 94110f4..4fdf8d0 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -48,10 +48,10 @@ #define H5O_TESTING #include "H5Opkg.h" /* Object headers */ -const char *FILENAME[] = {"swmr0", /* 0 */ - "swmr1", /* 1 */ - "swmr2", /* 2 */ - NULL}; +static const char *FILENAME[] = {"swmr0", /* 0 */ + "swmr1", /* 1 */ + "swmr2", /* 2 */ + NULL}; #define NAME_BUF_SIZE 1024 /* Length of file name */ diff --git a/test/tattr.c b/test/tattr.c index 6f3ecb4..9151b26 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -76,24 +76,25 @@ #define ATTR1_NAME "Attr1" #define ATTR1_RANK 1 #define ATTR1_DIM1 3 -int attr_data1[ATTR1_DIM1] = {512, -234, 98123}; /* Test data for 1st attribute */ +static int attr_data1[ATTR1_DIM1] = {512, -234, 98123}; /* Test data for 1st attribute */ /* rank & dimensions for another attribute */ #define ATTR1A_NAME "Attr1_a" -int attr_data1a[ATTR1_DIM1] = {256, 11945, -22107}; +static int attr_data1a[ATTR1_DIM1] = {256, 11945, -22107}; #define ATTR2_NAME "Attr2" #define ATTR2_RANK 2 #define ATTR2_DIM1 2 #define ATTR2_DIM2 2 -int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test data for 2nd attribute */ +static int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, + {197814, -3}}; /* Test data for 2nd attribute */ #define ATTR3_NAME "Attr3" #define ATTR3_RANK 3 #define ATTR3_DIM1 2 #define ATTR3_DIM2 2 #define ATTR3_DIM3 2 -double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = { +static double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = { {{2.3, -26.1}, {0.123, -10.0}}, {{973.23, -0.91827}, {2.0, 23.0}}}; /* Test data for 3rd attribute */ #define ATTR4_NAME "Attr4" @@ -103,10 +104,10 @@ double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = { #define ATTR4_FIELDNAME1 "i" #define ATTR4_FIELDNAME2 "d" #define ATTR4_FIELDNAME3 "c" -size_t attr4_field1_off = 0; -size_t attr4_field2_off = 0; -size_t attr4_field3_off = 0; -struct attr4_struct { +static size_t attr4_field1_off = 0; +static size_t attr4_field2_off = 0; +static size_t attr4_field3_off = 0; +static struct attr4_struct { int i; double d; char c; @@ -116,7 +117,7 @@ struct attr4_struct { #define ATTR5_NAME "Attr5" #define ATTR5_RANK 0 -float attr_data5 = -5.123F; /* Test data for 5th attribute */ +static float attr_data5 = -5.123F; /* Test data for 5th attribute */ #define ATTR6_RANK 3 #define ATTR6_DIM1 100 @@ -4540,21 +4541,21 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl) static void test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Compact Storage of Attributes with Creation Order Info\n")); @@ -4742,23 +4743,23 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl) static void test_attr_corder_create_dense(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dense Storage of Attributes with Creation Order Info\n")); @@ -5079,23 +5080,23 @@ test_attr_corder_create_reopen(hid_t fcpl, hid_t fapl) static void test_attr_corder_transition(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Storage Transitions of Attributes with Creation Order Info\n")); @@ -5488,24 +5489,24 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl) static void test_attr_corder_delete(hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned reopen_file; /* Whether to re-open the file before deleting group */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned reopen_file; /* Whether to re-open the file before deleting group */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Deleting Object w/Dense Attribute Storage and Creation Order Info\n")); @@ -5810,26 +5811,26 @@ attr_info_by_idx_check(hid_t obj_id, const char *attrname, hsize_t n, hbool_t us static void test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - H5A_info_t ainfo; /* Attribute information */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned use_index; /* Use index on creation order values */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + H5A_info_t ainfo; /* Attribute information */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned use_index; /* Use index on creation order values */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -6292,28 +6293,28 @@ test_attr_get_name_invalid_buf(hid_t fcpl, hid_t fapl) static void test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - H5A_info_t ainfo; /* Attribute information */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - unsigned use_index; /* Use index on creation order values */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + H5A_info_t ainfo; /* Attribute information */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + char tmpname[NAME_BUF_SIZE]; /* Temporary attribute name */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ MESSAGE(5, ("Testing Deleting Attribute By Index\n")); @@ -7273,30 +7274,30 @@ attr_iterate_check(hid_t fid, const char *dsetname, hid_t obj_id, H5_index_t idx static void test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - attr_iter_info_t iter_info; /* Iterator info */ - hbool_t *visited = NULL; /* Array of flags for visiting links */ - hsize_t idx; /* Start index for iteration */ - unsigned use_index; /* Use index on creation order values */ - const char *dsetname; /* Name of dataset for attributes */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + attr_iter_info_t iter_info; /* Iterator info */ + hbool_t *visited = NULL; /* Array of flags for visiting links */ + hsize_t idx; /* Start index for iteration */ + unsigned use_index; /* Use index on creation order values */ + const char *dsetname; /* Name of dataset for attributes */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -7680,27 +7681,27 @@ attr_open_by_idx_check(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, static void test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - H5_index_t idx_type; /* Type of index to operate on */ - H5_iter_order_t order; /* Order within in the index */ - unsigned use_index; /* Use index on creation order values */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + H5_index_t idx_type; /* Type of index to operate on */ + H5_iter_order_t order; /* Order within in the index */ + unsigned use_index; /* Use index on creation order values */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -8054,26 +8055,26 @@ attr_open_check(hid_t fid, const char *dsetname, hid_t obj_id, unsigned max_attr static void test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned use_index; /* Use index on creation order values */ - const char *dsetname; /* Name of dataset for attributes */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - hid_t ret_id; /* Generic hid_t return value */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned use_index; /* Use index on creation order values */ + const char *dsetname; /* Name of dataset for attributes */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + hid_t ret_id; /* Generic hid_t return value */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); @@ -8350,25 +8351,25 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) static void test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl) { - hid_t fid; /* HDF5 File ID */ - hid_t dset1, dset2, dset3; /* Dataset IDs */ - hid_t my_dataset; /* Current dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t attr; /* Attribute ID */ - hid_t dcpl; /* Dataset creation property list ID */ - unsigned max_compact; /* Maximum # of links to store in group compactly */ - unsigned min_dense; /* Minimum # of links to store in group "densely" */ - htri_t is_empty; /* Are there any attributes? */ - htri_t is_dense; /* Are attributes stored densely? */ - hsize_t nattrs; /* Number of attributes on object */ - hsize_t name_count; /* # of records in name index */ - hsize_t corder_count; /* # of records in creation order index */ - unsigned use_index; /* Use index on creation order values */ - const char *dsetname; /* Name of dataset for attributes */ - char attrname[NAME_BUF_SIZE]; /* Name of attribute */ - unsigned curr_dset; /* Current dataset to work on */ - unsigned u; /* Local index variable */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File ID */ + hid_t dset1, dset2, dset3; /* Dataset IDs */ + hid_t my_dataset = H5I_INVALID_HID; /* Current dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t attr; /* Attribute ID */ + hid_t dcpl; /* Dataset creation property list ID */ + unsigned max_compact; /* Maximum # of links to store in group compactly */ + unsigned min_dense; /* Minimum # of links to store in group "densely" */ + htri_t is_empty; /* Are there any attributes? */ + htri_t is_dense; /* Are attributes stored densely? */ + hsize_t nattrs; /* Number of attributes on object */ + hsize_t name_count; /* # of records in name index */ + hsize_t corder_count; /* # of records in creation order index */ + unsigned use_index; /* Use index on creation order values */ + const char *dsetname; /* Name of dataset for attributes */ + char attrname[NAME_BUF_SIZE]; /* Name of attribute */ + unsigned curr_dset; /* Current dataset to work on */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic return value */ /* Create dataspace for dataset & attributes */ sid = H5Screate(H5S_SCALAR); diff --git a/test/tcheck_version.c b/test/tcheck_version.c index 2d5c239..f14c61c 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -38,9 +38,9 @@ void parse(int ac, char **av); void abort_intercept(int H5_ATTR_UNUSED sig); /* global variables */ -unsigned major = H5_VERS_MAJOR; -unsigned minor = H5_VERS_MINOR; -unsigned release = H5_VERS_RELEASE; +static unsigned major = H5_VERS_MAJOR; +static unsigned minor = H5_VERS_MINOR; +static unsigned release = H5_VERS_RELEASE; void showhelp(void) diff --git a/test/tcoords.c b/test/tcoords.c index 230db60..0be11e4 100644 --- a/test/tcoords.c +++ b/test/tcoords.c @@ -33,7 +33,7 @@ /* Data written to the dataset for single block test. Global variable * for convenience. */ -int da_buffer[2][3][6][2]; +static int da_buffer[2][3][6][2]; /*********************************************************** ** diff --git a/test/testframe.c b/test/testframe.c index cb730b7..90d975e 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -221,7 +221,7 @@ TestParseCmdLine(int argc, char *argv[]) hbool_t skipped_all = FALSE; int ret_code; - while (argv++, --argc > 0) { + while ((void)argv++, --argc > 0) { if ((HDstrcmp(*argv, "-verbose") == 0) || (HDstrcmp(*argv, "-v") == 0)) { if (argc > 0) { --argc; diff --git a/test/tfile.c b/test/tfile.c index ac931cc..4bb2d82 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -142,14 +142,14 @@ #define FILE8 "tfile8.h5" /* Test file */ /* Files created under 1.6 branch and 1.8 branch--used in test_filespace_compatible() */ -const char *OLD_FILENAME[] = { +static const char *OLD_FILENAME[] = { "filespace_1_6.h5", /* 1.6 HDF5 file */ "filespace_1_8.h5" /* 1.8 HDF5 file */ }; /* Files created in 1.10.0 release --used in test_filespace_1.10.0_compatible() */ /* These files are copied from release 1.10.0 tools/h5format_convert/testfiles */ -const char *OLD_1_10_0_FILENAME[] = { +static const char *OLD_1_10_0_FILENAME[] = { "h5fc_ext1_i.h5", /* 0 */ "h5fc_ext1_f.h5", /* 1 */ "h5fc_ext2_if.h5", /* 2 */ @@ -159,7 +159,7 @@ const char *OLD_1_10_0_FILENAME[] = { }; /* Files used in test_filespace_round_compatible() */ -const char *FSPACE_FILENAMES[] = { +static const char *FSPACE_FILENAMES[] = { "fsm_aggr_nopersist.h5", /* H5F_FILE_SPACE_AGGR, not persisting free-space */ "fsm_aggr_persist.h5", /* H5F_FILE_SPACE_AGGR, persisting free-space */ "paged_nopersist.h5", /* H5F_FILE_SPACE_PAGE, not persisting free-space */ @@ -168,7 +168,7 @@ const char *FSPACE_FILENAMES[] = { "none.h5" /* H5F_FILE_SPACE_NONE */ }; -const char *FILESPACE_NAME[] = {"tfilespace", NULL}; +static const char *FILESPACE_NAME[] = {"tfilespace", NULL}; /* Declarations for test_libver_bounds_copy(): */ /* SRC_FILE: source file created under 1.8 branch with latest format */ diff --git a/test/tgenprop.c b/test/tgenprop.c index 5751ce7..7bfd590 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -39,22 +39,22 @@ /* Property definitions */ #define PROP1_NAME "Property 1" -int prop1_def = 10; /* Property 1 default value */ +static int prop1_def = 10; /* Property 1 default value */ #define PROP1_SIZE sizeof(prop1_def) #define PROP1_DEF_VALUE (&prop1_def) #define PROP2_NAME "Property 2" -float prop2_def = 3.14F; /* Property 2 default value */ +static float prop2_def = 3.14F; /* Property 2 default value */ #define PROP2_SIZE sizeof(prop2_def) #define PROP2_DEF_VALUE (&prop2_def) #define PROP3_NAME "Property 3" -char prop3_def[10] = "Ten chars"; /* Property 3 default value */ +static char prop3_def[10] = "Ten chars"; /* Property 3 default value */ #define PROP3_SIZE sizeof(prop3_def) #define PROP3_DEF_VALUE (&prop3_def) #define PROP4_NAME "Property 4" -double prop4_def = 1.41; /* Property 4 default value */ +static double prop4_def = 1.41; /* Property 4 default value */ #define PROP4_SIZE sizeof(prop4_def) #define PROP4_DEF_VALUE (&prop4_def) @@ -996,9 +996,9 @@ typedef struct { } prop_cb_info; /* Global variables for Callback information */ -prop_cb_info prop1_cb_info; /* Callback statistics for property #1 */ -prop_cb_info prop2_cb_info; /* Callback statistics for property #2 */ -prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */ +static prop_cb_info prop1_cb_info; /* Callback statistics for property #1 */ +static prop_cb_info prop2_cb_info; /* Callback statistics for property #2 */ +static prop_cb_info prop3_cb_info; /* Callback statistics for property #3 */ /**************************************************************** ** diff --git a/test/th5s.c b/test/th5s.c index 31944e6..7e9d216 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -74,18 +74,18 @@ /* Scalar dataset with simple datatype */ #define SPACE3_RANK 0 -unsigned space3_data = 65; +static unsigned space3_data = 65; /* Scalar dataset with compound datatype */ #define SPACE4_FIELDNAME1 "c1" #define SPACE4_FIELDNAME2 "u" #define SPACE4_FIELDNAME3 "f" #define SPACE4_FIELDNAME4 "c2" -size_t space4_field1_off = 0; -size_t space4_field2_off = 0; -size_t space4_field3_off = 0; -size_t space4_field4_off = 0; -struct space4_struct { +static size_t space4_field1_off = 0; +static size_t space4_field2_off = 0; +static size_t space4_field3_off = 0; +static size_t space4_field4_off = 0; +static struct space4_struct { char c1; unsigned u; float f; diff --git a/test/tid.c b/test/tid.c index ef1e201..6b7bb0b 100644 --- a/test/tid.c +++ b/test/tid.c @@ -872,7 +872,7 @@ typedef struct { } future_obj_t; /* Global (static) future ID object type */ -H5I_type_t future_obj_type_g = H5I_BADID; +static H5I_type_t future_obj_type_g = H5I_BADID; /* Callback to free the actual object for future object test */ static herr_t diff --git a/test/tmeta.c b/test/tmeta.c index d55882d..46474a3 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -26,7 +26,7 @@ #define TEST_INT32_VALUE (-981236) #define TEST_UINT32_VALUE 3476589 -uint8_t compar_buffer[] = { +static uint8_t compar_buffer[] = { /* Little-endian encoded version of the 16-bit signed integer */ (uint8_t)((TEST_INT16_VALUE)&0xff), (uint8_t)((TEST_INT16_VALUE >> 8) & 0xff), @@ -45,7 +45,7 @@ uint8_t compar_buffer[] = { (uint8_t)((TEST_UINT32_VALUE >> 24) & 0xff), }; -uint8_t encode_buffer[sizeof(compar_buffer)]; +static uint8_t encode_buffer[sizeof(compar_buffer)]; /**************************************************************** ** diff --git a/test/tsohm.c b/test/tsohm.c index 9f2dd50..e8de093 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -26,20 +26,21 @@ /* Default SOHM values */ #define DEF_NUM_INDEXES 0 -const unsigned def_type_flags[H5O_SHMESG_MAX_NINDEXES] = {0, 0, 0, 0, 0, 0}; -const unsigned def_minsizes[H5O_SHMESG_MAX_NINDEXES] = {250, 250, 250, 250, 250, 250}; +static const unsigned def_type_flags[H5O_SHMESG_MAX_NINDEXES] = {0, 0, 0, 0, 0, 0}; +static const unsigned def_minsizes[H5O_SHMESG_MAX_NINDEXES] = {250, 250, 250, 250, 250, 250}; #define DEF_L2B 50 #define DEF_B2L 40 /* Non-default SOHM values for testing */ #define TEST_NUM_INDEXES 4 -const unsigned test_type_flags[H5O_SHMESG_MAX_NINDEXES] = {H5O_SHMESG_FILL_FLAG, - H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_ATTR_FLAG, - H5O_SHMESG_SDSPACE_FLAG, - H5O_SHMESG_PLINE_FLAG, - 0, - 0}; -const unsigned test_minsizes[H5O_SHMESG_MAX_NINDEXES] = {0, 2, 40, 100, 3, 1000}; +static const unsigned test_type_flags[H5O_SHMESG_MAX_NINDEXES] = {H5O_SHMESG_FILL_FLAG, + H5O_SHMESG_DTYPE_FLAG | + H5O_SHMESG_ATTR_FLAG, + H5O_SHMESG_SDSPACE_FLAG, + H5O_SHMESG_PLINE_FLAG, + 0, + 0}; +static const unsigned test_minsizes[H5O_SHMESG_MAX_NINDEXES] = {0, 2, 40, 100, 3, 1000}; #define TEST_L2B 65 #define TEST_B2L 64 @@ -69,31 +70,31 @@ typedef struct dtype1_struct { } dtype1_struct; #define DTYPE2_SIZE 1024 -const char *DSETNAME[] = {"dataset0", "dataset1", "dataset2", "dataset3", "dataset4", - "dataset5", "dataset6", "dataset7", "dataset8", "dataset9", - "dataset10", "dataset11", NULL}; -const char *EXTRA_DSETNAME[] = {"ex_dataset0", "ex_dataset1", "ex_dataset2", - "ex_dataset3", "ex_dataset4", "ex_dataset5", - "ex_dataset6", "ex_dataset7", "ex_dataset8", - "ex_dataset9", "ex_dataset10", "ex_dataset11", - "ex_dataset12", "ex_dataset13", "ex_dataset14", - "ex_dataset15", "ex_dataset16", "ex_dataset17", - "ex_dataset18", "ex_dataset19", NULL}; +static const char *DSETNAME[] = {"dataset0", "dataset1", "dataset2", "dataset3", "dataset4", + "dataset5", "dataset6", "dataset7", "dataset8", "dataset9", + "dataset10", "dataset11", NULL}; +static const char *EXTRA_DSETNAME[] = {"ex_dataset0", "ex_dataset1", "ex_dataset2", + "ex_dataset3", "ex_dataset4", "ex_dataset5", + "ex_dataset6", "ex_dataset7", "ex_dataset8", + "ex_dataset9", "ex_dataset10", "ex_dataset11", + "ex_dataset12", "ex_dataset13", "ex_dataset14", + "ex_dataset15", "ex_dataset16", "ex_dataset17", + "ex_dataset18", "ex_dataset19", NULL}; #define SOHM_HELPER_NUM_EX_DSETS 20 typedef struct complex_t { double re; double im; } complex_t; #define ENUM_NUM_MEMBS 20 -const char *ENUM_NAME[] = {"enum_member0", "enum_member1", "enum_member2", - "enum_member3", "enum_member4", "enum_member5", - "enum_member6", "enum_member7", "enum_member8", - "enum_member9", "enum_member10", "enum_member11", - "enum_member12", "enum_member13", "enum_member14", - "enum_member15", "enum_member16", "enum_member17", - "enum_member18", "enum_member19", NULL}; -const int ENUM_VAL[] = {0, 13, -500, 63, 64, -64, 65, 2048, 1, 2, -1, - 7, 130, -5000, 630, 640, -640, 650, 20480, 10, -1001, -10}; +static const char *ENUM_NAME[] = {"enum_member0", "enum_member1", "enum_member2", + "enum_member3", "enum_member4", "enum_member5", + "enum_member6", "enum_member7", "enum_member8", + "enum_member9", "enum_member10", "enum_member11", + "enum_member12", "enum_member13", "enum_member14", + "enum_member15", "enum_member16", "enum_member17", + "enum_member18", "enum_member19", NULL}; +static const int ENUM_VAL[] = {0, 13, -500, 63, 64, -64, 65, 2048, 1, 2, -1, + 7, 130, -5000, 630, 640, -640, 650, 20480, 10, -1001, -10}; #define SIZE2_RANK1 6 #define SIZE2_RANK2 10 #define SIZE2_DIMS \ diff --git a/test/unlink.c b/test/unlink.c index 50781d9..a8fe2d8 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -25,9 +25,9 @@ #include "h5test.h" #include "H5Gpkg.h" /* Groups */ -const char *FILENAME[] = {"unlink", "new_move_a", "new_move_b", "lunlink", - "filespace", "slashes", "resurrect_set", "resurrect_type", - "resurrect_group", "unlink_chunked", "full_group", NULL}; +static const char *FILENAME[] = {"unlink", "new_move_a", "new_move_b", "lunlink", + "filespace", "slashes", "resurrect_set", "resurrect_type", + "resurrect_group", "unlink_chunked", "full_group", NULL}; /* Macros for test_create_unlink() & test_filespace */ #define GROUPNAME "group" diff --git a/test/unregister.c b/test/unregister.c index db6cfd1..5338b09 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -19,7 +19,7 @@ #include "H5CXprivate.h" /* API Contexts */ -const char *FILENAME[] = {"unregister_filter_1", "unregister_filter_2", NULL}; +static const char *FILENAME[] = {"unregister_filter_1", "unregister_filter_2", NULL}; #define GROUP_NAME "test_group" #define DSET_NAME "test_dataset" @@ -36,7 +36,7 @@ static size_t do_nothing(unsigned int flags, size_t cd_nelmts, const unsigned in size_t *buf_size, void **buf); /* Dummy filter for test_unregister_filters only */ -const H5Z_class2_t H5Z_DUMMY[1] = {{ +static const H5Z_class2_t H5Z_DUMMY[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_DUMMY, /* Filter ID number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c index ea674ec..04319ab 100644 --- a/test/use_disable_mdc_flushes.c +++ b/test/use_disable_mdc_flushes.c @@ -27,7 +27,7 @@ #include "H5Dpkg.h" /* Global Variable definitions */ -const char *progname_g = "use_disable_mdc_flushes"; /* program name */ +static const char *progname_g = "use_disable_mdc_flushes"; /* program name */ /* these two definitions must match each other */ #define UC_DATATYPE H5T_NATIVE_SHORT /* use case HDF5 data type */ @@ -40,14 +40,14 @@ const char *progname_g = "use_disable_mdc_flushes"; /* program name */ goto done; \ } -char *filename_g; -hsize_t nplanes_g; -int use_swmr_g; -int chunkplanes_g; -int chunksize_g; -hsize_t dims_g[UC_RANK]; -hsize_t max_dims_g[UC_RANK]; -hsize_t chunkdims_g[UC_RANK]; +static char *filename_g; +static hsize_t nplanes_g; +static int use_swmr_g; +static int chunkplanes_g; +static int chunksize_g; +static hsize_t dims_g[UC_RANK]; +static hsize_t max_dims_g[UC_RANK]; +static hsize_t chunkdims_g[UC_RANK]; static void usage(const char *prog); static int parse_option(int argc, char *const argv[]); diff --git a/test/vds.c b/test/vds.c index 9f2ea97..0f3e0b0 100644 --- a/test/vds.c +++ b/test/vds.c @@ -29,9 +29,9 @@ typedef enum { TEST_API_NTESTS } test_api_config_t; -const char *FILENAME[] = {"vds_virt_0", "vds_virt_1", "vds_src_0", "vds_src_1", "vds%%_src", - "vds_dapl", "vds_virt_2", "vds_virt_3", "vds_src_2", "vds_src_3", - "vds%%_src2", "vds_dapl2", NULL}; +static const char *FILENAME[] = {"vds_virt_0", "vds_virt_1", "vds_src_0", "vds_src_1", "vds%%_src", + "vds_dapl", "vds_virt_2", "vds_virt_3", "vds_src_2", "vds_src_3", + "vds%%_src2", "vds_dapl2", NULL}; /* Define to enable verbose test output */ /* #define VDS_TEST_VERBOSE 1 */ diff --git a/test/vds_env.c b/test/vds_env.c index 2f362d9..bb95d03 100644 --- a/test/vds_env.c +++ b/test/vds_env.c @@ -18,7 +18,7 @@ */ #include "h5test.h" -const char *FILENAME[] = {"vds_env_virt_0", "vds_env_virt_3", "vds_env_src_2", "vds_env%%_src2", NULL}; +static const char *FILENAME[] = {"vds_env_virt_0", "vds_env_virt_3", "vds_env_src_2", "vds_env%%_src2", NULL}; /* I/O test config flags */ #define TEST_IO_CLOSE_SRC 0x01u diff --git a/test/vfd.c b/test/vfd.c index d8fb5d0..a9cd241 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -47,23 +47,23 @@ #define DSET2_DIM 4 #endif /* H5_HAVE_DIRECT */ -const char *FILENAME[] = {"sec2_file", /*0*/ - "core_file", /*1*/ - "family_file", /*2*/ - "new_family_v16", /*3*/ - "multi_file", /*4*/ - "direct_file", /*5*/ - "log_file", /*6*/ - "stdio_file", /*7*/ - "windows_file", /*8*/ - "new_multi_file_v16", /*9*/ - "ro_s3_file", /*10*/ - "splitter_rw_file", /*11*/ - "splitter_wo_file", /*12*/ - "splitter.log", /*13*/ - "ctl_file", /*14*/ - "ctl_splitter_wo_file", /*15*/ - NULL}; +static const char *FILENAME[] = {"sec2_file", /*0*/ + "core_file", /*1*/ + "family_file", /*2*/ + "new_family_v16", /*3*/ + "multi_file", /*4*/ + "direct_file", /*5*/ + "log_file", /*6*/ + "stdio_file", /*7*/ + "windows_file", /*8*/ + "new_multi_file_v16", /*9*/ + "ro_s3_file", /*10*/ + "splitter_rw_file", /*11*/ + "splitter_wo_file", /*12*/ + "splitter.log", /*13*/ + "ctl_file", /*14*/ + "ctl_splitter_wo_file", /*15*/ + NULL}; #define LOG_FILENAME "log_vfd_out.log" diff --git a/test/vol.c b/test/vol.c index a7c669c..1690614 100644 --- a/test/vol.c +++ b/test/vol.c @@ -28,7 +28,7 @@ #include "H5VLpkg.h" /* Virtual Object Layer */ /* Filename */ -const char *FILENAME[] = {"vol_test_file", NULL}; +static const char *FILENAME[] = {"vol_test_file", NULL}; #define NATIVE_VOL_TEST_GROUP_NAME "test_group" #define NATIVE_VOL_TEST_DATASET_NAME "test_dataset" diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c index f6c300a..9fa5a9c 100644 --- a/testpar/t_filters_parallel.c +++ b/testpar/t_filters_parallel.c @@ -20,8 +20,8 @@ #include "t_filters_parallel.h" -const char *FILENAME[] = {"t_filters_parallel", NULL}; -char filenames[1][256]; +static const char *FILENAME[] = {"t_filters_parallel", NULL}; +char filenames[1][256]; static MPI_Comm comm = MPI_COMM_WORLD; static MPI_Info info = MPI_INFO_NULL; diff --git a/testpar/t_init_term.c b/testpar/t_init_term.c index 2f2ad61..e492d92 100644 --- a/testpar/t_init_term.c +++ b/testpar/t_init_term.c @@ -22,7 +22,7 @@ int nerrors = 0; /* errors count */ -const char *FILENAME[] = {"after_mpi_fin", NULL}; +static const char *FILENAME[] = {"after_mpi_fin", NULL}; int main(int argc, char **argv) diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index edfbcfe..f7131d5 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -22,7 +22,7 @@ */ #include "h5test.h" -const char *FILENAME[] = {"flush", "noflush", NULL}; +static const char *FILENAME[] = {"flush", "noflush", NULL}; static int *data_g = NULL; diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index 0250463..e346714 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -23,7 +23,7 @@ #include "h5test.h" -const char *FILENAME[] = {"flush", "noflush", NULL}; +static const char *FILENAME[] = {"flush", "noflush", NULL}; static int *data_g = NULL; diff --git a/testpar/t_prestart.c b/testpar/t_prestart.c index bfa72b6..dc291af 100644 --- a/testpar/t_prestart.c +++ b/testpar/t_prestart.c @@ -22,7 +22,7 @@ int nerrors = 0; /* errors count */ -const char *FILENAME[] = {"shutdown", NULL}; +static const char *FILENAME[] = {"shutdown", NULL}; int main(int argc, char **argv) diff --git a/testpar/t_pshutdown.c b/testpar/t_pshutdown.c index 278fd09..af98a76 100644 --- a/testpar/t_pshutdown.c +++ b/testpar/t_pshutdown.c @@ -26,7 +26,7 @@ int nerrors = 0; /* errors count */ -const char *FILENAME[] = {"shutdown", NULL}; +static const char *FILENAME[] = {"shutdown", NULL}; int main(int argc, char **argv) diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 825ca06..c554160 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -3345,7 +3345,7 @@ print_pos(diff_opt_t *opts, hsize_t idx, size_t u) int j; hsize_t count; hsize_t block; - hsize_t stride; + hsize_t stride = 0; hsize_t tmp = 0; hsize_t k0 = 0; /* whole location beyond current dimension */ hsize_t k1 = 0; /* partial location within dimension */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 396de54..e752895 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -51,7 +51,6 @@ int region_output; /* region output */ int oid_output; /* oid output */ int data_output; /* data output */ int attr_data_output; /* attribute data output */ -int compound_data; unsigned packed_bits_num; /* number of packed bits to display */ unsigned packed_data_offset; /* offset of packed bits to display */ diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 9f12367..33f9dd6 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -254,7 +254,7 @@ ref_path_table_put(const char *path, const H5O_token_t *token) /* * counter used to disambiguate multiple instances of same object. */ -int xid = 1; +static int xid = 1; int get_next_xid(void) @@ -268,7 +268,7 @@ get_next_xid(void) * minimizes the chance of collision with a real object id. * */ -haddr_t fake_xid = HADDR_MAX; +static haddr_t fake_xid = HADDR_MAX; void get_fake_token(H5O_token_t *token) diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index 49a4a20..6a8d091 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -33,7 +33,7 @@ #define MICROSECOND 1000000.0F /* global variables */ -io_time_t *timer_g; /* timer: global for stub functions */ +static io_time_t *timer_g; /* timer: global for stub functions */ /* * Function: sub_time diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c index 72cd88e..43b78b3 100644 --- a/tools/src/h5copy/h5copy.c +++ b/tools/src/h5copy/h5copy.c @@ -30,11 +30,11 @@ static struct h5_long_options l_opts[] = {{"destination", require_arg, 'd'}, {"version", no_arg, 'V'}, {"enable-error-stack", optional_arg, 'E'}, {NULL, 0, '\0'}}; -char *fname_src = NULL; -char *fname_dst = NULL; -char *oname_src = NULL; -char *oname_dst = NULL; -char *str_flag = NULL; +static char *fname_src = NULL; +static char *fname_dst = NULL; +static char *oname_src = NULL; +static char *oname_dst = NULL; +static char *str_flag = NULL; /*------------------------------------------------------------------------- * Function: leave diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h index 5d29317..46c366c 100644 --- a/tools/src/h5import/h5import.h +++ b/tools/src/h5import/h5import.h @@ -110,21 +110,21 @@ struct Options { int fcount; /* number of input files */ }; -char keytable[NUM_KEYS][30] = {"PATH", - "INPUT-CLASS", - "INPUT-SIZE", - "RANK", - "DIMENSION-SIZES", - "OUTPUT-CLASS", - "OUTPUT-SIZE", - "OUTPUT-ARCHITECTURE", - "OUTPUT-BYTE-ORDER", - "CHUNKED-DIMENSION-SIZES", - "COMPRESSION-TYPE", - "COMPRESSION-PARAM", - "EXTERNAL-STORAGE", - "MAXIMUM-DIMENSIONS", - "INPUT-BYTE-ORDER"}; +static char keytable[NUM_KEYS][30] = {"PATH", + "INPUT-CLASS", + "INPUT-SIZE", + "RANK", + "DIMENSION-SIZES", + "OUTPUT-CLASS", + "OUTPUT-SIZE", + "OUTPUT-ARCHITECTURE", + "OUTPUT-BYTE-ORDER", + "CHUNKED-DIMENSION-SIZES", + "COMPRESSION-TYPE", + "COMPRESSION-PARAM", + "EXTERNAL-STORAGE", + "MAXIMUM-DIMENSIONS", + "INPUT-BYTE-ORDER"}; static int state_table[15][8] = { /* token ordering: FILNAME OPT_o OPT_c OPT_h OPT_d OPT_p OPT_t OPT_s */ diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index c7ede3c..9b3030c 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -23,10 +23,10 @@ hsize_t compute_user_block_size(hsize_t); hsize_t copy_some_to_file(int, int, hsize_t, hsize_t, ssize_t); void parse_command_line(int, const char *const *); -int do_clobber = FALSE; -char *output_file = NULL; -char *input_file = NULL; -char *ub_file = NULL; +static int do_clobber = FALSE; +static char *output_file = NULL; +static char *input_file = NULL; +static char *ub_file = NULL; /* * Command-line options: The user can specify short or long-named diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 9578f7a..ca122e4 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -21,10 +21,10 @@ static int parse_command_line(int argc, const char *const *argv, pack_opt_t *op static void leave(int ret) H5_ATTR_NORETURN; /* module-scoped variables */ -static int has_i = 0; -static int has_o = 0; -const char *infile = NULL; -const char *outfile = NULL; +static int has_i = 0; +static int has_o = 0; +static const char *infile = NULL; +static const char *outfile = NULL; /* * Command-line options: The user can specify short or long-named diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 05e0be8..495954e 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -35,12 +35,12 @@ to accommodate datasets without any filters */ /* File space management strategies: see H5Fpublic.h for declarations */ -const char *FS_STRATEGY_NAME[] = {"H5F_FSPACE_STRATEGY_FSM_AGGR", - "H5F_FSPACE_STRATEGY_PAGE", - "H5F_FSPACE_STRATEGY_AGGR", - "H5F_FSPACE_STRATEGY_NONE", - "unknown", - NULL}; +static const char *FS_STRATEGY_NAME[] = {"H5F_FSPACE_STRATEGY_FSM_AGGR", + "H5F_FSPACE_STRATEGY_PAGE", + "H5F_FSPACE_STRATEGY_AGGR", + "H5F_FSPACE_STRATEGY_NONE", + "unknown", + NULL}; /* Datatype statistics for datasets */ typedef struct dtype_info_t { diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c index fc7d5b6..c183a41 100644 --- a/tools/src/misc/h5mkgrp.c +++ b/tools/src/misc/h5mkgrp.c @@ -39,7 +39,7 @@ typedef struct mkgrp_opt_t { hid_t fapl_id; /* fapl to use when opening the file */ } mkgrp_opt_t; -mkgrp_opt_t params_g; /* Command line parameter settings */ +static mkgrp_opt_t params_g; /* Command line parameter settings */ /*------------------------------------------------------------------------- * Function: leave diff --git a/tools/test/h5copy/dynlib_copy.c b/tools/test/h5copy/dynlib_copy.c index e71ca47..2abef79 100644 --- a/tools/test/h5copy/dynlib_copy.c +++ b/tools/test/h5copy/dynlib_copy.c @@ -24,7 +24,7 @@ static size_t H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, const un size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ +static const H5Z_class2_t H5Z_DYNLIBUD[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_DYNLIBUD, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c index e0402b5..3718964 100644 --- a/tools/test/h5format_convert/h5fc_gentest.c +++ b/tools/test/h5format_convert/h5fc_gentest.c @@ -27,15 +27,15 @@ #define EDGE_V3_FILE "h5fc_edge_v3.h5" #define ERR_LEVEL_FILE "h5fc_err_level.h5" -const char *FILENAME[] = {"h5fc_ext1_i.h5", /* 0 */ - "h5fc_ext1_s.h5", /* 1 */ - "h5fc_ext1_f.h5", /* 2 */ - "h5fc_ext2_is.h5", /* 3 */ - "h5fc_ext2_if.h5", /* 4 */ - "h5fc_ext2_sf.h5", /* 5 */ - "h5fc_ext3_isf.h5", /* 6 */ - "h5fc_ext_none.h5", /* 7 */ - NULL}; +static const char *FILENAME[] = {"h5fc_ext1_i.h5", /* 0 */ + "h5fc_ext1_s.h5", /* 1 */ + "h5fc_ext1_f.h5", /* 2 */ + "h5fc_ext2_is.h5", /* 3 */ + "h5fc_ext2_if.h5", /* 4 */ + "h5fc_ext2_sf.h5", /* 5 */ + "h5fc_ext3_isf.h5", /* 6 */ + "h5fc_ext_none.h5", /* 7 */ + NULL}; #define GROUP "GROUP" diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index c01df38..8928ee8 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -18,7 +18,7 @@ void parse_command_line(int argc, const char *const *argv); /* Name of tool */ #define PROGRAM_NAME "getub" -char *nbytes = NULL; +static char *nbytes = NULL; static const char *s_opts = "c:"; /* add more later ? */ static struct h5_long_options l_opts[] = {{"c", require_arg, 'c'}, /* input file */ diff --git a/tools/test/h5repack/dynlib_rpk.c b/tools/test/h5repack/dynlib_rpk.c index 225cea8..1feed12 100644 --- a/tools/test/h5repack/dynlib_rpk.c +++ b/tools/test/h5repack/dynlib_rpk.c @@ -26,7 +26,7 @@ static size_t H5Z_filter_dynlib1(unsigned int flags, size_t cd_nelmts, const uns size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_DYNLIB1[1] = {{ +static const H5Z_class2_t H5Z_DYNLIB1[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ H5Z_FILTER_DYNLIB1, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index fc0fe54..cbb5f8f 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -82,7 +82,7 @@ /* Files for testing file space paging */ #define FSPACE_OUT "h5repack_fspace_OUT.h5" /* The output file */ #define NELMTS(X) (sizeof(X) / sizeof(X[0])) /* # of elements */ -const char *H5REPACK_FSPACE_FNAMES[] = { +static const char *H5REPACK_FSPACE_FNAMES[] = { "h5repack_latest.h5", /* 0 */ "h5repack_default.h5", /* 1 */ "h5repack_page_persist.h5", /* 2 */ @@ -101,7 +101,7 @@ const char *H5REPACK_FSPACE_FNAMES[] = { /* obj and region references in attr of compound and vlen type */ #define FNAME_ATTR_REF "h5repack_attr_refs.h5" -const char *H5REPACK_FILENAMES[] = {"h5repack_big_out", NULL}; +static const char *H5REPACK_FILENAMES[] = {"h5repack_big_out", NULL}; #define H5REPACK_EXTFILE "h5repack_ext.bin" @@ -4099,9 +4099,11 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da */ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (write_dset(loc_id, 1, dims, "enum", tid, buf45) < 0) goto out; @@ -4323,9 +4325,11 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (write_dset(loc_id, 2, dims2, "enum2D", tid, 0) < 0) goto out; @@ -4531,9 +4535,11 @@ write_dset_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (write_dset(loc_id, 3, dims3, "enum3D", tid, 0) < 0) goto out; @@ -4990,9 +4996,11 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da */ if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (make_attr(loc_id, 1, dims, "enum", tid, buf45) < 0) goto out; @@ -5293,9 +5301,11 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (make_attr(loc_id, 2, dims2, "enum2D", tid, buf452) < 0) goto out; @@ -5737,9 +5747,11 @@ write_attr_in(hid_t loc_id, const char *dset_name, /* for saving reference to da if ((tid = H5Tcreate(H5T_ENUM, sizeof(e_t))) < 0) goto out; - if (H5Tenum_insert(tid, "RED", (val = 0, &val)) < 0) + val = 0; + if (H5Tenum_insert(tid, "RED", &val) < 0) goto out; - if (H5Tenum_insert(tid, "GREEN", (val = 1, &val)) < 0) + val = 1; + if (H5Tenum_insert(tid, "GREEN", &val) < 0) goto out; if (make_attr(loc_id, 3, dims3, "enum3D", tid, buf453) < 0) goto out; diff --git a/tools/test/misc/h5clear_gentest.c b/tools/test/misc/h5clear_gentest.c index 3ea6788..31796c1 100644 --- a/tools/test/misc/h5clear_gentest.c +++ b/tools/test/misc/h5clear_gentest.c @@ -13,7 +13,7 @@ #include "h5test.h" /* The HDF5 test files */ -const char *FILENAME[] = { +static const char *FILENAME[] = { "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */ "h5clear_log_v3.h5", /* 1 -- log file with superblock version 3 */ "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */ diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c index ac05aab..9359015 100644 --- a/tools/test/misc/repart_test.c +++ b/tools/test/misc/repart_test.c @@ -22,8 +22,8 @@ #define FAMILY_H5REPART_SIZE1 20000 #define FAMILY_H5REPART_SIZE2 (5 * KB) -const char *FILENAME[] = {"fst_family%05d.h5", "scd_family%05d.h5", "family_to_single.h5", - "family_to_sec2.h5", NULL}; +static const char *FILENAME[] = {"fst_family%05d.h5", "scd_family%05d.h5", "family_to_single.h5", + "family_to_sec2.h5", NULL}; herr_t test_family_h5repart_opens(void); herr_t test_single_h5repart_opens(void); diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c index 3f4b3d7..f630cf3 100644 --- a/tools/test/perform/chunk.c +++ b/tools/test/perform/chunk.c @@ -75,7 +75,7 @@ static size_t counter(unsigned H5_ATTR_UNUSED flags, size_t cd_nelmts, const uns size_t nbytes, size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_COUNTER[1] = {{ +static const H5Z_class2_t H5Z_COUNTER[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ FILTER_COUNTER, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index 7daeb68..13d7a12 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -53,7 +53,7 @@ static size_t counter(unsigned flags, size_t cd_nelmts, const unsigned *cd_value size_t *buf_size, void **buf); /* This message derives from H5Z */ -const H5Z_class2_t H5Z_COUNTER[1] = {{ +static const H5Z_class2_t H5Z_COUNTER[1] = {{ H5Z_CLASS_T_VERS, /* H5Z_class_t version */ FILTER_COUNTER, /* Filter id number */ 1, 1, /* Encoding and decoding enabled */ diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c index 016c9b7..1308fec 100644 --- a/tools/test/perform/direct_write_perf.c +++ b/tools/test/perform/direct_write_perf.c @@ -45,7 +45,7 @@ #include #endif -const char *FILENAME[] = {"direct_write", "unix.raw", NULL}; +static const char *FILENAME[] = {"direct_write", "unix.raw", NULL}; /* * Print the current location on the standard output stream. diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c index 6e62f6a..5fe3631 100644 --- a/tools/test/perform/perf_meta.c +++ b/tools/test/perform/perf_meta.c @@ -28,25 +28,25 @@ #define FACC_MPIO 0x1 /* MPIO */ /* Which test to run */ -int RUN_TEST = 0x0; /* all tests as default */ -int TEST_1 = 0x1; /* Test 1 */ -int TEST_2 = 0x2; /* Test 2 */ -int TEST_3 = 0x4; /* Test 3 */ +static int RUN_TEST = 0x0; /* all tests as default */ +static int TEST_1 = 0x1; /* Test 1 */ +static int TEST_2 = 0x2; /* Test 2 */ +static int TEST_3 = 0x4; /* Test 3 */ -const char *FILENAME[] = {"meta_perf_1", "meta_perf_2", "meta_perf_3", NULL}; +static const char *FILENAME[] = {"meta_perf_1", "meta_perf_2", "meta_perf_3", NULL}; /* Default values for performance. Can be changed through command line options */ -int NUM_DSETS = 16; -int NUM_ATTRS = 8; -int BATCH_ATTRS = 2; -hbool_t flush_dset = FALSE; -hbool_t flush_attr = FALSE; -int nerrors = 0; /* errors count */ -hid_t fapl; +static int NUM_DSETS = 16; +static int NUM_ATTRS = 8; +static int BATCH_ATTRS = 2; +static hbool_t flush_dset = FALSE; +static hbool_t flush_attr = FALSE; +static int nerrors = 0; /* errors count */ +static hid_t fapl; /* Data space IDs */ -hid_t space; -hid_t small_space; +static hid_t space; +static hid_t small_space; /* Performance data */ typedef struct p_time { @@ -59,7 +59,7 @@ typedef struct p_time { } p_time; /*Test file access type for parallel. MPIO as default */ -int facc_type = FACC_DEFAULT; +static int facc_type = FACC_DEFAULT; double retrieve_time(void); void perf(p_time *perf_t, double start_t, double end_t); -- cgit v0.12