From cc0165a973d17386cd4983ac1d0394ad4feb8034 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 16 Sep 2015 05:34:25 -0500 Subject: [svn-r27799] Minor warning fixes in the high-level library. Tested on: jam (too minor for h5committest) --- autogen.sh | 1 + hl/src/H5IM.c | 22 +++++++++++++--------- hl/src/H5LT.c | 14 +++++++------- hl/src/H5TB.c | 2 +- hl/test/test_image.c | 2 +- hl/test/test_lite.c | 2 +- hl/tools/gif2h5/hdf2gif.c | 2 +- 7 files changed, 25 insertions(+), 20 deletions(-) diff --git a/autogen.sh b/autogen.sh index 5517c61..91d8348 100755 --- a/autogen.sh +++ b/autogen.sh @@ -441,6 +441,7 @@ do echo '#pragma GCC diagnostic ignored "-Wunused-function" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wunused-macros" ' >> tmp.out echo '#pragma GCC diagnostic ignored "-Wunused-parameter" ' >> tmp.out + echo '#pragma GCC diagnostic ignored "-Wredundant-decls" ' >> tmp.out echo '#elif defined __SUNPRO_CC ' >> tmp.out echo '#pragma disable_warn ' >> tmp.out echo '#elif defined _MSC_VER ' >> tmp.out diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 6fa548d..6d08f02 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -255,12 +255,12 @@ herr_t H5IMget_image_info( hid_t loc_id, char *interlace, hssize_t *npals ) { - hid_t did; - hid_t sid; + hid_t did = -1; + hid_t sid = -1; hsize_t dims[IMAGE24_RANK]; - hid_t aid; - hid_t asid; - hid_t atid; + hid_t aid = -1; + hid_t asid = -1; + hid_t atid = -1; H5T_class_t aclass; int has_pal; int has_attr; @@ -396,10 +396,14 @@ herr_t H5IMget_image_info( hid_t loc_id, return 0; out: - H5Dclose( did ); - H5Aclose( aid ); - H5Sclose( asid ); - H5Tclose( atid ); + if(did > 0) + H5Dclose( did ); + if(aid > 0) + H5Aclose( aid ); + if(asid > 0) + H5Sclose( asid ); + if(atid > 0) + H5Tclose( atid ); return -1; } diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 8444e27..107e238 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -866,13 +866,13 @@ out: */ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) { - hid_t fapl, file_id; /* HDF5 identifiers */ - unsigned file_open_flags;/* Flags for image open */ - char file_name[64]; /* Filename buffer */ - size_t alloc_incr; /* Buffer allocation increment */ - size_t min_incr = 65536; /* Minimum buffer increment */ - double buf_prcnt = 0.1f; /* Percentage of buffer size to set - as increment */ + hid_t fapl=-1, file_id=-1; /* HDF5 identifiers */ + unsigned file_open_flags; /* Flags for image open */ + char file_name[64]; /* Filename buffer */ + size_t alloc_incr; /* Buffer allocation increment */ + size_t min_incr = 65536; /* Minimum buffer increment */ + double buf_prcnt = 0.1f; /* Percentage of buffer size to set + as increment */ static long file_name_counter; H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy, &image_realloc, &image_free, diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 1ca41a8..0f90393 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -2718,7 +2718,7 @@ herr_t H5TBdelete_field(hid_t loc_id, goto out; /* skip the field to delete */ - if(!H5TB_find_field(member_name, field_name) > 0) { + if(!H5TB_find_field(member_name, field_name)) { /* get the member type */ if((member_type_id = H5Tget_member_type(tid_1, (unsigned)i)) < 0) goto out; diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 5d68eeb..8ba0083 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -540,7 +540,7 @@ static int test_generate(void) { hid_t fid; hsize_t pal_dims[2] = { 256, 3 }; - float *data; + float *data = NULL; int imax, jmax, kmax; int n_elements; float valex, xmin, xmax, value; diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index d4e5f93..9d625e9 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1196,7 +1196,7 @@ static int test_strings(void) H5T_str_t str_pad; H5T_cset_t str_cset; H5T_class_t type_class; - char* dt_str; + char* dt_str = NULL; size_t str_len; TESTING3(" text for string types"); diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 5c342ba..e03d5c4 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -64,7 +64,7 @@ int main(int argc , char **argv) int ColorMapSize, InitCodeSize, Background, BitsPerPixel; int j,nc; int i; - int numcols; + int numcols = 0; BYTE pc2nc[256] , r1[256] , g1[256] , b1[256]; -- cgit v0.12