diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gifconv/hdf2gif.c | 23 | ||||
-rw-r--r-- | tools/gifconv/hdfgifwr.c | 22 | ||||
-rw-r--r-- | tools/gifconv/readhdf.c | 11 | ||||
-rw-r--r-- | tools/gifconv/writehdf.c | 54 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 30 | ||||
-rw-r--r-- | tools/h5dump/h5dumptst.c | 108 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 2 |
7 files changed, 184 insertions, 66 deletions
diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c index 2d6b339..9b5eebc 100644 --- a/tools/gifconv/hdf2gif.c +++ b/tools/gifconv/hdf2gif.c @@ -77,13 +77,16 @@ int main(int argc , char **argv) BYTE Blue[256]; int RWidth, RHeight; +#ifdef UNUSED int LeftOfs, TopOfs; + int CountDown; + int curx , cury; + int w,h; +#endif /* UNUSED */ int ColorMapSize, InitCodeSize, Background, BitsPerPixel; int j,nc; - int w,h,i; + int i; int numcols = 256; - int CountDown; - int curx , cury; int time_out = 0; /* time between two images in the animation */ int n_images , idx; @@ -175,8 +178,8 @@ int main(int argc , char **argv) has_local_palette = true; /* Do Endian Order testing and set Endian Order */ - w = 0x0001; - b = (BYTE *) &w; + idx = 0x0001; + b = (BYTE *) &idx; EndianOrder = (b[0] ? 1:0); if (!(fpGif = fopen(GIFName , "wb"))) { @@ -205,12 +208,14 @@ int main(int argc , char **argv) return -1; } + RWidth = dim_sizes[1]; + RHeight = dim_sizes[0]; +#ifdef UNUSED w = dim_sizes[1]; h = dim_sizes[0]; - RWidth = dim_sizes[1]; - RHeight = dim_sizes[0]; LeftOfs = TopOfs = 0; +#endif /* UNUSED */ /* @@ -271,14 +276,18 @@ int main(int argc , char **argv) BitsPerPixel = i; ColorMapSize = 1 << BitsPerPixel; +#ifdef UNUSED CountDown = w * h; /* # of pixels we'll be doing */ +#endif /* UNUSED */ if (BitsPerPixel <= 1) InitCodeSize = 2; else InitCodeSize = BitsPerPixel; +#ifdef UNUSED curx = cury = 0; +#endif /* UNUSED */ if (!fpGif) { fprintf(stderr, "WriteGIF: file not open for writing\n" ); diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c index e5f79e2..b13b79a 100644 --- a/tools/gifconv/hdfgifwr.c +++ b/tools/gifconv/hdfgifwr.c @@ -62,10 +62,12 @@ 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*/ +#ifdef UNUSED static int Width, Height; static int curx, cury; static long CountDown; static int Interlace; +#endif /* UNUSED */ #ifdef __STDC__ static void compress(int, FILE *, byte *, int); @@ -80,43 +82,57 @@ static void compress(), output(), cl_block(), cl_hash(); static void char_init(), char_out(), flush_char(); #endif /* __STDC__ */ -static byte pc2nc[256],r1[256],g1[256],b1[256]; +static byte pc2nc[256]; +#ifdef UNUSED +static byte r1[256],g1[256],b1[256]; +#endif /* UNUSED */ /*************************************************************/ 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) { +#ifdef UNUSED int RWidth, RHeight; int LeftOfs, TopOfs; - int ColorMapSize, InitCodeSize, Background; + int ColorMapSize, Background; +#endif /* UNUSED */ + int InitCodeSize; int i; byte *pic8 = pic; +#ifdef UNUSED Interlace = 0; Background = 0; +#endif /* UNUSED */ for (i = 0; i < 256; i++) { pc2nc[i] = pc2ncmap[i]; +#ifdef UNUSED r1[i] = rmap[i]; g1[i] = gmap[i]; b1[i] = bmap[i]; +#endif /* UNUSED */ } +#ifdef UNUSED ColorMapSize = 1 << BitsPerPixel; - RWidth = Width = w; + RWidth = Width = w; RHeight = Height = h; LeftOfs = TopOfs = 0; CountDown = w * h; /* # of pixels we'll be doing */ +#endif /* UNUSED */ if (BitsPerPixel <= 1) InitCodeSize = 2; else InitCodeSize = BitsPerPixel; +#ifdef UNUSED curx = cury = 0; +#endif /* UNUSED */ if (!fp) { fprintf(stderr, "WriteGIF: file not open for writing\n" ); diff --git a/tools/gifconv/readhdf.c b/tools/gifconv/readhdf.c index 912c2c6..08258de 100644 --- a/tools/gifconv/readhdf.c +++ b/tools/gifconv/readhdf.c @@ -34,7 +34,6 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, CHAR *h5_file, CHAR *dset_name, 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 */ hid_t pal_set; /* dataset for palette */ @@ -88,7 +87,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, } /* 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; @@ -139,7 +138,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, } /* 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); @@ -166,8 +165,8 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, } /* 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 4d69d01..3a6831a 100644 --- a/tools/gifconv/writehdf.c +++ b/tools/gifconv/writehdf.c @@ -19,7 +19,6 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name, 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; /* check strings */ @@ -41,15 +40,15 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name, 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; } @@ -63,10 +62,12 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) GIFHEAD gifHead; /* GIF Header structure */ GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */ - long ImageCount, /* number of images */ - CommentCount, /* number of comments */ + long ImageCount; /* number of images */ +#ifdef UNUSED + long CommentCount, /* number of comments */ ApplicationCount, /* number of application extensions */ PlainTextCount; /* number of plain text extensions */ +#endif /* UNUSED */ char ImageName[256]; /* Image name for the GR Image */ char GroupName[VSNAMELENMAX]; /* so that we can name the subgroups appropriately */ @@ -75,7 +76,6 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) 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 */ @@ -85,10 +85,12 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) gifHead = *(GifMemoryStruct.GifHeader); /* get some data from gifHead */ - ImageCount = (WORD)gifHead.ImageCount; + ImageCount = gifHead.ImageCount; +#ifdef UNUSED CommentCount = (WORD)gifHead.CommentCount; ApplicationCount = (WORD)gifHead.ApplicationCount; PlainTextCount = (WORD)gifHead.PlainTextCount; +#endif /* UNUSED */ /* get the main group name from GIFFileName */ GroupName[0]= '/'; @@ -138,7 +140,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , 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; } @@ -176,36 +178,36 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , 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; } @@ -251,7 +253,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , 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; } @@ -325,19 +327,19 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , 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; } @@ -356,43 +358,43 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , 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; } } /* 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 51a0608..dfc1a09 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -3237,9 +3237,9 @@ static const char *apos = "'"; static char * xml_escape_the_name(const char *str) { - int extra; - int len; - int i; + size_t extra; + size_t len; + size_t i; const char *cp; char *ncp; char *rcp; @@ -3323,9 +3323,9 @@ xml_escape_the_name(const char *str) static char * xml_escape_the_string(const char *str, int slen) { - int extra; - int len; - int i; + size_t extra; + size_t len; + size_t i; const char *cp; char *ncp; char *rcp; @@ -3360,7 +3360,7 @@ xml_escape_the_string(const char *str, int slen) } cp = str; - rcp = ncp = calloc((size_t)(len + extra + 1), sizeof(char)); + rcp = ncp = calloc((len + extra + 1), sizeof(char)); if (ncp == NULL) return NULL; /* ?? */ @@ -3472,7 +3472,7 @@ xml_print_datatype(hid_t type) } printf("\" Size=\""); sz = H5Tget_size(type); - printf("%d", sz); + printf("%lu", (unsigned long)sz); printf("\" />\n"); indent -= COL; indentation(indent); @@ -3503,12 +3503,12 @@ xml_print_datatype(hid_t type) } printf("\" Size=\""); sz = H5Tget_size(type); - printf("%d", sz); + printf("%lu", (unsigned long)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=\"%lu\" ", (unsigned long)spos); + printf("ExponentBits=\"%lu\" ExponentLocation=\"%lu\" ", (unsigned long)esize, (unsigned long)epos); + printf("MantissaBits=\"%lu\" MantissaLocation=\"%lu\" />\n", + (unsigned long)msize, (unsigned long)mpos); indent -= COL; indentation(indent); printf("</AtomicType>\n"); @@ -3577,7 +3577,7 @@ xml_print_datatype(hid_t type) printf("ERROR_UNKNOWN"); } size = H5Tget_size(type); - printf("\" Size=\"%d\"/>\n", size); + printf("\" Size=\"%lu\"/>\n", (unsigned long)size); indent -= COL; indentation(indent); printf("</AtomicType>\n"); @@ -3592,7 +3592,7 @@ xml_print_datatype(hid_t type) indentation(indent); printf("<OpaqueType Tag=\"%s\" ", H5Tget_tag(type)); size = H5Tget_size(type); - printf("Size=\"%d\"/>\n", size); + printf("Size=\"%lu\"/>\n", (unsigned long)size); indent -= COL; indentation(indent); printf("</AtomicType>\n"); diff --git a/tools/h5dump/h5dumptst.c b/tools/h5dump/h5dumptst.c index b4ab79e..24f5f21 100644 --- a/tools/h5dump/h5dumptst.c +++ b/tools/h5dump/h5dumptst.c @@ -1856,7 +1856,6 @@ static void test_vldatatypes(void) int i; herr_t ret=0; - ret = ret; /* so that compiler won't complain "is set but never used" */ file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* Allocate and initialize VL dataset to write */ @@ -1875,11 +1874,16 @@ static void test_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_INT); dset = H5Dcreate(file, "Dataset1.0", type, space, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + assert(ret>=0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata); + assert(ret>=0); ret = H5Dclose(dset); + assert(ret>=0); ret = H5Tclose(type); + assert(ret>=0); ret = H5Sclose(space); + assert(ret>=0); /* Allocate and initialize VL dataset to write */ for(i = 0; i < SPACE1_DIM1; i++) { @@ -1897,11 +1901,16 @@ static void test_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_FLOAT); dset = H5Dcreate(file, "Dataset2.0", type, space, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + assert(ret>=0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, wdata); + assert(ret>=0); ret = H5Dclose(dset); + assert(ret>=0); ret = H5Tclose(type); + assert(ret>=0); ret = H5Sclose(space); + assert(ret>=0); /* Allocate and initialize a scalar VL dataset to write */ adata.p = malloc(37 * sizeof(int)); @@ -1915,12 +1924,18 @@ static void test_vldatatypes(void) type = H5Tvlen_create(H5T_NATIVE_INT); dset = H5Dcreate(file, "Dataset3.0", type, space, H5P_DEFAULT); ret = H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, &adata); + assert(ret>=0); ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &adata); + assert(ret>=0); ret = H5Dclose(dset); + assert(ret>=0); ret = H5Tclose(type); + assert(ret>=0); ret = H5Sclose(space); + assert(ret>=0); ret = H5Fclose(file); + assert(ret>=0); } static void test_vldatatypes2(void) @@ -1935,8 +1950,6 @@ static void test_vldatatypes2(void) uintn i,j,k; /* counting variables */ herr_t ret; /* Generic return value */ - ret = ret; /* so that compiler won't complain "is set but never used" */ - /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=malloc((i+1)*sizeof(hvl_t)); @@ -1974,16 +1987,23 @@ static void test_vldatatypes2(void) /* Write dataset to disk */ ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Reclaim the write VL data */ ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid2); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } @@ -2003,8 +2023,6 @@ static void test_vldatatypes3(void) uintn i,j; /* counting variables */ herr_t ret; /* Generic return value */ - ret = ret; /* so that compiler won't complain "is set but never used" */ - /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { wdata[i].i=i*10; @@ -2029,24 +2047,34 @@ static void test_vldatatypes3(void) /* Insert fields */ ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); + assert(ret>=0); ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); + assert(ret>=0); ret=H5Tinsert(tid2, "v", HOFFSET(s1, v), tid1); + assert(ret>=0); /* Create a dataset */ dataset=H5Dcreate(fid1,"Dataset1",tid2,sid1,H5P_DEFAULT); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Reclaim the write VL data */ ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid2); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } static void test_vldatatypes4(void) @@ -2064,8 +2092,6 @@ static void test_vldatatypes4(void) uintn i,j; /* counting variables */ herr_t ret; /* Generic return value */ - ret = ret; /* so that compiler won't complain "is set but never used" */ - /* Allocate and initialize VL data to write */ for(i=0; i<SPACE1_DIM1; i++) { wdata[i].p=malloc((i+1)*sizeof(s1)); @@ -2087,7 +2113,9 @@ static void test_vldatatypes4(void) /* Insert fields */ ret=H5Tinsert(tid2, "i", HOFFSET(s1, i), H5T_NATIVE_INT); + assert(ret>=0); ret=H5Tinsert(tid2, "f", HOFFSET(s1, f), H5T_NATIVE_FLOAT); + assert(ret>=0); /* Create a datatype to refer to */ tid1 = H5Tvlen_create (tid2); @@ -2097,16 +2125,23 @@ static void test_vldatatypes4(void) /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Reclaim the write VL data */ ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Tclose(tid2); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } static void test_array1(void) @@ -2140,12 +2175,17 @@ static void test_array1(void) /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } static void test_array2(void) @@ -2181,12 +2221,17 @@ static void test_array2(void) /* Write dataset to disk */ ret=H5Dwrite(dataset,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid); + assert(ret>=0); ret = H5Sclose(sid); + assert(ret>=0); ret = H5Fclose(fid); + assert(ret>=0); } static void test_array3(void) @@ -2227,13 +2272,19 @@ static void test_array3(void) /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Tclose(tid2); + assert(ret>=0); ret = H5Sclose(sid); + assert(ret>=0); ret = H5Fclose(fid); + assert(ret>=0); } static void test_array4(void) @@ -2271,27 +2322,35 @@ static void test_array4(void) /* Insert integer field */ ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT); + assert(ret>=0); /* Insert float field */ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), H5T_NATIVE_FLOAT); + assert(ret>=0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); /* Close compound datatype */ ret=H5Tclose(tid2); + assert(ret>=0); /* Create a dataset */ dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } static void test_array5(void) @@ -2331,33 +2390,42 @@ static void test_array5(void) /* Insert integer field */ ret = H5Tinsert (tid2, "i", HOFFSET(s2_t,i), H5T_NATIVE_INT); + assert(ret>=0); /* Create an array of floats datatype */ tid3 = H5Tarray_create (H5T_NATIVE_FLOAT,ARRAY1_RANK,tdims1,NULL); /* Insert float array field */ ret = H5Tinsert (tid2, "f", HOFFSET(s2_t,f), tid3); + assert(ret>=0); /* Close array of floats field datatype */ ret=H5Tclose(tid3); + assert(ret>=0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); /* Close compound datatype */ ret=H5Tclose(tid2); + assert(ret>=0); /* Create a dataset */ dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } static void test_array6(void) @@ -2396,21 +2464,28 @@ static void test_array6(void) /* Close VL datatype */ ret=H5Tclose(tid2); + assert(ret>=0); /* Create a dataset */ dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Reclaim the write VL data */ ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } static void test_array7(void) @@ -2451,27 +2526,35 @@ static void test_array7(void) /* Close nested array datatype */ ret=H5Tclose(tid3); + assert(ret>=0); /* Create an array datatype to refer to */ tid1 = H5Tarray_create (tid2,ARRAY1_RANK,tdims1,NULL); /* Close VL datatype */ ret=H5Tclose(tid2); + assert(ret>=0); /* Create a dataset */ dataset=H5Dcreate(fid1,"Dataset1",tid1,sid1,H5P_DEFAULT); /* Write dataset to disk */ ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); + assert(ret>=0); /* Reclaim the write VL data */ ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata); + assert(ret>=0); /* Close Dataset */ ret = H5Dclose(dataset); + assert(ret>=0); ret = H5Tclose(tid1); + assert(ret>=0); ret = H5Sclose(sid1); + assert(ret>=0); ret = H5Fclose(fid1); + assert(ret>=0); } static void test_empty(void) @@ -2485,7 +2568,6 @@ static void test_empty(void) hsize_t dims[] = { SPACE1_DIM1 }; herr_t ret=0; - ret = ret; /* so that compiler won't complain "is set but never used" */ file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); space = H5Screate_simple(SPACE1_RANK, dims, NULL); @@ -2495,24 +2577,30 @@ static void test_empty(void) dset = H5Dcreate(file, "Dataset1.0", type, space, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); + assert(ret>=0); ret = H5Tclose(type); + assert(ret>=0); /* write out an empty native integer dataset dataset */ dset = H5Dcreate(file, "Dataset2.0", H5T_NATIVE_INT, space, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); + assert(ret>=0); /* write out an empty native floating-point dataset dataset */ dset = H5Dcreate(file, "Dataset3.0", H5T_NATIVE_FLOAT, space, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); + assert(ret>=0); /* write out an empty array dataset */ type = H5Tarray_create(H5T_NATIVE_INT,SPACE1_RANK,dims,NULL); dset = H5Dcreate(file, "Dataset4.0", type, space, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); + assert(ret>=0); ret = H5Tclose(type); + assert(ret>=0); /* write out an empty compound dataset */ type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct)); @@ -2522,11 +2610,15 @@ static void test_empty(void) dset = H5Dcreate(file, "Dataset5.0", type, space, H5P_DEFAULT); /* Don't write any data */ ret = H5Dclose(dset); + assert(ret>=0); ret = H5Tclose(type); + assert(ret>=0); ret = H5Sclose(space); + assert(ret>=0); ret = H5Fclose(file); + assert(ret>=0); } int main(void) diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index a34c5b3..c48236a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -180,7 +180,7 @@ h5tools_fopen(const char *fname, const char *driver, char *drivername, SPLIT_IDX, MULTI_IDX, #ifdef H5_HAVE_STREAM - STREAM_IDX, + STREAM_IDX #endif /* H5_HAVE_STREAM */ }; #define NUM_DRIVERS (sizeof(drivers_list) / sizeof(struct d_list)) |