From b8dbd390db9b47e73c6120ba61724b1e20ab333d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 16 Feb 2002 21:51:21 -0500 Subject: [svn-r4978] Purpose: Code cleanup Description: Cleanup compiler warnings found by the SGI compiler and gcc 3.0 Platforms tested: FreeBSD 4.5 w/gcc 3.0 (hack) && IRIX64 (modi4) --- fortran/src/H5f90i.h | 2 +- hl/tools/gif2h5/hdf2gif.c | 6 ------ hl/tools/gif2h5/hdfgifwr.c | 8 ++++++++ perform/chunk.c | 8 ++++---- perform/overhead.c | 2 +- src/H5.c | 2 +- src/H5FDfamily.c | 4 ++-- src/H5FLprivate.h | 2 +- src/H5P.c | 3 --- src/H5Sall.c | 4 ++-- src/H5T.c | 3 +-- src/H5TB.c | 2 +- test/h5test.c | 2 +- test/set_extend.c | 4 +++- test/titerate.c | 2 +- test/tselect.c | 2 +- test/ttsafe_acreate.c | 4 ---- test/ttsafe_cancel.c | 4 ---- test/ttsafe_dcreate.c | 4 ---- tools/gifconv/hdf2gif.c | 6 ------ tools/gifconv/hdfgifwr.c | 8 ++++++++ 21 files changed, 36 insertions(+), 46 deletions(-) diff --git a/fortran/src/H5f90i.h b/fortran/src/H5f90i.h index acdd4df..5d9ee76 100644 --- a/fortran/src/H5f90i.h +++ b/fortran/src/H5f90i.h @@ -78,7 +78,7 @@ typedef float real_f; #endif /*IBM6000*/ /* LINUX definitions */ -#if defined(i386) && defined(linux) +#if defined(i386) && (defined(linux) || defined(__FreeBSD__)) #define DF_MT DFMT_LINIX typedef char *_fcd; typedef long long hsize_t_f; diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index cc7bab4..40051dc 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -22,9 +22,6 @@ #define MAX_FILE_LEN 256 #define MAX_NUMBER_IMAGES 50 -extern int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, - BYTE *rmap, BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, - int numcols, int colorstyle, int BitsPerPixel); int EndianOrder; #ifdef NOT_USED @@ -67,7 +64,6 @@ int main(int argc , char **argv) /* reference variables */ int has_local_palette; /* treated as a flag */ - int loop_times; /* number of times to loop, treat it as yes/no */ BYTE* b; @@ -304,10 +300,8 @@ int main(int argc , char **argv) /* Write out the GIF header and logical screen descriptor */ if (n_images > 1) { fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */ - loop_times = 0; } else { fwrite("GIF87a", 1, 6, fpGif); /* the GIF magic number */ - loop_times = 1; } putword(RWidth, fpGif); /* screen descriptor */ diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c index 9804098..0ce13be 100644 --- a/hl/tools/gif2h5/hdfgifwr.c +++ b/hl/tools/gif2h5/hdfgifwr.c @@ -101,6 +101,14 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, int i; byte *pic8 = pic; + /* Shut compiler up... */ + ptype=ptype; + rmap=rmap; + gmap=gmap; + bmap=bmap; + numcols=numcols; + colorstyle=colorstyle; + #ifdef UNUSED Interlace = 0; Background = 0; diff --git a/perform/chunk.c b/perform/chunk.c index 9366c98..db2db14 100644 --- a/perform/chunk.c +++ b/perform/chunk.c @@ -371,7 +371,7 @@ main (void) cache_size+=RM_CACHE_DELT) { for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) { io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Rowmaj-rd %8d %8.2f", cache_size, io_percent); + printf ("Rowmaj-rd %8d %8.2f", (int)cache_size, io_percent); fflush (stdout); effic = test_rowmaj (READ, cache_size, io_size); printf (" %8.2f\n", effic); @@ -417,7 +417,7 @@ main (void) cache_size+=RM_CACHE_DELT) { for (io_percent=RM_START; io_percent<=RM_END; io_percent+=RM_DELTA) { io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Rowmaj-wr %8d %8.2f", cache_size, io_percent); + printf ("Rowmaj-wr %8d %8.2f", (int)cache_size, io_percent); fflush (stdout); effic = test_rowmaj (WRITE, cache_size, io_size); printf (" %8.2f\n", effic); @@ -462,7 +462,7 @@ main (void) io_percent<=DIAG_END; io_percent+=DIAG_DELTA) { io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Diag-rd %8d %8.2f", cache_size, io_percent); + printf ("Diag-rd %8d %8.2f", (int)cache_size, io_percent); fflush (stdout); effic = test_diag (READ, cache_size, io_size, MAX (1, io_size/2)); printf (" %8.2f\n", effic); @@ -507,7 +507,7 @@ main (void) io_percent<=DIAG_END; io_percent+=DIAG_DELTA) { io_size = MAX (1, (size_t)(CH_SIZE*io_percent)); - printf ("Diag-wr %8d %8.2f", cache_size, io_percent); + printf ("Diag-wr %8d %8.2f", (int)cache_size, io_percent); fflush (stdout); effic = test_diag (WRITE, cache_size, io_size, MAX (1, io_size/2)); printf (" %8.2f\n", effic); diff --git a/perform/overhead.c b/perform/overhead.c index 0723879..b0546ba 100644 --- a/perform/overhead.c +++ b/perform/overhead.c @@ -232,7 +232,7 @@ test(fill_t fill_style, const double splits[], break; case FILL_OUTWARD: j = (cur_size[0]-i)+1; - hs_start[0] = j%2 ? j/2 : cur_size[0]-j/2; + hs_start[0] = j%2 ? j/2 : (hssize_t)cur_size[0]-j/2; break; case FILL_RANDOM: for (j=rand()%cur_size[0]; had[j]; j=(j+1)%cur_size[0]) /*void*/; diff --git a/src/H5.c b/src/H5.c index ce143f6..c2c76d2 100644 --- a/src/H5.c +++ b/src/H5.c @@ -2123,7 +2123,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...) } } else { hobj_ref_t ref = va_arg (ap, hobj_ref_t); - fprintf (out, "Reference Object=%p", &ref); + fprintf (out, "Reference Object=%p", (void *)&ref); } break; diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 16c2265..3f40b22 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -876,7 +876,7 @@ H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si * list does not belong to this driver then assume defaults */ if(NULL == (plist = H5I_object(dxpl_id))) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) { H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist); @@ -954,7 +954,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s * list does not belong to this driver then assume defaults. */ if(NULL == (plist = H5I_object(dxpl_id))) - HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_DEFAULT!=dxpl_id && H5FD_FAMILY==H5P_get_driver(plist)) { H5FD_family_dxpl_t *dx = H5P_get_driver_info(plist); diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index ff89487..e531d0c 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -140,7 +140,7 @@ typedef struct H5FL_arr_head_t { * Macros for defining & using free lists for an array of a type */ /* Declare a free list to manage arrays of type 't' */ -#define H5FL_ARR_DEFINE(t,m) H5FL_arr_head_t t##_arr_free_list={0,0,NULL,0,#t##"_arr",m+1,sizeof(t),{NULL}} +#define H5FL_ARR_DEFINE(t,m) H5FL_arr_head_t t##_arr_free_list={0,0,NULL,0,#t"_arr",m+1,sizeof(t),{NULL}} /* Reference a free list for arrays of type 't' defined in another file */ #define H5FL_ARR_EXTERN(t) extern H5FL_arr_head_t t##_arr_free_list diff --git a/src/H5P.c b/src/H5P.c index cca556e..f8da556 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -4717,9 +4717,6 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, unsigned hashsize, ) { H5P_genclass_t *pclass; /* Property list class created */ - H5P_genprop_t *tmp; /* Temporary pointer to parent class properties */ - H5P_genprop_t *pcopy; /* Copy of property to insert into class */ - unsigned u; /* Local index variable */ H5P_genclass_t *ret_value=NULL; /* return value */ FUNC_ENTER (H5P_create_class, NULL); diff --git a/src/H5Sall.c b/src/H5Sall.c index 76fe0d6..3c111f7 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -632,7 +632,7 @@ for (u=0; u<=mem_space->extent.u.simple.rank; u++) *must_convert = FALSE; done: - FUNC_LEAVE(SUCCEED); + FUNC_LEAVE(ret_value); } @@ -892,7 +892,7 @@ H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout, done: - FUNC_LEAVE(SUCCEED); + FUNC_LEAVE(ret_value); } diff --git a/src/H5T.c b/src/H5T.c index d373629..d86aff0 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -2637,7 +2637,6 @@ H5T_detect_class (H5T_t *dt, H5T_class_t cls) case H5T_VLEN: case H5T_ENUM: HRETURN(H5T_detect_class(dt->parent,cls)); - break; default: break; @@ -2891,7 +2890,7 @@ H5Tget_precision(hid_t type_id) } if (dt->parent) dt = dt->parent; /*defer to parent*/ if (H5T_COMPOUND==dt->type || H5T_OPAQUE==dt->type || H5T_ARRAY==dt->type) { - HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_ORDER_ERROR, + HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified data type"); } diff --git a/src/H5TB.c b/src/H5TB.c index 4a63462..73892c5 100644 --- a/src/H5TB.c +++ b/src/H5TB.c @@ -65,7 +65,7 @@ #include "H5TBprivate.h" /*Threaded, balanced, binary trees */ # define KEYcmp(k1,k2,a) ((NULL!=compar) ? (*compar)( k1, k2, a) \ - : HDmemcmp( k1, k2, 0<(a) ? (a) : HDstrlen(k1) ) ) + : HDmemcmp( k1, k2, 0<(a) ? ((size_t)a) : HDstrlen(k1) ) ) /* Return maximum of two scalar values (use arguments w/o side effects): */ #define Max(a,b) ( (a) > (b) ? (a) : (b) ) diff --git a/test/h5test.c b/test/h5test.c index da4c02f..7a1fad5 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -472,7 +472,7 @@ h5_fileaccess(void) if ((val = HDstrtok(NULL, " \t\n\r"))) log_flags = HDstrtol(val, NULL, 0); - if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0) + if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0) return -1; #endif /* H5_WANT_H5_V1_4_COMPAT */ } else { diff --git a/test/set_extend.c b/test/set_extend.c index 29ff9a5..a076483 100644 --- a/test/set_extend.c +++ b/test/set_extend.c @@ -29,10 +29,12 @@ int main( void ) hsize_t dims_out[2]; hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; int data1[3][3] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; +#if 0 int buf1[3][3]; +#endif int buf2[2][2]; herr_t status; - int i, j; + hsize_t i, j; TESTING("extend dataset"); diff --git a/test/titerate.c b/test/titerate.c index b50913d..50c26ee 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -70,7 +70,7 @@ herr_t aiter_cb(hid_t loc_id, const char *name, void *op_data); ****************************************************************/ int iter_strcmp(const void *s1, const void *s2) { - return(strcmp(*(const char **)s1,*(const char **)s2)); + return(strcmp(*(const char * const *)s1,*(const char * const *)s2)); } /**************************************************************** diff --git a/test/tselect.c b/test/tselect.c index f98f967..e26ae64 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -1048,7 +1048,7 @@ test_select_hyper_stride(void) tbuf2=rbuf+loc2[i]; if(*tbuf!=*tbuf2) { printf("%d: hyperslab values don't match!, loc1[%d]=%d, loc2[%d]=%d\n",__LINE__,i,(int)loc1[i],i,(int)loc2[i]); - printf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",wbuf,tbuf,rbuf,tbuf2); + printf("wbuf=%p, tbuf=%p, rbuf=%p, tbuf2=%p\n",(void *)wbuf,(void *)tbuf,(void *)rbuf,(void *)tbuf2); printf("*tbuf=%u, *tbuf2=%u\n",(unsigned)*tbuf,(unsigned)*tbuf2); num_errs++; } /* end if */ diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index 7aa8bde..13cfc20 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -44,10 +44,6 @@ static int dummy; /* just to create a non-empty object file */ #define DATASETNAME "IntData" #define NUM_THREADS 16 -/* Global variables */ -extern int num_errs; -extern int Verbosity; - void *tts_acreate_thread(void *); typedef struct acreate_data_struct { diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 80981f5..2d2ce3f 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -38,10 +38,6 @@ static int dummy; /* just to create a non-empty object file */ #define FILENAME "ttsafe_cancel.h5" #define DATASETNAME "commonname" -/* Global variables */ -extern int num_errs; -extern int Verbosity; - void *tts_cancel_thread(void *); void tts_cancel_barrier(void); herr_t tts_cancel_callback(void *, hid_t, hsize_t, hssize_t *, void *); diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index aa77e36..ae4fdbc 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -35,10 +35,6 @@ static int dummy; /* just to create a non-empty object file */ #define DATASETNAME_LENGTH 10 #define NUM_THREAD 16 -/* Global variables */ -extern int num_errs; -extern int Verbosity; - void *tts_dcreate_creator(void *); typedef struct thread_info { diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c index cc7bab4..40051dc 100644 --- a/tools/gifconv/hdf2gif.c +++ b/tools/gifconv/hdf2gif.c @@ -22,9 +22,6 @@ #define MAX_FILE_LEN 256 #define MAX_NUMBER_IMAGES 50 -extern int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, - BYTE *rmap, BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, - int numcols, int colorstyle, int BitsPerPixel); int EndianOrder; #ifdef NOT_USED @@ -67,7 +64,6 @@ int main(int argc , char **argv) /* reference variables */ int has_local_palette; /* treated as a flag */ - int loop_times; /* number of times to loop, treat it as yes/no */ BYTE* b; @@ -304,10 +300,8 @@ int main(int argc , char **argv) /* Write out the GIF header and logical screen descriptor */ if (n_images > 1) { fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */ - loop_times = 0; } else { fwrite("GIF87a", 1, 6, fpGif); /* the GIF magic number */ - loop_times = 1; } putword(RWidth, fpGif); /* screen descriptor */ diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c index 9804098..0ce13be 100644 --- a/tools/gifconv/hdfgifwr.c +++ b/tools/gifconv/hdfgifwr.c @@ -101,6 +101,14 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, int i; byte *pic8 = pic; + /* Shut compiler up... */ + ptype=ptype; + rmap=rmap; + gmap=gmap; + bmap=bmap; + numcols=numcols; + colorstyle=colorstyle; + #ifdef UNUSED Interlace = 0; Background = 0; -- cgit v0.12