From 965e3bc3e20cefeb81b0b88002c1dc42d197c2ff Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 3 Nov 2001 22:23:30 -0500 Subject: [svn-r4591] Purpose: Code cleanup Description: Fix a bunch of warnings Platforms tested: Linux 2.2 (eirene) --- hl/tools/gif2h5/decompress.c | 4 ++-- hl/tools/gif2h5/gif.h | 5 +++++ hl/tools/gif2h5/hdf2gif.c | 4 ++-- tools/gifconv/decompress.c | 4 ++-- tools/gifconv/gif.h | 5 +++++ tools/gifconv/hdf2gif.c | 4 ++-- tools/h4toh5/h4toh5main.c | 10 +++++----- tools/h4toh5/h4toh5sds.c | 26 +++++++++----------------- tools/h4toh5/h4toh5vdata.c | 10 +++++----- tools/h4toh5/h4toh5vgroup.c | 12 ++++++------ tools/h5toh4/h5toh4.c | 6 +++--- 11 files changed, 46 insertions(+), 44 deletions(-) diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index eafa133..6cc5468 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -235,7 +235,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) FreeCode = FirstFree; CurCode = OldCode = Code = ReadCode(); FinChar = CurCode & DataMask; - AddToPixel(FinChar); + AddToPixel((BYTE)FinChar); } else { /* * If not a clear code, then must be data: save same as CurCode @@ -275,7 +275,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) * stacked LIFO, so deal with it that way... */ for (i = OutCount - 1; i >= 0; i--) - AddToPixel(OutCode[i]); + AddToPixel((BYTE)OutCode[i]); OutCount = 0; diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index 21ce502..a939e17 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/gif.h @@ -144,6 +144,11 @@ int ReadGifPlainText(GIFPLAINTEXT *, BYTE **); int ReadGifApplication(GIFAPPLICATION *, BYTE **); int ReadGifComment(GIFCOMMENT *, BYTE **); +/* HDFGIFWR.C */ +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); + /* WRITEHDF.C */ int WriteHDF(GIFTOMEM , CHAR * , CHAR *); diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 9b5eebc..c2ddb10 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -106,8 +106,8 @@ int main(int argc , char **argv) return 0; } - memset(image_name_arr , NULL , MAX_NUMBER_IMAGES); - memset(pal_name_arr , NULL , MAX_NUMBER_IMAGES); + memset(image_name_arr , 0 , MAX_NUMBER_IMAGES); + memset(pal_name_arr , 0 , MAX_NUMBER_IMAGES); HDFName = (CHAR *)malloc (strlen(argv[1]) + 1); GIFName = (CHAR *)malloc (strlen(argv[2]) + 1); diff --git a/tools/gifconv/decompress.c b/tools/gifconv/decompress.c index eafa133..6cc5468 100644 --- a/tools/gifconv/decompress.c +++ b/tools/gifconv/decompress.c @@ -235,7 +235,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) FreeCode = FirstFree; CurCode = OldCode = Code = ReadCode(); FinChar = CurCode & DataMask; - AddToPixel(FinChar); + AddToPixel((BYTE)FinChar); } else { /* * If not a clear code, then must be data: save same as CurCode @@ -275,7 +275,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) * stacked LIFO, so deal with it that way... */ for (i = OutCount - 1; i >= 0; i--) - AddToPixel(OutCode[i]); + AddToPixel((BYTE)OutCode[i]); OutCount = 0; diff --git a/tools/gifconv/gif.h b/tools/gifconv/gif.h index 21ce502..a939e17 100644 --- a/tools/gifconv/gif.h +++ b/tools/gifconv/gif.h @@ -144,6 +144,11 @@ int ReadGifPlainText(GIFPLAINTEXT *, BYTE **); int ReadGifApplication(GIFAPPLICATION *, BYTE **); int ReadGifComment(GIFCOMMENT *, BYTE **); +/* HDFGIFWR.C */ +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); + /* WRITEHDF.C */ int WriteHDF(GIFTOMEM , CHAR * , CHAR *); diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c index 9b5eebc..c2ddb10 100644 --- a/tools/gifconv/hdf2gif.c +++ b/tools/gifconv/hdf2gif.c @@ -106,8 +106,8 @@ int main(int argc , char **argv) return 0; } - memset(image_name_arr , NULL , MAX_NUMBER_IMAGES); - memset(pal_name_arr , NULL , MAX_NUMBER_IMAGES); + memset(image_name_arr , 0 , MAX_NUMBER_IMAGES); + memset(pal_name_arr , 0 , MAX_NUMBER_IMAGES); HDFName = (CHAR *)malloc (strlen(argv[1]) + 1); GIFName = (CHAR *)malloc (strlen(argv[2]) + 1); diff --git a/tools/h4toh5/h4toh5main.c b/tools/h4toh5/h4toh5main.c index 4b89656..51099d8 100644 --- a/tools/h4toh5/h4toh5main.c +++ b/tools/h4toh5/h4toh5main.c @@ -744,7 +744,7 @@ int h4toh5lonevgs(int32 file_id,int32 sd_id,hid_t h5group,hid_t h5_dimg,hid_t h5 } /* converting integer number into string format. */ - if(conv_int_str(ref_array[lone_vg_number],refstr) == FAIL) { + if(conv_int_str((int)ref_array[lone_vg_number],refstr) == FAIL) { printf("ref. is negative, error in converting\n"); Vdetach(vgroup_id); free(ref_array); @@ -942,7 +942,7 @@ int h4toh5vgrings(int32 file_id,int32 sd_id,hid_t h5group,hid_t h5_dimg,hid_t h5 } /* convert reference number into string format. */ - if(conv_int_str(ref_num,refstr) == FAIL) { + if(conv_int_str((uint16)ref_num,refstr) == FAIL) { printf("ref. is negative, error in converting\n"); Vdetach(vgroup_id); return FAIL; @@ -1100,7 +1100,7 @@ int h4toh5lonevds(int32 file_id, hid_t h5group,int h4_attr){ } /* converting reference number into string format.*/ - if(conv_int_str(ref_vdata_array[lone_vd_number],refstr)==FAIL) { + if(conv_int_str((uint16)ref_vdata_array[lone_vd_number],refstr)==FAIL) { printf("error in converting int to string.\n"); free(ref_vdata_array); VSdetach(vdata_id); @@ -1237,7 +1237,7 @@ int h4toh5unvisitedsds(int32 file_id,int32 sd_id,hid_t h5root,hid_t h5_dimg,int } /* convert object reference number into string format. */ - if(conv_int_str(obj_ref,refstr) == FAIL) { + if(conv_int_str((uint16)obj_ref,refstr) == FAIL) { printf("error in converting integer into string.\n"); SDendaccess(sds_id); return FAIL; @@ -1360,7 +1360,7 @@ int h4toh5unvisitedimages(int32 file_id,hid_t h5_root,hid_t h5_palg,int h4_attr) return FAIL; } - if(conv_int_str(obj_ref,refstr)== FAIL) { + if(conv_int_str((uint16)obj_ref,refstr)== FAIL) { printf("error in converting object reference number"); printf(" into string at h4toh5unvisitedimages routine.\n"); GRendaccess(ri_id); diff --git a/tools/h4toh5/h4toh5sds.c b/tools/h4toh5/h4toh5sds.c index 4e2a9d9..3163c0b 100644 --- a/tools/h4toh5/h4toh5sds.c +++ b/tools/h4toh5/h4toh5sds.c @@ -92,10 +92,10 @@ int Sds_h4_to_h5(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimgroup,int hid_t h5ty_id; hid_t h5_memtype; hid_t create_plist; - hid_t write_plist; +/* hid_t write_plist; */ hsize_t h5dims[MAX_VAR_DIMS]; hsize_t max_h5dims[MAX_VAR_DIMS]; - hsize_t bufsize; +/* hsize_t bufsize; */ char* h5csds_name; herr_t ret; @@ -856,7 +856,7 @@ hid_t h5dim_nameaid; hid_t attribID; hid_t create_plist; - int dim_index; +/* int dim_index; */ hsize_t h5dimscas[1]; hsize_t max_h5dimscas[1]; hsize_t h5dim_dims[1]; @@ -1288,7 +1288,7 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg int32* sds_stride; int32 count_sdsdata; int32 sds_ref; - int32 istat; +/* int32 istat; */ int i; int32 num_sdsattrs; void* fill_value; @@ -1300,9 +1300,7 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg char sdslabel[MAX_NC_NAME]; size_t h4size; size_t h4memsize; - HDF_CHUNK_DEF c_def_out; hsize_t* chunk_dims; - int32 c_flags; /* define varibles for hdf5. */ @@ -1311,10 +1309,10 @@ int convert_sdsfillvalue(int32 file_id,int32 sds_id,hid_t h5_group,hid_t h5_dimg hid_t h5ty_id; hid_t h5_memtype; hid_t create_plist; - hid_t write_plist; +/* hid_t write_plist; */ hsize_t h5dims[MAX_VAR_DIMS]; hsize_t max_h5dims[MAX_VAR_DIMS]; - hsize_t bufsize; +/* hsize_t bufsize; */ char* h5csds_name; if (SDgetinfo(sds_id,sdsname,&sds_rank,sds_dimsizes,&sds_dtype, @@ -1704,8 +1702,9 @@ uint16 get_SDref(int32 file_id,uint16 tag,int32 sds_ref){ } sd_ref = di.ref; - if(!found) ; - /* printf("cannot find sd_ref\n");*/ +/* if(!found) + printf("cannot find sd_ref\n"); +*/ DFdifree(GroupID); return sd_ref; @@ -1721,15 +1720,10 @@ static int convert_zerosdsunlimit(int32 file_id, int32 sds_dtype; int32 sds_rank; int32 sds_dimsizes[MAX_VAR_DIMS]; - int32* sds_start; - int32* sds_edge; - int32* sds_stride; - int32 count_sdsdata; int32 sds_ref; int32 istat; int i; int32 num_sdsattrs; - void* fill_value; int check_sdsname; int check_gloattr; @@ -1756,10 +1750,8 @@ static int convert_zerosdsunlimit(int32 file_id, hid_t h5ty_id; hid_t h5_memtype; hid_t create_plist; - hid_t write_plist; hsize_t h5dims[MAX_VAR_DIMS]; hsize_t max_h5dims[MAX_VAR_DIMS]; - hsize_t bufsize; char* h5csds_name; if (SDgetinfo(sds_id,sdsname,&sds_rank,sds_dimsizes,&sds_dtype, diff --git a/tools/h4toh5/h4toh5vdata.c b/tools/h4toh5/h4toh5vdata.c index e4efd1d..07a2fa5 100644 --- a/tools/h4toh5/h4toh5vdata.c +++ b/tools/h4toh5/h4toh5vdata.c @@ -420,7 +420,7 @@ int Vdata_h4_to_h5(int32 file_id,int32 vdata_id, hid_t group_id,int h4_attr) { } } - if(h4_transnumattr(h5dset,HDF4_REF_NUM,vdata_ref)==FAIL){ + if(h4_transnumattr(h5dset,HDF4_REF_NUM,(uint16)vdata_ref)==FAIL){ printf("error in transfering vdata attributes.\n"); free(h5memtype); free(h5type); @@ -527,7 +527,7 @@ int vdata_transattrs(int32 vdata_id,hid_t h5dset,int snum_vdattrs, strcat(svdattr_name,":"); strcat(svdattr_name,"HDF4_VDATA_ATTR_"); - if(conv_int_str(field_index,refstr)==FAIL) { + if(conv_int_str((uint16)field_index,refstr)==FAIL) { printf("error in converting vdata field index to string.\n"); return FAIL; } @@ -570,7 +570,7 @@ int vdata_transattrs(int32 vdata_id,hid_t h5dset,int snum_vdattrs, return FAIL; } - if ((sh5str_memtype = mkstr(count_svdadata*sh4_amemsize, + if ((sh5str_memtype = mkstr((int)(count_svdadata*sh4_amemsize), H5T_STR_SPACEPAD))<0) { printf("error in making memory string for vdata attribute. \n"); free(svd_adata); @@ -731,7 +731,7 @@ int gen_h5comptype(int32 vdata_id,int32 nfields, if(sh5type[i] == H5T_STRING) { - if ((h5str_type = mkstr(sh4size[i]*fieldorder,H5T_STR_SPACEPAD))<0) { + if ((h5str_type = mkstr((int)(sh4size[i]*fieldorder),H5T_STR_SPACEPAD))<0) { printf("error in making string of hdf5 string. \n"); return FAIL; } @@ -741,7 +741,7 @@ int gen_h5comptype(int32 vdata_id,int32 nfields, if (sh5memtype[i] == H5T_STRING) { - if((h5str_type = mkstr(sh4memsize[i]*fieldorder,H5T_STR_SPACEPAD))<0){ + if((h5str_type = mkstr((int)(sh4memsize[i]*fieldorder),H5T_STR_SPACEPAD))<0){ printf("error in making string for VDATA in memory. \n"); return FAIL; } diff --git a/tools/h4toh5/h4toh5vgroup.c b/tools/h4toh5/h4toh5vgroup.c index 9d3bbef..7fed1c9 100644 --- a/tools/h4toh5/h4toh5vgroup.c +++ b/tools/h4toh5/h4toh5vgroup.c @@ -171,7 +171,7 @@ int Vgroup_h4_to_h5(int32 file_id,int32 vgroup_id,int32 sd_id,hid_t h5_group,hid return FAIL; } - if(conv_int_str(obj_ref,refstr)== FAIL) { + if(conv_int_str((uint16)obj_ref,refstr)== FAIL) { printf("failed to convert object reference number "); printf("into string format at vgroup_h4_to_h5 routine.\n"); H5Gclose(h5_pgroup); @@ -262,7 +262,7 @@ int convert_vgroup(int32 file_id,int32 sd_id, int32 obj_ref, char* h5lgroup_name; int check_vgroup; - if(conv_int_str(obj_ref,refstr)== FAIL) { + if(conv_int_str((uint16)obj_ref,refstr)== FAIL) { printf("converting integer into string format.\n"); return FAIL; } @@ -408,7 +408,7 @@ int convert_vdata(int32 file_id,int32 obj_ref,char * h5pgroup_name, return FAIL; } - if(conv_int_str(obj_ref,refstr)== FAIL) { + if(conv_int_str((uint16)obj_ref,refstr)== FAIL) { printf("converting integer into string format.\n"); VSdetach(vdata_id); return FAIL; @@ -558,7 +558,7 @@ int convert_sds(int32 file_id,int32 sd_id,int32 obj_ref,char * h5pgroup_name, return FAIL; } - if(conv_int_str(obj_ref,refstr)== FAIL) { + if(conv_int_str((uint16)obj_ref,refstr)== FAIL) { printf("error in converting reference number into string type.\n"); return FAIL; } @@ -695,12 +695,12 @@ int convert_image(int32 file_id,int32 obj_ref,char * h5pgroup_name, return FAIL; } - if(conv_int_str(obj_ref,refstr)== FAIL) { + if(conv_int_str((uint16)obj_ref,refstr)== FAIL) { printf("converting integer into string format.\n"); return FAIL; } - gr_index= GRreftoindex(gr_id,obj_ref); + gr_index= GRreftoindex(gr_id,(uint16)obj_ref); if(gr_index == FAIL) { printf("error in getting gr index.\n"); return FAIL; diff --git a/tools/h5toh4/h5toh4.c b/tools/h5toh4/h5toh4.c index 4995c29..332d32f 100644 --- a/tools/h5toh4/h5toh4.c +++ b/tools/h5toh4/h5toh4.c @@ -627,8 +627,8 @@ convert_dataset (hid_t did, char *name, op_data_t *op_data) { char *fieldname=NULL; hid_t fieldtype; int32 order; - off_t offset; - off_t offset_array[512]; + size_t offset; + size_t offset_array[512]; hid_t h4type_array[512], memtype_array[512]; int32 order_array[512]; @@ -936,7 +936,7 @@ convert_dataset (hid_t did, char *name, op_data_t *op_data) { DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_dataset", __FILE__, __LINE__); break; } - if ((offset = H5Tget_offset(memtype_array[idx])) < 0 || offset >= 128 ) { + if ((int)(offset = H5Tget_offset(memtype_array[idx])) < 0 || offset >= 128 ) { fprintf(stderr, "Error: H5Tget_offset() is returning a bad value %d\n",(int)offset); DEBUG_PRINT("Error detected in %s() [%s line %d]\n", "convert_dataset", __FILE__, __LINE__); return FAIL; -- cgit v0.12