From 01093ad350365e1a29f1726c4ff8c72f1d4d739a Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 30 Mar 2015 10:12:49 -0500 Subject: [svn-r26649] squish warnings. --- src/H5Epublic.h | 2 +- src/H5FDmpio.c | 48 +++++++++++++++++----------------- src/H5Gdeprec.c | 2 +- src/H5RS.c | 4 +-- src/H5RSprivate.h | 2 +- src/H5Sdbg.c | 1 + src/H5TS.c | 2 +- src/H5TSprivate.h | 2 +- test/gen_filespace.c | 3 ++- test/gen_plist.c | 4 +-- test/ttsafe_cancel.c | 7 +++-- tools/h5dump/binread.c | 66 ++++++++++++++++++++++------------------------- tools/lib/h5tools_utils.h | 6 ++--- 13 files changed, 74 insertions(+), 75 deletions(-) diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 17a35d9..1639ab4 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -165,7 +165,7 @@ H5_DLL herr_t H5Eclose_stack(hid_t stack_id); H5_DLL ssize_t H5Eget_class_name(hid_t class_id, char *name, size_t size); H5_DLL herr_t H5Eset_current_stack(hid_t err_stack_id); H5_DLL herr_t H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, - hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg, ...); + hid_t cls_id, hid_t maj_id, hid_t min_id, const char *msg, ...)__attribute__((format (printf, 8, 9))); H5_DLL herr_t H5Epop(hid_t err_stack, size_t count); H5_DLL herr_t H5Eprint2(hid_t err_stack, FILE *stream); H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t func, diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 70cf49a..d81509a 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1049,8 +1049,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, char debug_str[128]; int flag, i; if (MPI_INFO_NULL != info_dup) { - /*OKAY: CAST DISCARDS CONST*/ - MPI_Info_get(fa->info, (char *)H5F_MPIO_DEBUG_KEY, 127, debug_str, &flag); + MPI_Info_get(fa->info, H5F_MPIO_DEBUG_KEY, sizeof(debug_str)-1, debug_str, &flag); if (flag) { fprintf(stdout, "H5FD_mpio debug flags=%s\n", debug_str ); for (i=0; @@ -1063,8 +1062,7 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, } #endif - /*OKAY: CAST DISCARDS CONST*/ - if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm_dup, (char*)name, mpi_amode, info_dup, &fh))) + if(MPI_SUCCESS != (mpi_code = MPI_File_open(comm_dup, name, mpi_amode, info_dup, &fh))) HMPI_GOTO_ERROR(NULL, "MPI_File_open failed", mpi_code) file_opened=1; @@ -1460,12 +1458,13 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add MPI_Count bytes_read; /* Number of bytes read in */ MPI_Count type_size; /* MPI datatype used for I/O's size */ MPI_Count io_size; /* Actual number of bytes requested */ + MPI_Count n; #else int bytes_read; /* Number of bytes read in */ int type_size; /* MPI datatype used for I/O's size */ int io_size; /* Actual number of bytes requested */ -#endif int n; +#endif H5P_genplist_t *plist = NULL; /* Property list pointer */ hbool_t use_view_this_time = FALSE; herr_t ret_value = SUCCEED; @@ -1506,7 +1505,10 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* Obtain the data transfer properties */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - xfer_mode = (H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1521,15 +1523,14 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add use_view_this_time = TRUE; /* prepare for a full-blown xfer using btype, ftype, and disp */ - if(H5P_get(plist,H5FD_MPI_XFER_MEM_MPI_TYPE_NAME,&buf_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - if(H5P_get(plist,H5FD_MPI_XFER_FILE_MPI_TYPE_NAME,&file_type)<0) + if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") /* * Set the file view when we are using MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if (MPI_SUCCESS != (mpi_code=MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) @@ -1548,9 +1549,12 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add if (H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); #endif - /* Peek the collective_opt property to check whether the application wants to do IO individually. */ + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); - coll_opt_mode = (H5FD_mpio_collective_opt_t)H5P_peek_unsigned(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME); + + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG @@ -1573,7 +1577,6 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t dxpl_id, haddr_t add /* * Reset the file view when we used MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } else { @@ -1799,8 +1802,9 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - /* Obtain the data transfer properties */ - xfer_mode = (H5FD_mpio_xfer_t)H5P_peek_unsigned(plist, H5D_XFER_IO_XFER_MODE_NAME); + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1823,7 +1827,6 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /* * Set the file view when we are using MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) @@ -1853,17 +1856,18 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif - /* Peek the collective_opt property to check whether the application wants to do IO individually. */ + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); - coll_opt_mode = (H5FD_mpio_collective_opt_t)H5P_peek_unsigned(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME); + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &coll_opt_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: doing MPI collective IO\n"); #endif - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) } /* end if */ else { @@ -1871,17 +1875,15 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: doing MPI independent IO\n"); #endif - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } /* end else */ /* Reset the file view when we used MPI derived types */ - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } else { - /*OKAY: CAST DISCARDS CONST QUALIFIER*/ - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, (void*)buf, size_i, buf_type, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code) } diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 17920ab..6433544 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -261,7 +261,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") /* Set the non-default local heap size hint */ - ginfo.lheap_size_hint = size_hint; + H5_ASSIGN_OVERFLOW(ginfo.lheap_size_hint, size_hint, size_t, uint32_t); if(H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") } /* end if */ diff --git a/src/H5RS.c b/src/H5RS.c index dc6795e..5bbdabd 100644 --- a/src/H5RS.c +++ b/src/H5RS.c @@ -139,7 +139,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ H5RS_str_t * -H5RS_wrap(const char *s) +H5RS_wrap(char *s) { H5RS_str_t *ret_value; /* Return value */ @@ -150,7 +150,7 @@ H5RS_wrap(const char *s) HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") /* Set the internal fields */ - ret_value->s = (char *)s; /* (Cast away const OK - QAK) */ + ret_value->s = s; ret_value->wrapped = 1; ret_value->n = 1; diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h index c46f53c..757e0e4 100644 --- a/src/H5RSprivate.h +++ b/src/H5RSprivate.h @@ -46,7 +46,7 @@ typedef struct H5RS_str_t H5RS_str_t; /* Private routines */ /********************/ H5_DLL H5RS_str_t *H5RS_create(const char *s); -H5_DLL H5RS_str_t *H5RS_wrap(const char *s); +H5_DLL H5RS_str_t *H5RS_wrap(char *s); H5_DLL H5RS_str_t *H5RS_own(char *s); H5_DLL herr_t H5RS_decr(H5RS_str_t *rs); H5_DLL herr_t H5RS_incr(H5RS_str_t *rs); diff --git a/src/H5Sdbg.c b/src/H5Sdbg.c index df033da..0cbe4f2 100644 --- a/src/H5Sdbg.c +++ b/src/H5Sdbg.c @@ -113,6 +113,7 @@ H5S_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, int indent, indent + 3, MAX(0, fwidth - 3)); break; + case H5S_NO_CLASS: default: fprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth, "Space class:", (long)(H5S_GET_EXTENT_TYPE(mesg))); diff --git a/src/H5TS.c b/src/H5TS.c index b69bd4d..d4b90db 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -489,7 +489,7 @@ H5TS_win32_thread_exit(void) *-------------------------------------------------------------------------- */ H5TS_thread_t -H5TS_create_thread(void *func, H5TS_attr_t *attr, void *udata) +H5TS_create_thread(void *(*func)(void *), H5TS_attr_t *attr, void *udata) { H5TS_thread_t ret_value; diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index cc22f96..5394b77 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -122,7 +122,7 @@ H5_DLL herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex); H5_DLL herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex); H5_DLL herr_t H5TS_cancel_count_inc(void); H5_DLL herr_t H5TS_cancel_count_dec(void); -H5_DLL H5TS_thread_t H5TS_create_thread(void * func, H5TS_attr_t * attr, void *udata); +H5_DLL H5TS_thread_t H5TS_create_thread(void *(*func)(void *), H5TS_attr_t * attr, void *udata); #if defined c_plusplus || defined __cplusplus } diff --git a/test/gen_filespace.c b/test/gen_filespace.c index 7ee2a7a..e0c42e8 100644 --- a/test/gen_filespace.c +++ b/test/gen_filespace.c @@ -42,7 +42,8 @@ static void gen_file(void) hid_t dataset, space; hsize_t dim[1]; int data[NUM_ELMTS]; - unsigned i, j; /* Local index variable */ + size_t j; /* Local index variable */ + int i; /* Local index variable */ H5F_file_space_type_t fs_type; /* File space handling strategy */ for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, fs_type = (H5F_file_space_type_t)(fs_type + 1)) { diff --git a/test/gen_plist.c b/test/gen_plist.c index acc5f3e..e77af73 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -280,8 +280,8 @@ main(void) assert(ret > 0); /* Create FAPL for the elink FAPL */ - if((fapl1 = ret = H5Pcreate(ret = H5P_FILE_ACCESS)) < 0) - assert(ret > 0); + if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) + assert(fapl1 > 0); if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0) assert(ret > 0); diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 56f431e..d8ed462 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -123,7 +123,7 @@ void tts_cancel(void) void *tts_cancel_thread(void UNUSED *arg) { int datavalue; - int *buffer; + int buffer; hid_t dataspace, datatype, dataset; hsize_t dimsf[1]; /* dataset dimensions */ cancel_cleanup_t *cleanup_structure; @@ -156,10 +156,9 @@ void *tts_cancel_thread(void UNUSED *arg) ret=H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &datavalue); assert(ret>=0); - buffer = HDmalloc(sizeof(int)); - ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer); + ret=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); assert(ret>=0); - ret=H5Diterate(buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset); + ret=H5Diterate(&buffer, H5T_NATIVE_INT, dataspace, tts_cancel_callback, &dataset); assert(ret>=0); sleep(3); diff --git a/tools/h5dump/binread.c b/tools/h5dump/binread.c index 5abb9af..74db92c 100644 --- a/tools/h5dump/binread.c +++ b/tools/h5dump/binread.c @@ -49,8 +49,7 @@ static void usage (void) { - fprintf(stderr, "\ - usage: binread FILE_NAME\n"); + fprintf(stderr, "usage: binread FILE_NAME\n"); } /*------------------------------------------------------------------------- @@ -64,38 +63,35 @@ usage (void) int main (int argc, const char *argv[]) { - FILE *stream; - int numread; - TYPE buf[NELMTS]; - size_t i, nelmts = NELMTS; - char *fname=NULL; - - if (argc != 2) - { - usage(); - exit(1); - } - - fname = strdup(argv[1]); - - if( (stream = fopen(fname, "rb" )) != NULL ) - { - numread = fread( buf, sizeof( TYPE ), nelmts, stream ); - printf( "Number of items read = %d\n", numread ); - - for (i = 0; i < nelmts; i++) - { - printf(FORMAT,buf[i]); - } - printf("\n"); - - fclose( stream ); - } - else - printf( "File %s could not be opened\n",fname ); - - free(fname); - - return 0; + FILE *stream; + size_t numread; + TYPE buf[NELMTS]; + size_t i, nelmts = NELMTS; + char *fname=NULL; + + if (argc != 2) { + usage(); + exit(1); + } + + fname = strdup(argv[1]); + + if((stream = fopen(fname, "rb")) != NULL) { + numread = fread(buf, sizeof( TYPE ), nelmts, stream); + printf("Number of items read = %llu\n", (unsigned long long)numread); + + for (i = 0; i < nelmts; i++) { + printf(FORMAT,buf[i]); + } + printf("\n"); + + fclose(stream); + } + else + printf("File %s could not be opened\n", fname); + + free(fname); + + return 0; } diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 3285278..fd588b9 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -124,9 +124,9 @@ H5TOOLS_DLLVAR int h5tools_nCols; /*max number of columns for /* Definitions of useful routines */ H5TOOLS_DLL void indentation(int); H5TOOLS_DLL void print_version(const char *progname); -H5TOOLS_DLL void parallel_print(const char* format, ... ); -H5TOOLS_DLL void error_msg(const char *fmt, ...); -H5TOOLS_DLL void warn_msg(const char *fmt, ...); +H5TOOLS_DLL void parallel_print(const char* format, ... )__attribute__((format (printf, 1, 2))); +H5TOOLS_DLL void error_msg(const char *fmt, ...)__attribute__((format (printf, 1, 2))); +H5TOOLS_DLL void warn_msg(const char *fmt, ...)__attribute__((format (printf, 1, 2))); H5TOOLS_DLL void help_ref_msg(FILE *output); H5TOOLS_DLL void free_table(table_t *table); #ifdef H5DUMP_DEBUG -- cgit v0.12