From 523a4f7658cc3af131a4a10f8030fc7387745702 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Fri, 3 Apr 2015 12:40:11 -0500 Subject: [svn-r26717] Merge revisions 26387, 26649, 26650, 26678, and 26691 from trunk to squish warnings. --- hl/tools/gif2h5/gif.h | 2 +- hl/tools/gif2h5/gif2hdf.c | 2 +- hl/tools/gif2h5/gif2mem.c | 20 +++++++------- src/H5Epublic.h | 2 +- src/H5FDmpio.c | 45 ++++++++++++++++---------------- src/H5Gdeprec.c | 2 +- src/H5HG.c | 4 +-- src/H5HGpkg.h | 23 ++++++++--------- src/H5Oalloc.c | 2 +- src/H5RS.c | 4 +-- src/H5RSprivate.h | 2 +- src/H5Sdbg.c | 1 + src/H5TS.c | 2 +- src/H5TSprivate.h | 2 +- src/H5Zfletcher32.c | 4 ++- src/H5api_adpt.h | 7 +++++ src/H5private.h | 7 ++--- test/ttsafe_cancel.c | 7 +++-- tools/h5dump/binread.c | 66 ++++++++++++++++++++++------------------------- tools/lib/h5tools_utils.h | 6 ++--- tools/lib/h5trav.c | 16 +++++++++--- 21 files changed, 117 insertions(+), 109 deletions(-) diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index 5334919..f34a111 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/gif.h @@ -143,7 +143,7 @@ typedef struct _GifToMem { */ /* GIF2MEM.C */ -GIFTOMEM Gif2Mem(BYTE *); +int Gif2Mem(BYTE *, GIFTOMEM *); /* GIFREAD.C */ int ReadGifHeader(GIFHEAD *, BYTE **); diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c index 810be78..8a9e971 100644 --- a/hl/tools/gif2h5/gif2hdf.c +++ b/hl/tools/gif2h5/gif2hdf.c @@ -99,7 +99,7 @@ main(int argv , char *argc[]) * Call Gif2Mem and break the whole file into parts. Gif2Mem also calls * decompresses the images so we don't have to worry about that */ - GifMemoryStruct = Gif2Mem(MemGif); + Gif2Mem(MemGif, &GifMemoryStruct); if (ferror(fpGif)) { printf("File Stream Error\n\n"); diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index d816aa1..456a32d 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -37,8 +37,8 @@ #include "gif.h" -GIFTOMEM -Gif2Mem(BYTE *MemGif) +int +Gif2Mem(BYTE *MemGif, GIFTOMEM *GifMemoryStruct) { /* * The gif structure outline for passing data to memory is given in gif.h. @@ -51,8 +51,6 @@ Gif2Mem(BYTE *MemGif) GIFCOMMENT **gifComment; /* Comment Extension structure */ GIFGRAPHICCONTROL **gifGraphicControl; /* Graphic Control Extension strct */ - GIFTOMEM GifMemoryStruct; - register WORD i; /* Loop counter */ BYTE Identifier; /* Extension block identifier holder */ BYTE Label; /* Extension block label holder */ @@ -133,15 +131,15 @@ Gif2Mem(BYTE *MemGif) gifHead->PlainTextCount = PlainTextCount; /* putting stuff into the gif2mem structure */ - GifMemoryStruct.GifHeader = gifHead; - GifMemoryStruct.GifImageDesc = gifImageDesc; - GifMemoryStruct.GifPlainTextExtension = gifPlainText; - GifMemoryStruct.GifApplicationExtension = gifApplication; - GifMemoryStruct.GifCommentExtension = gifComment; - GifMemoryStruct.GifGraphicControlExtension = gifGraphicControl; + GifMemoryStruct->GifHeader = gifHead; + GifMemoryStruct->GifImageDesc = gifImageDesc; + GifMemoryStruct->GifPlainTextExtension = gifPlainText; + GifMemoryStruct->GifApplicationExtension = gifApplication; + GifMemoryStruct->GifCommentExtension = gifComment; + GifMemoryStruct->GifGraphicControlExtension = gifGraphicControl; /* return the struct */ - return GifMemoryStruct; + return 0; case 0x2C: /* Image Descriptor */ /* 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 851a962..d645e82 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1042,8 +1042,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; @@ -1056,8 +1055,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; @@ -1492,7 +1490,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 @@ -1507,15 +1508,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) @@ -1534,9 +1534,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 @@ -1559,7 +1562,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 { @@ -1775,8 +1777,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 @@ -1799,7 +1802,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) @@ -1829,17 +1831,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 { @@ -1847,17 +1850,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 81682e9..df691f4 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/H5HG.c b/src/H5HG.c index a5d779e..a861042 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -182,7 +182,7 @@ HDmemset(heap->chunk, 0, size); * which was always at least H5HG_ALIGNMENT aligned then we could just * align the pointer, but this might not be the case. */ - n = H5HG_ALIGN(p - heap->chunk) - (p - heap->chunk); + n = H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk); #ifdef OLD_WAY /* Don't bother zeroing out the rest of the info in the heap -QAK */ HDmemset(p, 0, n); @@ -776,7 +776,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) else heap->obj[0].size += need; HDmemmove(obj_start, obj_start + need, - heap->size - ((obj_start + need) - heap->chunk)); + heap->size - (size_t)((obj_start + need) - heap->chunk)); if(heap->obj[0].size >= H5HG_SIZEOF_OBJHDR(f)) { p = heap->obj[0].begin; UINT16ENCODE(p, 0); /*id*/ diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 5d4234f..f3546a2 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -77,8 +77,7 @@ H5FL_BLK_EXTERN(gheap_chunk); * largest data type is eight bytes. */ #define H5HG_ALIGNMENT 8 -#define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ - H5HG_ALIGNMENT)) +#define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/H5HG_ALIGNMENT)) #define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) /* @@ -86,20 +85,20 @@ H5FL_BLK_EXTERN(gheap_chunk); * that the stuff that follows the header is aligned. */ #define H5HG_SIZEOF_HDR(f) \ - H5HG_ALIGN(4 + /*magic number */ \ - 1 + /*version number */ \ - 3 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*collection size */ + (size_t)H5HG_ALIGN(4 + /*magic number */ \ + 1 + /*version number */ \ + 3 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*collection size */ /* * The overhead associated with each object in the heap, always a multiple of * the alignment so that the stuff that follows the header is aligned. */ #define H5HG_SIZEOF_OBJHDR(f) \ - H5HG_ALIGN(2 + /*object id number */ \ - 2 + /*reference count */ \ - 4 + /*reserved */ \ - H5F_SIZEOF_SIZE(f)) /*object data size */ + (size_t)H5HG_ALIGN(2 + /*object id number */ \ + 2 + /*reference count */ \ + 4 + /*reserved */ \ + H5F_SIZEOF_SIZE(f)) /*object data size */ /* * The initial guess for the number of messages in a collection. We assume @@ -108,8 +107,8 @@ H5FL_BLK_EXTERN(gheap_chunk); * some overhead and each message has some overhead. The `+2' accounts for * rounding and for the free space object. */ -#define H5HG_NOBJS(f,z) (int)((((z)-H5HG_SIZEOF_HDR(f))/ \ - H5HG_SIZEOF_OBJHDR(f)+2)) +#define H5HG_NOBJS(f,z) ((((z)-H5HG_SIZEOF_HDR(f))/ \ + H5HG_SIZEOF_OBJHDR(f)+2)) /****************************/ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 5c00fb2..76f392d 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -762,7 +762,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new size_t idx; /* Message number */ uint8_t *p = NULL; /*ptr into new chunk */ H5O_cont_t *cont = NULL; /*native continuation message */ - unsigned chunkno; /* Chunk allocated */ + size_t chunkno; /* Chunk allocated */ haddr_t new_chunk_addr; unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ 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 3c7e4f4..7df65bf 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/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index 7f67015..2ee69d1 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -137,9 +137,11 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U /* Compute checksum (can't fail) */ fletcher = H5_checksum_fletcher32(src, nbytes); - if (NULL==(dst=outbuf=H5MM_malloc(nbytes+FLETCHER_LEN))) + if (NULL == (outbuf = H5MM_malloc(nbytes + FLETCHER_LEN))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate Fletcher32 checksum destination buffer") + dst = (unsigned char *) outbuf; + /* Copy raw data */ HDmemcpy((void*)dst, (void*)(*buf), nbytes); diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index 9b00bd9..7602310 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -21,6 +21,13 @@ #ifndef H5API_ADPT_H #define H5API_ADPT_H +#ifdef __cplusplus +#define __attribute__(X) /*void*/ +#endif /* __cplusplus */ +#ifndef H5_HAVE_ATTRIBUTE +#define __attribute__(X) /*void*/ +#endif /* H5_HAVE_ATTRIBUTE */ + /* This will only be defined if HDF5 was built with CMake */ #ifdef H5_BUILT_AS_DYNAMIC_LIB diff --git a/src/H5private.h b/src/H5private.h index 805eb0b..4c4b9d1 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -276,12 +276,10 @@ #endif /* - * Does the compiler support the __attribute__(()) syntax? This is how gcc - * suppresses warnings about unused function arguments. It's no big deal if - * we don't. + * Does the compiler support the __attribute__(()) syntax? It's no + * big deal if we don't. */ #ifdef __cplusplus -# define __attribute__(X) /*void*/ # define UNUSED /*void*/ # define NORETURN /*void*/ #else /* __cplusplus */ @@ -289,7 +287,6 @@ # define UNUSED __attribute__((unused)) # define NORETURN __attribute__((noreturn)) #else -# define __attribute__(X) /*void*/ # define UNUSED /*void*/ # define NORETURN /*void*/ #endif 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 diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index d0a4a76..90e6d3d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -50,6 +50,10 @@ typedef struct { hid_t fid; /* File ID being traversed */ } trav_print_udata_t; +typedef struct trav_path_op_data_t { + const char *path; +} trav_path_op_data_t; + /* format for hsize_t */ #ifdef H5TRAV_PRINT_SPACE #define HSIZE_T_FORMAT "%" H5_PRINTF_LL_WIDTH "u" @@ -899,11 +903,11 @@ trav_attr(hid_t #ifndef H5TRAV_PRINT_SPACE UNUSED #endif /* H5TRAV_PRINT_SPACE */ -obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, void *op_data) +obj, const char *attr_name, const H5A_info_t UNUSED *ainfo, void *_op_data) { - char *buf; + trav_path_op_data_t *op_data = (trav_path_op_data_t *)_op_data; + const char *buf = op_data->path; - buf = (char*)op_data; if((strlen(buf)==1) && (*buf=='/')) printf(" %-10s %s%s", "attribute", buf, attr_name); else @@ -1009,10 +1013,14 @@ trav_print_visit_obj(const char *path, const H5O_info_t *oinfo, /* Check if we've already seen this object */ if(NULL == already_visited) { + trav_path_op_data_t op_data; + + op_data.path = path; /* Finish printing line about object */ printf("\n"); if(trav_verbosity > 0) - H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, NULL, trav_attr, (void *)path, H5P_DEFAULT); + H5Aiterate_by_name(print_udata->fid, path, trav_index_by, trav_index_order, + NULL, trav_attr, &op_data, H5P_DEFAULT); } else /* Print the link's original name */ -- cgit v0.12