diff options
author | Sean McBride <sean@rogue-research.com> | 2023-06-19 05:13:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-19 05:13:38 (GMT) |
commit | 65d8c9347010771473b53c91adcec2f281772213 (patch) | |
tree | 487567dae0dc005de896f616b90e67744239a5e2 /hl | |
parent | 1f20354ee6cdfa9fd157ac9cdfff9acdf320a32d (diff) | |
download | hdf5-65d8c9347010771473b53c91adcec2f281772213.zip hdf5-65d8c9347010771473b53c91adcec2f281772213.tar.gz hdf5-65d8c9347010771473b53c91adcec2f281772213.tar.bz2 |
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
Diffstat (limited to 'hl')
-rw-r--r-- | hl/examples/ex_image1.c | 2 | ||||
-rw-r--r-- | hl/examples/ex_image2.c | 4 | ||||
-rw-r--r-- | hl/src/H5DS.c | 10 | ||||
-rw-r--r-- | hl/test/test_ld.c | 17 | ||||
-rw-r--r-- | hl/test/test_packet_vlen.c | 2 | ||||
-rw-r--r-- | hl/tools/gif2h5/decompress.c | 4 | ||||
-rw-r--r-- | hl/tools/gif2h5/hdf2gif.c | 2 | ||||
-rw-r--r-- | hl/tools/h5watch/h5watch.c | 2 |
8 files changed, 22 insertions, 21 deletions
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" */ |