From 6d7cbd13dce1ae24446ed84a88c64c68598dc6bf Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 19 Jun 2002 08:06:57 -0500 Subject: [svn-r5668] Purpose: Code cleanup Description: Turn on more warnings in the IRIX builds and clean them up. Platforms tested: IRIX64 6.5 (modi4) w/parallel, both -n32 and the default (-64?) mode --- config/irix6.x | 10 +++++--- hl/tools/gif2h5/decompress.c | 24 ++++++++---------- hl/tools/gif2h5/gif.h | 1 - hl/tools/gif2h5/gifread.c | 10 +++++--- hl/tools/gif2h5/hdf2gif.c | 29 +++------------------- hl/tools/gif2h5/hdfgifwr.c | 40 +++++++++--------------------- hl/tools/gif2h5/readhdf.c | 11 ++++----- hl/tools/gif2h5/writehdf.c | 59 +++++++++++++++++--------------------------- perform/chunk.c | 10 -------- perform/pio_engine.c | 26 +++++++++---------- perform/pio_perf.c | 8 +++--- perform/pio_perf.h | 4 +-- src/H5Dseq.c | 18 ++------------ src/H5FDmpio.c | 2 ++ src/H5Farray.c | 6 ++--- src/H5Fpkg.h | 7 ------ src/H5Fprivate.h | 7 ++++++ src/H5Fseq.c | 18 ++------------ src/H5Odtype.c | 2 +- src/H5Shyper.c | 10 +++++--- src/H5Smpio.c | 1 + src/H5T.c | 1 - src/H5Zdeflate.c | 6 ++--- test/big.c | 4 +-- test/dsets.c | 5 ++-- test/dtypes.c | 17 ++++++------- test/enum.c | 7 +++--- test/stab.c | 2 +- testpar/t_dset.c | 28 ++++++--------------- testpar/t_mdset.c | 20 +++++++++++---- testpar/t_mpi.c | 5 ++-- testpar/testphdf5.h | 14 +++++++++-- tools/gifconv/decompress.c | 24 ++++++++---------- tools/gifconv/gif.h | 1 - tools/gifconv/gifread.c | 10 +++++--- tools/gifconv/hdf2gif.c | 29 +++------------------- tools/gifconv/hdfgifwr.c | 40 +++++++++--------------------- tools/gifconv/readhdf.c | 11 ++++----- tools/gifconv/writehdf.c | 59 +++++++++++++++++--------------------------- tools/h5dump/h5dump.c | 22 ++++++++--------- tools/lib/h5tools_utils.c | 5 ++-- tools/lib/h5tools_utils.h | 4 +-- 42 files changed, 240 insertions(+), 377 deletions(-) diff --git a/config/irix6.x b/config/irix6.x index 97820da..65af4e9 100644 --- a/config/irix6.x +++ b/config/irix6.x @@ -53,13 +53,14 @@ case "X-$CC_BASENAME" in # 1429: the `long long' type is not standard # 1685: turn off warnings about turning off invalid warnings # 3201: remark - parameter not referenced - CFLAGS="$CFLAGS -woff 1174,1429,1209,1196,1685,3201" +# CFLAGS="$CFLAGS -woff 1174,1429,1209,1196,1685,3201" + CFLAGS="$CFLAGS -woff 1209,3201" # Always turn off these compiler warnings for the old compiler: # 799: the `long long' type is not standard # 803: turn off warnings about turning off invalid warnings # 835: __vfork() (this is an SGI config problem) - CFLAGS="$CFLAGS -woff 799,803,835" +# CFLAGS="$CFLAGS -woff 799,803,835" # Always turn off these loader warnings: # (notice the peculiar syntax) @@ -68,10 +69,13 @@ case "X-$CC_BASENAME" in # 85: duplicate definition preemption (from -lnsl) # 134: duplicate weak definition preemption (from -lnsl) CFLAGS="$CFLAGS -Wl,-woff,47,-woff,84,-woff,85,-woff,134" + + # Always turn on full warnings + CFLAGS="$CFLAGS -fullwarn" fi # Extra debugging flags - DEBUG_CFLAGS="-g -fullwarn" + DEBUG_CFLAGS="-g" DEBUG_CPPFLAGS= # Extra production flags diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 18dbb3e..ff6c4ca 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -15,19 +15,15 @@ char *cmd; FILE *fp; +static WORD + XC = 0, YC = 0, /* Output X and Y coords of current pixel */ + CodeSize, /* Code size, read from GIF header */ + InitCodeSize, /* Starting code size, used during Clear */ + BytesPerScanline, /* Bytes per scanline in output raster */ + IWidth, IHeight; /* image dimensions */ static int BitOffset = 0, /* Bit Offset of next code */ -XC = 0, YC = 0, /* Output X and Y coords of current pixel */ Pass = 0, /* Used by output routine if WORDerlaced pic */ OutCount = 0, /* Decompressor output 'stack count' */ -RWidth, RHeight, /* screen dimensions */ -IWidth, IHeight, /* image dimensions */ -LeftOfs, TopOfs, /* image offset */ -BitsPerPixel, /* Bits per pixel, read from GIF header */ -BytesPerScanline, /* Bytes per scanline in output raster */ -ColorMapSize, /* number of colors */ -Background, /* background color */ -CodeSize, /* Code size, read from GIF header */ -InitCodeSize, /* Starting code size, used during Clear */ Code, /* Value returned by ReadCode */ MaxCode, /* limiting value for current code size */ ClearCode, /* GIF clear code */ @@ -73,7 +69,8 @@ int numused; * three BYTEs, compute the bit Offset WORDo our 24-bit chunk, shift to * bring the desired code to the bottom, then mask it off and return it. */ -ReadCode() +static int +ReadCode(void) { int RawCode, ByteOffset; @@ -87,8 +84,7 @@ ReadCode() } -AddToPixel(Index) -BYTE Index; +static void AddToPixel(BYTE Index) { if (YCPackedField & 0x07) +1)) -1); + DataMask = (1 << ((GifHead->PackedField & 0x07) +1)) -1; Raster = GifImageDesc->GIFImage; diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index 7f1d042..9e4f9e8 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/gif.h @@ -169,7 +169,6 @@ int WriteHDF(GIFTOMEM , CHAR * , CHAR *); */ int ReadHDF(BYTE** data , BYTE palette[256][3] , hsize_t *image_size , CHAR *h5_file , CHAR *dset_name , CHAR *pal_name); -BYTE *ReadDataSubBlocks(BYTE ** , WORD *); BYTE *Decompress (GIFIMAGEDESC * , GIFHEAD *); BYTE GetByte(BYTE *); WORD GetWord(BYTE *); diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index f2fefff..c7b7b96 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -2,6 +2,9 @@ #include #include "gif.h" +static BYTE * +ReadDataSubBlocks(BYTE **MemGif2 , WORD *DSize); + int EndianOrder; int i; @@ -53,7 +56,7 @@ BYTE **MemGif2; /* GIF image file input FILE stream */ for (i = 0 ; i < 6 ; i++) { GifHead->HeaderDump[i] = *(*MemGif2)++; } - if (strncmp(GifHead->HeaderDump , "GIF" , 3)) { + if (strncmp((const char *)GifHead->HeaderDump , "GIF" , 3)) { printf("The file does not appear to be a valid GIF file.\n"); exit(-1); } @@ -352,7 +355,9 @@ WORD *DSize; bufSize += (dataSize); /* Running total of the buffer size */ *DSize = bufSize; - /* *ptr1++ = dataSize; /* Write the data count */ +#ifdef COMMENTED_OUT + *ptr1++ = dataSize; /* Write the data count */ +#endif /* COMMENTED_OUT */ while (dataSize--) /* Read/write the Plain Text data */ *ptr1++ = *(*MemGif2)++; @@ -370,7 +375,6 @@ WORD *DSize; } - /**ptr1++ = (BYTE) NULL; /* Add NULL to simulate Terminator value */ *ptr1++ = '\0'; return(ptr2); /* Return a pointer to the sub-block data */ diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 1963a20..6443627 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -52,7 +52,7 @@ void putword(int w, FILE *fp) fputc((w>>8)&0xff,fp); } -void usage() { +static void usage(void) { printf("Usage: h52gif -i [-p ]\n"); printf("h52gif expects *at least* one h5_image. You may repeat -i [-p ] at most 50 times (maximum of 50 images).\n"); } @@ -68,12 +68,9 @@ int main(int argc , char **argv) { CHAR *HDFName = NULL; CHAR *GIFName = NULL; - CHAR *image_path = NULL; - CHAR *pal_path = NULL; /* reference variables */ int has_local_palette; /* treated as a flag */ - int loop_times; /* number of times to loop, i'm going to treat it as a yes or no */ BYTE* b; @@ -86,10 +83,8 @@ int main(int argc , char **argv) { /*int LeftOfs, TopOfs;*/ int ColorMapSize, InitCodeSize, Background, BitsPerPixel; int j,nc; - int w,h,i; + int w,i; int numcols = 256; - int CountDown; - int curx , cury; int time_out = 0; /* time between two images in the animation */ int n_images , index; @@ -207,19 +202,7 @@ int main(int argc , char **argv) { assert(dim_sizes[1]==(hsize_t)((int)dim_sizes[1])); RWidth = (int)dim_sizes[1]; RHeight = (int)dim_sizes[0]; - w = (int)dim_sizes[1]; - h = (int)dim_sizes[0]; - -#ifdef UNUSED - /* w = dim_sizes[1]; - h = dim_sizes[0]; - - */ - LeftOfs = TopOfs = 0; -#endif /*UNUSED */ - - /* If the first image does not have a palette, I make my own global color table ** Obviously this is not the best thing to do, better steps would be: ** 1. Check for either a global palette or a global attribute called palette @@ -266,13 +249,9 @@ int main(int argc , char **argv) { ColorMapSize = 1 << BitsPerPixel; - CountDown = w * h; /* # of pixels we'll be doing */ - if (BitsPerPixel <= 1) InitCodeSize = 2; else InitCodeSize = BitsPerPixel; - curx = cury = 0; - if (!fpGif) { fprintf(stderr, "WriteGIF: file not open for writing\n" ); return (1); @@ -285,11 +264,9 @@ 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 */ @@ -305,7 +282,7 @@ int main(int argc , char **argv) { fputc(0, fpGif); /* future expansion byte */ - /* If loop_times is 0 , put in the application extension to make the gif anime loop + /* If time_out>0, put in the application extension to make the gif anime loop ** indefinitely */ if (time_out > 0) { diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c index 7277e13..3c15477 100644 --- a/hl/tools/gif2h5/hdfgifwr.c +++ b/hl/tools/gif2h5/hdfgifwr.c @@ -73,13 +73,10 @@ typedef long int count_int; /* MONO returns total intensity of r,g,b components */ #define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/ -static int Width, Height; -static int curx, cury; -static long CountDown; -static int Interlace; - #ifdef __STDC__ +#ifdef UNUSED static void putword(int, FILE *); +#endif /* UNUSED */ static void compress(int, FILE *, byte *, int); static void output(int); static void cl_block(void); @@ -88,15 +85,16 @@ static void char_init(void); static void char_out(int); static void flush_char(void); #else -static void putword(), compress(), output(), cl_block(), cl_hash(); +#ifdef UNUSED +static void putword(); +#endif /* UNUSED */ +static void compress(), output(), cl_block(), cl_hash(); static void char_init(), char_out(), flush_char(); #endif -static byte pc2nc[256],r1[256],g1[256],b1[256]; +static byte pc2nc[256]; -void xvbzero(s, len) - char *s; - int len; +static void xvbzero(char *s, size_t len) { for ( ; len>0; len--) *s++ = 0; } @@ -110,36 +108,18 @@ int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colo int numcols, colorstyle; int BitsPerPixel; { - int RWidth, RHeight; - int LeftOfs, TopOfs; - int ColorMapSize, InitCodeSize, Background; + int InitCodeSize; int i; byte *pic8; pic8 = pic; - Interlace = 0; - Background = 0; - for (i=0; i<256; i++) { pc2nc[i] = pc2ncmap[i]; - r1[i] = rmap[i]; - g1[i] = gmap[i]; - b1[i] = bmap[i]; } - ColorMapSize = 1 << BitsPerPixel; - - RWidth = Width = w; - RHeight = Height = h; - LeftOfs = TopOfs = 0; - - CountDown = w * h; /* # of pixels we'll be doing */ - if (BitsPerPixel <= 1) InitCodeSize = 2; else InitCodeSize = BitsPerPixel; - curx = cury = 0; - if (!fp) { fprintf(stderr, "WriteGIF: file not open for writing\n" ); return (1); @@ -155,6 +135,7 @@ int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colo +#ifdef UNUSED /******************************/ static void putword(w, fp) int w; @@ -166,6 +147,7 @@ FILE *fp; fputc((w>>8)&0xff,fp); } +#endif /* UNUSED */ diff --git a/hl/tools/gif2h5/readhdf.c b/hl/tools/gif2h5/readhdf.c index 602c48f..5b9c9d1 100644 --- a/hl/tools/gif2h5/readhdf.c +++ b/hl/tools/gif2h5/readhdf.c @@ -32,7 +32,6 @@ int ReadHDF(BYTE** data , CHAR *pal_name) { hid_t fHfile; /* H5 file to open */ - herr_t status; /* status variable */ hid_t dspace; /* dataspace identifier for the the dataset */ hid_t dset; /* dataset identifier */ @@ -89,7 +88,7 @@ int ReadHDF(BYTE** data , } /* get the actual image */ - if ((status = H5Dread(dset , H5Dget_type(dset) , H5S_ALL , H5S_ALL , H5P_DEFAULT , *data)) < 0) { + if (H5Dread(dset , H5Dget_type(dset) , H5S_ALL , H5S_ALL , H5P_DEFAULT , *data) < 0) { fprintf(stderr , "Unable to read data \n"); cleanup(*data); return -1; @@ -140,7 +139,7 @@ int ReadHDF(BYTE** data , } /* get the actual palette */ - if ((status = H5Dread(pal_set , H5Dget_type(pal_set) , H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf)) < 0) { + if (H5Dread(pal_set , H5Dget_type(pal_set) , H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf) < 0) { fprintf(stderr , "Unable to read data \n"); cleanup(*data); cleanup(temp_buf); @@ -165,9 +164,9 @@ int ReadHDF(BYTE** data , } /* close everything */ - status = H5Dclose(dset); - status = H5Sclose(dspace); - status = H5Fclose(fHfile); + H5Dclose(dset); + H5Sclose(dspace); + H5Fclose(fHfile); return 0; } diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c index 53cf9be..1eb49fd 100644 --- a/hl/tools/gif2h5/writehdf.c +++ b/hl/tools/gif2h5/writehdf.c @@ -13,7 +13,6 @@ int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value) hsize_t attr_dims_size; /* dimensions for the attribute */ hid_t attr_dataspace_id; /* dataspaces needed for the various attributes */ hid_t attr_attr_id; /* attribute id */ - herr_t status; /* check return status */ hid_t attr_type_id; @@ -36,15 +35,15 @@ int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value) attr_attr_id = H5Acreate(dataset_id , attr_name , attr_type_id , attr_dataspace_id , H5P_DEFAULT); /* write out the attribute data */ - if ((status = H5Awrite(attr_attr_id , attr_type_id , attr_value)) < 0) + if (H5Awrite(attr_attr_id , attr_type_id , attr_value) < 0) return -1; /* close the attribute */ - if ((status = H5Aclose(attr_attr_id)) < 0) + if (H5Aclose(attr_attr_id) < 0) return -1; /* close the dataspace */ - if ((status = H5Sclose(attr_dataspace_id)) < 0) { + if (H5Sclose(attr_dataspace_id) < 0) { fprintf(stderr , "Unable to close attribute dataspace. Aborting \n"); return -1; } @@ -62,23 +61,14 @@ char *GIFFileName; GIFHEAD gifHead; /* GIF Header structure */ GIFIMAGEDESC* gifImageDesc; /* Logical Image Descriptor struct */ - long ImageCount , /* number of images */ - CommentCount, /* number of comments */ - ApplicationCount , /* number of application extensions */ - PlainTextCount; /* number of plain text extensions */ - + long ImageCount; /* number of images */ char ImageName[256]; /* Image name for the GR Image */ - /* CommentName[256], - ApplicationName[256], - PlainTextName[256]; */ - char GroupName[VSNAMELENMAX]; /* so that we can name the subgroups appropriately */ /* H5 variables */ hid_t file_id; /* H5 file id */ hid_t image_id; /* H5 id for the whole image */ hid_t pal_id; /* H5 id for the palette */ - herr_t status; /* status variable */ hobj_ref_t pal_ref; /* Create a reference for the palette */ /* temp counter */ @@ -93,10 +83,7 @@ char *GIFFileName; gifHead = *(GifMemoryStruct.GifHeader); /* get some data from gifHead */ - ImageCount = (WORD)gifHead.ImageCount; - CommentCount = (WORD)gifHead.CommentCount; - ApplicationCount = (WORD)gifHead.ApplicationCount; - PlainTextCount = (WORD)gifHead.PlainTextCount; + ImageCount = gifHead.ImageCount; /* get the main group name from GIFFileName */ GroupName[0]= '/'; @@ -145,7 +132,7 @@ char *GIFFileName; /* write the palette data out */ /****** Ask Elena about VOIDP ******/ - if ((status = H5Dwrite(pal_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)gifHead.HDFPalette)) < 0) { + if (H5Dwrite(pal_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)gifHead.HDFPalette) < 0) { fprintf(stderr , "Error writing dataset. Aborting...\n"); return -1; } @@ -183,36 +170,36 @@ char *GIFFileName; ref_dataset_id = H5Dcreate(image_id , "Palette Reference" , H5T_STD_REF_OBJ , ref_dataspace_id , H5P_DEFAULT); /* create a reference to the palette */ - if ((status = H5Rcreate(&pal_ref , image_id , "Global Palette" , H5R_OBJECT , -1)) < 0) { + if (H5Rcreate(&pal_ref , image_id , "Global Palette" , H5R_OBJECT , -1) < 0) { fprintf(stderr , "Unable to create palette reference\n"); return -1; } /* write the reference out */ - if ((status = H5Dwrite(ref_dataset_id , H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL , H5P_DEFAULT, &pal_ref)) < 0) { + if (H5Dwrite(ref_dataset_id , H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL , H5P_DEFAULT, &pal_ref) < 0) { fprintf(stderr , "Unable to write Palette Reference"); return -1; } /* close dataset */ - if ((status = H5Dclose(ref_dataset_id)) < 0) { + if (H5Dclose(ref_dataset_id) < 0) { fprintf(stderr , "Unable to close palette dataset.\n"); return -1; } /* close dataspace */ - if ((status = H5Sclose(ref_dataspace_id)) < 0) { + if (H5Sclose(ref_dataspace_id) < 0) { fprintf(stderr , "Unable to close palette dataspace.\n"); return -1; } /* close everything */ - if ((status = H5Dclose(pal_id)) < 0) { + if (H5Dclose(pal_id) < 0) { fprintf(stderr , "Unable to close palette dataset. Aborting.\n"); return -1; } - if ((status = H5Sclose(dataspace_id)) < 0) { + if (H5Sclose(dataspace_id) < 0) { fprintf(stderr , "Unable to close palette dataspace. Aborting.\n"); return -1; } @@ -258,7 +245,7 @@ char *GIFFileName; /* write out the image */ /****** Ask Elena about VOIDP ******/ - if ((status = H5Dwrite(sub_image_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)(gifImageDesc->Image))) < 0) { + if (H5Dwrite(sub_image_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)(gifImageDesc->Image)) < 0) { fprintf(stderr , "Error writing image. Aborting... \n"); return -1; } @@ -332,19 +319,19 @@ char *GIFFileName; /* create the attribute */ attr_attr_id = H5Acreate(sub_image_id , "PALETTE" , H5T_STD_REF_OBJ , attr_dataspace_id , H5P_DEFAULT); - if ((status = H5Awrite(attr_attr_id , H5T_STD_REF_OBJ , &pal_ref)) < 0) { + if (H5Awrite(attr_attr_id , H5T_STD_REF_OBJ , &pal_ref) < 0) { fprintf(stderr , "Unable to write attribute. Aborting \n"); return -1; } /* close the attribute */ - if ((status = H5Aclose(attr_attr_id)) < 0) { + if (H5Aclose(attr_attr_id) < 0) { fprintf(stderr , "Unable to close CLASS IMAGE attribute. Aborting.\n"); return -1; } /* close the dataspace */ - if ((status = H5Sclose(attr_dataspace_id)) < 0) { + if (H5Sclose(attr_dataspace_id) < 0) { fprintf(stderr , "Unable to close attribute dataspace. Aborting \n"); return -1; } @@ -364,31 +351,31 @@ char *GIFFileName; /* create the attribute */ attr_attr_id = H5Acreate(sub_image_id , "IMAGE_MINMAXRANGE" , H5T_NATIVE_UINT8 , attr_dataspace_id , H5P_DEFAULT); - if ((status = H5Awrite(attr_attr_id , H5T_NATIVE_UINT8 , minmax)) < 0) { + if (H5Awrite(attr_attr_id , H5T_NATIVE_UINT8 , minmax) < 0) { fprintf(stderr , "Unable to write attribute. Aborting \n"); return -1; } /* close the attribute */ - if ((status = H5Aclose(attr_attr_id)) < 0) { + if (H5Aclose(attr_attr_id) < 0) { fprintf(stderr , "Unable to close CLASS IMAGE attribute. Aborting.\n"); return -1; } /* close the dataspace */ - if ((status = H5Sclose(attr_dataspace_id)) < 0) { + if (H5Sclose(attr_dataspace_id) < 0) { fprintf(stderr , "Unable to close attribute dataspace. Aborting \n"); return -1; } /* close everything */ - if ((status = H5Dclose(sub_image_id)) < 0) { + if (H5Dclose(sub_image_id) < 0) { fprintf(stderr , "Unable to close image dataset. Aborting \n"); return -1; } - if ((status = H5Sclose(dataspace_id)) < 0) { + if (H5Sclose(dataspace_id) < 0) { fprintf(stderr , "Unable to close image dataspace. Aborting \n"); return -1; } @@ -396,13 +383,13 @@ char *GIFFileName; } /* close the main image group */ - if ((status = H5Gclose(image_id)) < 0) { + if (H5Gclose(image_id) < 0) { fprintf(stderr , "Could not close the image group. Aborting...\n"); return -1; } /* close the H5 file */ - if ((status = H5Fclose(file_id)) < 0) { + if (H5Fclose(file_id) < 0) { fprintf(stderr , "Could not close HDF5 file. Aborting...\n"); return -1; } diff --git a/perform/chunk.c b/perform/chunk.c index f74397b..8f3e1a4 100644 --- a/perform/chunk.c +++ b/perform/chunk.c @@ -179,12 +179,7 @@ test_rowmaj (int op, size_t cache_size, size_t io_size) signed char *buf = calloc (1, (size_t)(SQUARE(io_size))); hsize_t i, j, hs_size[2]; hssize_t hs_offset[2]; -#ifdef H5_WANT_H5_V1_4_COMPAT int mdc_nelmts, rdcc_nelmts; -#else /* H5_WANT_H5_V1_4_COMPAT */ - int mdc_nelmts; - size_t rdcc_nelmts; -#endif /* H5_WANT_H5_V1_4_COMPAT */ double w0; H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0); @@ -260,12 +255,7 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset) hsize_t nio = 0; hssize_t hs_offset[2]; signed char *buf = calloc (1, (size_t)(SQUARE (io_size))); -#ifdef H5_WANT_H5_V1_4_COMPAT int mdc_nelmts, rdcc_nelmts; -#else /* H5_WANT_H5_V1_4_COMPAT */ - int mdc_nelmts; - size_t rdcc_nelmts; -#endif /* H5_WANT_H5_V1_4_COMPAT */ double w0; H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0); diff --git a/perform/pio_engine.c b/perform/pio_engine.c index 1163b74..689bd7d 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -157,7 +157,7 @@ do_pio(parameters param) char fname[FILENAME_MAX]; int maxprocs; - int nfiles, nf; + long nfiles, nf; long ndsets; off_t nelmts; char *buffer = NULL; /*data buffer pointer */ @@ -200,7 +200,7 @@ do_pio(parameters param) if (nfiles < 0 ) { fprintf(stderr, - "number of files must be >= 0 (%d)\n", + "number of files must be >= 0 (%ld)\n", nfiles); GOTOERROR(FAIL); } @@ -263,7 +263,7 @@ do_pio(parameters param) MPI_Barrier(pio_comm_g); - sprintf(base_name, "#pio_tmp_%u", nf); + sprintf(base_name, "#pio_tmp_%lu", nf); pio_create_filename(iot, base_name, fname, sizeof(fname)); set_time(res.timers, HDF5_GROSS_WRITE_FIXED_DIMS, START); @@ -498,7 +498,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, #endif /* calculate dataset parameters. data type is always native C int */ - dset_size = nelmts * ELMT_SIZE; + dset_size = nelmts * (off_t)ELMT_SIZE; nelmts_in_buf = buf_size/ELMT_SIZE; /* hdf5 data space setup */ @@ -702,7 +702,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, /* Contiguous pattern */ /* need to (off_t) the elmnts_begin expression because they */ /* may be of smaller sized integer types */ - file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*ELMT_SIZE; + file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*(off_t)ELMT_SIZE; /* only care if seek returns error */ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; @@ -717,7 +717,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, size_t xferred=0; size_t toxfer=0; - file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*ELMT_SIZE; + file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*(off_t)ELMT_SIZE; if (pio_debug_level >= 4) { HDprint_rank(output); HDfprintf(output, @@ -733,7 +733,7 @@ HDfprintf(output, toxfer = nelmts_toxfer - xferred; /* Skip offset over blocks of other processes */ file_offset = dset_offset + - (off_t)(elmts_begin + (nelmts_xfer+xferred)*pio_mpi_nprocs_g)*ELMT_SIZE; + (off_t)(elmts_begin + (nelmts_xfer+xferred)*pio_mpi_nprocs_g)*(off_t)ELMT_SIZE; if (pio_debug_level >= 4) { HDprint_rank(output); HDfprintf(output, @@ -759,7 +759,7 @@ HDfprintf(output, break; case MPIO: - mpi_offset = dset_offset + (elmts_begin + nelmts_xfer)*ELMT_SIZE; + mpi_offset = dset_offset + (elmts_begin + nelmts_xfer)*(off_t)ELMT_SIZE; mrc = MPI_File_write_at(fd->mpifd, mpi_offset, buffer, (int)(nelmts_toxfer), ELMT_MPI_TYPE, &mpi_status); @@ -882,7 +882,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, #endif /* calculate dataset parameters. data type is always native C int */ - dset_size = nelmts * ELMT_SIZE; + dset_size = nelmts * (off_t)ELMT_SIZE; nelmts_in_buf = buf_size/ELMT_SIZE; /* hdf5 data space setup */ @@ -1039,7 +1039,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, /* Contiguous pattern */ /* need to (off_t) the elmnts_begin expression because they */ /* may be of smaller sized integer types */ - file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*ELMT_SIZE; + file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*(off_t)ELMT_SIZE; /* only care if seek returns error */ rc = POSIXSEEK(fd->posixfd, file_offset) < 0 ? -1 : 0; @@ -1054,7 +1054,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, size_t xferred=0; size_t toxfer=0; - file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*ELMT_SIZE; + file_offset = dset_offset + (off_t)(elmts_begin + nelmts_xfer)*(off_t)ELMT_SIZE; if (pio_debug_level >= 4) { HDprint_rank(output); HDfprintf(output, @@ -1070,7 +1070,7 @@ HDfprintf(output, toxfer = nelmts_toxfer - xferred; /* Skip offset over blocks of other processes */ file_offset = dset_offset + - (off_t)(elmts_begin + (nelmts_xfer+xferred)*pio_mpi_nprocs_g)*ELMT_SIZE; + (off_t)(elmts_begin + (nelmts_xfer+xferred)*pio_mpi_nprocs_g)*(off_t)ELMT_SIZE; if (pio_debug_level >= 4) { HDprint_rank(output); HDfprintf(output, @@ -1096,7 +1096,7 @@ HDfprintf(output, break; case MPIO: - mpi_offset = dset_offset + (elmts_begin + nelmts_xfer)*ELMT_SIZE; + mpi_offset = dset_offset + (elmts_begin + nelmts_xfer)*(off_t)ELMT_SIZE; mrc = MPI_File_read_at(fd->mpifd, mpi_offset, buffer, (int)(nelmts_toxfer), ELMT_MPI_TYPE, diff --git a/perform/pio_perf.c b/perform/pio_perf.c index 8289f26..6b63c7b 100644 --- a/perform/pio_perf.c +++ b/perform/pio_perf.c @@ -253,7 +253,7 @@ struct options { off_t file_size; /* size of file */ long num_dsets; /* number of datasets */ long num_files; /* number of files */ - long num_iters; /* number of iterations */ + int num_iters; /* number of iterations */ int max_num_procs; /* maximum number of processes to use */ int min_num_procs; /* minimum number of processes to use */ size_t max_xfer_size; /* maximum transfer buffer size */ @@ -705,7 +705,7 @@ run_test(iotype iot, parameters parms, struct options *opts) static void output_all_info(minmax *mm, int count, int indent_level) { - register int i; + int i; for (i = 0; i < count; ++i) { print_indent(indent_level); @@ -750,7 +750,7 @@ get_minmax(minmax *mm, double val) static minmax accumulate_minmax_stuff(minmax *mm, int count) { - register int i; + int i; minmax total_mm; total_mm.sum = 0.0; @@ -871,7 +871,7 @@ output_results(const struct options *opts, const char *name, minmax *table, total_mm = accumulate_minmax_stuff(table, table_size); print_indent(3); - output_report("%s (%d iteration(s)):\n", name,(int)table_size); + output_report("%s (%d iteration(s)):\n", name,table_size); /* Note: The maximum throughput uses the minimum amount of time & vice versa */ diff --git a/perform/pio_perf.h b/perform/pio_perf.h index 4ed0240..6c2999d 100644 --- a/perform/pio_perf.h +++ b/perform/pio_perf.h @@ -34,10 +34,10 @@ typedef enum iotype_ { typedef struct parameters_ { iotype io_type; /* The type of IO test to perform */ int num_procs; /* Maximum number of processes to use */ - int num_files; /* Number of files to create */ + long num_files; /* Number of files to create */ long num_dsets; /* Number of datasets to create */ off_t num_elmts; /* Number of native ints in each dset */ - int num_iters; /* Number of times to loop doing the IO */ + int num_iters; /* Number of times to loop doing the IO */ size_t buf_size; /* Buffer size */ size_t block_size; /* interleaved block size */ hsize_t h5_align; /* HDF5 object alignment */ diff --git a/src/H5Dseq.c b/src/H5Dseq.c index e39f023..bb7b97a 100644 --- a/src/H5Dseq.c +++ b/src/H5Dseq.c @@ -154,8 +154,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ unsigned long max, min, temp; - temp = seq_len; - assert(temp==seq_len); /* verify no overflow */ + H5_ASSIGN_OVERFLOW(temp,seq_len,hsize_t,unsigned long); MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, H5FD_mpio_communicator(f->shared->lf)); MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, @@ -190,8 +189,6 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, case H5D_CHUNKED: { - unsigned leading_partials; /* Flag set if there are leading partial hyperslabs to take care of */ - /* * This method is unable to access external raw data files */ @@ -238,12 +235,9 @@ printf("%s: acc=%ld, down_size[%d]=%ld\n",FUNC,(long)acc,i,(long)down_size[i]); } /* end for */ /* Compute the hyperslab offset from the address given */ - leading_partials=0; for(i=ndims-1; i>=0; i--) { coords[i]=addr%dset_dims[i]; addr/=dset_dims[i]; - if(i>0 && coords[i]>0) - leading_partials=1; #ifdef QAK printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,i,(long)coords[i]); #endif /* QAK */ @@ -251,7 +245,6 @@ printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,i,(long)coords[ coords[ndims]=0; /* No offset for element info */ #ifdef QAK printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,ndims,(long)coords[ndims]); -printf("%s: leading_partials=%u\n",FUNC,leading_partials); #endif /* QAK */ /* @@ -607,8 +600,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ unsigned long max, min, temp; - temp = seq_len; - assert(temp==seq_len); /* verify no overflow */ + H5_ASSIGN_OVERFLOW(temp,seq_len,hsize_t,unsigned long); MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, H5FD_mpio_communicator(f->shared->lf)); MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, @@ -643,8 +635,6 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, case H5D_CHUNKED: { - unsigned leading_partials; /* Flag set if there are leading partial hyperslabs to take care of */ - /* * This method is unable to access external raw data files */ @@ -691,12 +681,9 @@ printf("%s: acc=%ld, down_size[%d]=%ld\n",FUNC,(long)acc,i,(long)down_size[i]); } /* end for */ /* Compute the hyperslab offset from the address given */ - leading_partials=0; for(i=ndims-1; i>=0; i--) { coords[i]=addr%dset_dims[i]; addr/=dset_dims[i]; - if(i>0 && coords[i]>0) - leading_partials=1; #ifdef QAK printf("%s: addr=%lu, dset_dims[%d]=%ld, coords[%d]=%ld\n",FUNC,(unsigned long)addr,i,(long)dset_dims[i],i,(long)coords[i]); #endif /* QAK */ @@ -704,7 +691,6 @@ printf("%s: addr=%lu, dset_dims[%d]=%ld, coords[%d]=%ld\n",FUNC,(unsigned long)a coords[ndims]=0; /* No offset for element info */ #ifdef QAK printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,ndims,(long)coords[ndims]); -printf("%s: leading_partials=%u\n",FUNC,leading_partials); #endif /* QAK */ /* diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 15e42c5..4d360d7 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -993,7 +993,9 @@ H5FD_mpio_close(H5FD_t *_file) static herr_t H5FD_mpio_query(const H5FD_t *_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); diff --git a/src/H5Farray.c b/src/H5Farray.c index 0f56977..4d5bf36 100644 --- a/src/H5Farray.c +++ b/src/H5Farray.c @@ -282,8 +282,7 @@ H5F_arr_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ unsigned long max, min, temp; - temp = nelmts; - assert(temp==nelmts); /* verify no overflow */ + H5_ASSIGN_OVERFLOW(temp,nelmts,hsize_t,unsigned long); MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, H5FD_mpio_communicator(f->shared->lf)); MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, @@ -564,8 +563,7 @@ H5F_arr_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ unsigned long max, min, temp; - temp = nelmts; - assert(temp==nelmts); /* verify no overflow */ + H5_ASSIGN_OVERFLOW(temp,nelmts,hsize_t,unsigned long); MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, H5FD_mpio_communicator(f->shared->lf)); MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 703f67f..8346ca4 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -213,13 +213,6 @@ __DLL__ herr_t H5F_istore_write(H5F_t *f, hid_t dxpl_id, const struct H5O_fill_t *fill, const hssize_t offset[], const hsize_t size[], const void *buf); -#ifdef H5_HAVE_PARALLEL -__DLL__ herr_t H5F_istore_allocate (H5F_t *f, hid_t dxpl_id, - const struct H5O_layout_t *layout, - const hsize_t *space_dim, - const struct H5O_pline_t *pline, - const struct H5O_fill_t *fill); -#endif /* H5_HAVE_PARALLEL */ /* Functions that operate on contiguous storage wrt boot block */ __DLL__ herr_t H5F_contig_read(H5F_t *f, hsize_t max_data, H5FD_mem_t type, haddr_t addr, hsize_t size, diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 6948852..440853e 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -316,6 +316,13 @@ __DLL__ herr_t H5F_seq_write (H5F_t *f, hid_t dxpl_id, /* Functions that operate on indexed storage */ +#ifdef H5_HAVE_PARALLEL +__DLL__ herr_t H5F_istore_allocate (H5F_t *f, hid_t dxpl_id, + const struct H5O_layout_t *layout, + const hsize_t *space_dim, + const struct H5O_pline_t *pline, + const struct H5O_fill_t *fill); +#endif /* H5_HAVE_PARALLEL */ __DLL__ hsize_t H5F_istore_allocated(H5F_t *f, unsigned ndims, haddr_t addr); __DLL__ herr_t H5F_istore_dump_btree(H5F_t *f, FILE *stream, unsigned ndims, haddr_t addr); diff --git a/src/H5Fseq.c b/src/H5Fseq.c index e39f023..bb7b97a 100644 --- a/src/H5Fseq.c +++ b/src/H5Fseq.c @@ -154,8 +154,7 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ unsigned long max, min, temp; - temp = seq_len; - assert(temp==seq_len); /* verify no overflow */ + H5_ASSIGN_OVERFLOW(temp,seq_len,hsize_t,unsigned long); MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, H5FD_mpio_communicator(f->shared->lf)); MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, @@ -190,8 +189,6 @@ H5F_seq_read(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, case H5D_CHUNKED: { - unsigned leading_partials; /* Flag set if there are leading partial hyperslabs to take care of */ - /* * This method is unable to access external raw data files */ @@ -238,12 +235,9 @@ printf("%s: acc=%ld, down_size[%d]=%ld\n",FUNC,(long)acc,i,(long)down_size[i]); } /* end for */ /* Compute the hyperslab offset from the address given */ - leading_partials=0; for(i=ndims-1; i>=0; i--) { coords[i]=addr%dset_dims[i]; addr/=dset_dims[i]; - if(i>0 && coords[i]>0) - leading_partials=1; #ifdef QAK printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,i,(long)coords[i]); #endif /* QAK */ @@ -251,7 +245,6 @@ printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,i,(long)coords[ coords[ndims]=0; /* No offset for element info */ #ifdef QAK printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,ndims,(long)coords[ndims]); -printf("%s: leading_partials=%u\n",FUNC,leading_partials); #endif /* QAK */ /* @@ -607,8 +600,7 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, */ unsigned long max, min, temp; - temp = seq_len; - assert(temp==seq_len); /* verify no overflow */ + H5_ASSIGN_OVERFLOW(temp,seq_len,hsize_t,unsigned long); MPI_Allreduce(&temp, &max, 1, MPI_UNSIGNED_LONG, MPI_MAX, H5FD_mpio_communicator(f->shared->lf)); MPI_Allreduce(&temp, &min, 1, MPI_UNSIGNED_LONG, MPI_MIN, @@ -643,8 +635,6 @@ H5F_seq_write(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout, case H5D_CHUNKED: { - unsigned leading_partials; /* Flag set if there are leading partial hyperslabs to take care of */ - /* * This method is unable to access external raw data files */ @@ -691,12 +681,9 @@ printf("%s: acc=%ld, down_size[%d]=%ld\n",FUNC,(long)acc,i,(long)down_size[i]); } /* end for */ /* Compute the hyperslab offset from the address given */ - leading_partials=0; for(i=ndims-1; i>=0; i--) { coords[i]=addr%dset_dims[i]; addr/=dset_dims[i]; - if(i>0 && coords[i]>0) - leading_partials=1; #ifdef QAK printf("%s: addr=%lu, dset_dims[%d]=%ld, coords[%d]=%ld\n",FUNC,(unsigned long)addr,i,(long)dset_dims[i],i,(long)coords[i]); #endif /* QAK */ @@ -704,7 +691,6 @@ printf("%s: addr=%lu, dset_dims[%d]=%ld, coords[%d]=%ld\n",FUNC,(unsigned long)a coords[ndims]=0; /* No offset for element info */ #ifdef QAK printf("%s: addr=%lu, coords[%d]=%ld\n",FUNC,(unsigned long)addr,ndims,(long)coords[ndims]); -printf("%s: leading_partials=%u\n",FUNC,leading_partials); #endif /* QAK */ /* diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 9e7fb77..9da8aac 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -1298,7 +1298,7 @@ H5O_dtype_debug(H5F_t *f, const void *mesg, FILE *stream, dt->u.array.ndims); fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); for (i=0; iu.array.ndims; i++) { - fprintf (stream, "%s%u", i?", ":"", dt->u.array.dim[i]); + fprintf (stream, "%s%u", i?", ":"", (unsigned)dt->u.array.dim[i]); } fprintf (stream, "}\n"); fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Permutation:"); diff --git a/src/H5Shyper.c b/src/H5Shyper.c index caac5cc..b7181ce 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -484,6 +484,7 @@ H5S_hyper_block_cache (H5S_hyper_node_t *node, static herr_t H5S_hyper_block_read (H5S_hyper_node_t *node, H5S_hyper_io_info_t *io_info, hsize_t region_size) { + size_t tmp_region_size; FUNC_ENTER (H5S_hyper_block_read, SUCCEED); assert(node && node->cinfo.cached); @@ -504,8 +505,8 @@ H5S_hyper_block_read (H5S_hyper_node_t *node, H5S_hyper_io_info_t *io_info, hsiz * offset */ node->cinfo.rpos+=region_size*io_info->elmt_size; - H5_ASSIGN_OVERFLOW(node->cinfo.rleft,node->cinfo.rleft-region_size,hsize_t,size_t); - /* node->cinfo.rleft-=region_size;*/ + H5_ASSIGN_OVERFLOW(tmp_region_size,region_size,hsize_t,size_t); + node->cinfo.rleft-=tmp_region_size; /* If we've read in all the elements from the block, throw it away */ if(node->cinfo.rleft==0 && (node->cinfo.wleft==0 || node->cinfo.wleft==node->cinfo.size)) { @@ -540,6 +541,7 @@ H5S_hyper_block_write (H5S_hyper_node_t *node, { hssize_t file_offset[H5O_LAYOUT_NDIMS]; /*offset of slab in file*/ hsize_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ + size_t tmp_region_size; unsigned u; /* Counters */ FUNC_ENTER (H5S_hyper_block_write, SUCCEED); @@ -559,8 +561,8 @@ H5S_hyper_block_write (H5S_hyper_node_t *node, * offset */ node->cinfo.wpos+=region_size*io_info->elmt_size; - H5_ASSIGN_OVERFLOW(node->cinfo.wleft,node->cinfo.wleft-region_size,hsize_t,size_t); - node->cinfo.wleft-=region_size; + H5_ASSIGN_OVERFLOW(tmp_region_size,region_size,hsize_t,size_t); + node->cinfo.wleft-=tmp_region_size; /* If we've read in all the elements from the block, throw it away */ if(node->cinfo.wleft==0 && (node->cinfo.rleft==0 || node->cinfo.rleft==node->cinfo.size)) { diff --git a/src/H5Smpio.c b/src/H5Smpio.c index f09a129..7469943 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -28,6 +28,7 @@ #include "H5Eprivate.h" #include "H5Fpkg.h" /* Ugly, but necessary for the MPIO I/O accesses */ #include "H5FDmpio.h" /*the MPIO file driver */ +#include "H5FDprivate.h" /* Necessary for the H5FD_write & H5FD_read prototypes.. */ #include "H5Spkg.h" #ifndef H5_HAVE_PARALLEL diff --git a/src/H5T.c b/src/H5T.c index 3f355cc..28f6327 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1974,7 +1974,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; diff --git a/src/H5Zdeflate.c b/src/H5Zdeflate.c index 7483bb2..1b76158 100644 --- a/src/H5Zdeflate.c +++ b/src/H5Zdeflate.c @@ -89,9 +89,9 @@ H5Z_filter_deflate (unsigned UNUSED flags, size_t cd_nelmts, } HDmemset(&z_strm, 0, sizeof(z_strm)); z_strm.next_in = *buf; - z_strm.avail_in = nbytes; + H5_ASSIGN_OVERFLOW(z_strm.avail_in,nbytes,size_t,uInt); z_strm.next_out = outbuf; - z_strm.avail_out = nalloc; + H5_ASSIGN_OVERFLOW(z_strm.avail_out,nalloc,size_t,uInt); if (Z_OK!=inflateInit(&z_strm)) { HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed"); } @@ -111,7 +111,7 @@ H5Z_filter_deflate (unsigned UNUSED flags, size_t cd_nelmts, "uncompression"); } z_strm.next_out = (unsigned char*)outbuf + z_strm.total_out; - z_strm.avail_out = nalloc - z_strm.total_out; + z_strm.avail_out = (uInt)(nalloc - z_strm.total_out); } } diff --git a/test/big.c b/test/big.c index 6122641..a27f72f 100644 --- a/test/big.c +++ b/test/big.c @@ -35,8 +35,8 @@ const char *FILENAME[] = { # define GB8LL 0 /*cannot do the test*/ #endif -/* Protocols */ -void usage(void); +/* Prototypes */ +static void usage(void); /*------------------------------------------------------------------------- diff --git a/test/dsets.c b/test/dsets.c index 7b64c85..7d60532 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -376,13 +376,14 @@ test_compression(hid_t file) const hsize_t chunk_size[2] = {2, 25}; const hssize_t hs_offset[2] = {7, 30}; const hsize_t hs_size[2] = {4, 50}; - const char *not_supported; - hsize_t i, j, n; void *tconv_buf = NULL; +#if !(defined(H5_HAVE_COMPRESS2) && defined(H5_HAVE_ZLIB_H) && defined(H5_HAVE_LIBZ)) + const char *not_supported; not_supported = " Deflate compression is not supported.\n" " The zlib was not found when hdf5 was configured."; +#endif TESTING("compression (setup)"); diff --git a/test/dtypes.c b/test/dtypes.c index df26823..2ac8e6c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1125,7 +1125,6 @@ test_query(void) hid_t file=-1, tid1=-1, tid2=-1; char filename[1024]; char compnd_type[]="Compound_type", enum_type[]="Enum_type"; - int nmembs, index; short enum_val; TESTING("query functions of compound and enumeration types"); @@ -1195,24 +1194,24 @@ test_query(void) } /* end if */ /* Query member number and member index by name, for compound type. */ - if((nmembs=H5Tget_nmembers(tid1))!=4) { + if(H5Tget_nmembers(tid1)!=4) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid1, "c"))!=2) { + if(H5Tget_member_index(tid1, "c")!=2) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; } /* end if */ /* Query member number and member index by name, for enumeration type. */ - if((nmembs=H5Tget_nmembers(tid2))!=5) { + if(H5Tget_nmembers(tid2)!=5) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid2, "ORANGE"))!=3) { + if(H5Tget_member_index(tid2, "ORANGE")!=3) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; @@ -1255,24 +1254,24 @@ test_query(void) } /* end if */ /* Query member number and member index by name, for compound type */ - if((nmembs=H5Tget_nmembers(tid1))!=4) { + if(H5Tget_nmembers(tid1)!=4) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid1, "c"))!=2) { + if(H5Tget_member_index(tid1, "c")!=2) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; } /* end if */ /* Query member number and member index by name, for enumeration type */ - if((nmembs=H5Tget_nmembers(tid2))!=5) { + if(H5Tget_nmembers(tid2)!=5) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if((index=H5Tget_member_index(tid2, "ORANGE"))!=3) { + if(H5Tget_member_index(tid2, "ORANGE")!=3) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; diff --git a/test/enum.c b/test/enum.c index 464db00..c9d5e48 100644 --- a/test/enum.c +++ b/test/enum.c @@ -372,18 +372,19 @@ test_tr2(hid_t file) *------------------------------------------------------------------------- */ static int -test_value_dsnt_exist() +test_value_dsnt_exist(void) { hid_t datatype_id; /* identifiers */ - herr_t status; int val; char nam[100]; size_t size = 100; + TESTING("for non-existing name and value"); + /* Turn off error reporting since we expect failure in this test */ - if (H5Eset_auto(NULL, NULL) < 0) goto error; + if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT))< 0) goto error; /* These calls should fail, since no memebrs exist yet */ diff --git a/test/stab.c b/test/stab.c index fd9a607..1c43760 100644 --- a/test/stab.c +++ b/test/stab.c @@ -118,7 +118,7 @@ test_long(hid_t file) /* Group names */ name1 = malloc(namesize); for (i=0; i= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dataset_pl, RANK, chunk_dims); @@ -1144,7 +1134,6 @@ extend_readInd(char *filename) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ - hid_t sid; /* Dataspace ID */ hid_t file_dataspace; /* File dataspace ID */ hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2; /* Dataset ID */ @@ -1158,7 +1147,6 @@ extend_readInd(char *filename) hsize_t block[RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ - int i, j; int mpi_size, mpi_rank; MPI_Comm comm = MPI_COMM_WORLD; diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 46ab44b..46e2117 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -96,7 +96,7 @@ void multiple_dset_write(char *filename, int ndatasets) void multiple_group_write(char *filename, int ngroups) { int mpi_rank, mpi_size; - int i, j, l, m; + int l, m; char gname[64]; hid_t fid, gid, plist, memspace, filespace; hssize_t chunk_origin[DIM]; @@ -283,12 +283,15 @@ int read_dataset(hid_t memspace, hid_t filespace, hid_t gid) { int i, j, n, mpi_rank, vrfy_errors=0; char dname[32]; - DATATYPE outdata[SIZE][SIZE], indata[SIZE][SIZE]; + DATATYPE *outdata, *indata; hid_t did; hsize_t block[DIM]={SIZE,SIZE}; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + indata = (DATATYPE*)malloc(SIZE*SIZE*sizeof(DATATYPE)); + outdata = (DATATYPE*)malloc(SIZE*SIZE*sizeof(DATATYPE)); + for(n=0; n MAX_ERR_REPORT && !verbose) printf("proc %d: [more errors ...]\n", mpi_rank); @@ -346,7 +345,7 @@ test_mpio_gb_file(char *filename) if ((*(buf+j) != expected) && (vrfyerrs++ < MAX_ERR_REPORT || verbose)) printf("proc %d: found data error at [%ld+%d], expect %d, got %d\n", - mpi_rank, mpi_off, j, expected, *(buf+j)); + mpi_rank, (long)mpi_off, j, expected, *(buf+j)); } if (vrfyerrs > MAX_ERR_REPORT && !verbose) printf("proc %d: [more errors ...]\n", mpi_rank); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 693ad30..5ef10c0 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -116,7 +116,17 @@ 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 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); +void test_split_comm_access(char *filename); +void dataset_writeInd(char *filename); +void dataset_writeAll(char *filename); +void extend_writeInd(char *filename); +void dataset_readInd(char *filename); +void dataset_readAll(char *filename); +void extend_readInd(char *filename); +int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original); #endif /* PHDF5TEST_H */ diff --git a/tools/gifconv/decompress.c b/tools/gifconv/decompress.c index 18dbb3e..ff6c4ca 100644 --- a/tools/gifconv/decompress.c +++ b/tools/gifconv/decompress.c @@ -15,19 +15,15 @@ char *cmd; FILE *fp; +static WORD + XC = 0, YC = 0, /* Output X and Y coords of current pixel */ + CodeSize, /* Code size, read from GIF header */ + InitCodeSize, /* Starting code size, used during Clear */ + BytesPerScanline, /* Bytes per scanline in output raster */ + IWidth, IHeight; /* image dimensions */ static int BitOffset = 0, /* Bit Offset of next code */ -XC = 0, YC = 0, /* Output X and Y coords of current pixel */ Pass = 0, /* Used by output routine if WORDerlaced pic */ OutCount = 0, /* Decompressor output 'stack count' */ -RWidth, RHeight, /* screen dimensions */ -IWidth, IHeight, /* image dimensions */ -LeftOfs, TopOfs, /* image offset */ -BitsPerPixel, /* Bits per pixel, read from GIF header */ -BytesPerScanline, /* Bytes per scanline in output raster */ -ColorMapSize, /* number of colors */ -Background, /* background color */ -CodeSize, /* Code size, read from GIF header */ -InitCodeSize, /* Starting code size, used during Clear */ Code, /* Value returned by ReadCode */ MaxCode, /* limiting value for current code size */ ClearCode, /* GIF clear code */ @@ -73,7 +69,8 @@ int numused; * three BYTEs, compute the bit Offset WORDo our 24-bit chunk, shift to * bring the desired code to the bottom, then mask it off and return it. */ -ReadCode() +static int +ReadCode(void) { int RawCode, ByteOffset; @@ -87,8 +84,7 @@ ReadCode() } -AddToPixel(Index) -BYTE Index; +static void AddToPixel(BYTE Index) { if (YCPackedField & 0x07) +1)) -1); + DataMask = (1 << ((GifHead->PackedField & 0x07) +1)) -1; Raster = GifImageDesc->GIFImage; diff --git a/tools/gifconv/gif.h b/tools/gifconv/gif.h index 7f1d042..9e4f9e8 100644 --- a/tools/gifconv/gif.h +++ b/tools/gifconv/gif.h @@ -169,7 +169,6 @@ int WriteHDF(GIFTOMEM , CHAR * , CHAR *); */ int ReadHDF(BYTE** data , BYTE palette[256][3] , hsize_t *image_size , CHAR *h5_file , CHAR *dset_name , CHAR *pal_name); -BYTE *ReadDataSubBlocks(BYTE ** , WORD *); BYTE *Decompress (GIFIMAGEDESC * , GIFHEAD *); BYTE GetByte(BYTE *); WORD GetWord(BYTE *); diff --git a/tools/gifconv/gifread.c b/tools/gifconv/gifread.c index f2fefff..c7b7b96 100644 --- a/tools/gifconv/gifread.c +++ b/tools/gifconv/gifread.c @@ -2,6 +2,9 @@ #include #include "gif.h" +static BYTE * +ReadDataSubBlocks(BYTE **MemGif2 , WORD *DSize); + int EndianOrder; int i; @@ -53,7 +56,7 @@ BYTE **MemGif2; /* GIF image file input FILE stream */ for (i = 0 ; i < 6 ; i++) { GifHead->HeaderDump[i] = *(*MemGif2)++; } - if (strncmp(GifHead->HeaderDump , "GIF" , 3)) { + if (strncmp((const char *)GifHead->HeaderDump , "GIF" , 3)) { printf("The file does not appear to be a valid GIF file.\n"); exit(-1); } @@ -352,7 +355,9 @@ WORD *DSize; bufSize += (dataSize); /* Running total of the buffer size */ *DSize = bufSize; - /* *ptr1++ = dataSize; /* Write the data count */ +#ifdef COMMENTED_OUT + *ptr1++ = dataSize; /* Write the data count */ +#endif /* COMMENTED_OUT */ while (dataSize--) /* Read/write the Plain Text data */ *ptr1++ = *(*MemGif2)++; @@ -370,7 +375,6 @@ WORD *DSize; } - /**ptr1++ = (BYTE) NULL; /* Add NULL to simulate Terminator value */ *ptr1++ = '\0'; return(ptr2); /* Return a pointer to the sub-block data */ diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c index 1963a20..6443627 100644 --- a/tools/gifconv/hdf2gif.c +++ b/tools/gifconv/hdf2gif.c @@ -52,7 +52,7 @@ void putword(int w, FILE *fp) fputc((w>>8)&0xff,fp); } -void usage() { +static void usage(void) { printf("Usage: h52gif -i [-p ]\n"); printf("h52gif expects *at least* one h5_image. You may repeat -i [-p ] at most 50 times (maximum of 50 images).\n"); } @@ -68,12 +68,9 @@ int main(int argc , char **argv) { CHAR *HDFName = NULL; CHAR *GIFName = NULL; - CHAR *image_path = NULL; - CHAR *pal_path = NULL; /* reference variables */ int has_local_palette; /* treated as a flag */ - int loop_times; /* number of times to loop, i'm going to treat it as a yes or no */ BYTE* b; @@ -86,10 +83,8 @@ int main(int argc , char **argv) { /*int LeftOfs, TopOfs;*/ int ColorMapSize, InitCodeSize, Background, BitsPerPixel; int j,nc; - int w,h,i; + int w,i; int numcols = 256; - int CountDown; - int curx , cury; int time_out = 0; /* time between two images in the animation */ int n_images , index; @@ -207,19 +202,7 @@ int main(int argc , char **argv) { assert(dim_sizes[1]==(hsize_t)((int)dim_sizes[1])); RWidth = (int)dim_sizes[1]; RHeight = (int)dim_sizes[0]; - w = (int)dim_sizes[1]; - h = (int)dim_sizes[0]; - -#ifdef UNUSED - /* w = dim_sizes[1]; - h = dim_sizes[0]; - - */ - LeftOfs = TopOfs = 0; -#endif /*UNUSED */ - - /* If the first image does not have a palette, I make my own global color table ** Obviously this is not the best thing to do, better steps would be: ** 1. Check for either a global palette or a global attribute called palette @@ -266,13 +249,9 @@ int main(int argc , char **argv) { ColorMapSize = 1 << BitsPerPixel; - CountDown = w * h; /* # of pixels we'll be doing */ - if (BitsPerPixel <= 1) InitCodeSize = 2; else InitCodeSize = BitsPerPixel; - curx = cury = 0; - if (!fpGif) { fprintf(stderr, "WriteGIF: file not open for writing\n" ); return (1); @@ -285,11 +264,9 @@ 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 */ @@ -305,7 +282,7 @@ int main(int argc , char **argv) { fputc(0, fpGif); /* future expansion byte */ - /* If loop_times is 0 , put in the application extension to make the gif anime loop + /* If time_out>0, put in the application extension to make the gif anime loop ** indefinitely */ if (time_out > 0) { diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c index 7277e13..3c15477 100644 --- a/tools/gifconv/hdfgifwr.c +++ b/tools/gifconv/hdfgifwr.c @@ -73,13 +73,10 @@ typedef long int count_int; /* MONO returns total intensity of r,g,b components */ #define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/ -static int Width, Height; -static int curx, cury; -static long CountDown; -static int Interlace; - #ifdef __STDC__ +#ifdef UNUSED static void putword(int, FILE *); +#endif /* UNUSED */ static void compress(int, FILE *, byte *, int); static void output(int); static void cl_block(void); @@ -88,15 +85,16 @@ static void char_init(void); static void char_out(int); static void flush_char(void); #else -static void putword(), compress(), output(), cl_block(), cl_hash(); +#ifdef UNUSED +static void putword(); +#endif /* UNUSED */ +static void compress(), output(), cl_block(), cl_hash(); static void char_init(), char_out(), flush_char(); #endif -static byte pc2nc[256],r1[256],g1[256],b1[256]; +static byte pc2nc[256]; -void xvbzero(s, len) - char *s; - int len; +static void xvbzero(char *s, size_t len) { for ( ; len>0; len--) *s++ = 0; } @@ -110,36 +108,18 @@ int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colo int numcols, colorstyle; int BitsPerPixel; { - int RWidth, RHeight; - int LeftOfs, TopOfs; - int ColorMapSize, InitCodeSize, Background; + int InitCodeSize; int i; byte *pic8; pic8 = pic; - Interlace = 0; - Background = 0; - for (i=0; i<256; i++) { pc2nc[i] = pc2ncmap[i]; - r1[i] = rmap[i]; - g1[i] = gmap[i]; - b1[i] = bmap[i]; } - ColorMapSize = 1 << BitsPerPixel; - - RWidth = Width = w; - RHeight = Height = h; - LeftOfs = TopOfs = 0; - - CountDown = w * h; /* # of pixels we'll be doing */ - if (BitsPerPixel <= 1) InitCodeSize = 2; else InitCodeSize = BitsPerPixel; - curx = cury = 0; - if (!fp) { fprintf(stderr, "WriteGIF: file not open for writing\n" ); return (1); @@ -155,6 +135,7 @@ int hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, pc2ncmap, numcols, colo +#ifdef UNUSED /******************************/ static void putword(w, fp) int w; @@ -166,6 +147,7 @@ FILE *fp; fputc((w>>8)&0xff,fp); } +#endif /* UNUSED */ diff --git a/tools/gifconv/readhdf.c b/tools/gifconv/readhdf.c index 602c48f..5b9c9d1 100644 --- a/tools/gifconv/readhdf.c +++ b/tools/gifconv/readhdf.c @@ -32,7 +32,6 @@ int ReadHDF(BYTE** data , CHAR *pal_name) { hid_t fHfile; /* H5 file to open */ - herr_t status; /* status variable */ hid_t dspace; /* dataspace identifier for the the dataset */ hid_t dset; /* dataset identifier */ @@ -89,7 +88,7 @@ int ReadHDF(BYTE** data , } /* get the actual image */ - if ((status = H5Dread(dset , H5Dget_type(dset) , H5S_ALL , H5S_ALL , H5P_DEFAULT , *data)) < 0) { + if (H5Dread(dset , H5Dget_type(dset) , H5S_ALL , H5S_ALL , H5P_DEFAULT , *data) < 0) { fprintf(stderr , "Unable to read data \n"); cleanup(*data); return -1; @@ -140,7 +139,7 @@ int ReadHDF(BYTE** data , } /* get the actual palette */ - if ((status = H5Dread(pal_set , H5Dget_type(pal_set) , H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf)) < 0) { + if (H5Dread(pal_set , H5Dget_type(pal_set) , H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf) < 0) { fprintf(stderr , "Unable to read data \n"); cleanup(*data); cleanup(temp_buf); @@ -165,9 +164,9 @@ int ReadHDF(BYTE** data , } /* close everything */ - status = H5Dclose(dset); - status = H5Sclose(dspace); - status = H5Fclose(fHfile); + H5Dclose(dset); + H5Sclose(dspace); + H5Fclose(fHfile); return 0; } diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c index 53cf9be..1eb49fd 100644 --- a/tools/gifconv/writehdf.c +++ b/tools/gifconv/writehdf.c @@ -13,7 +13,6 @@ int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value) hsize_t attr_dims_size; /* dimensions for the attribute */ hid_t attr_dataspace_id; /* dataspaces needed for the various attributes */ hid_t attr_attr_id; /* attribute id */ - herr_t status; /* check return status */ hid_t attr_type_id; @@ -36,15 +35,15 @@ int write_text_attribute(hid_t dataset_id , char *attr_name , char *attr_value) attr_attr_id = H5Acreate(dataset_id , attr_name , attr_type_id , attr_dataspace_id , H5P_DEFAULT); /* write out the attribute data */ - if ((status = H5Awrite(attr_attr_id , attr_type_id , attr_value)) < 0) + if (H5Awrite(attr_attr_id , attr_type_id , attr_value) < 0) return -1; /* close the attribute */ - if ((status = H5Aclose(attr_attr_id)) < 0) + if (H5Aclose(attr_attr_id) < 0) return -1; /* close the dataspace */ - if ((status = H5Sclose(attr_dataspace_id)) < 0) { + if (H5Sclose(attr_dataspace_id) < 0) { fprintf(stderr , "Unable to close attribute dataspace. Aborting \n"); return -1; } @@ -62,23 +61,14 @@ char *GIFFileName; GIFHEAD gifHead; /* GIF Header structure */ GIFIMAGEDESC* gifImageDesc; /* Logical Image Descriptor struct */ - long ImageCount , /* number of images */ - CommentCount, /* number of comments */ - ApplicationCount , /* number of application extensions */ - PlainTextCount; /* number of plain text extensions */ - + long ImageCount; /* number of images */ char ImageName[256]; /* Image name for the GR Image */ - /* CommentName[256], - ApplicationName[256], - PlainTextName[256]; */ - char GroupName[VSNAMELENMAX]; /* so that we can name the subgroups appropriately */ /* H5 variables */ hid_t file_id; /* H5 file id */ hid_t image_id; /* H5 id for the whole image */ hid_t pal_id; /* H5 id for the palette */ - herr_t status; /* status variable */ hobj_ref_t pal_ref; /* Create a reference for the palette */ /* temp counter */ @@ -93,10 +83,7 @@ char *GIFFileName; gifHead = *(GifMemoryStruct.GifHeader); /* get some data from gifHead */ - ImageCount = (WORD)gifHead.ImageCount; - CommentCount = (WORD)gifHead.CommentCount; - ApplicationCount = (WORD)gifHead.ApplicationCount; - PlainTextCount = (WORD)gifHead.PlainTextCount; + ImageCount = gifHead.ImageCount; /* get the main group name from GIFFileName */ GroupName[0]= '/'; @@ -145,7 +132,7 @@ char *GIFFileName; /* write the palette data out */ /****** Ask Elena about VOIDP ******/ - if ((status = H5Dwrite(pal_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)gifHead.HDFPalette)) < 0) { + if (H5Dwrite(pal_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)gifHead.HDFPalette) < 0) { fprintf(stderr , "Error writing dataset. Aborting...\n"); return -1; } @@ -183,36 +170,36 @@ char *GIFFileName; ref_dataset_id = H5Dcreate(image_id , "Palette Reference" , H5T_STD_REF_OBJ , ref_dataspace_id , H5P_DEFAULT); /* create a reference to the palette */ - if ((status = H5Rcreate(&pal_ref , image_id , "Global Palette" , H5R_OBJECT , -1)) < 0) { + if (H5Rcreate(&pal_ref , image_id , "Global Palette" , H5R_OBJECT , -1) < 0) { fprintf(stderr , "Unable to create palette reference\n"); return -1; } /* write the reference out */ - if ((status = H5Dwrite(ref_dataset_id , H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL , H5P_DEFAULT, &pal_ref)) < 0) { + if (H5Dwrite(ref_dataset_id , H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL , H5P_DEFAULT, &pal_ref) < 0) { fprintf(stderr , "Unable to write Palette Reference"); return -1; } /* close dataset */ - if ((status = H5Dclose(ref_dataset_id)) < 0) { + if (H5Dclose(ref_dataset_id) < 0) { fprintf(stderr , "Unable to close palette dataset.\n"); return -1; } /* close dataspace */ - if ((status = H5Sclose(ref_dataspace_id)) < 0) { + if (H5Sclose(ref_dataspace_id) < 0) { fprintf(stderr , "Unable to close palette dataspace.\n"); return -1; } /* close everything */ - if ((status = H5Dclose(pal_id)) < 0) { + if (H5Dclose(pal_id) < 0) { fprintf(stderr , "Unable to close palette dataset. Aborting.\n"); return -1; } - if ((status = H5Sclose(dataspace_id)) < 0) { + if (H5Sclose(dataspace_id) < 0) { fprintf(stderr , "Unable to close palette dataspace. Aborting.\n"); return -1; } @@ -258,7 +245,7 @@ char *GIFFileName; /* write out the image */ /****** Ask Elena about VOIDP ******/ - if ((status = H5Dwrite(sub_image_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)(gifImageDesc->Image))) < 0) { + if (H5Dwrite(sub_image_id , H5T_NATIVE_UINT8 , H5S_ALL , H5S_ALL , H5P_DEFAULT , (void *)(gifImageDesc->Image)) < 0) { fprintf(stderr , "Error writing image. Aborting... \n"); return -1; } @@ -332,19 +319,19 @@ char *GIFFileName; /* create the attribute */ attr_attr_id = H5Acreate(sub_image_id , "PALETTE" , H5T_STD_REF_OBJ , attr_dataspace_id , H5P_DEFAULT); - if ((status = H5Awrite(attr_attr_id , H5T_STD_REF_OBJ , &pal_ref)) < 0) { + if (H5Awrite(attr_attr_id , H5T_STD_REF_OBJ , &pal_ref) < 0) { fprintf(stderr , "Unable to write attribute. Aborting \n"); return -1; } /* close the attribute */ - if ((status = H5Aclose(attr_attr_id)) < 0) { + if (H5Aclose(attr_attr_id) < 0) { fprintf(stderr , "Unable to close CLASS IMAGE attribute. Aborting.\n"); return -1; } /* close the dataspace */ - if ((status = H5Sclose(attr_dataspace_id)) < 0) { + if (H5Sclose(attr_dataspace_id) < 0) { fprintf(stderr , "Unable to close attribute dataspace. Aborting \n"); return -1; } @@ -364,31 +351,31 @@ char *GIFFileName; /* create the attribute */ attr_attr_id = H5Acreate(sub_image_id , "IMAGE_MINMAXRANGE" , H5T_NATIVE_UINT8 , attr_dataspace_id , H5P_DEFAULT); - if ((status = H5Awrite(attr_attr_id , H5T_NATIVE_UINT8 , minmax)) < 0) { + if (H5Awrite(attr_attr_id , H5T_NATIVE_UINT8 , minmax) < 0) { fprintf(stderr , "Unable to write attribute. Aborting \n"); return -1; } /* close the attribute */ - if ((status = H5Aclose(attr_attr_id)) < 0) { + if (H5Aclose(attr_attr_id) < 0) { fprintf(stderr , "Unable to close CLASS IMAGE attribute. Aborting.\n"); return -1; } /* close the dataspace */ - if ((status = H5Sclose(attr_dataspace_id)) < 0) { + if (H5Sclose(attr_dataspace_id) < 0) { fprintf(stderr , "Unable to close attribute dataspace. Aborting \n"); return -1; } /* close everything */ - if ((status = H5Dclose(sub_image_id)) < 0) { + if (H5Dclose(sub_image_id) < 0) { fprintf(stderr , "Unable to close image dataset. Aborting \n"); return -1; } - if ((status = H5Sclose(dataspace_id)) < 0) { + if (H5Sclose(dataspace_id) < 0) { fprintf(stderr , "Unable to close image dataspace. Aborting \n"); return -1; } @@ -396,13 +383,13 @@ char *GIFFileName; } /* close the main image group */ - if ((status = H5Gclose(image_id)) < 0) { + if (H5Gclose(image_id) < 0) { fprintf(stderr , "Could not close the image group. Aborting...\n"); return -1; } /* close the H5 file */ - if ((status = H5Fclose(file_id)) < 0) { + if (H5Fclose(file_id) < 0) { fprintf(stderr , "Could not close HDF5 file. Aborting...\n"); return -1; } diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index fdf9169..1fa7bc9 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -24,7 +24,7 @@ static const char *progname = "h5dump"; static int d_status = EXIT_SUCCESS; static int unamedtype = 0; /* shared data type with no name */ -static int prefix_len = 1024; +static size_t prefix_len = 1024; static table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL; static char *prefix; static const char *driver = NULL; /* The driver to open the file with. */ @@ -1407,7 +1407,7 @@ dump_all(hid_t group, const char *name, void * op_data) d_status = EXIT_FAILURE; ret = FAIL; } else { - int new_len = strlen(prefix) + strlen(name) + 2; + size_t new_len = strlen(prefix) + strlen(name) + 2; if (prefix_len <= new_len) { prefix_len = new_len + 1; @@ -2277,7 +2277,7 @@ handle_groups(hid_t fid, char *group, void * UNUSED data) dump_header_format->groupblockend); d_status = EXIT_FAILURE; } else { - int new_len = strlen(group) + 1; + size_t new_len = strlen(group) + 1; if (prefix_len <= new_len) { prefix_len = new_len; @@ -3526,7 +3526,7 @@ xml_print_datatype(hid_t type) } printf("\" Size=\""); sz = H5Tget_size(type); - printf("%d", sz); + printf("%u", (unsigned)sz); printf("\" />\n"); indent -= COL; indentation(indent); @@ -3557,12 +3557,12 @@ xml_print_datatype(hid_t type) } printf("\" Size=\""); sz = H5Tget_size(type); - printf("%d", sz); + printf("%u", (unsigned)sz); H5Tget_fields(type, &spos, &epos, &esize, &mpos, &msize); - printf("\" SignBitLocation=\"%d\" ", spos); - printf("ExponentBits=\"%d\" ExponentLocation=\"%d\" ", esize, epos); - printf("MantissaBits=\"%d\" MantissaLocation=\"%d\" />\n", - msize, mpos); + printf("\" SignBitLocation=\"%u\" ", (unsigned)spos); + printf("ExponentBits=\"%u\" ExponentLocation=\"%u\" ", (unsigned)esize, (unsigned)epos); + printf("MantissaBits=\"%u\" MantissaLocation=\"%u\" />\n", + (unsigned)msize, (unsigned)mpos); indent -= COL; indentation(indent); printf("\n"); @@ -3631,7 +3631,7 @@ xml_print_datatype(hid_t type) printf("ERROR_UNKNOWN"); } size = H5Tget_size(type); - printf("\" Size=\"%d\"/>\n", size); + printf("\" Size=\"%u\"/>\n", (unsigned)size); indent -= COL; indentation(indent); printf("\n"); @@ -3646,7 +3646,7 @@ xml_print_datatype(hid_t type) indentation(indent); printf("\n", size); + printf("Size=\"%u\"/>\n", (unsigned)size); indent -= COL; indentation(indent); printf("\n"); diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index e7de960..c92fcfd 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -352,10 +352,9 @@ init_table(table_t **tbl) *------------------------------------------------------------------------- */ void -init_prefix(char **prefix, int prefix_len) +init_prefix(char **prefix, size_t prefix_len) { - assert(prefix_len > 0); - *prefix = HDcalloc((size_t)prefix_len, 1); + *prefix = HDcalloc(prefix_len, 1); } diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index e66fa65..d25ed5e 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -95,7 +95,7 @@ typedef struct table_t { /*this struct stores the information that is passed to the find_objs function*/ typedef struct find_objs_t { - int prefix_len; + size_t prefix_len; char *prefix; unsigned int threshold; /* should be 0 or 1 */ table_t *group_table; @@ -120,6 +120,6 @@ extern char *get_objectname(table_t*, int); extern herr_t find_objs(hid_t group, const char *name, void *op_data); extern int search_obj(table_t *temp, unsigned long *); extern void init_table(table_t **tbl); -extern void init_prefix(char **temp, int); +extern void init_prefix(char **temp, size_t ); #endif /* H5TOOLS_UTILS_H__ */ -- cgit v0.12