From 8bb096b6977a90df82ca3d32287aa2a7abeb5510 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 19 Jun 2002 11:08:27 -0500 Subject: [svn-r5675] Purpose: Code cleanup Description: Removed more compiler warnings, etc. Platforms tested: Linux 2.2.x (eirene) w/parallel --- c++/Makefile.in | 2 +- hl/tools/gif2h5/gif.h | 6 ++++ hl/tools/gif2h5/gif2hdf.c | 4 +-- hl/tools/gif2h5/gif2mem.c | 1 - hl/tools/gif2h5/gifread.c | 12 ++++---- hl/tools/gif2h5/hdf2gif.c | 17 +++++------- hl/tools/gif2h5/hdfgifwr.c | 29 +++++++------------- hl/tools/gif2h5/writehdf.c | 3 +- perform/pio_engine.c | 16 +++++------ perform/pio_perf.c | 26 +++++++++--------- perform/pio_timer.c | 2 +- src/H5D.c | 8 +++--- src/H5Distore.c | 9 +++--- src/H5FDmpio.c | 16 +++++------ src/H5Fistore.c | 9 +++--- src/H5S.c | 6 ++-- src/H5Smpio.c | 6 ++-- src/H5T.c | 2 +- test/dtypes.c | 18 ++++++------ test/enum.c | 2 +- test/fillval.c | 2 +- test/h5test.c | 4 +-- testpar/t_dset.c | 68 ++++++++++++++++++++++++---------------------- testpar/t_mdset.c | 2 ++ testpar/t_mpi.c | 7 ++--- testpar/testphdf5.c | 14 +++++----- testpar/testphdf5.h | 6 +--- tools/gifconv/gif.h | 6 ++++ tools/gifconv/gif2hdf.c | 4 +-- tools/gifconv/gif2mem.c | 1 - tools/gifconv/gifread.c | 12 ++++---- tools/gifconv/hdf2gif.c | 17 +++++------- tools/gifconv/hdfgifwr.c | 29 +++++++------------- tools/gifconv/writehdf.c | 3 +- tools/h5dump/h5dumptst.c | 4 +-- tools/lib/h5tools.c | 2 +- 36 files changed, 182 insertions(+), 193 deletions(-) diff --git a/c++/Makefile.in b/c++/Makefile.in index 96f491c..e24f1a6 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -109,7 +109,7 @@ distclean: done -$(RM) config/commence config/conclude -$(RM) config/stamp1 config/stamp2 config/depend? - -$(RM) config.cache config.log config.status + -$(RM) config.cache config.log config.status configure.lineno -$(RM) src/H5config.h src/H5pubconf.h -$(RM) libtool Makefile diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index 9e4f9e8..a3e26b4 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/gif.h @@ -22,6 +22,7 @@ /* typedef H5T_NATIVE_UINT8 BYTE; */ typedef unsigned char BYTE; +typedef BYTE byte; /* typedef H5T_NATIVE_UINT16 WORD; */ typedef unsigned long WORD; @@ -174,5 +175,10 @@ BYTE GetByte(BYTE *); WORD GetWord(BYTE *); void cleanup(BYTE*); + +/* HDFGIFWR.C */ +extern int +hdfWriteGIF(FILE *fp, byte *pic, int w, int h, byte *pc2ncmap, int BitsPerPixel); + #endif /* GIF_H */ diff --git a/hl/tools/gif2h5/gif2hdf.c b/hl/tools/gif2h5/gif2hdf.c index e3942b7..d844903 100644 --- a/hl/tools/gif2h5/gif2hdf.c +++ b/hl/tools/gif2h5/gif2hdf.c @@ -28,7 +28,7 @@ main(int argv , char *argc[]) /* replacing int32 with long */ long i,ImageCount; - long filesize; + size_t filesize; BYTE *MemGif; BYTE *StartPos; @@ -69,7 +69,7 @@ main(int argv , char *argc[]) /* Get the whole file into memory. Mem's much faster than I/O */ fseek(fpGif, 0L , 2); - filesize = ftell(fpGif); + filesize = (size_t)ftell(fpGif); fseek(fpGif, 0L , 0); if (filesize == 0) printf("File Size Zero"); if (!(MemGif = StartPos = (BYTE *)malloc(filesize))) { diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index 70357e5..e2bdf6d 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -39,7 +39,6 @@ /* #include "hdf.h" */ #define VERSION "1.00" -extern int EndianOrder; GIFTOMEM Gif2Mem(BYTE *MemGif) diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index c7b7b96..aea7fc3 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -6,8 +6,6 @@ static BYTE * ReadDataSubBlocks(BYTE **MemGif2 , WORD *DSize); int EndianOrder; -int i; - WORD GetWord (MemGif) @@ -49,7 +47,7 @@ ReadGifHeader(GifHead, MemGif2) GIFHEAD *GifHead; /* Pointer to GIF header structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { - register WORD i; /* Loop counter */ + WORD i; /* Loop counter */ WORD tableSize; /* Number of entires in the Global Color Table */ GifHead->TableSize = 0; @@ -213,7 +211,7 @@ ReadGifGraphicControl(GifGraphicControl, MemGif2) GIFGRAPHICCONTROL *GifGraphicControl; /* Pointer to GC Extension structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { - + int i; for (i = 0 ; i < 5 ; i++) { GifGraphicControl->GCEDump[i] = *(*MemGif2)++; @@ -237,6 +235,8 @@ ReadGifPlainText(GifPlainText, MemGif2) GIFPLAINTEXT *GifPlainText; /* Pointer to Plain Text Extension structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { + int i; + for (i = 0 ; i < 13 ; i++) { GifPlainText->PTEDump[i] = *(*MemGif2)++; } @@ -273,6 +273,8 @@ ReadGifApplication(GifApplication, MemGif2) GIFAPPLICATION *GifApplication; /* Pointer to Application Extension structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { + int i; + for (i = 0 ; i < 12 ; i++) { GifApplication->AEDump[i] = *(*MemGif2)++; } @@ -336,7 +338,7 @@ WORD *DSize; { BYTE *ptr1; /* Pointer used to "walk the heap" */ BYTE *ptr2; /* Pointer used to mark the top of the heap */ - BYTE dataSize; /* Size of the current data sub-block being read */ + size_t dataSize; /* Size of the current data sub-block being read */ WORD bufSize; /* Total size of the Plain Text data buffer */ int tempcount = 0; diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 6443627..56be138 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -29,12 +29,9 @@ #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; -void PutByte(BYTE b , FILE *fpGif) +static void PutByte(BYTE b , FILE *fpGif) { if (fputc(b , fpGif) == EOF) { printf("File Writing Error, cannot continue"); @@ -43,7 +40,7 @@ void PutByte(BYTE b , FILE *fpGif) } -void putword(int w, FILE *fp) +static void putword(int w, FILE *fp) { /* writes a 16-bit integer in GIF order (LSB first) */ @@ -86,7 +83,7 @@ int main(int argc , char **argv) { int w,i; int numcols = 256; int time_out = 0; /* time between two images in the animation */ - int n_images , index; + int n_images , indx; BYTE pc2nc[256] , r1[256] , g1[256] , b1[256]; @@ -182,7 +179,7 @@ int main(int argc , char **argv) { n_images = number_of_images; Background = 0; - for (index = 0 ; index < n_images ; index++) { + for (indx = 0 ; indx < n_images ; indx++) { /* try to read the image and the palette */ /* Lots of funky stuff to support multiple images has been taken off. @@ -193,7 +190,7 @@ int main(int argc , char **argv) { ** to write the global palette out and then independantly write the smaller local ** palettes */ - if (ReadHDF(&Image , GlobalPalette , dim_sizes , HDFName , image_name_arr[index] , pal_name_arr[index]) < 0) { + if (ReadHDF(&Image , GlobalPalette , dim_sizes , HDFName , image_name_arr[indx] , pal_name_arr[indx]) < 0) { fprintf(stderr , "Unable to read HDF file\n"); return -1; } @@ -260,7 +257,7 @@ int main(int argc , char **argv) { /* If it is the first image we do all the header stuff that isn't required for the ** rest of the images. */ - if (index == 0) { + if (indx == 0) { /* Write out the GIF header and logical screen descriptor */ if (n_images > 1) { fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */ @@ -332,7 +329,7 @@ int main(int argc , char **argv) { fputc (InitCodeSize , fpGif); - hdfWriteGIF(fpGif , Image , 0 , dim_sizes[0] , dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel); + hdfWriteGIF(fpGif , Image , (int)dim_sizes[0] , (int)dim_sizes[1] , pc2nc , BitsPerPixel); fputc(0x00 , fpGif); free (Image); } diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c index 3c15477..261487a 100644 --- a/hl/tools/gif2h5/hdfgifwr.c +++ b/hl/tools/gif2h5/hdfgifwr.c @@ -47,12 +47,8 @@ *****************************************************************/ -#include #include "gif.h" -#include -#include -typedef BYTE byte; typedef long int count_int; /* indicies into conv24MB */ @@ -100,13 +96,8 @@ static void xvbzero(char *s, size_t len) } /*************************************************************/ -int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colorstyle, BitsPerPixel) - FILE *fp; - byte *pic; - int ptype, w,h; - byte *rmap, *gmap, *bmap , *pc2ncmap; - int numcols, colorstyle; - int BitsPerPixel; +int +hdfWriteGIF(FILE *fp, byte *pic, int w, int h, byte *pc2ncmap, int BitsPerPixel) { int InitCodeSize; int i; @@ -368,7 +359,7 @@ int code; cur_bits += n_bits; while( cur_bits >= 8 ) { - char_out( (unsigned int) (cur_accum & 0xff) ); + char_out( (int) (cur_accum & 0xff) ); cur_accum >>= 8; cur_bits -= 8; } @@ -396,7 +387,7 @@ int code; if( code == EOFCode ) { /* At EOF, write the rest of the buffer */ while( cur_bits > 0 ) { - char_out( (unsigned int)(cur_accum & 0xff) ); + char_out( (int)(cur_accum & 0xff) ); cur_accum >>= 8; cur_bits -= 8; } @@ -427,14 +418,14 @@ static void cl_block () /* table clear for block compress */ /********************************/ -static void cl_hash(hsize) /* reset code table */ -register count_int hsize; +static void cl_hash(hashsize) /* reset code table */ +register count_int hashsize; { - register count_int *htab_p = htab+hsize; + register count_int *htab_p = htab+hashsize; register long i; register long m1 = -1; - i = hsize - 16; + i = hashsize - 16; do { /* might use Sys V memset(3) here */ *(htab_p-16) = m1; *(htab_p-15) = m1; @@ -469,7 +460,7 @@ register count_int hsize; /* * Number of characters so far in this 'packet' */ -static int a_count; +static size_t a_count; /* * Set up the 'byte output' routine @@ -502,7 +493,7 @@ int c; static void flush_char() { if( a_count > 0 ) { - fputc( a_count, g_outfile ); + fputc( (int)a_count, g_outfile ); fwrite( accum, 1, a_count, g_outfile ); a_count = 0; } diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c index 1eb49fd..9590f79 100644 --- a/hl/tools/gif2h5/writehdf.c +++ b/hl/tools/gif2h5/writehdf.c @@ -7,7 +7,8 @@ ** Function: write_text_attribute ** Use: Just a small wrapper to write text attributes easily ********************************************************************/ -int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value) { +static int write_text_attribute(hid_t dataset_id , const char *attr_name , const char *attr_value) +{ /* variables for the attributes */ hsize_t attr_dims_size; /* dimensions for the attribute */ diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 689bd7d..3c16860 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -352,7 +352,7 @@ done: static char * pio_create_filename(iotype iot, const char *base_name, char *fullname, size_t size) { - const char *prefix, *suffix; + const char *prefix, *suffix=""; char *ptr, last = '\0'; size_t i, j; @@ -470,11 +470,11 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts_xfer; size_t nelmts_toxfer; char dname[64]; - off_t dset_offset; /*dataset offset in a file */ + off_t dset_offset=0; /*dataset offset in a file */ off_t file_offset; /*file offset of the next transfer */ off_t dset_size; /*one dataset size in bytes */ size_t nelmts_in_buf; /*how many element the buffer holds */ - size_t nelmts_in_blk; /*how many element a block holds */ + size_t nelmts_in_blk=0; /*how many element a block holds */ off_t elmts_begin; /*first elmt this process transfer */ off_t elmts_count; /*number of elmts this process transfer */ hid_t dcpl = -1; /* Dataset creation property list */ @@ -688,7 +688,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, if (parms->verify) { /*Prepare write data for verify later*/ int *intptr = (int *)buffer; - register int i; + size_t i; for (i = 0; i < nelmts_toxfer; ++i) *intptr++ = pio_mpi_rank_g; @@ -855,11 +855,11 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nelmts_xfer; size_t nelmts_toxfer; char dname[64]; - off_t dset_offset; /*dataset offset in a file */ + off_t dset_offset=0; /*dataset offset in a file */ off_t file_offset; /*file offset of the next transfer */ off_t dset_size; /*one dataset size in bytes */ size_t nelmts_in_buf; /*how many element the buffer holds */ - size_t nelmts_in_blk; /*how many element a block holds */ + size_t nelmts_in_blk=0; /*how many element a block holds */ off_t elmts_begin; /*first elmt this process transfer */ off_t elmts_count; /*number of elmts this process transfer */ @@ -1131,8 +1131,8 @@ HDfprintf(output, if (parms->verify) { /*verify read data*/ int *intptr = (int *)buffer; - register int i; - register int nerror=0; + size_t i; + int nerror=0; for (i = 0; i < nelmts_toxfer; ++i){ if (*intptr++ != pio_mpi_rank_g){ diff --git a/perform/pio_perf.c b/perform/pio_perf.c index 6b63c7b..b2ee607 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -512,16 +512,16 @@ run_test(iotype iot, parameters parms, struct options *opts) /* allocate space for tables minmax and that it is sufficient */ /* to initialize all elements to zeros by calloc. */ - write_mpi_mm_table = calloc(parms.num_iters , sizeof(minmax)); - write_mm_table = calloc(parms.num_iters , sizeof(minmax)); - write_gross_mm_table = calloc(parms.num_iters , sizeof(minmax)); - write_raw_mm_table = calloc(parms.num_iters , sizeof(minmax)); + write_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + write_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + write_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + write_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); if (!parms.h5_write_only) { - read_mpi_mm_table = calloc(parms.num_iters , sizeof(minmax)); - read_mm_table = calloc(parms.num_iters , sizeof(minmax)); - read_gross_mm_table = calloc(parms.num_iters , sizeof(minmax)); - read_raw_mm_table = calloc(parms.num_iters , sizeof(minmax)); + read_mpi_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + read_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + read_gross_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); + read_raw_mm_table = calloc((size_t)parms.num_iters , sizeof(minmax)); } /* Do IO iteration times, collecting statistics each time */ @@ -786,7 +786,7 @@ static int create_comm_world(int num_procs, int *doing_pio) { /* MPI variables */ - int mrc, ret_value; /* return values */ + int mrc; /* return values */ int color; /* for communicator creation */ int myrank, nprocs; @@ -826,7 +826,7 @@ create_comm_world(int num_procs, int *doing_pio) done: *doing_pio = color; - return ret_value; + return SUCCESS; error_done: destroy_comm_world(); @@ -1122,10 +1122,10 @@ parse_command_line(int argc, char *argv[]) buf[i++] = *end; if (strlen(buf) > 1 || isdigit(buf[0])) { - register int i; + size_t j; - for (i = 0; i < 10 && buf[i] != '\0'; ++i) - if (!isdigit(buf[i])) { + for (j = 0; j < 10 && buf[j] != '\0'; ++j) + if (!isdigit(buf[j])) { fprintf(stderr, "pio_perf: invalid --debug option %s\n", buf); exit(EXIT_FAILURE); diff --git a/perform/pio_timer.c b/perform/pio_timer.c index 675b5d1..2d0e141 100644 --- a/perform/pio_timer.c +++ b/perform/pio_timer.c @@ -138,7 +138,7 @@ set_time(pio_time *pt, timer_type t, int start_stop) } if (pio_debug_level >= 4) { - char *msg; + const char *msg; int myrank; MPI_Comm_rank(pio_comm_g, &myrank); diff --git a/src/H5D.c b/src/H5D.c index 2fc1337..2f80c2a 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1606,7 +1606,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, hbool_t must_convert; /*have to xfer the slow way*/ #ifdef H5_HAVE_PARALLEL H5FD_mpio_dxpl_t *dx = NULL; - H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */ + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /*xfer_mode for this request */ hbool_t xfer_mode_changed=0; /*xfer_mode needs restore */ hbool_t doing_mpio=0; /*This is an MPIO access */ #endif @@ -1654,7 +1654,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Collect Parallel I/O information for possible later use */ if (H5FD_MPIO==xfer_parms->driver_id){ doing_mpio++; - if (dx=xfer_parms->driver_info){ + if ((dx=xfer_parms->driver_info)!=NULL){ xfer_mode = dx->xfer_mode; }else HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, @@ -2060,7 +2060,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, hbool_t must_convert; /*have to xfer the slow way*/ #ifdef H5_HAVE_PARALLEL H5FD_mpio_dxpl_t *dx = NULL; - H5FD_mpio_xfer_t xfer_mode; /*xfer_mode for this request */ + H5FD_mpio_xfer_t xfer_mode=H5FD_MPIO_INDEPENDENT; /*xfer_mode for this request */ hbool_t xfer_mode_changed=0; /*xfer_mode needs restore */ hbool_t doing_mpio=0; /*This is an MPIO access */ #endif @@ -2137,7 +2137,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space, /* Collect Parallel I/O information for possible later use */ if (H5FD_MPIO==xfer_parms->driver_id){ doing_mpio++; - if (dx=xfer_parms->driver_info){ + if ((dx=xfer_parms->driver_info)!=NULL){ xfer_mode = dx->xfer_mode; }else HGOTO_ERROR (H5E_DATASET, H5E_CANTINIT, FAIL, diff --git a/src/H5Distore.c b/src/H5Distore.c index cbfa1bf..ce29bbf 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -2317,7 +2317,8 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* Allocate chunk buffer for processes to use when writing fill values */ - if (NULL==(chunk = H5MM_malloc(chunk_size))) + H5_CHECK_OVERFLOW(chunk_size,hsize_t,size_t); + if (NULL==(chunk = H5MM_malloc((size_t)chunk_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk"); /* Fill the chunk with the proper values */ @@ -2326,12 +2327,12 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * Replicate the fill value throughout the chunk. */ assert(0==chunk_size % fill->size); - H5V_array_fill(chunk, fill->buf, fill->size, chunk_size/fill->size); + H5V_array_fill(chunk, fill->buf, fill->size, (size_t)chunk_size/fill->size); } else { /* * No fill value was specified, assume all zeros. */ - HDmemset (chunk, 0, chunk_size); + HDmemset (chunk, 0, (size_t)chunk_size); } /* end else */ /* Retrieve up MPI parameters */ @@ -2359,7 +2360,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Round-robin write the chunks out from only one process */ if(mpi_round==mpi_rank) { - if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) + if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, (hsize_t)udata.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); } /* end if */ mpi_round=(++mpi_round)%mpi_size; diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 4d360d7..6724d18 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -428,7 +428,7 @@ H5FD_mpio_communicator(H5FD_t *_file) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - FUNC_ENTER(H5FD_mpio_communicator, NULL); + FUNC_ENTER(H5FD_mpio_communicator, MPI_COMM_NULL); assert(file); assert(H5FD_MPIO==file->pub.driver_id); @@ -612,12 +612,15 @@ H5FD_mpio_wait_for_left_neighbor(H5FD_t *_file) { H5FD_mpio_t *file = (H5FD_mpio_t*)_file; char msgbuf[1]; - MPI_Status rcvstat = {0}; + MPI_Status rcvstat; FUNC_ENTER(H5FD_mpio_wait_for_left_neighbor, FAIL); assert(file); assert(H5FD_MPIO==file->pub.driver_id); + /* Portably initialize MPI status variable */ + HDmemset(&rcvstat,0,sizeof(MPI_Status)); + /* p0 has no left neighbor; all other procs wait for msg */ if (file->mpi_rank != 0) { if (MPI_SUCCESS!= MPI_Recv( &msgbuf, 1, MPI_CHAR, file->mpi_rank-1, MPI_ANY_TAG, file->comm, &rcvstat )) @@ -785,7 +788,7 @@ H5FD_mpio_fapl_get(H5FD_t *_file) */ static H5FD_t * H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr/*unused*/) + haddr_t UNUSED maxaddr) { H5FD_mpio_t *file=NULL; MPI_File fh; @@ -991,16 +994,11 @@ H5FD_mpio_close(H5FD_t *_file) *------------------------------------------------------------------------- */ static herr_t -H5FD_mpio_query(const H5FD_t *_file, unsigned long *flags /* out */) +H5FD_mpio_query(const H5FD_t UNUSED *_file, unsigned long *flags /* out */) { -#ifndef NDEBUG - const H5FD_mpio_t *file = (const H5FD_mpio_t*)_file; -#endif /* NDEBUG */ herr_t ret_value=SUCCEED; FUNC_ENTER(H5FD_mpio_query, FAIL); - assert(file); - assert(H5FD_MPIO==file->pub.driver_id); /* Set the VFL feature flags that this driver supports */ if(flags) { diff --git a/src/H5Fistore.c b/src/H5Fistore.c index cbfa1bf..ce29bbf 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -2317,7 +2317,8 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, } /* Allocate chunk buffer for processes to use when writing fill values */ - if (NULL==(chunk = H5MM_malloc(chunk_size))) + H5_CHECK_OVERFLOW(chunk_size,hsize_t,size_t); + if (NULL==(chunk = H5MM_malloc((size_t)chunk_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk"); /* Fill the chunk with the proper values */ @@ -2326,12 +2327,12 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, * Replicate the fill value throughout the chunk. */ assert(0==chunk_size % fill->size); - H5V_array_fill(chunk, fill->buf, fill->size, chunk_size/fill->size); + H5V_array_fill(chunk, fill->buf, fill->size, (size_t)chunk_size/fill->size); } else { /* * No fill value was specified, assume all zeros. */ - HDmemset (chunk, 0, chunk_size); + HDmemset (chunk, 0, (size_t)chunk_size); } /* end else */ /* Retrieve up MPI parameters */ @@ -2359,7 +2360,7 @@ H5F_istore_allocate(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout, /* Round-robin write the chunks out from only one process */ if(mpi_round==mpi_rank) { - if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) + if (H5F_block_write(f, H5FD_MEM_DRAW, udata.addr, (hsize_t)udata.key.nbytes, dxpl_id, chunk)<0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); } /* end if */ mpi_round=(++mpi_round)%mpi_size; diff --git a/src/H5S.c b/src/H5S.c index d2dc810..f0edaf9 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -265,11 +265,9 @@ H5S_term_interface(void) H5I_destroy_group(H5I_DATASPACE); /* Clear/free conversion table */ - HDmemset((void*)&H5S_fconv_g[0], 0, sizeof(H5S_fconv_g)); - HDmemset((void*)&H5S_mconv_g[0], 0, sizeof(H5S_mconv_g)); + HDmemset(H5S_fconv_g, 0, sizeof(H5S_fconv_g)); + HDmemset(H5S_mconv_g, 0, sizeof(H5S_mconv_g)); - /*HDmemset(H5S_fconv_g, 0, sizeof(H5S_fconv_g)); - HDmemset(H5S_mconv_g, 0, sizeof(H5S_mconv_g));*/ for (i=0; iextent.u.simple.rank; ++i) - total_bytes *= space->extent.u.simple.size[i]; + for (u=0; uextent.u.simple.rank; ++u) + total_bytes *= space->extent.u.simple.size[u]; /* fill in the return values */ *new_type = MPI_BYTE; diff --git a/src/H5T.c b/src/H5T.c index 28f6327..fe41df4 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -7333,7 +7333,7 @@ done: */ hid_t H5Tarray_create(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], - const int UNUSED perm[/* ndims */]) + const int perm[/* ndims */]) { H5T_t *base = NULL; /* base data type */ H5T_t *dt = NULL; /* new array data type */ diff --git a/test/dtypes.c b/test/dtypes.c index 2ac8e6c..3b0a7c5 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -3235,12 +3235,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) break; case INT_LLONG: memcpy(aligned, saved+j*sizeof(long_long), sizeof(long_long)); - printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); break; case INT_ULLONG: memcpy(aligned, saved+j*sizeof(long_long), sizeof(unsigned long_long)); - printf(" %29"H5_PRINTF_LL_WIDTH"u\n", + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned)); break; case INT_OTHER: @@ -3288,12 +3288,12 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) break; case INT_LLONG: memcpy(aligned, buf+j*sizeof(long_long), sizeof(long_long)); - printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)aligned)); break; case INT_ULLONG: memcpy(aligned, buf+j*sizeof(long_long), sizeof(unsigned long_long)); - printf(" %29"H5_PRINTF_LL_WIDTH"u\n", + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)aligned)); break; case INT_OTHER: @@ -3332,10 +3332,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) printf(" %29lu\n", *((unsigned long*)hw)); break; case INT_LLONG: - printf(" %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"d\n", *((long_long*)hw)); break; case INT_ULLONG: - printf(" %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw)); + HDfprintf(stdout," %29"H5_PRINTF_LL_WIDTH"u\n", *((unsigned long_long*)hw)); break; case INT_OTHER: break; @@ -3836,7 +3836,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) } else { long double x; memcpy(&x, (long double*)saved+j, sizeof(long double)); - printf(" %29.20Le\n", x); + HDfprintf(stdout," %29.20Le\n", x); #endif } @@ -3858,7 +3858,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) } else { long double x; memcpy(&x, (long double*)buf+j, sizeof(long double)); - printf(" %29.20Le\n", x); + HDfprintf(stdout," %29.20Le\n", x); #endif } @@ -3874,7 +3874,7 @@ test_conv_flt_1 (const char *name, hid_t src, hid_t dst) printf(" %29.20e\n", hw_d); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE } else { - printf(" %29.20Le\n", hw_ld); + HDfprintf(stdout," %29.20Le\n", hw_ld); #endif } diff --git a/test/enum.c b/test/enum.c index c9d5e48..293bee2 100644 --- a/test/enum.c +++ b/test/enum.c @@ -375,7 +375,7 @@ static int test_value_dsnt_exist(void) { - hid_t datatype_id; /* identifiers */ + hid_t datatype_id=(-1); /* identifiers */ int val; char nam[100]; size_t size = 100; diff --git a/test/fillval.c b/test/fillval.c index 34f3c39..8ddd8c2 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -778,7 +778,7 @@ test_compatible(void) } fspace = -1; if((fspace = H5Dget_space(dset2))<0) goto error; - dims[0] = dims[1] = -1; + dims[0] = dims[1] = (hsize_t)-1; if(H5Sget_simple_extent_dims(fspace, dims, NULL)<0) goto error; if(dims[0] != 8 || dims[1] != 8) { H5_FAILED(); diff --git a/test/h5test.c b/test/h5test.c index 748211f..fbd1857 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -539,7 +539,7 @@ h5_fileaccess(void) memset(memb_map, 0, sizeof memb_map); memset(memb_fapl, 0, sizeof memb_fapl); - memset((void*)(&memb_name[0]), 0, sizeof memb_name); + memset(memb_name, 0, sizeof memb_name); memset(memb_addr, 0, sizeof memb_addr); assert(strlen(multi_letters)==H5FD_MEM_NTYPES); @@ -782,7 +782,7 @@ h5_dump_info_object(MPI_Info info) int flag; int i, nkeys; - printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", info, + printf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info, MPI_MAX_INFO_VAL); if (info==MPI_INFO_NULL){ printf("object is MPI_INFO_NULL\n"); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 9ba6901..feaf370 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -42,7 +42,7 @@ * ZROW same as BYROW except process 0 gets 0 rows * ZCOL same as BYCOL except process 0 gets 0 columns */ -void +static void slab_set(int mpi_rank, int mpi_size, hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], int mode) { @@ -122,16 +122,16 @@ if (verbose){ * Fill the dataset with trivial data for testing. * Assume dimension rank is 2 and data is stored contiguous. */ -void -dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE * dataset) +static void +dataset_fill(hssize_t start[], hsize_t block[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; - int i, j; + hsize_t i, j; /* put some trivial data in the data_array */ for (i=0; i < block[0]; i++){ for (j=0; j < block[1]; j++){ - *dataptr = (i+start[0])*100 + (j+start[1]+1); + *dataptr = (DATATYPE)((i+start[0])*100 + (j+start[1]+1)); dataptr++; } } @@ -141,10 +141,11 @@ dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[ /* * Print the content of the dataset. */ -void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE * dataset) +static void +dataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; - int i, j; + hsize_t i, j; /* print the column heading */ printf("%-8s", "Cols:"); @@ -169,7 +170,8 @@ void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t */ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) { - int i, j, vrfyerrs; + hsize_t i, j; + int vrfyerrs; /* print it if verbose */ if (verbose) { @@ -178,9 +180,9 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bl (long)start[0], (long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); printf("original values:\n"); - dataset_print(start, count, stride, block, original); + dataset_print(start, block, original); printf("compared values:\n"); - dataset_print(start, count, stride, block, dataset); + dataset_print(start, block, dataset); } vrfyerrs = 0; @@ -188,9 +190,9 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bl for (j=0; j < block[1]; j++){ if (*dataset != *original){ if (vrfyerrs++ < MAX_ERR_REPORT || verbose){ - printf("Dataset Verify failed at [%d][%d](row %d, col %d): expect %d, got %d\n", - i, j, - (int)(i+start[0]), (int)(j+start[1]), + printf("Dataset Verify failed at [%ld][%ld](row %ld, col %ld): expect %d, got %d\n", + (long)i, (long)j, + (long)(i+start[0]), (long)(j+start[1]), *(original), *(dataset)); } dataset++; @@ -299,7 +301,7 @@ dataset_writeInd(char *filename) slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); /* put some trivial data in the data_array */ - dataset_fill(start, count, stride, block, data_array1); + dataset_fill(start, block, data_array1); MESG("data_array initialized"); /* create a file dataspace independently */ @@ -429,7 +431,7 @@ dataset_readInd(char *filename) VRFY((mem_dataspace >= 0), ""); /* fill dataset with test data */ - dataset_fill(start, count, stride, block, data_origin1); + dataset_fill(start, block, data_origin1); /* read data independently */ ret = H5Dread(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, @@ -572,11 +574,11 @@ dataset_writeAll(char *filename) VRFY((mem_dataspace >= 0), ""); /* fill the local slab with some trivial data */ - dataset_fill(start, count, stride, block, data_array1); + dataset_fill(start, block, data_array1); MESG("data_array initialized"); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_array1); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -618,11 +620,11 @@ dataset_writeAll(char *filename) slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); /* put some trivial data in the data_array */ - dataset_fill(start, count, stride, block, data_array1); + dataset_fill(start, block, data_array1); MESG("data_array initialized"); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_array1); + dataset_print(start, block, data_array1); } /* create a file dataspace independently */ @@ -636,11 +638,11 @@ dataset_writeAll(char *filename) VRFY((mem_dataspace >= 0), ""); /* fill the local slab with some trivial data */ - dataset_fill(start, count, stride, block, data_array1); + dataset_fill(start, block, data_array1); MESG("data_array initialized"); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_array1); + dataset_print(start, block, data_array1); } /* set up the collective transfer properties list */ @@ -783,11 +785,11 @@ dataset_readAll(char *filename) VRFY((mem_dataspace >= 0), ""); /* fill dataset with test data */ - dataset_fill(start, count, stride, block, data_origin1); + dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_origin1); + dataset_print(start, block, data_origin1); } /* set up the collective transfer properties list */ @@ -846,11 +848,11 @@ dataset_readAll(char *filename) VRFY((mem_dataspace >= 0), ""); /* fill dataset with test data */ - dataset_fill(start, count, stride, block, data_origin1); + dataset_fill(start, block, data_origin1); MESG("data_array initialized"); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_origin1); + dataset_print(start, block, data_origin1); } /* set up the collective transfer properties list */ @@ -1020,11 +1022,11 @@ extend_writeInd(char *filename) slab_set(mpi_rank, mpi_size, start, count, stride, block, BYROW); /* put some trivial data in the data_array */ - dataset_fill(start, count, stride, block, data_array1); + dataset_fill(start, block, data_array1); MESG("data_array initialized"); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_array1); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -1060,11 +1062,11 @@ extend_writeInd(char *filename) slab_set(mpi_rank, mpi_size, start, count, stride, block, BYCOL); /* put some trivial data in the data_array */ - dataset_fill(start, count, stride, block, data_array1); + dataset_fill(start, block, data_array1); MESG("data_array initialized"); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_array1); + dataset_print(start, block, data_array1); } /* create a memory dataspace independently */ @@ -1223,10 +1225,10 @@ extend_readInd(char *filename) VRFY((mem_dataspace >= 0), ""); /* fill dataset with test data */ - dataset_fill(start, count, stride, block, data_origin1); + dataset_fill(start, block, data_origin1); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_array1); + dataset_print(start, block, data_array1); } /* read data independently */ @@ -1258,10 +1260,10 @@ extend_readInd(char *filename) VRFY((mem_dataspace >= 0), ""); /* fill dataset with test data */ - dataset_fill(start, count, stride, block, data_origin1); + dataset_fill(start, block, data_origin1); if (verbose){ MESG("data_array created"); - dataset_print(start, count, stride, block, data_array1); + dataset_print(start, block, data_array1); } /* read data independently */ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index a29b8ae..6dd5449 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -200,7 +200,9 @@ void create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if(! ((counter+1) % 10)) { +#ifdef VERBOSE printf("created %dth child groups\n", counter+1); +#endif /* VERBOSE */ MPI_Barrier(MPI_COMM_WORLD); } diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 5b6bb27..f2ed500 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -40,7 +40,6 @@ hid_t fapl; /* file access property list */ /* protocols */ static void test_mpio_overlap_writes(char *filename); static void test_mpio_gb_file(char *filename); -static void test_mpio_gb_file(char *filename); static int parse_options(int argc, char **argv); static void usage(void); @@ -296,13 +295,13 @@ test_mpio_gb_file(char *filename) for (i=ntimes-2; i <= ntimes; i++){ mpi_off = (i*mpi_size + mpi_rank)*(MPI_Offset)MB; if (verbose) - printf("proc %d: write to mpi_off=%016llx, %lld\n", + HDfprintf(stdout,"proc %d: write to mpi_off=%016llx, %lld\n", mpi_rank, mpi_off, mpi_off); /* set data to some trivial pattern for easy verification */ for (j=0; j] [-n] " @@ -132,7 +132,7 @@ usage(void) /* * parse the command line options */ -int +static int parse_options(int argc, char **argv) { int mpi_size, mpi_rank; /* mpi variables */ @@ -258,7 +258,7 @@ parse_options(int argc, char **argv) * Create the appropriate File access property list */ hid_t -create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type ) +create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type ) { hid_t ret_pl = -1; herr_t ret; /* generic return value */ @@ -270,17 +270,17 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type ) ret_pl = H5Pcreate (H5P_FILE_ACCESS); VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); - if (facc_type == FACC_DEFAULT) + if (l_facc_type == FACC_DEFAULT) return (ret_pl); - if (facc_type == FACC_MPIO){ + if (l_facc_type == FACC_MPIO){ /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); return(ret_pl); } - if (facc_type == (FACC_MPIO | FACC_SPLIT)){ + if (l_facc_type == (FACC_MPIO | FACC_SPLIT)){ hid_t mpio_pl; mpio_pl = H5Pcreate (H5P_FILE_ACCESS); @@ -304,7 +304,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type ) } -main(int argc, char **argv) +int main(int argc, char **argv) { int mpi_size, mpi_rank; /* mpi variables */ diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 5ef10c0..9886d76 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -17,10 +17,6 @@ #ifndef PHDF5TEST_H #define PHDF5TEST_H -#include -#include - -#include "hdf5.h" #include "h5test.h" /* Define some handy debugging shorthands, routines, ... */ @@ -116,7 +112,7 @@ extern void *old_client_data; /*previous error handler arg.*/ extern int facc_type; /*Test file access type */ /* prototypes */ -hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type ); +hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type ); void multiple_dset_write(char *filename, int ndatasets); void multiple_group_write(char *filename, int ngroups); void multiple_group_read(char *filename, int ngroups); diff --git a/tools/gifconv/gif.h b/tools/gifconv/gif.h index 9e4f9e8..a3e26b4 100644 --- a/tools/gifconv/gif.h +++ b/tools/gifconv/gif.h @@ -22,6 +22,7 @@ /* typedef H5T_NATIVE_UINT8 BYTE; */ typedef unsigned char BYTE; +typedef BYTE byte; /* typedef H5T_NATIVE_UINT16 WORD; */ typedef unsigned long WORD; @@ -174,5 +175,10 @@ BYTE GetByte(BYTE *); WORD GetWord(BYTE *); void cleanup(BYTE*); + +/* HDFGIFWR.C */ +extern int +hdfWriteGIF(FILE *fp, byte *pic, int w, int h, byte *pc2ncmap, int BitsPerPixel); + #endif /* GIF_H */ diff --git a/tools/gifconv/gif2hdf.c b/tools/gifconv/gif2hdf.c index e3942b7..d844903 100644 --- a/tools/gifconv/gif2hdf.c +++ b/tools/gifconv/gif2hdf.c @@ -28,7 +28,7 @@ main(int argv , char *argc[]) /* replacing int32 with long */ long i,ImageCount; - long filesize; + size_t filesize; BYTE *MemGif; BYTE *StartPos; @@ -69,7 +69,7 @@ main(int argv , char *argc[]) /* Get the whole file into memory. Mem's much faster than I/O */ fseek(fpGif, 0L , 2); - filesize = ftell(fpGif); + filesize = (size_t)ftell(fpGif); fseek(fpGif, 0L , 0); if (filesize == 0) printf("File Size Zero"); if (!(MemGif = StartPos = (BYTE *)malloc(filesize))) { diff --git a/tools/gifconv/gif2mem.c b/tools/gifconv/gif2mem.c index 70357e5..e2bdf6d 100644 --- a/tools/gifconv/gif2mem.c +++ b/tools/gifconv/gif2mem.c @@ -39,7 +39,6 @@ /* #include "hdf.h" */ #define VERSION "1.00" -extern int EndianOrder; GIFTOMEM Gif2Mem(BYTE *MemGif) diff --git a/tools/gifconv/gifread.c b/tools/gifconv/gifread.c index c7b7b96..aea7fc3 100644 --- a/tools/gifconv/gifread.c +++ b/tools/gifconv/gifread.c @@ -6,8 +6,6 @@ static BYTE * ReadDataSubBlocks(BYTE **MemGif2 , WORD *DSize); int EndianOrder; -int i; - WORD GetWord (MemGif) @@ -49,7 +47,7 @@ ReadGifHeader(GifHead, MemGif2) GIFHEAD *GifHead; /* Pointer to GIF header structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { - register WORD i; /* Loop counter */ + WORD i; /* Loop counter */ WORD tableSize; /* Number of entires in the Global Color Table */ GifHead->TableSize = 0; @@ -213,7 +211,7 @@ ReadGifGraphicControl(GifGraphicControl, MemGif2) GIFGRAPHICCONTROL *GifGraphicControl; /* Pointer to GC Extension structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { - + int i; for (i = 0 ; i < 5 ; i++) { GifGraphicControl->GCEDump[i] = *(*MemGif2)++; @@ -237,6 +235,8 @@ ReadGifPlainText(GifPlainText, MemGif2) GIFPLAINTEXT *GifPlainText; /* Pointer to Plain Text Extension structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { + int i; + for (i = 0 ; i < 13 ; i++) { GifPlainText->PTEDump[i] = *(*MemGif2)++; } @@ -273,6 +273,8 @@ ReadGifApplication(GifApplication, MemGif2) GIFAPPLICATION *GifApplication; /* Pointer to Application Extension structure */ BYTE **MemGif2; /* GIF image file input FILE stream */ { + int i; + for (i = 0 ; i < 12 ; i++) { GifApplication->AEDump[i] = *(*MemGif2)++; } @@ -336,7 +338,7 @@ WORD *DSize; { BYTE *ptr1; /* Pointer used to "walk the heap" */ BYTE *ptr2; /* Pointer used to mark the top of the heap */ - BYTE dataSize; /* Size of the current data sub-block being read */ + size_t dataSize; /* Size of the current data sub-block being read */ WORD bufSize; /* Total size of the Plain Text data buffer */ int tempcount = 0; diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c index 6443627..56be138 100644 --- a/tools/gifconv/hdf2gif.c +++ b/tools/gifconv/hdf2gif.c @@ -29,12 +29,9 @@ #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; -void PutByte(BYTE b , FILE *fpGif) +static void PutByte(BYTE b , FILE *fpGif) { if (fputc(b , fpGif) == EOF) { printf("File Writing Error, cannot continue"); @@ -43,7 +40,7 @@ void PutByte(BYTE b , FILE *fpGif) } -void putword(int w, FILE *fp) +static void putword(int w, FILE *fp) { /* writes a 16-bit integer in GIF order (LSB first) */ @@ -86,7 +83,7 @@ int main(int argc , char **argv) { int w,i; int numcols = 256; int time_out = 0; /* time between two images in the animation */ - int n_images , index; + int n_images , indx; BYTE pc2nc[256] , r1[256] , g1[256] , b1[256]; @@ -182,7 +179,7 @@ int main(int argc , char **argv) { n_images = number_of_images; Background = 0; - for (index = 0 ; index < n_images ; index++) { + for (indx = 0 ; indx < n_images ; indx++) { /* try to read the image and the palette */ /* Lots of funky stuff to support multiple images has been taken off. @@ -193,7 +190,7 @@ int main(int argc , char **argv) { ** to write the global palette out and then independantly write the smaller local ** palettes */ - if (ReadHDF(&Image , GlobalPalette , dim_sizes , HDFName , image_name_arr[index] , pal_name_arr[index]) < 0) { + if (ReadHDF(&Image , GlobalPalette , dim_sizes , HDFName , image_name_arr[indx] , pal_name_arr[indx]) < 0) { fprintf(stderr , "Unable to read HDF file\n"); return -1; } @@ -260,7 +257,7 @@ int main(int argc , char **argv) { /* If it is the first image we do all the header stuff that isn't required for the ** rest of the images. */ - if (index == 0) { + if (indx == 0) { /* Write out the GIF header and logical screen descriptor */ if (n_images > 1) { fwrite("GIF89a", 1, 6, fpGif); /* the GIF magic number */ @@ -332,7 +329,7 @@ int main(int argc , char **argv) { fputc (InitCodeSize , fpGif); - hdfWriteGIF(fpGif , Image , 0 , dim_sizes[0] , dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel); + hdfWriteGIF(fpGif , Image , (int)dim_sizes[0] , (int)dim_sizes[1] , pc2nc , BitsPerPixel); fputc(0x00 , fpGif); free (Image); } diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c index 3c15477..261487a 100644 --- a/tools/gifconv/hdfgifwr.c +++ b/tools/gifconv/hdfgifwr.c @@ -47,12 +47,8 @@ *****************************************************************/ -#include #include "gif.h" -#include -#include -typedef BYTE byte; typedef long int count_int; /* indicies into conv24MB */ @@ -100,13 +96,8 @@ static void xvbzero(char *s, size_t len) } /*************************************************************/ -int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colorstyle, BitsPerPixel) - FILE *fp; - byte *pic; - int ptype, w,h; - byte *rmap, *gmap, *bmap , *pc2ncmap; - int numcols, colorstyle; - int BitsPerPixel; +int +hdfWriteGIF(FILE *fp, byte *pic, int w, int h, byte *pc2ncmap, int BitsPerPixel) { int InitCodeSize; int i; @@ -368,7 +359,7 @@ int code; cur_bits += n_bits; while( cur_bits >= 8 ) { - char_out( (unsigned int) (cur_accum & 0xff) ); + char_out( (int) (cur_accum & 0xff) ); cur_accum >>= 8; cur_bits -= 8; } @@ -396,7 +387,7 @@ int code; if( code == EOFCode ) { /* At EOF, write the rest of the buffer */ while( cur_bits > 0 ) { - char_out( (unsigned int)(cur_accum & 0xff) ); + char_out( (int)(cur_accum & 0xff) ); cur_accum >>= 8; cur_bits -= 8; } @@ -427,14 +418,14 @@ static void cl_block () /* table clear for block compress */ /********************************/ -static void cl_hash(hsize) /* reset code table */ -register count_int hsize; +static void cl_hash(hashsize) /* reset code table */ +register count_int hashsize; { - register count_int *htab_p = htab+hsize; + register count_int *htab_p = htab+hashsize; register long i; register long m1 = -1; - i = hsize - 16; + i = hashsize - 16; do { /* might use Sys V memset(3) here */ *(htab_p-16) = m1; *(htab_p-15) = m1; @@ -469,7 +460,7 @@ register count_int hsize; /* * Number of characters so far in this 'packet' */ -static int a_count; +static size_t a_count; /* * Set up the 'byte output' routine @@ -502,7 +493,7 @@ int c; static void flush_char() { if( a_count > 0 ) { - fputc( a_count, g_outfile ); + fputc( (int)a_count, g_outfile ); fwrite( accum, 1, a_count, g_outfile ); a_count = 0; } diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c index 1eb49fd..9590f79 100644 --- a/tools/gifconv/writehdf.c +++ b/tools/gifconv/writehdf.c @@ -7,7 +7,8 @@ ** Function: write_text_attribute ** Use: Just a small wrapper to write text attributes easily ********************************************************************/ -int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value) { +static int write_text_attribute(hid_t dataset_id , const char *attr_name , const char *attr_value) +{ /* variables for the attributes */ hsize_t attr_dims_size; /* dimensions for the attribute */ diff --git a/tools/h5dump/h5dumptst.c b/tools/h5dump/h5dumptst.c index 512c645..9687140 100644 --- a/tools/h5dump/h5dumptst.c +++ b/tools/h5dump/h5dumptst.c @@ -1036,7 +1036,7 @@ static void test_many(void) { dset1[j].a[idx[3]][idx[2]][idx[1]][idx[0]] = i0+j; dset1[j].b[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j); -#if WIN32 +#ifdef WIN32 dset1[j].c[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j+(signed __int64)sdim); #else dset1[j].c[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j+sdim); @@ -2785,7 +2785,7 @@ void test_multi(void) HDmemset(memb_map, 0, sizeof memb_map); HDmemset(memb_fapl, 0, sizeof memb_fapl); - HDmemset((void *)(&memb_name[0]), 0, sizeof memb_name); + HDmemset(memb_name, 0, sizeof memb_name); HDmemset(memb_addr, 0, sizeof memb_addr); assert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index a0fc81c..2dc2f75 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -198,7 +198,7 @@ h5tools_fopen(const char *fname, const char *driver, char *drivername, #define NUM_DRIVERS (sizeof(drivers_list) / sizeof(struct d_list)) static int initialized = 0; - register int drivernum; + size_t drivernum; hid_t fid = FAIL; #ifndef VERSION12 hid_t fapl = H5P_DEFAULT; -- cgit v0.12