diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
commit | 6b45f5172ccb4311e0be9ae15da3758abb6b0e67 (patch) | |
tree | 5a7a112fe7a8a98c6fecb45b513789d15962eb3d /tools | |
parent | 6562465a2c2a58cfbc2f47bf60bb538f7a783933 (diff) | |
download | hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.zip hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.gz hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.bz2 |
[svn-r11245] Purpose:
Code cleanup
Description:
Trim trailing whitespace, which is making 'diff'ing the two branches
difficult.
Solution:
Ran this script in each directory:
foreach f (*.[ch] *.cpp)
sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f
end
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'tools')
66 files changed, 3018 insertions, 3018 deletions
diff --git a/tools/gifconv/decompress.c b/tools/gifconv/decompress.c index 410778f..2ebf28d 100644 --- a/tools/gifconv/decompress.c +++ b/tools/gifconv/decompress.c @@ -81,7 +81,7 @@ int numused; * our location in the Raster array as a BIT Offset. We compute the BYTE * Offset WORDo the raster array by dividing this by 8, pick up 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. + * code to the bottom, then mask it off and return it. */ static int ReadCode(void) @@ -166,39 +166,39 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) { int i; - XC = 0; + XC = 0; YC = 0; Pass = 0; OutCount = 0; BitOffset = 0; - + DataMask = (1 << ((GifHead->PackedField & 0x07) +1)) -1; Raster = GifImageDesc->GIFImage; /* Check for image seperator */ - + /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; Interlace = GifImageDesc->PackedField & 0x40; - + /* * Note that I ignore the possible existence of a local color map. I'm * told there aren't many files around that use them, and the spec says * it's defined for future use. This could lead to an error reading some - * files. + * files. */ - + /* * Start reading the raster data. First we get the WORDial code size and * compute decompressor constant values, based on this code size. */ - + CodeSize = GifImageDesc->CodeSize; ClearCode = (1 << CodeSize); EOFCode = ClearCode + 1; FreeCode = FirstFree = ClearCode + 2; - + /* * The GIF spec has it that the code size is the code size used to compute * the above values is the code size given in the file, but the code size @@ -218,19 +218,19 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) */ /* Allocate the Image */ - + if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) { printf("Out of memory"); exit(-1); } - + BytesPerScanline = IWidth; - + /* * Decompress the file, continuing until you see the GIF EOF code. One * obvious enhancement is to add checking for corrupt files here. */ - + Code = ReadCode(); while (Code != EOFCode) { @@ -269,7 +269,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) */ while (CurCode > DataMask) { if (OutCount > 1024) { - /*return error message*/ + /*return error message*/ } OutCode[OutCount++] = Suffix[CurCode]; @@ -316,5 +316,5 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) Code = ReadCode(); } - return Image; + return Image; } diff --git a/tools/gifconv/gif.h b/tools/gifconv/gif.h index 282085f..ad60968 100644 --- a/tools/gifconv/gif.h +++ b/tools/gifconv/gif.h @@ -47,8 +47,8 @@ typedef unsigned char boolean; ** Set EndianOrder = 0 if machine is little endian ** EndianOrder = 1 if machine is big endian. */ -extern int EndianOrder; - +extern int EndianOrder; + /* ** The GIF header format. ** @@ -63,9 +63,9 @@ typedef struct _GifHeader { /* Offset Description */ BYTE ApplicationCount; BYTE PlainTextCount; BYTE HDFPalette[256][3]; - BYTE HeaderDump[6]; /* BYTE array to dump header contents */ + BYTE HeaderDump[6]; /* BYTE array to dump header contents */ BYTE LSDDump[7]; /* Logical Screen Descriptor dump */ -} GIFHEAD; +} GIFHEAD; /* @@ -122,9 +122,9 @@ typedef struct _GifCommentExtension { /* ** GIF to HDF Memory Struct -** Purpose : The gif to hdf structure is used to pass all the +** Purpose : The gif to hdf structure is used to pass all the ** gif data to the memory, which gets caught by the hdf driver -** Its the drivers job to put the data in the appropriate places +** Its the drivers job to put the data in the appropriate places ** in the HDF file. ** I have assumed that the ImageDescriptors and GraphicControls follow ** one another, ie. I have not associated them with each other. The driver diff --git a/tools/gifconv/gif2mem.c b/tools/gifconv/gif2mem.c index 01aa5a2..0695995 100644 --- a/tools/gifconv/gif2mem.c +++ b/tools/gifconv/gif2mem.c @@ -100,7 +100,7 @@ Gif2Mem(BYTE *MemGif) /* Read the GIF image file header information */ ReadGifHeader(gifHead, &MemGif); - + /* Check for FILE stream error */ #if 0 if (ferror(fpGif)) @@ -121,7 +121,7 @@ Gif2Mem(BYTE *MemGif) for (;;) { Identifier = *MemGif++; - + switch (Identifier) { case 0x3B: /* Trailer */ /* @@ -140,16 +140,16 @@ Gif2Mem(BYTE *MemGif) GifMemoryStruct.GifApplicationExtension = gifApplication; GifMemoryStruct.GifCommentExtension = gifComment; GifMemoryStruct.GifGraphicControlExtension = gifGraphicControl; - + /* return the struct */ return GifMemoryStruct; case 0x2C: /* Image Descriptor */ /* * If there was no image descriptor before this increase image - * count. If an imagedescriptor was present, reset GCEflag + * count. If an imagedescriptor was present, reset GCEflag */ - if (GCEflag == 0) + if (GCEflag == 0) ImageCount++; else GCEflag = 0; @@ -180,17 +180,17 @@ Gif2Mem(BYTE *MemGif) printf("Out of memory!"); exit(-1); } - + if (ReadGifImageDesc(gifImageDesc[ImageCount-1], &MemGif) == -1) fputs("Error reading Image Descriptor information\n", stderr); - + /* Decompress the Image */ gifImageDesc[ImageCount-1]->Image = Decompress(gifImageDesc[ImageCount-1], gifHead); free(gifImageDesc[ImageCount-1]->GIFImage); - /* + /* * Convert the local palette into an HDF compatible palette In * case the local color table is present, it is written out as * the HDFPalette If it is absent the global table is written @@ -213,8 +213,8 @@ Gif2Mem(BYTE *MemGif) } break; - - case 0x21: /* Extension Block */ + + case 0x21: /* Extension Block */ Label = *MemGif++; switch (Label) { @@ -240,7 +240,7 @@ Gif2Mem(BYTE *MemGif) "Error reading Plain Text Extension information.\n"); break; - + case 0xFE: /* Comment Extension */ CommentCount++; @@ -251,19 +251,19 @@ Gif2Mem(BYTE *MemGif) printf("Out of memory!"); exit(-1); } - + if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) { printf("Out of memory!"); exit(-1); } - + if (ReadGifComment(gifComment[CommentCount - 1], &MemGif)) fprintf(stderr, "Error reading Comment Extension information\n"); break; - + case 0xF9: /* Graphic Control Extension */ if (GCEflag == 0 ) ImageCount++; @@ -289,17 +289,17 @@ Gif2Mem(BYTE *MemGif) gifImageDesc[j] = NULL; } } - + if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL)))) { printf("Out of memory!"); exit(-1); } - - + + if (ReadGifGraphicControl(gifGraphicControl[ImageCount-1], &MemGif)) fprintf(stderr, "Error reading Graphic Control Extension information\n"); - + if (!*MemGif++ == 0) fprintf(stderr, "Error reading Graphic Control Extension\n"); @@ -311,18 +311,18 @@ Gif2Mem(BYTE *MemGif) if (ApplicationCount > ApplicationArray) ApplicationArray = (ApplicationArray << 1) + 1; - + if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) { printf("Out of memory!"); exit(-1); } - + if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) { printf("Out of memory!"); exit(-1); } - + if (ReadGifApplication(gifApplication[ApplicationCount - 1], &MemGif)) fprintf(stderr, "Error reading Application Extension information\n"); diff --git a/tools/gifconv/gifread.c b/tools/gifconv/gifread.c index b135617..5f4aba0 100644 --- a/tools/gifconv/gifread.c +++ b/tools/gifconv/gifread.c @@ -11,16 +11,16 @@ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <stdio.h> -#include <stdlib.h> +#include <stdio.h> +#include <stdlib.h> -#include "gif.h" +#include "gif.h" int EndianOrder; static BYTE *ReadDataSubBlocks(BYTE **MemGif2, WORD *DSize); -WORD +WORD GetWord(BYTE *MemGif) { WORD w; @@ -39,7 +39,7 @@ GetWord(BYTE *MemGif) BYTE GetByte(BYTE *MemGif) -{ +{ return *MemGif; } @@ -69,7 +69,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ printf("The file does not appear to be a valid GIF file.\n"); exit(-1); } - + for (i = 0 ; i < 7 ; i++) { GifHead->LSDDump[i] = *(*MemGif2)++; } @@ -84,7 +84,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ /* Read the Global Color Table */ - /* + /* * There are some changes made here apart from just reading in the * global color table as would seem intuitively obvious. The colors * are stored in the bottom part of the palette as opposed to the top @@ -100,7 +100,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ /* Check for a FILE stream error */ #if 0 if (ferror(FpGif)) - return -1; + return -1; #endif /* 0 */ return 0; /* No FILE stream error occured */ @@ -136,11 +136,11 @@ ReadGifImageDesc( for (i = 0 ; i < 9 ; i++) { GifImageDesc->GIDDump[i] = *(*MemGif2)++; } - + /* ** Get the relevant fields. I need ImageWidth and Height actively hence I have ** taken information from those fields. I intend to keep the GifImageDesc data - ** structure as it is so that anyone needing the rest of the fields can do so + ** structure as it is so that anyone needing the rest of the fields can do so ** quickly. */ @@ -160,10 +160,10 @@ ReadGifImageDesc( GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF); GifImageDesc->ImageHeight = ((WORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); - + } - + GifImageDesc->PackedField = GifImageDesc->GIDDump[8]; /* Interlace = GifImageDesc->PackedField & 0x20; */ @@ -193,7 +193,7 @@ ReadGifImageDesc( printf("Out of memory"); exit(-1); } - + TempPtr = GifImageDesc->GIFImage; do @@ -258,7 +258,7 @@ ReadGifPlainText( if (!(GifPlainText->PlainTextData = ReadDataSubBlocks(MemGif2 , &(GifPlainText->DataSize)))) return(1); - /* + /* GifPlainText->Terminator = 0; */ @@ -299,7 +299,7 @@ ReadGifApplication( /* GifApplication->Terminator = 0; */ - + /* Check for a FILE stream error */ /* if (ferror(FpGif)) @@ -325,13 +325,13 @@ ReadGifComment( BYTE **MemGif2 /* GIF image file input FILE stream */ ) { - + /* Read in the Plain Text data sub-blocks */ if (!(GifComment->CommentData = ReadDataSubBlocks(MemGif2 , &(GifComment->DataSize)))) return(1); GifComment->Terminator = 0; - + return(0); /* No FILE stream error occured */ } @@ -357,9 +357,9 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream int tempcount = 0; bufSize = 0; /* The output buffer is empty */ - + dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */ - + /* Allocate initial data buffer */ if (!(ptr1 = ptr2 = (BYTE *) malloc((size_t)dataSize + 1))) { printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed"); @@ -376,23 +376,23 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream #endif /* COMMENTED_OUT */ while (dataSize--) /* Read/write the Plain Text data */ *ptr1++ = *(*MemGif2)++; - + /* Check if there is another data sub-block */ if ((dataSize = *(*MemGif2)++) == 0) break; /* Block Terminator encountered */ - + /* Increase the buffer size to accomodate the next sub-block */ if (!(ptr1 = ptr2 = (BYTE *) realloc(ptr2, bufSize + dataSize + 1))) return((BYTE *) NULL); - + ptr1 += bufSize; /* Move pointer to the end of the data */ - - + + } *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 51ec144..52e57f7 100644 --- a/tools/gifconv/hdf2gif.c +++ b/tools/gifconv/hdf2gif.c @@ -64,7 +64,7 @@ usage(void) FILE *fpGif = NULL; int main(int argc , char **argv) { - + hsize_t dim_sizes[2]; BYTE *Image; @@ -180,7 +180,7 @@ int main(int argc , char **argv) return -1; } - + /* we shall always have a palette - read hdf will see to that */ has_local_palette = true; @@ -188,12 +188,12 @@ int main(int argc , char **argv) idx = 0x0001; b = (BYTE *) &idx; EndianOrder = (b[0] ? 1:0); - + if (!(fpGif = fopen(GIFName , "wb"))) { printf("Error opening gif file for output. Aborting.\n"); return -1; } - + /* hardwire n_images to 1 for now. */ n_images = number_of_images; @@ -249,7 +249,7 @@ int main(int argc , char **argv) Blue[i] = GlobalPalette[i][2]; } } - + for (i = 0; i < 256; i++) { pc2nc[i] = r1[i] = g1[i] = b1[i] = 0; } @@ -288,7 +288,7 @@ int main(int argc , char **argv) #ifdef UNUSED CountDown = w * h; /* # of pixels we'll be doing */ #endif /* UNUSED */ - + if (BitsPerPixel <= 1) InitCodeSize = 2; else @@ -305,7 +305,7 @@ int main(int argc , char **argv) /* * If it is the first image we do all the header stuff that isn't - * required for the rest of the images. + * required for the rest of the images. */ if (idx == 0) { /* Write out the GIF header and logical screen descriptor */ @@ -379,7 +379,7 @@ int main(int argc , char **argv) i = hdfWriteGIF(fpGif , Image , 0 , (int)dim_sizes[0] , (int)dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel); - fputc(0x00, fpGif); + fputc(0x00, fpGif); free(Image); } diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c index a18b81f..b1b5be5 100644 --- a/tools/gifconv/hdfgifwr.c +++ b/tools/gifconv/hdfgifwr.c @@ -13,13 +13,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * hdfgifwr.c - handles writing of GIF files. - * - * Contains: + * hdfgifwr.c - handles writing of GIF files. + * + * Contains: * hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols, colorstyle, * comment) * - * Note: slightly brain-damaged, in that it'll only write non-interlaced + * Note: slightly brain-damaged, in that it'll only write non-interlaced * GIF files (in the interests of speed, or something) */ @@ -44,7 +44,7 @@ * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) *****************************************************************/ - + #include <stdio.h> #include <stdlib.h> @@ -125,7 +125,7 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, Background = 0; #endif /* UNUSED */ - for (i = 0; i < 256; i++) { + for (i = 0; i < 256; i++) { pc2nc[i] = pc2ncmap[i]; #ifdef UNUSED r1[i] = rmap[i]; @@ -325,7 +325,7 @@ probe: continue; } - if ((long)HashTabOf (i) >= 0) + if ((long)HashTabOf (i) >= 0) goto probe; nomatch: @@ -380,7 +380,7 @@ output(int code) cur_accum |= ((long)code << cur_bits); else cur_accum = code; - + cur_bits += n_bits; while( cur_bits >= 8 ) { @@ -406,7 +406,7 @@ output(int code) maxcode = MAXCODE(n_bits); } } - + if (code == EOFCode) { /* At EOF, write the rest of the buffer */ while( cur_bits > 0 ) { diff --git a/tools/gifconv/readhdf.c b/tools/gifconv/readhdf.c index 2720d4d..3fc454c 100644 --- a/tools/gifconv/readhdf.c +++ b/tools/gifconv/readhdf.c @@ -30,17 +30,17 @@ cleanup(BYTE *ptr) ** BYTE palette[256][3] - the corresponding palette ** hsize_t* image_size - the size of each dimension of the image ** -** Future Notes: -** The way readHDF works right now is that it expects the user +** Future Notes: +** The way readHDF works right now is that it expects the user ** to know the exact path to the HDF image. Thus it does not ** parse the HDF file looking for image datasets and corresponding -** palettes. Also it takes in the default palette for the image +** palettes. Also it takes in the default palette for the image ** specified, if the palette is missing, it makes a default greyscale ** palette and throws it in. ** */ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, - CHAR *h5_file, CHAR *dset_name, CHAR *pal_name) + CHAR *h5_file, CHAR *dset_name, CHAR *pal_name) { hid_t fHfile; /* H5 file to open */ hid_t dspace; /* dataspace identifier for the the dataset */ @@ -130,7 +130,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, pal_exist = 0; return -1; } - + pal_dtype = H5Dget_type(pal_set); if (dtype < 0) { fprintf(stderr , "Unable to open palette datatype\n"); @@ -151,7 +151,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, pal_exist = 0; return -1; } - + /* get the dimension size of the palette. */ if (H5Sget_simple_extent_dims(pal_space , loc_pal_size , NULL) !=2 ) { fprintf(stderr , "Unable to get dimension info\n"); diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c index d343aae..8d7405e 100644 --- a/tools/gifconv/writehdf.c +++ b/tools/gifconv/writehdf.c @@ -49,11 +49,11 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name, attr_dataspace_id , H5P_DEFAULT); /* write out the attribute data */ - if (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 (H5Aclose(attr_attr_id) < 0) + if (H5Aclose(attr_attr_id) < 0) return -1; /* close the dataspace */ @@ -192,12 +192,12 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) return -1; } - /* write the reference out */ + /* write the reference out */ 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 (H5Dclose(ref_dataset_id) < 0) { fprintf(stderr , "Unable to close palette dataset.\n"); @@ -271,7 +271,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) /* This info is available at http://hdf.ncsa.uiuc.edu/HDF5/doc/ImageSpec.html */ /* The following attributes must be set for each image: ** --------------------------------------- - ** Attribute Name Value + ** Attribute Name Value ** CLASS IMAGE ** IMAGE_VERSION 1.0 ** IMAGE_SUBCLASS IMAGE_BITMAP @@ -324,7 +324,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) ** Attribute: PALETTE ** Value : Reference to Palette *****************************************/ - + /**** MAKE SURE PALETTE EXISTS!!! ****/ if (gifHead.PackedField & 0x80) { /* global palette exists */ diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 691fe8a..11fba7c 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -38,10 +38,10 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** *------------------------------------------------------------------------- */ - if ( argc==2 && (strcmp("-h",argv[1])==0) ) + if ( argc==2 && (strcmp("-h",argv[1])==0) ) usage(); - if ( argc<3 ) + if ( argc<3 ) { printf("Number of arguments is only %d\n", argc ); usage(); @@ -60,32 +60,32 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** * parse command line options *------------------------------------------------------------------------- */ - for (i=3; i<argc ; i++) + for (i=3; i<argc ; i++) { /* get the single-letter switches */ if ( '-'==argv[i][0] ) { - for (s=argv[i]+1; *s; s++) + for (s=argv[i]+1; *s; s++) { switch (*s) { default: printf("-%s is an invalid option\n", s ); usage(); break; - case 'h': + case 'h': usage(); break; - case 'v': + case 'v': options->m_verbose = 1; break; - case 'q': + case 'q': /* use quiet mode; supress the message "0 differences found" */ options->m_quiet = 1; break; - case 'r': + case 'r': options->m_report = 1; break; - case 'd': + case 'd': /* if it is not another option */ if ( i<argc-1 &&'-' != argv[i+1][0] ) { @@ -104,7 +104,7 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** usage(); } break; - case 'p': + case 'p': if ( i<argc-1 &&'-' !=argv[i+1][0] ) { options->p=1; @@ -122,7 +122,7 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** usage(); } break; - case 'n': + case 'n': if ( i<argc-1 && '-' !=argv[i+1][0] ) { options->n=1; @@ -141,7 +141,7 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** } break; } /*switch*/ - } /*for*/ + } /*for*/ } /*if*/ else /* not single-letter switches */ @@ -184,21 +184,21 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** { if (options->m_quiet || options->err_stat) return; - + if (options->cmn_objs==0) - { + { printf("No common objects found. Files are not comparable.\n"); if (!options->m_verbose) printf("Use -v for a list of objects.\n"); } - + if (options->not_cmp==1) { printf("Some objects are not comparable\n"); if (!options->m_verbose) printf("Use -v for a list of objects.\n"); } - + } /*------------------------------------------------------------------------- @@ -257,8 +257,8 @@ int check_f_input( const char *str ) { double x; - /* - the atof return value on a hexadecimal input is different + /* + the atof return value on a hexadecimal input is different on some systems; we do a character check for this */ if (strlen(str)>2 && str[0]=='0' && str[1]=='x') @@ -274,7 +274,7 @@ int check_f_input( const char *str ) /*------------------------------------------------------------------------- * Function: usage * - * Purpose: print a usage message + * Purpose: print a usage message * * Return: void * diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index 8dd2610..51c618e 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -22,7 +22,7 @@ * * Purpose: h5diff main program * - * Return: An exit status of 0 means no differences were found, 1 means some + * Return: An exit status of 0 means no differences were found, 1 means some * differences were found. * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu @@ -36,7 +36,7 @@ * Normal mode: print the number of differences found and where they occured * Report mode: print the above plus the differences * Verbose mode: print the above plus a list of objects and warnings - * Quiet mode: do not print output + * Quiet mode: do not print output * * November 2004: Leon Arber (larber@uiuc.edu) * Additions that allow h5diff to be run in parallel @@ -64,9 +64,9 @@ int main(int argc, const char *argv[]) nfound = h5diff(fname1,fname2,objname1,objname2,&options); print_results(nfound, &options); - + /*------------------------------------------------------------------------- - * exit code + * exit code * >0 if differences, 0 if no differences, <0 if error *------------------------------------------------------------------------- */ diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c index 3b6267d..94773c8 100644 --- a/tools/h5diff/ph5diff_main.c +++ b/tools/h5diff/ph5diff_main.c @@ -25,7 +25,7 @@ static void ph5diff_worker(int ); * * Purpose: h5diff/ph5diff main program * - * Return: An exit status of 0 means no differences were found, 1 means some + * Return: An exit status of 0 means no differences were found, 1 means some * differences were found. * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu @@ -39,12 +39,12 @@ static void ph5diff_worker(int ); * Normal mode: print the number of differences found and where they occured * Report mode: print the above plus the differences * Verbose mode: print the above plus a list of objects and warnings - * Quiet mode: do not print output + * Quiet mode: do not print output * * November 2004: Leon Arber (larber@uiuc.edu) * Additions that allow h5diff to be run in parallel * - * This function drives the diff process and will do a serial or parallel diff depending + * This function drives the diff process and will do a serial or parallel diff depending * on the value of the global variable g_Parallel (default is 0), set to 1 when the program * is run as "ph5diff" *------------------------------------------------------------------------- @@ -60,7 +60,7 @@ int main(int argc, const char *argv[]) const char *objname2 = NULL; hsize_t nfound=0; diff_opt_t options; - + outBuffOffset = 0; g_Parallel = 1; @@ -74,11 +74,11 @@ int main(int argc, const char *argv[]) printf("Only 1 task available...doing serial diff\n"); g_Parallel = 0; - + parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); - + nfound = h5diff(fname1,fname2,objname1,objname2,&options); - + print_results(nfound, &options); MPI_Finalize(); @@ -90,13 +90,13 @@ int main(int argc, const char *argv[]) if(nID == 0) { parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); - + nfound = h5diff(fname1,fname2,objname1,objname2,&options); - + MPI_Barrier(MPI_COMM_WORLD); print_results(nfound, &options); - print_manager_output(); + print_manager_output(); MPI_Finalize(); @@ -125,9 +125,9 @@ int main(int argc, const char *argv[]) */ static void ph5diff_worker(int nID) -{ +{ struct diff_args args; - hid_t file1_id, file2_id; + hid_t file1_id, file2_id; char filenames[2][1024]; char out_data[PRINT_DATA_MAX_SIZE] = {0}; hsize_t nfound=0; @@ -137,7 +137,7 @@ ph5diff_worker(int nID) MPI_Comm_rank(MPI_COMM_WORLD, &nID); outBuffOffset = 0; - + MPI_Recv(filenames, 1024*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); if(Status.MPI_TAG == MPI_TAG_PARALLEL) { @@ -180,19 +180,19 @@ ph5diff_worker(int nID) /*Wait for print token. */ MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status); - + /*When get token, send all of our output to the manager task and then return the token */ for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE) MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); - + /* An overflow file exists, so we send it's output to the manager too and then delete it */ if(overflow_file) { int tmp; memset(out_data, 0, PRINT_DATA_MAX_SIZE); i=0; - + rewind(overflow_file); while((tmp = getc(overflow_file)) >= 0) { @@ -211,7 +211,7 @@ ph5diff_worker(int nID) fclose(overflow_file); overflow_file = NULL; } - + fflush(stdout); memset(outBuff, 0, OUTBUFF_SIZE); outBuffOffset = 0; @@ -224,7 +224,7 @@ ph5diff_worker(int nID) else if(Status.MPI_TAG == MPI_TAG_END) { MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status); - /* printf("exiting..., task: %d\n", nID); + /* printf("exiting..., task: %d\n", nID); fflush(stdout);*/ break; } @@ -238,6 +238,6 @@ ph5diff_worker(int nID) } MPI_Barrier(MPI_COMM_WORLD); - MPI_Finalize(); + MPI_Finalize(); } diff --git a/tools/h5diff/testh5diff.h b/tools/h5diff/testh5diff.h index 13c02ea..c450e3e 100644 --- a/tools/h5diff/testh5diff.h +++ b/tools/h5diff/testh5diff.h @@ -15,16 +15,16 @@ #include <stdio.h> #include <stdlib.h> #include "hdf5.h" -#include "H5private.h" +#include "H5private.h" -int test_basic(const char *file1, +int test_basic(const char *file1, const char *file2); -int test_types(const char *file1, +int test_types(const char *file1, const char *file2); -int test_native(const char *file1, +int test_native(const char *file1, const char *file2); @@ -35,19 +35,19 @@ int test_attr(const char *file, int make_diffs /* flag to modify data buffers */); -int write_attr(hid_t loc_id, - int rank, - hsize_t *dims, +int write_attr(hid_t loc_id, + int rank, + hsize_t *dims, const char *attr_name, - hid_t type_id, + hid_t type_id, void *buf); -int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, +int write_dset( hid_t loc_id, + int rank, + hsize_t *dims, const char *dset_name, - hid_t type_id, + hid_t type_id, void *buf ); diff --git a/tools/h5diff/testh5diff_attr.c b/tools/h5diff/testh5diff_attr.c index fb6dc39..3a962de 100644 --- a/tools/h5diff/testh5diff_attr.c +++ b/tools/h5diff/testh5diff_attr.c @@ -19,7 +19,7 @@ /*------------------------------------------------------------------------- * Function: write_attr_in * - * Purpose: write attributes in LOC_ID (dataset, group, named datatype) + * Purpose: write attributes in LOC_ID (dataset, group, named datatype) * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -28,28 +28,28 @@ *------------------------------------------------------------------------- */ - -static void write_attr_in(hid_t loc_id, + +static void write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id, int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t + typedef struct s_t { char a; double b; } s_t; - typedef enum + typedef enum { RED, GREEN } e_t; hid_t attr_id; - hid_t space_id; - hid_t type_id; + hid_t space_id; + hid_t type_id; herr_t status; int val, i, j, k, n; float f; @@ -98,7 +98,7 @@ static void write_attr_in(hid_t loc_id, * 1D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -109,11 +109,11 @@ static void write_attr_in(hid_t loc_id, for (i=0; i<2; i++) for (j=0; j<2; j++) { - buf1[i][j]='z'; + buf1[i][j]='z'; } } - /* - buf1[2][2]= {"ab","de"}; + /* + buf1[2][2]= {"ab","de"}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <string> and <string> @@ -139,8 +139,8 @@ static void write_attr_in(hid_t loc_id, for (i=0; i<2; i++) buf2[i]=buf2[1]=0; } - /* - buf2[2]= {1,2}; + /* + buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <bitfield> and <bitfield> @@ -160,8 +160,8 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - /* - buf2[2]= {1,2}; + /* + buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <opaque> and <opaque> @@ -181,7 +181,7 @@ static void write_attr_in(hid_t loc_id, * H5T_COMPOUND *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -189,9 +189,9 @@ static void write_attr_in(hid_t loc_id, buf3[i].a=0; buf3[i].b=0; } } - - /* - buf3[2]= {{1,2},{3,4}}; + + /* + buf3[2]= {{1,2},{3,4}}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <compound> and <compound> @@ -208,7 +208,7 @@ static void write_attr_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -229,10 +229,10 @@ static void write_attr_in(hid_t loc_id, { for (i=0; i<2; i++) { - buf45[i]=GREEN; + buf45[i]=GREEN; } } - /* + /* buf45[2]= {RED,RED}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> @@ -252,7 +252,7 @@ static void write_attr_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; @@ -269,7 +269,7 @@ static void write_attr_in(hid_t loc_id, ((int *)buf5[1].p)[0]=0; ((int *)buf5[1].p)[1]=0; } - /* + /* $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> position vlen of </g1> vlen of </g1> difference @@ -300,10 +300,10 @@ static void write_attr_in(hid_t loc_id, for (i=0; i<2; i++) for (j=0; j<3; j++) { - buf6[i][j]=0; + buf6[i][j]=0; } } - /* + /* buf6[2][3]= {{1,2,3},{4,5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> @@ -330,12 +330,12 @@ position array of </g1> array of </g1> difference { for (i=0; i<2; i++) { - buf7[i]=0; - buf8[i]=0; + buf7[i]=0; + buf8[i]=0; } } - /* - buf7[2]= {1,2}; + /* + buf7[2]= {1,2}; buf8[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> @@ -366,7 +366,7 @@ position array of </g1> array of </g1> difference memset(buf12, 'z', sizeof buf12); } - /* + /* buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <string2D> and <string2D> @@ -401,8 +401,8 @@ position array of </g1> array of </g1> difference memset(buf22,0,sizeof buf22); } - /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <bitfield2D> and <bitfield2D> position bitfield2D of </g1> bitfield2D of </g1> difference @@ -425,8 +425,8 @@ position array of </g1> array of </g1> difference *------------------------------------------------------------------------- */ - /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <opaque2D> and <opaque2D> position opaque2D of </g1> opaque2D of </g1> difference @@ -452,7 +452,7 @@ position array of </g1> array of </g1> difference memset(buf32,0,sizeof buf32); } - /* + /* buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <opaque2D> and <opaque2D> @@ -472,7 +472,7 @@ position array of </g1> array of </g1> difference H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -495,7 +495,7 @@ position array of </g1> array of </g1> difference for (i=0; i<3; i++) for (j=0; j<2; j++) { - if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; + if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; } /* @@ -549,7 +549,7 @@ position enum2D of </g1> enum2D of </g1> difference [ 2 1 ] 10 0 10 [ 2 1 ] 11 0 11 */ - + space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); attr_id = H5Acreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT); @@ -570,8 +570,8 @@ position enum2D of </g1> enum2D of </g1> difference { memset(buf62,0,sizeof buf62); } - /* - buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; + /* + buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <array2D> and <array2D> @@ -635,7 +635,7 @@ position float2D of </g1> float2D of </g1> difference write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- * 3D attributes *------------------------------------------------------------------------- @@ -849,7 +849,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -919,7 +919,7 @@ position enum3D of </g1> enum3D of </g1> difference * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) { @@ -948,7 +948,7 @@ position vlen3D of </g1> vlen3D of </g1> difference [ 1 0 1 ] 9 0 9 [ 1 1 0 ] 10 0 10 etc -*/ +*/ space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); attr_id = H5Acreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT); @@ -1022,7 +1022,7 @@ etc [ 1 1 0 ] 9 0 9 [ 1 1 1 ] 10 0 10 etc -*/ +*/ write_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); write_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); } @@ -1037,11 +1037,11 @@ etc *------------------------------------------------------------------------- */ - + int test_attr(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t file_id; + hid_t file_id; hid_t dset_id; hid_t group_id; hid_t root_id; diff --git a/tools/h5diff/testh5diff_basic.c b/tools/h5diff/testh5diff_basic.c index fe0282d..bebb70d 100644 --- a/tools/h5diff/testh5diff_basic.c +++ b/tools/h5diff/testh5diff_basic.c @@ -46,7 +46,7 @@ file1.h5 file2.h5 -r g1/dset1 g1/dset2 # 1.6 - file1.h5 file2.h5 + file1.h5 file2.h5 # ############################################################################## # # basic types @@ -122,13 +122,13 @@ # 6.0: Check if the command line number of arguments is less than 3 - h5diff_test1.h5 + h5diff_test1.h5 # 6.1: Check for invalid options - h5diff_test1.h5 h5diff_test2.h5 -x + h5diff_test1.h5 h5diff_test2.h5 -x # ############################################################################## -# # -d +# # -d # ############################################################################## # 6.2: no value @@ -238,11 +238,11 @@ * Basic review tests *------------------------------------------------------------------------- */ - + int test_basic(const char *file1, const char *file2) { - hid_t file1_id, file2_id; + hid_t file1_id, file2_id; hid_t group1_id, group2_id, group3_id; herr_t status; hsize_t dims[2] = { 3,2 }; @@ -257,9 +257,9 @@ int test_basic(const char *file1, const char *file2) * Create two files *------------------------------------------------------------------------- */ - - file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - file2_id = H5Fcreate (file2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file2_id = H5Fcreate (file2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* Create groups */ group1_id = H5Gcreate(file1_id, "g1", 0); @@ -273,7 +273,7 @@ int test_basic(const char *file1, const char *file2) write_dset(group2_id,2,dims,"dset1",H5T_NATIVE_DOUBLE,data2); /*------------------------------------------------------------------------- - * Close + * Close *------------------------------------------------------------------------- */ status = H5Gclose(group1_id); @@ -288,28 +288,28 @@ int test_basic(const char *file1, const char *file2) * Compare different types: H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK *------------------------------------------------------------------------- */ - + int test_types(const char *file1, const char UNUSED *file2) { - hid_t file1_id; + hid_t file1_id; hid_t group_id; - hid_t type_id; + hid_t type_id; herr_t status; hsize_t dims[1]={1}; /* Compound datatype */ - typedef struct s_t + typedef struct s_t { int a; float b; } s_t; - + /*------------------------------------------------------------------------- * Create one file *------------------------------------------------------------------------- */ - file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file1_id = H5Fcreate (file1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------------------------------------------------------- * H5G_DATASET @@ -336,16 +336,16 @@ int test_types(const char *file1, const char UNUSED *file2) /* Commit compound datatype and close it */ H5Tcommit(file1_id, "type", type_id); H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5G_LINK *------------------------------------------------------------------------- */ - + status = H5Glink(file1_id, H5G_LINK_SOFT, "dset", "link"); /*------------------------------------------------------------------------- - * Close + * Close *------------------------------------------------------------------------- */ status = H5Fclose(file1_id); @@ -357,14 +357,14 @@ int test_types(const char *file1, const char UNUSED *file2) /*------------------------------------------------------------------------- - * Datasets datatypes + * Datasets datatypes *------------------------------------------------------------------------- */ - + int test_native(const char *file1, const char UNUSED *file2) { - hid_t file1_id; + hid_t file1_id; hsize_t dims[2]={3,2}; herr_t status; char buf1a[3][2] = {{1,1},{1,1},{1,1}}; @@ -381,12 +381,12 @@ int test_native(const char *file1, const char UNUSED *file2) double buf6b[3][2] = {{1,1},{3,4},{5,6}}; /*unsigned/signed test - signed char -128 to 127 - unsigned char 0 to 255 + signed char -128 to 127 + unsigned char 0 to 255 */ char buf7a[3][2] = {{-1,-128},{-1,-1},{-1,-1}}; unsigned char buf7b[3][2] = {{1,128},{1,1},{1,1}}; - + /* long_long test */ long_long buf8a[3][2] = {{1,1},{1,1},{1,1}}; long_long buf8b[3][2] = {{1,1},{3,4},{5,6}}; @@ -395,8 +395,8 @@ int test_native(const char *file1, const char UNUSED *file2) unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}}; unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}}; - - + + /*------------------------------------------------------------------------- * Create a file *------------------------------------------------------------------------- @@ -410,16 +410,16 @@ int test_native(const char *file1, const char UNUSED *file2) write_dset(file1_id,2,dims,"dset0a",H5T_STD_I16LE,buf2a); write_dset(file1_id,2,dims,"dset0b",H5T_STD_I32LE,buf3b); - + /*------------------------------------------------------------------------- - * Check H5T_NATIVE_CHAR + * Check H5T_NATIVE_CHAR *------------------------------------------------------------------------- */ write_dset(file1_id,2,dims,"dset1a",H5T_NATIVE_CHAR,buf1a); write_dset(file1_id,2,dims,"dset1b",H5T_NATIVE_CHAR,buf1b); /*------------------------------------------------------------------------- - * Check H5T_NATIVE_SHORT + * Check H5T_NATIVE_SHORT *------------------------------------------------------------------------- */ write_dset(file1_id,2,dims,"dset2a",H5T_NATIVE_SHORT,buf2a); @@ -447,7 +447,7 @@ int test_native(const char *file1, const char UNUSED *file2) write_dset(file1_id,2,dims,"dset5b",H5T_NATIVE_FLOAT,buf5b); /*------------------------------------------------------------------------- - * Check H5T_NATIVE_DOUBLE + * Check H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ @@ -488,7 +488,7 @@ int test_native(const char *file1, const char UNUSED *file2) /*------------------------------------------------------------------------- - * Close + * Close *------------------------------------------------------------------------- */ status = H5Fclose(file1_id); diff --git a/tools/h5diff/testh5diff_dset.c b/tools/h5diff/testh5diff_dset.c index cae7d1c..6d18c8a 100644 --- a/tools/h5diff/testh5diff_dset.c +++ b/tools/h5diff/testh5diff_dset.c @@ -19,7 +19,7 @@ /*------------------------------------------------------------------------- * Function: write_dset_in * - * Purpose: write datasets in LOC_ID + * Purpose: write datasets in LOC_ID * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -28,28 +28,28 @@ *------------------------------------------------------------------------- */ - -static void write_dset_in(hid_t loc_id, + +static void write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id, int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t + typedef struct s_t { char a; double b; } s_t; - typedef enum + typedef enum { RED, GREEN } e_t; hid_t dset_id; - hid_t space_id; - hid_t type_id; + hid_t space_id; + hid_t type_id; hid_t plist_id; herr_t status; int val, i, j, k, n; @@ -95,22 +95,22 @@ static void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- - * 1D + * 1D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) for (j=0; j<2; j++) { - buf1[i][j]='z'; + buf1[i][j]='z'; } } @@ -163,7 +163,7 @@ static void write_dset_in(hid_t loc_id, { for (i=0; i<2; i++) { - buf45[i]=GREEN; + buf45[i]=GREEN; } } @@ -172,7 +172,7 @@ static void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -199,7 +199,7 @@ static void write_dset_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; @@ -238,7 +238,7 @@ static void write_dset_in(hid_t loc_id, for (i=0; i<2; i++) for (j=0; j<3; j++) { - buf6[i][j]=0; + buf6[i][j]=0; } } @@ -255,8 +255,8 @@ static void write_dset_in(hid_t loc_id, { for (i=0; i<2; i++) { - buf7[i]=0; - buf8[i]=0; + buf7[i]=0; + buf8[i]=0; } } @@ -265,7 +265,7 @@ static void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- - * 2D + * 2D *------------------------------------------------------------------------- */ @@ -290,7 +290,7 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf22,0,sizeof buf22); @@ -324,7 +324,7 @@ static void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -368,7 +368,7 @@ static void write_dset_in(hid_t loc_id, else ((int *)buf52[i][j].p)[l] = n++; } } - + space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); dset_id = H5Dcreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT); @@ -400,7 +400,7 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf72,0,sizeof buf72); @@ -424,9 +424,9 @@ static void write_dset_in(hid_t loc_id, write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- - * 3D + * 3D *------------------------------------------------------------------------- */ @@ -502,7 +502,7 @@ static void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -534,7 +534,7 @@ static void write_dset_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) { @@ -549,7 +549,7 @@ static void write_dset_in(hid_t loc_id, } } } - + space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); dset_id = H5Dcreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT); @@ -611,11 +611,11 @@ static void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - + int test_dsetall(const char *file, int make_diffs /* flag to modify data buffers */) { - hid_t file_id; + hid_t file_id; hid_t dset_id; hid_t group_id; hid_t space_id; @@ -643,7 +643,7 @@ int test_dsetall(const char *file, group_id = H5Gcreate(file_id,"g1",0); /*------------------------------------------------------------------------- - * write a series of datasets on the group + * write a series of datasets on the group *------------------------------------------------------------------------- */ diff --git a/tools/h5diff/testh5diff_main.c b/tools/h5diff/testh5diff_main.c index 70a1ff1..8480675 100644 --- a/tools/h5diff/testh5diff_main.c +++ b/tools/h5diff/testh5diff_main.c @@ -25,12 +25,12 @@ int main(int UNUSED argc, const UNUSED char *argv[]) test_native("file4.h5",NULL); /* generate 2 files with attribute differences */ - test_attr("file5.h5",0); - test_attr("file6.h5",1); + test_attr("file5.h5",0); + test_attr("file6.h5",1); /* generate 2 files with all datatype differences */ - test_dsetall("file7.h5",0); - test_dsetall("file8.h5",1); + test_dsetall("file7.h5",0); + test_dsetall("file8.h5",1); return 0; } diff --git a/tools/h5diff/testh5diff_util.c b/tools/h5diff/testh5diff_util.c index b0abf81..5e81881 100644 --- a/tools/h5diff/testh5diff_util.c +++ b/tools/h5diff/testh5diff_util.c @@ -27,16 +27,16 @@ *------------------------------------------------------------------------- */ - -int write_attr(hid_t loc_id, - int rank, - hsize_t *dims, + +int write_attr(hid_t loc_id, + int rank, + hsize_t *dims, const char *attr_name, - hid_t type_id, + hid_t type_id, void *buf) { hid_t attr_id; - hid_t space_id; + hid_t space_id; herr_t status; /* Create a buf space */ @@ -44,7 +44,7 @@ int write_attr(hid_t loc_id, /* Create the attribute */ attr_id = H5Acreate(loc_id,attr_name,type_id,space_id,H5P_DEFAULT); - + /* Write the buf */ if ( buf ) status = H5Awrite(attr_id,type_id,buf); @@ -68,15 +68,15 @@ int write_attr(hid_t loc_id, */ -int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, +int write_dset( hid_t loc_id, + int rank, + hsize_t *dims, const char *dset_name, - hid_t type_id, + hid_t type_id, void *buf ) { hid_t dset_id; - hid_t space_id; + hid_t space_id; herr_t status; /* Create a buf space */ @@ -84,7 +84,7 @@ int write_dset( hid_t loc_id, /* Create a dataset */ dset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT); - + /* Write the buf */ if ( buf ) status = H5Dwrite(dset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 82716b2..b4a8728 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -50,10 +50,10 @@ static int display_attr_data = TRUE; static int display_char = FALSE; /*print 1-byte numbers as ASCII */ static int usingdasho = FALSE; static int display_bb = FALSE; /*superblock */ -static int display_dcpl = FALSE; /*dcpl */ -static int display_fi = FALSE; /*file index */ -static int display_ai = TRUE; /*array index */ -static int display_escape = FALSE; /*escape non printable characters */ +static int display_dcpl = FALSE; /*dcpl */ +static int display_fi = FALSE; /*file index */ +static int display_ai = TRUE; /*array index */ +static int display_escape = FALSE; /*escape non printable characters */ /** ** Added for XML ** @@ -147,13 +147,13 @@ static h5dump_t dataformat = { "%s", /*dset_ptformat_pre */ "%s", /*dset_ptformat */ 1, /*array indices */ - 1 /*escape non printable characters */ + 1 /*escape non printable characters */ }; /** ** Added for XML ** **/ -/* +/* * Alternative formating for data dumped to XML * In general, the numbers are the same, but separators * except spaces are not used. @@ -231,7 +231,7 @@ static h5dump_t xml_dataformat = { "%s", /*dset_ptformat_pre */ "%s", /*dset_ptformat */ 0, /*array indices */ - 0 /*escape non printable characters */ + 0 /*escape non printable characters */ }; /** XML **/ @@ -310,7 +310,7 @@ static const dump_header standardformat = { ")", /*dataspacedimend */ }; -/** +/** ** Added for XML ** **/ /* internal functions used by XML option */ @@ -478,7 +478,7 @@ static void xml_dump_datatype(hid_t type); static herr_t xml_dump_attr(hid_t, const char *, void *); static void xml_dump_data(hid_t, int, struct subset_t *, int); -/** +/** ** Added for XML ** ** ** This is the global dispatch table for the dump functions. @@ -517,7 +517,7 @@ static const dump_functions xml_function_table = { }; /* - * The global table is set to either ddl_function_table or + * The global table is set to either ddl_function_table or * xml_function_table in the initialization. */ static const dump_functions *dump_function_table; @@ -764,7 +764,7 @@ print_datatype(hid_t type,unsigned in_group) case H5T_STRING: /* Make a copy of type in memory in case when TYPE is on disk, the size - * will be bigger than in memory. This makes it easier to compare + * will be bigger than in memory. This makes it easier to compare * types in memory. */ tmp_type = H5Tcopy(type); size = H5Tget_size(tmp_type); @@ -815,9 +815,9 @@ print_datatype(hid_t type,unsigned in_group) if (H5Tequal(tmp_type, str_type)) { printf("H5T_C_S1;\n"); goto done; - } + } - /* Change the endianness and see if they're equal. */ + /* Change the endianness and see if they're equal. */ order = H5Tget_order(tmp_type); if(order==H5T_ORDER_LE) H5Tset_order(str_type, H5T_ORDER_LE); @@ -842,7 +842,7 @@ print_datatype(hid_t type,unsigned in_group) goto done; } - /* Change the endianness and see if they're equal. */ + /* Change the endianness and see if they're equal. */ order = H5Tget_order(tmp_type); if(order==H5T_ORDER_LE) H5Tset_order(str_type, H5T_ORDER_LE); @@ -994,7 +994,7 @@ done: * Purpose: Dump the data type. Data type can be HDF5 predefined * atomic data type or committed/transient data type. * - * Return: void + * Return: void * * Programmer: Ruey-Hsia Li * @@ -1024,7 +1024,7 @@ dump_datatype(hid_t type) * Purpose: Dump the data space. Data space can be named data space, * array, or others. * - * Return: void + * Return: void * * Programmer: Ruey-Hsia Li * @@ -1381,9 +1381,9 @@ dump_all(hid_t group, const char *name, void * op_data) "TargetPath=\"%s\" TargetObj=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", xmlnsprefix, - t_name, - linkxid, - t_tmp, + t_name, + linkxid, + t_tmp, t_targbuf, targetxid, parentxid, t_prefix); free(targetxid); @@ -1395,10 +1395,10 @@ dump_all(hid_t group, const char *name, void * op_data) "TargetPath=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" />\n", xmlnsprefix, - t_name, + t_name, linkxid, - t_tmp, - t_targbuf, + t_tmp, + t_targbuf, parentxid, t_prefix); } @@ -1496,13 +1496,13 @@ dump_all(hid_t group, const char *name, void * op_data) "H5Path=\"%s\" Parents=\"%s\" " "H5ParentPaths=\"%s\">\n", xmlnsprefix, - t_name, dsetxid, get_next_xid(), + t_name, dsetxid, get_next_xid(), t_tmp, parentxid, (strcmp(prefix, "") ? t_prefix : "/")); indentation(indent + COL); xml_name_to_XID(dset_table->objs[i].objname,pointerxid,100,1); - printf("<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", + printf("<%sDatasetPtr OBJ-XID=\"%s\" H5Path=\"%s\"/>\n", xmlnsprefix, pointerxid,t_tmp); indentation(indent); @@ -1521,7 +1521,7 @@ dump_all(hid_t group, const char *name, void * op_data) goto done; } else { dset_table->objs[i].displayed = 1; - + } } @@ -1636,7 +1636,7 @@ dump_group(hid_t gid, const char *name) H5Gget_objinfo(gid, ".", TRUE, &statbuf); - if (statbuf.nlink > 1) { + if (statbuf.nlink > 1) { i = search_obj(group_table, statbuf.objno); if (i < 0) { @@ -1648,7 +1648,7 @@ dump_group(hid_t gid, const char *name) indentation(indent); printf("%s \"%s\"\n", HARDLINK, group_table->objs[i].objname); } else { - + group_table->objs[i].displayed = 1; H5Aiterate(gid, NULL, dump_attr, NULL); H5Giterate(gid, ".", NULL, dump_all, (void *) &xtype); @@ -1687,15 +1687,15 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_header_format->datasetblockbegin); type = H5Dget_type(did); space = H5Dget_space(did); - dcpl_id = H5Dget_create_plist(did); - + dcpl_id = H5Dget_create_plist(did); + dump_comment(did); dump_datatype(type); dump_dataspace(space); if (display_oid) dump_oid(did); - + if (display_dcpl) dump_dcpl(dcpl_id, type, did); @@ -1967,7 +1967,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex) status = h5tools_dump_dset(stdout, outputformat, obj_id, -1, sset, depth); H5Tclose(f_type); } else { - /* need to call h5tools_dump_mem for the attribute data */ + /* need to call h5tools_dump_mem for the attribute data */ space = H5Aget_space(obj_id); space_type = H5Sget_simple_extent_type(space); if(space_type == H5S_NULL || space_type == H5S_NO_CLASS || space_type == H5S_COMPLEX) { @@ -1986,7 +1986,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex) alloc_size = nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type)); assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - + buf = malloc((size_t)alloc_size); assert(buf); @@ -2020,9 +2020,9 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int pindex) status = h5tools_dump_mem(stdout, outputformat, obj_id, p_type, space, buf, depth); - + free(buf); - H5Tclose(p_type); + H5Tclose(p_type); H5Tclose(type); } H5Sclose(space); @@ -2083,10 +2083,10 @@ dump_oid(hid_t oid) static void dump_comment(hid_t obj_id) { char comment[50]; - + comment[0] = '\0'; H5Gget_comment(obj_id, ".", sizeof(comment), comment); - + if (comment[0]) { indentation(indent); printf("COMMENT \"%s\"\n", comment); @@ -2176,15 +2176,15 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) ioffset=H5Dget_offset(obj_id); next=H5Pget_external_count(dcpl_id); strcpy(f_name,"\0"); - + /*------------------------------------------------------------------------- - * STORAGE_LAYOUT + * STORAGE_LAYOUT *------------------------------------------------------------------------- */ indentation(indent + COL); printf("%s %s\n", STORAGE_LAYOUT, BEGIN); - if (H5D_CHUNKED == H5Pget_layout(dcpl_id)) + if (H5D_CHUNKED == H5Pget_layout(dcpl_id)) { /*start indent */ indent += COL; @@ -2192,7 +2192,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) printf("%s ", CHUNKED); rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize); HDfprintf(stdout,"%s %Hu", dump_header_format->dataspacedimbegin, chsize[0]); - for ( i=1; i<rank; i++) + for ( i=1; i<rank; i++) HDfprintf(stdout, ", %Hu", chsize[i]); printf(" %s\n", dump_header_format->dataspacedimend); indentation(indent + COL); @@ -2202,7 +2202,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indentation(indent + COL); printf("%s\n",END); } - else if (H5D_COMPACT == H5Pget_layout(dcpl_id)) + else if (H5D_COMPACT == H5Pget_layout(dcpl_id)) { /*start indent */ indent += COL; @@ -2215,13 +2215,13 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indentation(indent + COL); printf("%s\n",END); } - else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) + else if (H5D_CONTIGUOUS == H5Pget_layout(dcpl_id)) { /*------------------------------------------------------------------------- * EXTERNAL_FILE *------------------------------------------------------------------------- */ - if (next) + if (next) { /*start indent */ indent += COL; @@ -2262,7 +2262,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) } } /*------------------------------------------------------------------------- - * FILTERS + * FILTERS *------------------------------------------------------------------------- */ nfilters = H5Pget_nfilters(dcpl_id); @@ -2273,28 +2273,28 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) if (nfilters) { - for (i=0; i<nfilters; i++) + for (i=0; i<nfilters; i++) { cd_nelmts = NELMTS(cd_values); #ifdef H5_WANT_H5_V1_6_COMPAT - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name); #else - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name, NULL); #endif /* H5_WANT_H5_V1_6_COMPAT */ - + switch (filtn) { case H5Z_FILTER_DEFLATE: @@ -2313,37 +2313,37 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) { szip_options_mask=cd_values[0];; szip_pixels_per_block=cd_values[1]; - + indentation(indent + COL); printf("%s %s\n",SZIP, BEGIN); - + /*start indent */ indent += COL; indentation(indent + COL); printf("PIXELS_PER_BLOCK %d\n", szip_pixels_per_block); - + indentation(indent + COL); - if (szip_options_mask & H5_SZIP_CHIP_OPTION_MASK) + if (szip_options_mask & H5_SZIP_CHIP_OPTION_MASK) printf("MODE %s\n", "HARDWARE"); - else if (szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) + else if (szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) printf("MODE %s\n", "K13"); - + indentation(indent + COL); - if (szip_options_mask & H5_SZIP_EC_OPTION_MASK) + if (szip_options_mask & H5_SZIP_EC_OPTION_MASK) printf("CODING %s\n", "ENTROPY"); - else if (szip_options_mask & H5_SZIP_NN_OPTION_MASK) + else if (szip_options_mask & H5_SZIP_NN_OPTION_MASK) printf("CODING %s\n", "NEAREST NEIGHBOUR"); - + indentation(indent + COL); - if (szip_options_mask & H5_SZIP_LSB_OPTION_MASK) + if (szip_options_mask & H5_SZIP_LSB_OPTION_MASK) printf("BYTE_ORDER %s\n", "LSB"); - else if (szip_options_mask & H5_SZIP_MSB_OPTION_MASK) + else if (szip_options_mask & H5_SZIP_MSB_OPTION_MASK) printf("BYTE_ORDER %s\n", "MSB"); - + indentation(indent + COL); - if (szip_options_mask & H5_SZIP_RAW_OPTION_MASK) + if (szip_options_mask & H5_SZIP_RAW_OPTION_MASK) printf("HEADER %s\n", "RAW"); - + /*end indent */ indent -= COL; indentation(indent + COL); @@ -2381,10 +2381,10 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) printf("%s\n", END); } break; - }/*switch*/ + }/*switch*/ } /*i*/ }/*nfilters*/ - else + else { indentation(indent + COL); printf("NONE\n"); @@ -2404,15 +2404,15 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indentation(indent + COL); printf("FILL_TIME "); H5Pget_fill_time(dcpl_id, &ft); - switch ( ft ) + switch ( ft ) { - case H5D_FILL_TIME_ALLOC: + case H5D_FILL_TIME_ALLOC: printf("%s", "H5D_FILL_TIME_ALLOC\n"); break; - case H5D_FILL_TIME_NEVER: + case H5D_FILL_TIME_NEVER: printf("%s", "H5D_FILL_TIME_NEVER\n"); break; - case H5D_FILL_TIME_IFSET: + case H5D_FILL_TIME_IFSET: printf("%s", "H5D_FILL_TIME_IFSET\n"); break; default: @@ -2422,15 +2422,15 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indentation(indent + COL); printf("%s ", "VALUE "); H5Pfill_value_defined(dcpl_id, &fvstatus); - if (fvstatus == H5D_FILL_VALUE_UNDEFINED) + if (fvstatus == H5D_FILL_VALUE_UNDEFINED) { printf("%s\n", "H5D_FILL_VALUE_UNDEFINED"); } - else + else { dump_fill_value(dcpl_id,type_id,obj_id); } - /* end indent */ + /* end indent */ indent -= COL; indentation(indent + COL); printf("\n"); @@ -2447,22 +2447,22 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indent += COL; indentation(indent + COL); H5Pget_alloc_time(dcpl_id, &at); - switch (at) + switch (at) { - case H5D_ALLOC_TIME_EARLY: + case H5D_ALLOC_TIME_EARLY: printf("%s", "H5D_ALLOC_TIME_EARLY\n"); break; case H5D_ALLOC_TIME_INCR: printf("%s", "H5D_ALLOC_TIME_INCR\n"); break; - case H5D_ALLOC_TIME_LATE: + case H5D_ALLOC_TIME_LATE: printf("%s", "H5D_ALLOC_TIME_LATE\n"); break; default: assert(0); break; } - /* end indent */ + /* end indent */ indent -= COL; indentation(indent + COL); printf("%s\n",END); @@ -2528,7 +2528,7 @@ dump_fcpl(hid_t fid) indentation(indent + COL); HDfprintf(stdout,"%s %Hd\n","LENGTH_SIZE", (long_long)len_size); indentation(indent + COL); - printf("%s %u\n","BTREE_RANK", sym_ik); + printf("%s %u\n","BTREE_RANK", sym_ik); indentation(indent + COL); printf("%s %d\n","BTREE_LEAF", sym_lk); @@ -2586,7 +2586,7 @@ dump_fcpl(hid_t fid) /*------------------------------------------------------------------------- * Function: dump_fcontents * - * Purpose: prints all objects + * Purpose: prints all objects * * Return: void * @@ -2610,7 +2610,7 @@ static void dump_fcontents(hid_t fid) { gid=H5Gopen(fid,"/"); for (i = 0; i < type_table->nobjs; i++) - if (!type_table->objs[i].recorded) + if (!type_table->objs[i].recorded) { did = H5Dopen(gid, type_table->objs[i].objname); tid = H5Dget_type(did); @@ -2826,7 +2826,7 @@ handle_datasets(hid_t fid, char *dset, void *data) if ((dsetid = H5Dopen(fid, dset)) < 0) { begin_obj(dump_header_format->datasetbegin, dset, - dump_header_format->datasetblockbegin); + dump_header_format->datasetblockbegin); indentation(COL); error_msg(progname, "unable to open dataset \"%s\"\n", dset); end_obj(dump_header_format->datasetend, @@ -2938,7 +2938,7 @@ handle_groups(hid_t fid, char *group, void UNUSED * data) if ((gid = H5Gopen(fid, group)) < 0) { begin_obj(dump_header_format->groupbegin, group, - dump_header_format->groupblockbegin); + dump_header_format->groupblockbegin); indentation(COL); error_msg(progname, "unable to open group \"%s\"\n", group); end_obj(dump_header_format->groupend, @@ -3050,7 +3050,7 @@ handle_datatypes(hid_t fid, char *type, void UNUSED * data) if (!strncmp(name, type, strlen(type)) || !strncmp(name1, type, strlen(type))) break; - } + } idx++; } @@ -3058,7 +3058,7 @@ handle_datatypes(hid_t fid, char *type, void UNUSED * data) if (idx == type_table->nobjs) { /* unknown type */ begin_obj(dump_header_format->datatypebegin, type, - dump_header_format->datatypeblockbegin); + dump_header_format->datatypeblockbegin); indentation(COL); error_msg(progname, "unable to open datatype \"%s\"\n", type); end_obj(dump_header_format->datatypeend, @@ -3560,7 +3560,7 @@ main(int argc, const char *argv[]) ns = strdup(xmlnsprefix); indx = strrchr(ns,(int)':'); if (indx) *indx = '\0'; - + printf("<%sHDF5-File xmlns:%s=\"http://hdf.ncsa.uiuc.edu/DTDs/HDF5-File\" " "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " "xsi:schemaLocation=\"http://hdf.ncsa.uiuc.edu/DTDs/HDF5File " @@ -3573,7 +3573,7 @@ main(int argc, const char *argv[]) } } - if (!doxml) + if (!doxml) { if (display_fi) { @@ -3581,11 +3581,11 @@ main(int argc, const char *argv[]) end_obj(dump_header_format->fileend,dump_header_format->fileblockend); goto done; } - + if (display_bb) dump_fcpl(fid); } - + if (display_all) { if ((gid = H5Gopen(fid, "/")) < 0) { @@ -3625,39 +3625,39 @@ done: d_status = EXIT_FAILURE; free_handler(hand, argc); - + for(i=0; i<info.group_table->nobjs; i++) { if(info.group_table->objs[i].objname) free(info.group_table->objs[i].objname); } free(group_table->objs); - + for(i=0; i<info.dset_table->nobjs; i++) { if(info.dset_table->objs[i].objname) free(info.dset_table->objs[i].objname); } free(dset_table->objs); - + for(i=0; i<info.type_table->nobjs; i++) { if(info.type_table->objs[i].objname) free(info.type_table->objs[i].objname); } free(type_table->objs); - + free(prefix); free(info.prefix); /* To Do: clean up XML table */ H5Eset_auto_stack(H5E_DEFAULT, func, edata); - + leave(d_status); } /*------------------------------------------------------------------------- * Function: print_enum * - * Purpose: prints the enum data + * Purpose: prints the enum data * * Return: void * @@ -3666,7 +3666,7 @@ done: * Modifications: * * NOTE: this function was taken from h5ls. should be moved into the toolslib - * + * *-----------------------------------------------------------------------*/ static void print_enum(hid_t type) @@ -3766,7 +3766,7 @@ print_enum(hid_t type) /* - * create a string suitable for and XML NCNAME. Uses the + * create a string suitable for and XML NCNAME. Uses the * object reference to create the string. * * 'gen'; 0 - return null if not found @@ -4070,7 +4070,7 @@ xml_print_datatype(hid_t type, unsigned in_group) } } else { - + switch (H5Tget_class(type)) { case H5T_INTEGER: indentation(indent); @@ -4113,9 +4113,9 @@ xml_print_datatype(hid_t type, unsigned in_group) break; case H5T_FLOAT: - /* <hdf5:FloatType ByteOrder="bo" Size="bytes" + /* <hdf5:FloatType ByteOrder="bo" Size="bytes" SignBitLocation="bytes" - ExponentBits="eb" ExponentLocation="el" + ExponentBits="eb" ExponentLocation="el" MantissaBits="mb" MantissaLocation="ml" /> */ ord = H5Tget_order(type); indentation(indent); @@ -4165,7 +4165,7 @@ xml_print_datatype(hid_t type, unsigned in_group) str_pad = H5Tget_strpad(type); cset = H5Tget_cset(type); is_vlstr = H5Tis_variable_str(type); - + indentation(indent); printf("<%sAtomicType>\n",xmlnsprefix); indent += COL; @@ -4178,7 +4178,7 @@ xml_print_datatype(hid_t type, unsigned in_group) } if(is_vlstr) printf("StrSize=\"H5T_VARIABLE\" StrPad=\""); - else + else printf("StrSize=\"%d\" StrPad=\"", (int) size); if (str_pad == H5T_STR_NULLTERM) { printf("H5T_STR_NULLTERM\"/>\n"); @@ -4481,7 +4481,7 @@ xml_dump_dataspace(hid_t space) case H5S_SCALAR: /* scalar dataspace (just a tag, no XML attrs. defined */ printf("<%sScalarDataspace />\n",xmlnsprefix); - + break; case H5S_SIMPLE: /* simple dataspace */ @@ -4507,7 +4507,7 @@ xml_dump_dataspace(hid_t space) } indentation(indent + COL + COL); printf("</%sSimpleDataspace>\n", xmlnsprefix ); - + break; #ifdef TMP /* Commented out: wait until the schema is updated first */ @@ -4519,7 +4519,7 @@ xml_dump_dataspace(hid_t space) #endif /* TMP */ case H5S_COMPLEX: printf("<!-- not yet implemented -->\n"); - + break; case H5S_NO_CLASS: default: @@ -4735,7 +4735,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, void UNUSED * op_data) break; } } else { - /* The case of an attribute never yet written ?? + /* The case of an attribute never yet written ?? * Or dataspace is H5S_NULL. */ indentation(indent + COL); printf("<%sData>\n",xmlnsprefix); @@ -4800,7 +4800,7 @@ xml_dump_named_datatype(hid_t type, const char *name) xml_name_to_XID(tmp,dtxid,100,1); xml_name_to_XID(prefix,parentxid,100,1); if (strncmp(name, "#", 1) == 0) { - /* Special: this is an 'anonymous' NDT, deleted but + /* Special: this is an 'anonymous' NDT, deleted but still in use. We follow the dumper's undocumented practice, and use its object id as its name. @@ -4811,13 +4811,13 @@ xml_dump_named_datatype(hid_t type, const char *name) printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\">\n", xmlnsprefix, - name, dtxid, + name, dtxid, parentxid,(strcmp(prefix, "") ? t_prefix : "/")); } else { printf("<%sNamedDataType Name=\"%s\" OBJ-XID=\"%s\" " "H5Path=\"%s\" Parents=\"%s\" H5ParentPaths=\"%s\">\n", xmlnsprefix, - t_name, dtxid, + t_name, dtxid, t_tmp, parentxid, (strcmp(prefix, "") ? t_prefix : "/")); } free(dtxid); @@ -4920,7 +4920,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par,parentxid,100,1); printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s-%d\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\">\n", - xmlnsprefix,t_name, grpxid, get_next_xid(), + xmlnsprefix,t_name, grpxid, get_next_xid(), t_objname, parentxid, par_name); free(t_objname); free(par_name); @@ -5014,7 +5014,7 @@ xml_dump_group(hid_t gid, const char *name) xml_name_to_XID(par,parentxid,100,1); printf("<%sGroup Name=\"%s\" OBJ-XID=\"%s\" H5Path=\"%s\" " "Parents=\"%s\" H5ParentPaths=\"%s\" >\n", - xmlnsprefix,t_name, grpxid, t_tmp, + xmlnsprefix,t_name, grpxid, t_tmp, parentxid, par_name); free(t_tmp); free(par_name); @@ -5220,7 +5220,7 @@ xml_print_strs(hid_t did, int source) space = H5Aget_space(did); ssiz = H5Sget_simple_extent_npoints(space); ssiz *= H5Tget_size(type); - + buf = malloc((size_t)ssiz); if (buf == NULL) { return FAIL; @@ -5249,7 +5249,7 @@ xml_print_strs(hid_t did, int source) onestring = *(char **)bp; if(onestring) str_size = (size_t)HDstrlen(onestring); - } else { + } else { HDstrncpy(onestring, bp, tsiz); str_size = tsiz; } @@ -5263,7 +5263,7 @@ xml_print_strs(hid_t did, int source) printf("\"%s\"\n", t_onestring); free(t_onestring); } - + bp += tsiz; } @@ -5327,7 +5327,7 @@ check_compression(hid_t dcpl) * Function: check_filters * * Purpose: private function to check for the filters and - * put tags in the XML. + * put tags in the XML. * * Return: void * @@ -5392,13 +5392,13 @@ check_filters(hid_t dcpl) printf("Mode =\"Hardware\" "); } else if (cd_values[0] & H5_SZIP_ALLOW_K13_OPTION_MASK) { printf("Mode =\"K13\" "); - } + } printf("Coding=\""); if (cd_values[0] & H5_SZIP_EC_OPTION_MASK) { printf("Entropy"); } else if (cd_values[0] & H5_SZIP_NN_OPTION_MASK) { printf("NN"); - } + } printf("\" "); printf("ByteOrder=\""); @@ -5406,12 +5406,12 @@ check_filters(hid_t dcpl) printf("LSB"); } else if (cd_values[0] & H5_SZIP_MSB_OPTION_MASK) { printf("MSB"); - } + } printf("\" "); if (cd_values[0] & H5_SZIP_RAW_OPTION_MASK) { printf("Header=\"Raw\""); - } + } printf("/>\n"); } else { /* unknown option */ @@ -5669,13 +5669,13 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) H5Pget_fill_time(dcpl, &ft); printf("FillTime=\""); switch ( ft ) { - case H5D_FILL_TIME_ALLOC: + case H5D_FILL_TIME_ALLOC: printf("FillOnAlloc"); break; - case H5D_FILL_TIME_NEVER: + case H5D_FILL_TIME_NEVER: printf("FillNever"); break; - case H5D_FILL_TIME_IFSET: + case H5D_FILL_TIME_IFSET: printf("FillIfSet"); break; default: @@ -5686,16 +5686,16 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) H5Pget_alloc_time(dcpl, &at); printf("AllocationTime=\""); switch ( at ) { - case H5D_ALLOC_TIME_EARLY: + case H5D_ALLOC_TIME_EARLY: printf("Early"); break; case H5D_ALLOC_TIME_INCR: printf("Incremental"); break; - case H5D_ALLOC_TIME_LATE: + case H5D_ALLOC_TIME_LATE: printf("Late"); break; - case H5D_ALLOC_TIME_DEFAULT: + case H5D_ALLOC_TIME_DEFAULT: default: printf("?"); break; @@ -5732,7 +5732,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t UNUSED * sset) H5Aiterate(did, NULL, dump_function_table->dump_attribute_function, NULL); indent -= COL; tempi = H5Dget_storage_size(did); - + if (display_data && (tempi > 0)) { switch (H5Tget_class(type)) { case H5T_INTEGER: @@ -5954,7 +5954,7 @@ h5_fileaccess(void) const char *name; char s[1024]; hid_t fapl = -1; - + /* First use the environment variable, then the constant */ val = HDgetenv("HDF5_DRIVER"); #ifdef HDF5_DRIVER @@ -5963,7 +5963,7 @@ h5_fileaccess(void) if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) return -1; if (!val || !*val) return fapl; /*use default*/ - + HDstrncpy(s, val, sizeof s); s[sizeof(s)-1] = '\0'; if (NULL==(name=HDstrtok(s, " \t\n\r"))) return fapl; diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index cdb2f1b..f79db30 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -87,16 +87,16 @@ */ /* utility functions */ -static int +static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t type_id, void *buf); -static int +static int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t type_id, void *buf ); /* a filter operation callback function */ static size_t -myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, +myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, const unsigned int UNUSED *cd_values, size_t nbytes, size_t UNUSED *buf_size, void UNUSED **buf); @@ -180,11 +180,11 @@ typedef struct s1_t { #define F41_RANK 1 #define F41_ARRAY_RANK 1 #define F41_ARRAY_RANKd 2 -#define F41_DIMb 4 -#define F41_ARRAY_DIMc 6 -#define F41_ARRAY_DIMd1 5 -#define F41_ARRAY_DIMd2 6 -#define F41_ARRAY_DIMf 10 +#define F41_DIMb 4 +#define F41_ARRAY_DIMc 6 +#define F41_ARRAY_DIMd1 5 +#define F41_ARRAY_DIMd2 6 +#define F41_ARRAY_DIMf 10 /* "File 42" macros */ /* Name of dataset to create in datafile */ @@ -202,9 +202,9 @@ typedef struct s1_t { static void gent_group(void) { hid_t fid, group; - + fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + /* / */ group = H5Gcreate (fid, "/g1", 0); H5Gclose(group); @@ -212,17 +212,17 @@ static void gent_group(void) H5Gclose(group); group = H5Gcreate (fid, "/g3", 0); H5Gclose(group); - + /* /g1 */ group = H5Gcreate (fid, "/g1/g1.1", 0); H5Gclose(group); group = H5Gcreate (fid, "/g1/g1.2", 0); H5Gclose(group); - + /* /g2 */ group = H5Gcreate (fid, "/g2/g2.1", 0); H5Gclose(group); - + /* /g3 */ group = H5Gcreate (fid, "/g3/g3.1", 0); H5Gclose(group); @@ -232,7 +232,7 @@ static void gent_group(void) H5Gclose(group); group = H5Gcreate (fid, "/g3/g3.4", 0); H5Gclose(group); - + /* /g2/g2.1 */ group = H5Gcreate (fid, "/g2/g2.1/g2.1.1", 0); H5Gclose(group); @@ -240,7 +240,7 @@ static void gent_group(void) H5Gclose(group); group = H5Gcreate (fid, "/g2/g2.1/g2.1.3", 0); H5Gclose(group); - + H5Fclose(fid); } @@ -251,9 +251,9 @@ static void gent_dataset(void) int dset1[10][20]; double dset2[30][20]; int i, j; - + fid = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + /* dset1 */ dims[0] = 10; dims[1] = 20; space = H5Screate_simple(2, dims, NULL); @@ -266,7 +266,7 @@ static void gent_dataset(void) H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); H5Sclose(space); H5Dclose(dataset); - + /* dset2 */ dims[0] = 30; dims[1] = 20; space = H5Screate_simple(2, dims, NULL); @@ -277,7 +277,7 @@ static void gent_dataset(void) dset2[i][j] = 0.0001*j+i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); - + H5Sclose(space); H5Dclose(dataset); H5Fclose(fid); @@ -291,12 +291,12 @@ static void gent_dataset2(void) int dset1[10][20]; double dset2[30][10]; int i, j; - + fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); create_plist = H5Pcreate(H5P_DATASET_CREATE); dims[0] = 5; dims[1] = 5; H5Pset_chunk(create_plist, 2, dims); - + /* dset1 */ dims[0] = 10; dims[1] = 20; maxdims[0] = H5S_UNLIMITED; maxdims[1] = 20; @@ -310,7 +310,7 @@ static void gent_dataset2(void) H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); H5Sclose(space); H5Dclose(dataset); - + /* dset2 */ dims[0] = 30; dims[1] = 10; maxdims[0] = 30; maxdims[1] = H5S_UNLIMITED; @@ -339,10 +339,10 @@ static void gent_attribute(void) double d[10]; char string[]= "string attribute"; int point = 100; - + fid = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); root = H5Gopen (fid, "/"); - + /* attribute 1 */ dims[0] = 24; space = H5Screate_simple(1, dims, NULL); @@ -351,7 +351,7 @@ static void gent_attribute(void) H5Awrite(attr, H5T_NATIVE_SCHAR, buf); H5Sclose(space); H5Aclose(attr); - + /* attribute 2 */ dims[0] = 10; space = H5Screate_simple(1, dims, NULL); @@ -362,7 +362,7 @@ static void gent_attribute(void) H5Awrite(attr, H5T_NATIVE_INT, data); H5Sclose(space); H5Aclose(attr); - + /* attribute 3 */ dims[0] = 10; space = H5Screate_simple(1, dims, NULL); @@ -373,14 +373,14 @@ static void gent_attribute(void) H5Awrite(attr, H5T_NATIVE_DOUBLE, d); H5Sclose(space); H5Aclose(attr); - + /* attribute 4 */ space = H5Screate(H5S_SCALAR); attr = H5Acreate (root, "attr4", H5T_STD_I32BE, space, H5P_DEFAULT); H5Awrite(attr, H5T_NATIVE_INT, &point); H5Sclose(space); H5Aclose(attr); - + /* attribute 5 */ space = H5Screate(H5S_SCALAR); type = H5Tcopy(H5T_C_S1); @@ -398,7 +398,7 @@ static void gent_attribute(void) static void gent_softlink(void) { hid_t fid, root; - + fid = H5Fcreate(FILE4, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); root = H5Gopen (fid, "/"); H5Glink (root, H5G_LINK_SOFT, "somevalue", "slink1"); @@ -426,9 +426,9 @@ static void gent_hardlink(void) hid_t fid, group, dataset, space; hsize_t dim = 5; int i, dset[5]; - + fid = H5Fcreate(FILE5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + space = H5Screate_simple(1, &dim, NULL); dataset = H5Dcreate(fid, "/dset1", H5T_STD_I32BE, space, H5P_DEFAULT); @@ -437,15 +437,15 @@ static void gent_hardlink(void) H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset); H5Sclose(space); H5Dclose(dataset); - + group = H5Gcreate (fid, "/g1", 0); H5Glink (group, H5G_LINK_HARD, "/dset1", "dset2"); H5Gclose(group); - + group = H5Gcreate (fid, "/g2", 0); H5Glink (group, H5G_LINK_HARD, "/dset1", "dset3"); H5Gclose(group); - + group = H5Gopen(fid, "/g1"); H5Glink (group, H5G_LINK_HARD, "/g2", "g1.1"); H5Gclose(group); @@ -500,12 +500,12 @@ static void gent_compound_dt(void) { /* test compound data type */ hsize_t sdim = 5; hsize_t dset3_dim[2]; - + for (i = 0; i < (int)sdim; i++) { - dset1[i].a = i; + dset1[i].a = i; dset1[i].b = (float)(i*i); dset1[i].c = (float)(1./(i+1)); - + dset2[i].a = i; dset2[i].b = (float)(i+ i*0.1); @@ -522,7 +522,7 @@ static void gent_compound_dt(void) { /* test compound data type */ space = H5Screate_simple(1, &sdim, NULL); type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); - type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0])); + type2 = H5Tcreate(H5T_COMPOUND, sizeof(dset1[0])); H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE); H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE); H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE); @@ -689,10 +689,10 @@ static void gent_compound_dt2(void) { /* test compound data type */ sdim = 10; for (i = 0; i < (int)sdim; i++) { - dset1[i].a = i; + dset1[i].a = i; dset1[i].b = (float)(i*i); dset1[i].c = (float)(1./(i+1)); - + dset2[i].a = i; dset2[i].b = (float)(i+ i*0.1); @@ -716,7 +716,7 @@ static void gent_compound_dt2(void) { /* test compound data type */ space = H5Screate_simple(1, &sdim, &maxdim); type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); - + H5Tinsert(type, "a_name", HOFFSET(dset1_t, a), H5T_STD_I32BE); H5Tinsert(type, "b_name", HOFFSET(dset1_t, b), H5T_IEEE_F32BE); H5Tinsert(type, "c_name", HOFFSET(dset1_t, c), H5T_IEEE_F64BE); @@ -724,7 +724,7 @@ static void gent_compound_dt2(void) { /* test compound data type */ dataset = H5Dcreate(fid, "/dset1", type, space, create_plist); type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); - + H5Tinsert(type2, "a_name", HOFFSET(dset1_t, a), H5T_NATIVE_INT); H5Tinsert(type2, "b_name", HOFFSET(dset1_t, b), H5T_NATIVE_FLOAT); H5Tinsert(type2, "c_name", HOFFSET(dset1_t, c), H5T_NATIVE_DOUBLE); @@ -753,7 +753,7 @@ static void gent_compound_dt2(void) { /* test compound data type */ type2 = H5Tcreate (H5T_COMPOUND, sizeof(dset2_t)); H5Tinsert(type2, "int_name", HOFFSET(dset2_t, a), H5T_NATIVE_INT); - H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT); + H5Tinsert(type2, "float_name", HOFFSET(dset2_t, b), H5T_NATIVE_FLOAT); H5Dwrite(dataset, type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); H5Tclose(type); @@ -940,7 +940,7 @@ float dset2_1[10], dset2_2[3][5]; H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); - + /* dset2.2 */ dims[0] = 3; dims[1] = 5; space = H5Screate_simple(2, dims, NULL); @@ -962,9 +962,9 @@ float dset2_1[10], dset2_2[3][5]; o /___\ g1 o/ \o g2 - \___/ + \___/ + - o - group objects */ @@ -999,7 +999,7 @@ hid_t fid, group; H5Gclose(group); /* create path from object at /g1 to object at /g2 and name it g1.1 */ - H5Glink (fid, H5G_LINK_HARD, "/g2", "/g1/g1.1"); + H5Glink (fid, H5G_LINK_HARD, "/g2", "/g1/g1.1"); /* create path from object at /g2 to object at /g1 and name it g2.1 */ H5Glink (fid, H5G_LINK_SOFT, "/g1", "/g2/g2.1"); @@ -1124,7 +1124,7 @@ static void gent_many(void) { idx[perm[1]] = i1; for (i0 = 0; i0 < 2; i0++) { idx[perm[0]] = i0; - + dset1[j].a[idx[3]][idx[2]][idx[1]][idx[0]] = i0+j; dset1[j].b[idx[3]][idx[2]][idx[1]][idx[0]] = (double)(i0+j); #ifdef WIN32 @@ -1226,18 +1226,18 @@ static void gent_str(void) { hsize_t dims2[]={20}; char string2[20][10] = {"ab cd ef1", "ab cd ef2", "ab cd ef3", "ab cd ef4", - "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", - "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", - "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6", + "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", + "ab cd ef9", "ab cd ef0", "ab cd ef1", "ab cd ef2", + "ab cd ef3", "ab cd ef4", "ab cd ef5", "ab cd ef6", "ab cd ef7", "ab cd ef8", "ab cd ef9", "ab cd ef0"}; hsize_t dims3[] = { 27}; - char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", - "abcd4", "abcd5", "abcd6", "abcd7", - "abcd8", "abcd9", "abcd0", "abcd1", - "abcd2", "abcd3", "abcd4", "abcd5", - "abcd6", "abcd7", "abcd8", "abcd9", - "abcd0", "abcd1", "abcd2", "abcd3", + char string3[27][6] = {"abcd0", "abcd1", "abcd2", "abcd3", + "abcd4", "abcd5", "abcd6", "abcd7", + "abcd8", "abcd9", "abcd0", "abcd1", + "abcd2", "abcd3", "abcd4", "abcd5", + "abcd6", "abcd7", "abcd8", "abcd9", + "abcd0", "abcd1", "abcd2", "abcd3", "abcd4", "abcd5", "abcd6"}; int i, j, k, l; @@ -1337,7 +1337,7 @@ static void gent_str(void) { for (k = 0 ; k < 12; k++) strcpy(comp1[i][j].s[k], "abcdefgh12345678abcdefgh12345678"); } - + dataset = H5Dcreate(fid, "/comp1", f_type, space, H5P_DEFAULT); H5Dwrite(dataset, f_type2, H5S_ALL, H5S_ALL, H5P_DEFAULT, comp1); @@ -1353,8 +1353,8 @@ static void gent_str(void) { / / / | \ \ \ g1 g2 g3 g4 g5 g6 - | | | | \ \ - string1 string3 string5 + | | | | \ \ + string1 string3 string5 string2 string4 string6 */ @@ -1637,7 +1637,7 @@ static void gent_objref(void) /* Close disk dataspace */ H5Sclose(sid1); - + /* Close Dataset */ H5Dclose(dataset); @@ -1741,13 +1741,13 @@ static void gent_datareg(void) /* Close disk dataspace */ H5Sclose(sid1); - + /* Close Dataset */ H5Dclose(dset1); /* Close uint8 dataset dataspace */ H5Sclose(sid2); - + /* Close file */ H5Fclose(fid1); @@ -1771,8 +1771,8 @@ static void gent_nestcomp(void) typedef struct s1_t { int a; float b; - double c; - cmp_t d; + double c; + cmp_t d; } s2_t; hid_t cmp_tid; /* Handle for the compound datatype */ hid_t char_id; /* Handle for the string datatype */ @@ -1814,16 +1814,16 @@ static void gent_nestcomp(void) file = H5Fcreate(FILE18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* - * Create the memory data type. + * Create the memory data type. */ - /* + /* * Create a datatype for compound field first. */ cmp_tid = H5Tcreate (H5T_COMPOUND, sizeof(cmp_t)); /* We are using C string of length one to represent "real" character */ char_id = H5Tcopy(H5T_C_S1); - H5Tset_strpad(char_id, H5T_STR_NULLTERM); + H5Tset_strpad(char_id, H5T_STR_NULLTERM); H5Tinsert(cmp_tid, "char_name", HOFFSET(cmp_t, a), char_id); array_dt=H5Tarray_create(H5T_NATIVE_FLOAT,ndims,array_dims,NULL); @@ -1838,13 +1838,13 @@ static void gent_nestcomp(void) /* Insert compound memeber created above */ H5Tinsert(s2_tid, "d_name", HOFFSET(s2_t, d), cmp_tid); - /* + /* * Create the dataset. */ dataset = H5Dcreate(file, datasetname, s2_tid, space, H5P_DEFAULT); /* - * Wtite data to the dataset; + * Wtite data to the dataset; */ status = H5Dwrite(dataset, s2_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, s1); if (status < 0) @@ -1872,7 +1872,7 @@ static void gent_opaque(void) test[x][0] = x; test[x][1] = 99 - x; } - + /* * Create the data space. */ @@ -1884,25 +1884,25 @@ static void gent_opaque(void) file = H5Fcreate(FILE19, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* - * Create the memory datatype. + * Create the memory datatype. */ type = H5Tcreate (H5T_OPAQUE, sizeof(char)*100*2); H5Tset_tag(type, "test opaque type"); - /* + /* * Create the dataset. */ dataset = H5Dcreate(file, "opaque test", type, space, H5P_DEFAULT); /* - * Write data to the dataset; + * Write data to the dataset; */ H5Dwrite(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, test); H5Tclose(type); H5Sclose(space); H5Dclose(dataset); - H5Fclose(file); + H5Fclose(file); } static void gent_bitfields(void) @@ -1913,7 +1913,7 @@ static void gent_bitfields(void) unsigned char buf[32]; file = H5Fcreate(FILE20, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + if ((grp=H5Gcreate(file, "typetests", 0))<0) goto error; /* bitfield_1 */ @@ -1963,7 +1963,7 @@ static void gent_vldatatypes(void) herr_t ret=0; file = H5Fcreate(FILE21, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + /* Allocate and initialize VL dataset to write */ for(i = 0; i < SPACE1_DIM1; i++) { int j; @@ -2254,8 +2254,8 @@ static void gent_vldatatypes4(void) static void gent_vldatatypes5(void) { hvl_t wdata [SPACE1_DIM1]; - hid_t fid1; - hid_t dataset; + hid_t fid1; + hid_t dataset; hid_t sid1; hid_t tid1; hsize_t dims1[] = {SPACE1_DIM1}; @@ -2791,9 +2791,9 @@ static void gent_empty(void) static void gent_group_comments(void) { hid_t fid, group; - + fid = H5Fcreate(FILE33, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + /* / */ group = H5Gcreate (fid, "/g1", 0); H5Gset_comment(group, "/g1", "Comment for group /g1"); @@ -2804,7 +2804,7 @@ static void gent_group_comments(void) group = H5Gcreate (fid, "/g3", 0); H5Gset_comment(group, "/g3", "Comment for group /g3"); H5Gclose(group); - + /* /g1 */ group = H5Gcreate (fid, "/g1/g1.1", 0); H5Gset_comment(group, "/g1/g1.1", "Comment for group /g1/g1.1"); @@ -2812,12 +2812,12 @@ static void gent_group_comments(void) group = H5Gcreate (fid, "/g1/g1.2", 0); H5Gset_comment(group, "/g1/g1.2", "Comment for group /g1/g1.2"); H5Gclose(group); - + /* /g2 */ group = H5Gcreate (fid, "/g2/g2.1", 0); H5Gset_comment(group, "/g2/g2.1", "Comment for group /g2/g2.1"); H5Gclose(group); - + /* /g3 */ group = H5Gcreate (fid, "/g3/g3.1", 0); H5Gset_comment(group, "/g3/g3.1", "Comment for group /g3/g3.1"); @@ -2831,7 +2831,7 @@ static void gent_group_comments(void) group = H5Gcreate (fid, "/g3/g3.4", 0); H5Gset_comment(group, "/g3/g3.4", "Comment for group /g3/g3.4"); H5Gclose(group); - + /* /g2/g2.1 */ group = H5Gcreate (fid, "/g2/g2.1/g2.1.1", 0); H5Gset_comment(group, "/g2/g2.1/g2.1.1", "Comment for group /g2/g2.1/g2.1.1"); @@ -2842,7 +2842,7 @@ static void gent_group_comments(void) group = H5Gcreate (fid, "/g2/g2.1/g2.1.3", 0); H5Gset_comment(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3"); H5Gclose(group); - + H5Fclose(fid); } @@ -2979,7 +2979,7 @@ static void gent_large_objname(void) hid_t fid, group, group2; char grp_name[128]; register int i; - + fid = H5Fcreate(FILE37, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); group = H5Gcreate(fid, "this_is_a_large_group_name", 0); @@ -3080,7 +3080,7 @@ static void gent_char(void) /*------------------------------------------------------------------------- * Function: write_attr_in * - * Purpose: write attributes in LOC_ID (dataset, group, named datatype) + * Purpose: write attributes in LOC_ID (dataset, group, named datatype) * * Return: void * @@ -3091,26 +3091,26 @@ static void gent_char(void) *------------------------------------------------------------------------- */ -static void write_attr_in(hid_t loc_id, +static void write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id) { /* Compound datatype */ - typedef struct s_t + typedef struct s_t { char a; double b; } s_t; - typedef enum + typedef enum { E_RED, E_GREEN } e_t; hid_t attr_id; - hid_t space_id; - hid_t type_id; + hid_t space_id; + hid_t type_id; herr_t status; int val, i, j, k, n; float f; @@ -3156,7 +3156,7 @@ static void write_attr_in(hid_t loc_id, * 1D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -3192,7 +3192,7 @@ static void write_attr_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3219,7 +3219,7 @@ static void write_attr_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; @@ -3297,7 +3297,7 @@ static void write_attr_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3339,7 +3339,7 @@ static void write_attr_in(hid_t loc_id, ((int *)buf52[i][j].p)[l] = n++; } } - + space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); attr_id = H5Acreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT); @@ -3366,7 +3366,7 @@ static void write_attr_in(hid_t loc_id, write_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); write_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- * 3D attributes *------------------------------------------------------------------------- @@ -3426,7 +3426,7 @@ static void write_attr_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_attr(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3457,7 +3457,7 @@ static void write_attr_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) { @@ -3471,7 +3471,7 @@ static void write_attr_in(hid_t loc_id, } } } - + space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); attr_id = H5Acreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT); @@ -3520,7 +3520,7 @@ static void write_attr_in(hid_t loc_id, /*------------------------------------------------------------------------- * Function: write_dset_in * - * Purpose: write datasets in LOC_ID + * Purpose: write datasets in LOC_ID * * Return: void * @@ -3531,26 +3531,26 @@ static void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ -static void write_dset_in(hid_t loc_id, +static void write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id) { /* Compound datatype */ - typedef struct s_t + typedef struct s_t { char a; double b; } s_t; - typedef enum + typedef enum { E_RED, E_GREEN } e_t; hid_t dset_id; - hid_t space_id; - hid_t type_id; + hid_t space_id; + hid_t type_id; hid_t plist_id; herr_t status; int val, i, j, k, n; @@ -3595,10 +3595,10 @@ static void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- - * 1D + * 1D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -3634,7 +3634,7 @@ static void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3661,7 +3661,7 @@ static void write_dset_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; @@ -3700,7 +3700,7 @@ static void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- - * 2D + * 2D *------------------------------------------------------------------------- */ @@ -3739,7 +3739,7 @@ static void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3781,7 +3781,7 @@ static void write_dset_in(hid_t loc_id, ((int *)buf52[i][j].p)[l] = n++; } } - + space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); dset_id = H5Dcreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT); @@ -3821,9 +3821,9 @@ static void write_dset_in(hid_t loc_id, write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- - * 3D + * 3D *------------------------------------------------------------------------- */ @@ -3881,7 +3881,7 @@ static void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -3912,7 +3912,7 @@ static void write_dset_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) { @@ -3926,7 +3926,7 @@ static void write_dset_in(hid_t loc_id, } } } - + space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); dset_id = H5Dcreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT); @@ -3976,7 +3976,7 @@ static void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- * Function: gent_attr_all * - * Purpose: generate all datatype attributes + * Purpose: generate all datatype attributes * * Return: void * @@ -3989,7 +3989,7 @@ static void write_dset_in(hid_t loc_id, static void gent_attr_all(void) { - hid_t file_id; + hid_t file_id; hid_t dset_id; hid_t group_id; hid_t group2_id; @@ -3999,7 +3999,7 @@ static void gent_attr_all(void) herr_t status; /* Create a file and a dataset */ - file_id = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + file_id = H5Fcreate(FILE40, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /* Create a 1D dataset */ space_id = H5Screate_simple(1,dims,NULL); @@ -4056,12 +4056,12 @@ static void gent_attr_all(void) *------------------------------------------------------------------------- */ -static +static int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, hid_t type_id, void *buf) { hid_t attr_id; - hid_t space_id; + hid_t space_id; herr_t status; /* Create a buf space */ @@ -4069,7 +4069,7 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, /* Create the attribute */ attr_id = H5Acreate(loc_id,attr_name,type_id,space_id,H5P_DEFAULT); - + /* Write the buf */ if ( buf ) status = H5Awrite(attr_id,type_id,buf); @@ -4085,7 +4085,7 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name, * * Purpose: utility function to create and write a dataset in LOC_ID * - * Return: + * Return: * * Programmer: pvn@ncsa.uiuc.edu * @@ -4099,7 +4099,7 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, hid_t type_id, void *buf ) { hid_t dset_id; - hid_t space_id; + hid_t space_id; herr_t status; /* Create a buf space */ @@ -4107,7 +4107,7 @@ int write_dset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name, /* Create a dataset */ dset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT); - + /* Write the buf */ if ( buf ) status = H5Dwrite(dset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); @@ -4159,7 +4159,7 @@ static void gent_compound_complex(void) hsize_t array_dimb[] = {F41_DIMb}; /* Array dimensions */ hsize_t array_dimd[]={F41_ARRAY_DIMd1,F41_ARRAY_DIMd2}; /* Array dimensions */ hsize_t array_dimf[]={F41_ARRAY_DIMf}; /* Array dimensions */ - hid_t str_array_id; + hid_t str_array_id; int m, n, o; /* Array init loop vars */ @@ -4373,10 +4373,10 @@ static void gent_null_space(void) hid_t fid, root, dataset, space, attr; int dset_buf = 10; int point = 4; - + fid = H5Fcreate(FILE45, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); root = H5Gopen (fid, "/"); - + /* null space */ space = H5Screate(H5S_NULL); @@ -4405,7 +4405,7 @@ static void gent_null_space(void) * *------------------------------------------------------------------------- */ -static +static int make_dset(hid_t loc_id, const char *name, hid_t sid, @@ -4454,7 +4454,7 @@ make_external(hid_t fid) hsize_t max_size[1]; /*data space maximum size */ hsize_t size; /*bytes reserved for data in the external file*/ int ret; - + cur_size[0] = max_size[0] = 100; size = (max_size[0]*sizeof(int)/2); @@ -4508,11 +4508,11 @@ static void gent_filters(void) buf1[i][j]=n++; } } - + /* create a file */ fid = H5Fcreate(FILE44, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); assert(fid>=0); - + /* create a space */ sid = H5Screate_simple(SPACE2_RANK, dims1, NULL); @@ -4715,7 +4715,7 @@ static void gent_filters(void) ret=make_dset(fid,"all",sid,H5T_NATIVE_INT,dcpl,buf1); assert(ret>=0); - + /*------------------------------------------------------------------------- * user defined filter *------------------------------------------------------------------------- @@ -4726,9 +4726,9 @@ static void gent_filters(void) #ifdef H5_WANT_H5_V1_4_COMPAT ret=H5Zregister (MYFILTER_ID, "myfilter", myfilter); -#else +#else ret=H5Zregister (H5Z_MYFILTER); -#endif +#endif assert(ret>=0); ret=H5Pset_filter (dcpl, MYFILTER_ID, 0, 0, NULL); @@ -4748,7 +4748,7 @@ static void gent_filters(void) make_external(fid); /*------------------------------------------------------------------------- - * H5D_ALLOC_TIME_EARLY + * H5D_ALLOC_TIME_EARLY *------------------------------------------------------------------------- */ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY); @@ -4757,7 +4757,7 @@ static void gent_filters(void) assert(ret>=0); /*------------------------------------------------------------------------- - * H5D_ALLOC_TIME_INCR + * H5D_ALLOC_TIME_INCR *------------------------------------------------------------------------- */ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR); @@ -4766,7 +4766,7 @@ static void gent_filters(void) assert(ret>=0); /*------------------------------------------------------------------------- - * H5D_ALLOC_TIME_LATE + * H5D_ALLOC_TIME_LATE *------------------------------------------------------------------------- */ ret=H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); @@ -4787,14 +4787,14 @@ static void gent_filters(void) ret=H5Tclose(tid); assert(ret>=0); - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ ret=H5Sclose(sid); assert(ret>=0); - + ret=H5Pclose(dcpl); assert(ret>=0); @@ -4811,7 +4811,7 @@ static void gent_filters(void) *------------------------------------------------------------------------- */ static size_t -myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, +myfilter(unsigned int UNUSED flags, size_t UNUSED cd_nelmts, const unsigned int UNUSED *cd_values, size_t nbytes, size_t UNUSED *buf_size, void UNUSED **buf) { @@ -4833,7 +4833,7 @@ set_local_myfilter(hid_t dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) unsigned flags; /* Filter flags */ size_t cd_nelmts=0; /* Number of filter parameters */ unsigned cd_values[2]={5,6}; /* Filter parameters */ - + /* Get the filter's current parameters */ #ifdef H5_WANT_H5_V1_6_COMPAT if(H5Pget_filter_by_id(dcpl_id,MYFILTER_ID,&flags,&cd_nelmts,cd_values,0,NULL)<0) @@ -4842,12 +4842,12 @@ set_local_myfilter(hid_t dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) #endif /* H5_WANT_H5_V1_6_COMPAT */ return(FAIL); - cd_nelmts=2; - + cd_nelmts=2; + /* Modify the filter's parameters for this dataset */ if(H5Pmodify_filter(dcpl_id,MYFILTER_ID,flags, cd_nelmts,cd_values)<0) return(FAIL); - + return(SUCCEED); } @@ -4972,7 +4972,7 @@ static void gent_fcontents(void) static void gent_fvalues(void) { /* compound datatype */ - typedef struct c_t + typedef struct c_t { char a; double b; @@ -4998,7 +4998,7 @@ static void gent_fvalues(void) /* create a file */ fid = H5Fcreate(FILE48, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); assert(fid>=0); - + /* create a space */ sid = H5Screate_simple(1, dims, NULL); @@ -5041,7 +5041,7 @@ static void gent_fvalues(void) ret=H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval1); assert(ret>=0); - + ret=make_dset(fid,"fill_time_alloc",sid,H5T_NATIVE_INT,dcpl,buf); assert(ret>=0); @@ -5072,7 +5072,7 @@ static void gent_fvalues(void) assert(ret>=0); /*------------------------------------------------------------------------- - * dataset with a H5T_VLEN fill value + * dataset with a H5T_VLEN fill value *------------------------------------------------------------------------- */ buf3[0].len = 1; @@ -5085,7 +5085,7 @@ static void gent_fvalues(void) tid = H5Tvlen_create(H5T_NATIVE_INT); dcpl = H5Pcreate(H5P_DATASET_CREATE); - + fillval3.p=NULL; fillval3.len=0; ret = H5Pset_fill_value(dcpl, tid, &fillval3); assert(ret>=0); @@ -5101,7 +5101,7 @@ static void gent_fvalues(void) assert(ret>=0); /*------------------------------------------------------------------------- - * dataset with a H5T_ARRAY fill value + * dataset with a H5T_ARRAY fill value *------------------------------------------------------------------------- */ tid = H5Tarray_create(H5T_NATIVE_INT,1,dimarray,NULL); @@ -5130,7 +5130,7 @@ static void gent_fvalues(void) static void gent_string(void) { /* compound datatype */ - typedef struct c_t + typedef struct c_t { int a; char str[255]; @@ -5147,7 +5147,7 @@ static void gent_string(void) "conceived in liberty\n and dedicated to the proposition that all men are created equal.", "Now we are engaged\n in a great civil war,", "testing whether that\n nation or any nation so conceived and so dedicated can long endure." - }; + }; c_t buf3 = {24, "Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; char buf4[] = {"Four score and seven\n years ago our forefathers brought forth on this continent a new nation"}; hsize_t dims1[] = {1}; @@ -5281,7 +5281,7 @@ static void gent_aindices(void) buf5 = malloc(32 * 4097 * sizeof(double) ); for (i = 0; i < 32 * 4097; i++) buf5[i] = 1; - + /* create a file */ fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); assert(fid>=0); @@ -5312,7 +5312,7 @@ static void gent_aindices(void) write_dset(gid[5],4,dims4,"4d",H5T_NATIVE_INT,buf4); for (i=0; i<6; i++) H5Gclose(gid[i]); - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index b24aa84..79c249b 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -21,7 +21,7 @@ #include <ctype.h> #include "h5import.h" -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { struct Options opt; int outfile_named = FALSE; @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) const char *err7 = "Invalid type of data - %s.\n"; const char *err8 = "Invalid size of data - %s.\n"; const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n"; - + (void) setvbuf(stderr, (char *) NULL, _IOLBF, 0); (void) setvbuf(stdout, (char *) NULL, _IOLBF, 0); @@ -50,7 +50,7 @@ int main(int argc, char *argv[]) /* * validate the number of command line arguments */ - + if (argc < 2) { (void) fprintf(stderr, err1, argc); @@ -72,25 +72,25 @@ int main(int argc, char *argv[]) usage(argv[0]); goto err; } - + state = state_table[state][token]; switch (state) { - - case 1: /* counting input files */ - if (opt.fcount < 29) { + + case 1: /* counting input files */ + if (opt.fcount < 29) { (void) HDstrcpy(opt.infiles[opt.fcount].datafile, argv[i]); in = &(opt.infiles[opt.fcount].in); opt.infiles[opt.fcount].config = 0; - setDefaultValues(in, opt.fcount); + setDefaultValues(in, opt.fcount); opt.fcount++; } else { (void) fprintf(stderr, err9, argv[i]); goto err; } - + break; case 2: /* -c found; look for configfile */ @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) (void) fprintf(stderr, err8, argv[i]); goto err; } - /*set default value for output-size */ + /*set default value for output-size */ in->outputSize = in->inputSize; break; @@ -181,11 +181,11 @@ int main(int argc, char *argv[]) usage(argv[0]); goto err; } - + if (process(&opt) == -1) goto err; - return(0); + return(0); err: (void) fprintf(stderr, err4); return(-1); @@ -212,38 +212,38 @@ gtoken(char *s) if (!HDstrncmp("outfile", &s[1], len)) token = OPT_o; break; - + case 'c': if (!HDstrncmp("config", &s[1], len)) token = OPT_c; break; - + case 'h': if (!HDstrncmp("help", &s[1], len)) token = OPT_h; - break; + break; case 'd': if (!HDstrncmp("dims", &s[1], len)) token = OPT_d; - break; + break; case 'p': if (!HDstrncmp("path", &s[1], len)) token = OPT_p; - break; + break; case 't': if (!HDstrncmp("type", &s[1], len)) token = OPT_t; - break; + break; case 's': if (!HDstrncmp("size", &s[1], len)) token = OPT_s; - break; + break; } - + if (token == ERR) (void) fprintf(stderr, err1, s); } @@ -254,7 +254,7 @@ gtoken(char *s) return (token); } -static int +static int processDataFile(char *infile, struct Input *in, FILE **strm) { const char *err1 = "Unable to open the input file %s for reading.\n"; @@ -262,8 +262,8 @@ processDataFile(char *infile, struct Input *in, FILE **strm) const char *err3 = "Error in allocating floating-point data storage.\n"; const char *err4 = "Error in reading integer data.\n"; const char *err5 = "Error in reading floating-point data.\n"; - const char *err6 = "Error in allocating unsigned integer data storage.\n"; - const char *err7 = "Error in reading unsigned integer data.\n"; + const char *err6 = "Error in allocating unsigned integer data storage.\n"; + const char *err7 = "Error in reading unsigned integer data.\n"; const char *err10 = "Unrecognized input class type.\n"; if ((*strm = fopen(infile, "r")) == NULL) @@ -279,33 +279,33 @@ processDataFile(char *infile, struct Input *in, FILE **strm) if (allocateIntegerStorage(in) == -1) { (void) fprintf(stderr, err2, infile); - return(-1); + return(-1); } if (readIntegerData(strm, in) == -1) { (void) fprintf(stderr, err4, infile); - return(-1); + return(-1); } break; case 1: /* TEXTFP */ case 2: /* TEXTFPE */ - case 3: /* FP */ + case 3: /* FP */ if (allocateFloatStorage(in) == -1) { (void) fprintf(stderr, err3, infile); - return(-1); + return(-1); } - + if (readFloatData(strm, in) == -1) { (void) fprintf(stderr, err5, infile); - return(-1); + return(-1); } break; - + case 5: /* STR */ break; @@ -314,15 +314,15 @@ processDataFile(char *infile, struct Input *in, FILE **strm) if (allocateUIntegerStorage(in) == -1) { (void) fprintf(stderr, err6, infile); - return(-1); + return(-1); } if (readUIntegerData(strm, in) == -1) { (void) fprintf(stderr, err7, infile); - return(-1); + return(-1); } break; - + default: (void) fprintf(stderr, err10); return(-1); @@ -330,7 +330,7 @@ processDataFile(char *infile, struct Input *in, FILE **strm) return (0); } -static int +static int readIntegerData(FILE **strm, struct Input *in) { H5DT_INT8 *in08; @@ -346,7 +346,7 @@ readIntegerData(FILE **strm, struct Input *in) const char *err1 = "Unable to get integer value from file.\n"; const char *err2 = "Unrecongnized input class type.\n"; - const char *err3 = "Invalid input size.\n"; + const char *err3 = "Invalid input size.\n"; for (j=0; j<in->rank;j++) len *= in->sizeOfDimension[j]; @@ -357,38 +357,38 @@ readIntegerData(FILE **strm, struct Input *in) switch(in->inputClass) { case 0: /* TEXTIN */ - in08 = (H5DT_INT8 *) in->data; + in08 = (H5DT_INT8 *) in->data; for (i = 0; i < len; i++, in08++) - { + { if (fscanf(*strm, "%hd", &temp) != 1) { (void) fprintf(stderr, err1); return (-1); } (*in08) = (H5DT_INT8)temp; - } + } break; case 4: /* IN */ - in08 = (H5DT_INT8 *) in->data; + in08 = (H5DT_INT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (fread((char *) in08, sizeof(H5DT_INT8), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 16: - in16 = (H5DT_INT16 *) in->data; + in16 = (H5DT_INT16 *) in->data; switch(in->inputClass) { case 0: /* TEXTIN */ @@ -407,21 +407,21 @@ readIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in16++) { if (fread((char *) in16, sizeof(H5DT_INT16), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 32: - in32 = (H5DT_INT32 *) in->data; + in32 = (H5DT_INT32 *) in->data; switch(in->inputClass) { case 0: /* TEXTIN */ @@ -439,13 +439,13 @@ readIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in32++) { if (fread((char *) in32, sizeof(H5DT_INT32), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -454,7 +454,7 @@ readIntegerData(FILE **strm, struct Input *in) #ifndef WIN32 case 64: - in64 = (H5DT_INT64 *) in->data; + in64 = (H5DT_INT64 *) in->data; switch(in->inputClass) { case 0: /* TEXTIN */ @@ -464,7 +464,7 @@ readIntegerData(FILE **strm, struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } *in64 = (H5DT_INT64) HDstrtoll(buffer, NULL, 10); } break; @@ -473,20 +473,20 @@ readIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in64++) { if (fread((char *) in64, sizeof(H5DT_INT64), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; -#endif /* ifndef WIN32 */ - +#endif /* ifndef WIN32 */ + default: (void) fprintf(stderr, err3); break; @@ -494,13 +494,13 @@ readIntegerData(FILE **strm, struct Input *in) return(0); } -static int +static int readUIntegerData(FILE **strm, struct Input *in) { H5DT_UINT8 *in08; H5DT_UINT16 *in16, temp; H5DT_UINT32 *in32; -#ifndef WIN32 +#ifndef WIN32 H5DT_UINT64 *in64; char buffer[256]; #endif @@ -520,38 +520,38 @@ readUIntegerData(FILE **strm, struct Input *in) switch(in->inputClass) { case 6: /* TEXTUIN */ - in08 = (H5DT_UINT8 *) in->data; + in08 = (H5DT_UINT8 *) in->data; for (i = 0; i < len; i++, in08++) - { + { if (fscanf(*strm, "%hu", &temp) != 1) { (void) fprintf(stderr, err1); return (-1); } (*in08) = (H5DT_UINT8)temp; - } + } break; case 7: /* UIN */ - in08 = (H5DT_UINT8 *) in->data; + in08 = (H5DT_UINT8 *) in->data; for (i = 0; i < len; i++, in08++) { if (fread((char *) in08, sizeof(H5DT_UINT8), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 16: - in16 = (H5DT_UINT16 *) in->data; + in16 = (H5DT_UINT16 *) in->data; switch(in->inputClass) { case 6: /* TEXTUIN */ @@ -569,21 +569,21 @@ readUIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in16++) { if (fread((char *) in16, sizeof(H5DT_UINT16), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; - + case 32: - in32 = (H5DT_UINT32 *) in->data; + in32 = (H5DT_UINT32 *) in->data; switch(in->inputClass) { case 6: /* TEXTUIN */ @@ -601,13 +601,13 @@ readUIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in32++) { if (fread((char *) in32, sizeof(H5DT_UINT32), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -616,7 +616,7 @@ readUIntegerData(FILE **strm, struct Input *in) #ifndef WIN32 case 64: - in64 = (H5DT_UINT64 *) in->data; + in64 = (H5DT_UINT64 *) in->data; switch(in->inputClass) { case 6: /* TEXTUIN */ @@ -626,7 +626,7 @@ readUIntegerData(FILE **strm, struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } *in64 = (H5DT_UINT64) HDstrtoll(buffer, NULL, 10); } break; @@ -635,20 +635,20 @@ readUIntegerData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, in64++) { if (fread((char *) in64, sizeof(H5DT_UINT64), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); } break; #endif /* ifndef WIN32 */ - + default: (void) fprintf(stderr, err3); break; @@ -656,7 +656,7 @@ readUIntegerData(FILE **strm, struct Input *in) return(0); } -static int +static int readFloatData(FILE **strm, struct Input *in) { H5DT_FLOAT32 *fp32; @@ -675,7 +675,7 @@ readFloatData(FILE **strm, struct Input *in) switch(in->inputSize) { case 32: - fp32 = (H5DT_FLOAT32 *) in->data; + fp32 = (H5DT_FLOAT32 *) in->data; switch(in->inputClass) { case 1: /* TEXTFP */ @@ -698,13 +698,13 @@ readFloatData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, fp32++) { if (fread((char *) fp32, sizeof(H5DT_FLOAT32), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -712,7 +712,7 @@ readFloatData(FILE **strm, struct Input *in) break; case 64: - fp64 = (H5DT_FLOAT64 *) in->data; + fp64 = (H5DT_FLOAT64 *) in->data; switch(in->inputClass) { case 1: /* TEXTFP */ @@ -735,13 +735,13 @@ readFloatData(FILE **strm, struct Input *in) for (i = 0; i < len; i++, fp64++) { if (fread((char *) fp64, sizeof(H5DT_FLOAT64), 1, *strm) != 1) - { + { (void) fprintf(stderr, err1); return (-1); - } + } } break; - + default: (void) fprintf(stderr, err2); return (-1); @@ -755,7 +755,7 @@ readFloatData(FILE **strm, struct Input *in) return(0); } -static int +static int allocateIntegerStorage(struct Input *in) { hsize_t len=1; @@ -775,7 +775,7 @@ allocateIntegerStorage(struct Input *in) return (-1); } break; - + case 16: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT16))) == NULL) { @@ -783,13 +783,13 @@ allocateIntegerStorage(struct Input *in) return (-1); } break; - + case 32: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_INT32))) == NULL) { (void) fprintf(stderr, err1); return (-1); - } + } break; case 64: @@ -797,9 +797,9 @@ allocateIntegerStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; - + default: (void) fprintf(stderr, err2); break; @@ -826,7 +826,7 @@ static int allocateUIntegerStorage(struct Input *in) return (-1); } break; - + case 16: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT16))) == NULL) { @@ -834,13 +834,13 @@ static int allocateUIntegerStorage(struct Input *in) return (-1); } break; - + case 32: if ((in->data = (VOIDP) HDmalloc((size_t) len * sizeof(H5DT_UINT32))) == NULL) { (void) fprintf(stderr, err1); return (-1); - } + } break; case 64: @@ -848,24 +848,24 @@ static int allocateUIntegerStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; - + default: (void) fprintf(stderr, err2); break; } - return(0); + return(0); } -static int +static int allocateFloatStorage(struct Input *in) { hsize_t len = 1; int j; const char *err1 = "Unable to allocate dynamic memory.\n"; const char *err2 = "Invalid storage size for float input data.\n"; - + for (j=0; j<in->rank;j++) len *= in->sizeOfDimension[j]; @@ -876,7 +876,7 @@ allocateFloatStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; case 64: @@ -884,9 +884,9 @@ allocateFloatStorage(struct Input *in) { (void) fprintf(stderr, err1); return (-1); - } + } break; - + default: (void) fprintf(stderr, err2); break; @@ -894,52 +894,52 @@ allocateFloatStorage(struct Input *in) return(0); } -static int +static int processConfigurationFile(char *infile, struct Input *in, FILE **strm) { char key[255]; int kindex; char temp[255]; int ival; - + const char *err1 = "Unable to open the configuration file: %s for reading.\n"; const char *err2 = "Unknown keyword in configuration file: %s\n"; const char *err3a = "PATH keyword appears twice in %s.\n"; const char *err3b = "Error in parsing the path information from %s.\n"; - const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n"; + const char *err4a = "INPUT-CLASS keyword appears twice in %s.\n"; const char *err4b = "Error in retrieving the input class from %s.\n"; - const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n"; + const char *err5a = "INPUT-SIZE keyword appears twice in %s.\n"; const char *err5b = "Error in retrieving the input size from %s.\n"; - const char *err6a = "RANK keyword appears twice in %s.\n"; + const char *err6a = "RANK keyword appears twice in %s.\n"; const char *err6b = "Error in retrieving the rank from %s.\n"; - const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n"; - const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n"; - const char *err7c = "Error in retrieving the dimension sizes from %s.\n"; - const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n"; + const char *err7a = "DIMENSION-SIZES keyword appears twice in %s.\n"; + const char *err7b = "DIMENSION-SIZES cannot appear before RANK is provided.\n"; + const char *err7c = "Error in retrieving the dimension sizes from %s.\n"; + const char *err8a = "OUTPUT-CLASS keyword appears twice in %s.\n"; const char *err8b = "Error in retrieving the output class from %s.\n"; - const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n"; + const char *err9a = "OUTPUT-SIZE keyword appears twice in %s.\n"; const char *err9b = "Error in retrieving the output size from %s.\n"; - const char *err10a = "OUTPUT-ARCHITECTURE keyword appears twice in %s.\n"; + const char *err10a = "OUTPUT-ARCHITECTURE keyword appears twice in %s.\n"; const char *err10b = "Error in retrieving the output architecture from %s.\n"; - const char *err11a = "OUTPUT-BYTE-ORDER keyword appears twice in %s.\n"; + const char *err11a = "OUTPUT-BYTE-ORDER keyword appears twice in %s.\n"; const char *err11b = "Error in retrieving the output byte order from %s.\n"; - const char *err12a = "CHUNKED-DIMENSION-SIZES keyword appears twice in %s.\n"; - const char *err12b = "CHUNKED-DIMENSION-SIZES cannot appear before DIMENSION-SIZES are provided.\n"; - const char *err12c = "Error in retrieving the chunked dimension sizes from %s.\n"; - const char *err13a = "COMPRESSION-TYPE keyword appears twice in %s.\n"; + const char *err12a = "CHUNKED-DIMENSION-SIZES keyword appears twice in %s.\n"; + const char *err12b = "CHUNKED-DIMENSION-SIZES cannot appear before DIMENSION-SIZES are provided.\n"; + const char *err12c = "Error in retrieving the chunked dimension sizes from %s.\n"; + const char *err13a = "COMPRESSION-TYPE keyword appears twice in %s.\n"; const char *err13b = "Error in retrieving the compression type from %s.\n"; - const char *err14a = "COMPRESSION-PARAM keyword appears twice in %s.\n"; + const char *err14a = "COMPRESSION-PARAM keyword appears twice in %s.\n"; const char *err14b = "Error in retrieving the compression parameter from %s.\n"; - const char *err15a = "EXTERNAL-STORAGE keyword appears twice in %s.\n"; + const char *err15a = "EXTERNAL-STORAGE keyword appears twice in %s.\n"; const char *err15b = "Error in retrieving the external storage paramters from %s.\n"; const char *err16a = "MAXIMUM-DIMENSIONS keyword appears twice in %s.\n"; - const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n"; + const char *err16b = "MAXIMUM-DIMENSIONS cannot appear before DIMENSION-SIZES are provided.\n"; const char *err16c = "Error in retrieving the maximum dimension sizes from %s.\n"; const char *err17 = "Configuration parameters are invalid in %s.\n"; const char *err18 = "Unable to get string value.\n"; const char *err19 = "Unable to get integer value.\n"; - /* create vector to map which keywords have been found + /* create vector to map which keywords have been found check vector after each keyword to check for violation at the end check vector to see if required fields have been provided process the output file according to the options @@ -950,7 +950,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) (void) fprintf(stderr, err1, infile); return (-1); } - + while (fscanf(*strm, "%s", key) == 1) { if ((kindex = mapKeywordToIndex(key)) == -1) @@ -964,17 +964,17 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[PATH] == 1) { (void) fprintf(stderr, err3a, infile); - return (-1); + return (-1); } if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err18); - return (-1); - } + return (-1); + } if (parsePathInfo(&in->path, temp) == -1) { (void) fprintf(stderr, err3b, infile); - return (-1); + return (-1); } in->configOptionVector[PATH] = 1; break; @@ -983,7 +983,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[INPUT_CLASS] == 1) { (void) fprintf(stderr, err4a, infile); - return (-1); + return (-1); } if (fscanf(*strm, "%s", temp) != 1) @@ -994,7 +994,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (getInputClass(in, temp) == -1) { (void) fprintf(stderr, err4b, infile); - return (-1); + return (-1); } in->configOptionVector[INPUT_CLASS] = 1; @@ -1015,7 +1015,7 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[INPUT_SIZE] == 1) { (void) fprintf(stderr, err5a, infile); - return (-1); + return (-1); } if (fscanf(*strm, "%d", (&ival)) != 1) { @@ -1025,11 +1025,11 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (getInputSize(in, ival) == -1) { (void) fprintf(stderr, err5b, infile); - return (-1); + return (-1); } in->configOptionVector[INPUT_SIZE] = 1; - - /*set default value for output-size */ + + /*set default value for output-size */ if (in->configOptionVector[OUTPUT_SIZE] == 0) in->outputSize = in->inputSize; break; @@ -1038,13 +1038,13 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[RANK] == 1) { (void) fprintf(stderr, err6a, infile); - return (-1); + return (-1); } if (getRank(in, strm) == -1) { (void) fprintf(stderr, err6b, infile); - return (-1); + return (-1); } in->configOptionVector[RANK] = 1; break; @@ -1053,18 +1053,18 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[DIM] == 1) { (void) fprintf(stderr, err7a, infile); - return (-1); + return (-1); } if (in->configOptionVector[RANK] == 0) { (void) fprintf(stderr, err7b, infile); - return (-1); - } + return (-1); + } if (getDimensionSizes(in, strm) == -1) { (void) fprintf(stderr, err7c, infile); - return (-1); + return (-1); } in->configOptionVector[DIM] = 1; break; @@ -1073,13 +1073,13 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_CLASS] == 1) { (void) fprintf(stderr, err8a, infile); - return (-1); + return (-1); } if (getOutputClass(in, strm) == -1) { (void) fprintf(stderr, err8b, infile); - return (-1); + return (-1); } in->configOptionVector[OUTPUT_CLASS] = 1; break; @@ -1088,14 +1088,14 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_SIZE] == 1) { (void) fprintf(stderr, err9a, infile); - return (-1); + return (-1); } if (getOutputSize(in, strm) == -1) { (void) fprintf(stderr, err9b, infile); - return (-1); - } + return (-1); + } in->configOptionVector[OUTPUT_SIZE] = 1; break; @@ -1103,14 +1103,14 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_ARCH] == 1) { (void) fprintf(stderr, err10a, infile); - return (-1); + return (-1); } if (getOutputArchitecture(in, strm) == -1) { (void) fprintf(stderr, err10b, infile); - return (-1); - } + return (-1); + } in->configOptionVector[OUTPUT_ARCH] = 1; break; @@ -1118,14 +1118,14 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[OUTPUT_B_ORDER] == 1) { (void) fprintf(stderr, err11a, infile); - return (-1); + return (-1); } if (getOutputByteOrder(in, strm) == -1) { (void) fprintf(stderr, err11b, infile); - return (-1); - } + return (-1); + } in->configOptionVector[OUTPUT_B_ORDER] = 1; break; @@ -1133,37 +1133,37 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[CHUNK] == 1) { (void) fprintf(stderr, err12a, infile); - return (-1); + return (-1); } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { (void) fprintf(stderr, err12b, infile); - return (-1); + return (-1); } if (getChunkedDimensionSizes(in, strm) == -1) { (void) fprintf(stderr, err12c, infile); - return (-1); - } - in->configOptionVector[CHUNK] = 1; + return (-1); + } + in->configOptionVector[CHUNK] = 1; break; case 10: /* COMPRESSION-TYPE */ if (in->configOptionVector[COMPRESS] == 1) { (void) fprintf(stderr, err13a, infile); - return (-1); + return (-1); } if (getCompressionType(in, strm) == -1) { (void) fprintf(stderr, err13b, infile); - return (-1); + return (-1); } in->configOptionVector[COMPRESS] = 1; - + if (in->configOptionVector[COMPRESS_PARAM] == 0) { if (in->compressionType == 0) @@ -1175,20 +1175,20 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[COMPRESS_PARAM] == 1) { (void) fprintf(stderr, err14a, infile); - return (-1); + return (-1); } if (getCompressionParameter(in, strm) == -1) { (void) fprintf(stderr, err14b, infile); - return (-1); + return (-1); } - + in->configOptionVector[COMPRESS_PARAM] = 1; if (in->configOptionVector[COMPRESS] == 0) - in->compressionType = 0; - + in->compressionType = 0; + in->configOptionVector[COMPRESS] = 1; break; @@ -1196,38 +1196,38 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) if (in->configOptionVector[EXTERNAL] == 1) { (void) fprintf(stderr, err15a, infile); - return (-1); + return (-1); } if (getExternalFilename(in, strm) == -1) { (void) fprintf(stderr, err15b, infile); - return (-1); - } - in->configOptionVector[EXTERNAL] = 1; + return (-1); + } + in->configOptionVector[EXTERNAL] = 1; break; case 13: /* MAXIMUM-DIMENSIONS */ if (in->configOptionVector[EXTEND] == 1) { (void) fprintf(stderr, err16a, infile); - return (-1); + return (-1); } /* cant appear before dimension sizes have been provided */ if (in->configOptionVector[DIM] == 0) { (void) fprintf(stderr, err16b, infile); - return (-1); - } + return (-1); + } if (getMaximumDimensionSizes(in, strm) == -1) { (void) fprintf(stderr, err16c, infile); - return (-1); - } - in->configOptionVector[EXTEND] = 1; + return (-1); + } + in->configOptionVector[EXTEND] = 1; break; - - default: + + default: break; } } @@ -1235,20 +1235,20 @@ processConfigurationFile(char *infile, struct Input *in, FILE **strm) check if keywords obtained are valid if yes, return 0 else error */ - + if (validateConfigurationParameters(in) == -1) { (void) fprintf(stderr, err17, infile); - return (-1); - } + return (-1); + } - return (0); + return (0); } -static int +static int validateConfigurationParameters(struct Input * in) { - const char *err1 = "One or more of the required fields (RANK, DIMENSION-SIZES) missing.\n"; + const char *err1 = "One or more of the required fields (RANK, DIMENSION-SIZES) missing.\n"; const char *err2 = "Cannot specify chunking or compression or extendible data sets with the external file option.\n"; const char *err3 = "Cannot specify the compression or the extendible data sets without the chunking option.\n"; const char *err4a = "OUTPUT-ARCHITECTURE cannot be STD if OUTPUT-CLASS is floating point (FP).\n"; @@ -1259,25 +1259,25 @@ validateConfigurationParameters(struct Input * in) #endif if ( - (in->configOptionVector[DIM] != 1) || + (in->configOptionVector[DIM] != 1) || (in->configOptionVector[RANK] != 1)) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if (in->configOptionVector[EXTERNAL] == 1) { - if ((in->configOptionVector[COMPRESS] == 1) || - (in->configOptionVector[CHUNK] == 1) || + if ((in->configOptionVector[COMPRESS] == 1) || + (in->configOptionVector[CHUNK] == 1) || (in->configOptionVector[EXTEND] == 1)) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } } - if ((in->configOptionVector[COMPRESS] == 1) || + if ((in->configOptionVector[COMPRESS] == 1) || (in->configOptionVector[EXTEND] == 1)) { if (in->configOptionVector[CHUNK] != 1) @@ -1286,7 +1286,7 @@ validateConfigurationParameters(struct Input * in) return (-1); } } - + /* Arch cant be STD if O/p class is FP */ if (in->outputArchitecture == 1) if (in->outputClass == 1) @@ -1302,7 +1302,7 @@ validateConfigurationParameters(struct Input * in) (void) fprintf(stderr, err4b); return (-1); } - + if (in->outputClass == 1) if(in->outputSize != 32 && in->outputSize != 64 ) @@ -1318,10 +1318,10 @@ validateConfigurationParameters(struct Input * in) return -1; } #endif - return (0); + return (0); } -static int +static int mapKeywordToIndex(char *key) { int i; @@ -1331,7 +1331,7 @@ mapKeywordToIndex(char *key) return -1; } -static int +static int parsePathInfo(struct path_info *path, char *temp) { const char delimiter[] = "/"; @@ -1351,7 +1351,7 @@ parsePathInfo(struct path_info *path, char *temp) return (0); } -static int +static int parseDimensions(struct Input *in, char *strm) { const char delimiter[] = ","; @@ -1371,7 +1371,7 @@ parseDimensions(struct Input *in, char *strm) i++; } in->rank = i+1; - if ((in->sizeOfDimension = + if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); @@ -1392,37 +1392,37 @@ parseDimensions(struct Input *in, char *strm) return (0); } -static int +static int getOutputClass(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output class.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = OutputClassStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputClass = kindex; return (0); } -static int +static int OutputClassStrToInt(char *temp) { int i; char classKeywordTable[3][15] = { "IN", - "FP", + "FP", "UIN" }; for (i=0; i<3; i++) @@ -1431,7 +1431,7 @@ OutputClassStrToInt(char *temp) return -1; } /* same as getInputSize. But defined separately for extensibility */ -static int +static int getOutputSize(struct Input *in, FILE** strm) { int ival; @@ -1439,7 +1439,7 @@ getOutputSize(struct Input *in, FILE** strm) int outputSizeValidValues[4] = {8,16,32,64}; const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for output size.\n"; - + if (fscanf(*strm, "%d", (&ival)) != 1) { (void) fprintf(stderr, err1); @@ -1447,37 +1447,37 @@ getOutputSize(struct Input *in, FILE** strm) } for (i=0; i<4; i++) - if (outputSizeValidValues[i] == ival) + if (outputSizeValidValues[i] == ival) { in->outputSize = ival; - return (0); - } - (void) fprintf(stderr, err2); - return(-1); + return (0); + } + (void) fprintf(stderr, err2); + return(-1); } -static int +static int getInputClass(struct Input *in, char * temp) { int kindex; const char *err1 = "Invalid value for input class.\n"; - + if ((kindex = InputClassStrToInt(temp)) == -1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } - + in->inputClass = kindex; return (0); } -static int +static int InputClassStrToInt(char *temp) { int i; char classKeywordTable[8][15] = { - "TEXTIN", + "TEXTIN", "TEXTFP", "TEXTFPE", "FP", @@ -1492,7 +1492,7 @@ InputClassStrToInt(char *temp) } /* same as getOutputSize. But defined separately for extensibility */ -static int +static int getInputSize(struct Input *in, int ival) { int i; @@ -1500,40 +1500,40 @@ getInputSize(struct Input *in, int ival) const char *err1 = "Invalid value for input size.\n"; for (i=0; i<4; i++) - if (inputSizeValidValues[i] == ival) + if (inputSizeValidValues[i] == ival) { in->inputSize = ival; - return (0); - } - (void) fprintf(stderr, err1); - return(-1); + return (0); + } + (void) fprintf(stderr, err1); + return(-1); } -static int +static int getRank(struct Input *in, FILE** strm) { int ival; const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for rank.\n"; - + if (fscanf(*strm, "%d", (&ival)) != 1) { (void) fprintf(stderr, err1); return (-1); } - if (ival >=MIN_NUM_DIMENSION && ival <=MAX_NUM_DIMENSION ) + if (ival >=MIN_NUM_DIMENSION && ival <=MAX_NUM_DIMENSION ) { in->rank = ival; return (0); } - (void) fprintf(stderr, err2); - return(-1); + (void) fprintf(stderr, err2); + return(-1); } /* same as getChunkedDimensionSizes. But defined separately for extensibility */ -static int +static int getDimensionSizes(struct Input *in, FILE **strm) { int ival; @@ -1542,16 +1542,16 @@ getDimensionSizes(struct Input *in, FILE **strm) const char *err1 = "Unable to allocate dynamic memory.\n"; const char *err2 = "No. of dimensions for which dimension sizes provided is not equal to provided rank.\n"; - if ((in->sizeOfDimension = + if ((in->sizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); return (-1); } - + while (fscanf(*strm, "%d", (&ival)) == 1) in->sizeOfDimension[i++] = ival; - + if (in->rank != i) { (void) fprintf(stderr, err2); @@ -1560,7 +1560,7 @@ getDimensionSizes(struct Input *in, FILE **strm) return (0); } /* same as getDimensionSizes. But defined separately for extensibility */ -static int +static int getChunkedDimensionSizes(struct Input *in, FILE **strm) { int ival; @@ -1570,16 +1570,16 @@ getChunkedDimensionSizes(struct Input *in, FILE **strm) const char *err2 = "No. of dimensions for which chunked dimension sizes provided is not equal to provided rank.\n"; const char *err3 = "The CHUNKED-DIMENSION-SIZES cannot exceed the sizes of DIMENSION-SIZES\n"; - if ((in->sizeOfChunk = + if ((in->sizeOfChunk = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); return (-1); } - + while (fscanf(*strm, "%d", (&ival)) == 1) in->sizeOfChunk[i++] = ival; - + if (in->rank != i) { (void) fprintf(stderr, err2); @@ -1595,7 +1595,7 @@ getChunkedDimensionSizes(struct Input *in, FILE **strm) return (0); } -static int +static int getMaximumDimensionSizes(struct Input *in, FILE **strm) { int ival; @@ -1605,13 +1605,13 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm) const char *err2 = "No. of dimensions for which maximum dimension sizes provided is not equal to provided rank.\n"; const char *err3 = "The MAXIMUM-DIMENSIONS cannot be less than the sizes of DIMENSION-SIZES. Exception: can be -1 to indicate unlimited size\n"; - if ((in->maxsizeOfDimension = + if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) { (void) fprintf(stderr, err1); return (-1); } - + while (fscanf(*strm, "%d", (&ival)) == 1) { if (ival == -1) @@ -1619,7 +1619,7 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm) else in->maxsizeOfDimension[i++] = ival; } - + if (in->rank != i) { (void) fprintf(stderr, err2); @@ -1638,31 +1638,31 @@ getMaximumDimensionSizes(struct Input *in, FILE **strm) return (0); } -static int +static int getOutputArchitecture(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output architecture.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = OutputArchStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputArchitecture = kindex; return (0); } -static int +static int OutputArchStrToInt(char *temp) { int i; @@ -1681,31 +1681,31 @@ OutputArchStrToInt(char *temp) return -1; } -static int +static int getOutputByteOrder(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output byte-order.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = OutputByteOrderStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputByteOrder = kindex; return (0); } -static int +static int OutputByteOrderStrToInt(char *temp) { int i; @@ -1718,32 +1718,32 @@ OutputByteOrderStrToInt(char *temp) return -1; } -static int +static int getCompressionType(struct Input *in, FILE** strm) { char temp[255]; int kindex; const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for compression.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } if ((kindex = CompressionTypeStrToInt(temp)) == -1) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } - + in->outputByteOrder = kindex; return (0); } -static int +static int CompressionTypeStrToInt(char *temp) { /* currently supports only GZIP */ @@ -1758,17 +1758,17 @@ CompressionTypeStrToInt(char *temp) return -1; } -static int +static int getCompressionParameter(struct Input *in, FILE** strm) { /* currently supports only GZIP */ - /* can be extended by adding more values to COMPRESSION-TYPE and + /* can be extended by adding more values to COMPRESSION-TYPE and handling the paramters here by adding more cases */ int ival; const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for compression paramter.\n"; - const char *err3 = "Unsupported Compression Type.\n"; + const char *err3 = "Unsupported Compression Type.\n"; switch (in->compressionType) { @@ -1782,7 +1782,7 @@ getCompressionParameter(struct Input *in, FILE** strm) if (ival <0 || ival > 9) { (void) fprintf(stderr, err2); - return (-1); + return (-1); } in->compressionParam = ival; return (0); @@ -1793,34 +1793,34 @@ getCompressionParameter(struct Input *in, FILE** strm) } } -static int +static int getExternalFilename(struct Input *in, FILE** strm) { char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; - + if (fscanf(*strm, "%s", temp) != 1) { (void) fprintf(stderr, err1); - return (-1); + return (-1); } - + in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp)) * sizeof(char)); (void) HDstrcpy(in->externFilename, temp); return (0); } -void +void setDefaultValues(struct Input *in, int count) { int i; char temp[255]; - char num[255]; + char num[255]; in->inputClass = 3; /* FP */ in->inputSize = 32; in->outputClass = 1; /* FP */ - in->outputSize = 32; + in->outputSize = 32; in->rank = 0; in->path.count = 1; @@ -1836,15 +1836,15 @@ setDefaultValues(struct Input *in, int count) in->configOptionVector[i] = 0; } -hid_t +hid_t createOutputDataType(struct Input *in) { hid_t new_type = (-1); const char *err1 = "Invalid value for output class.\n"; - + switch (in->outputClass) { - case 0: + case 0: switch (in->outputArchitecture) { case 0: /* NATIVE */ @@ -1855,11 +1855,11 @@ createOutputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_SHORT); + new_type = H5Tcopy (H5T_NATIVE_SHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_INT); + new_type = H5Tcopy (H5T_NATIVE_INT); break; case 64: @@ -1877,9 +1877,9 @@ createOutputDataType(struct Input *in) case 1: H5Tset_order (new_type,H5T_ORDER_LE); break; - } + } break; - + case 1: /* STD */ switch(in->outputSize) { @@ -1894,7 +1894,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I8LE); break; - } + } break; case 16: @@ -1908,7 +1908,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I16LE); break; - } + } break; case 32: @@ -1922,7 +1922,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I32LE); break; - } + } break; case 64: @@ -1936,11 +1936,11 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_I64LE); break; - } - break; + } + break; } break; - + } break; @@ -1951,7 +1951,7 @@ createOutputDataType(struct Input *in) switch(in->outputSize) { case 32: - new_type = H5Tcopy (H5T_NATIVE_FLOAT); + new_type = H5Tcopy (H5T_NATIVE_FLOAT); break; case 64: @@ -1969,9 +1969,9 @@ createOutputDataType(struct Input *in) case 1: H5Tset_order (new_type,H5T_ORDER_LE); break; - } + } break; - + case 1: /* STD not supported for float */ break; @@ -1990,7 +1990,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_IEEE_F32LE); break; - } + } break; case 64: @@ -2004,11 +2004,11 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_IEEE_F64LE); break; - } - break; + } + break; } break; - + } break; @@ -2023,11 +2023,11 @@ createOutputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_USHORT); + new_type = H5Tcopy (H5T_NATIVE_USHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_UINT); + new_type = H5Tcopy (H5T_NATIVE_UINT); break; case 64: @@ -2045,9 +2045,9 @@ createOutputDataType(struct Input *in) case 1: H5Tset_order (new_type,H5T_ORDER_LE); break; - } + } break; - + case 1: switch(in->outputSize) { @@ -2062,7 +2062,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U8LE); break; - } + } break; case 16: @@ -2076,7 +2076,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U16LE); break; - } + } break; case 32: @@ -2090,7 +2090,7 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U32LE); break; - } + } break; case 64: @@ -2104,15 +2104,15 @@ createOutputDataType(struct Input *in) case 1: new_type = H5Tcopy (H5T_STD_U64LE); break; - } - break; + } + break; } break; - + case 2: /* IEEE not supported for INT */ break; - + } break; @@ -2124,7 +2124,7 @@ createOutputDataType(struct Input *in) return new_type; } -hid_t +hid_t createInputDataType(struct Input *in) { hid_t new_type = (-1); @@ -2141,11 +2141,11 @@ createInputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_SHORT); + new_type = H5Tcopy (H5T_NATIVE_SHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_INT); + new_type = H5Tcopy (H5T_NATIVE_INT); break; case 64: @@ -2164,8 +2164,8 @@ createInputDataType(struct Input *in) break; case 64: - new_type = H5Tcopy (H5T_NATIVE_DOUBLE); - break; + new_type = H5Tcopy (H5T_NATIVE_DOUBLE); + break; } break; @@ -2181,11 +2181,11 @@ createInputDataType(struct Input *in) break; case 16: - new_type = H5Tcopy (H5T_NATIVE_USHORT); + new_type = H5Tcopy (H5T_NATIVE_USHORT); break; case 32: - new_type = H5Tcopy (H5T_NATIVE_UINT); + new_type = H5Tcopy (H5T_NATIVE_UINT); break; case 64: @@ -2198,43 +2198,43 @@ createInputDataType(struct Input *in) (void) fprintf(stderr, err1); return (-1); } - return new_type; + return new_type; } -static int +static int process(struct Options *opt) { struct Input *in; - hid_t file_id, group_id, handle; - hid_t dataset, dataspace = (-1); + hid_t file_id, group_id, handle; + hid_t dataset, dataspace = (-1); FILE *strm, *extfile; hid_t intype, outtype; - hid_t proplist; - hsize_t numOfElements = 1; + hid_t proplist; + hsize_t numOfElements = 1; int j,k; const char *err1 = "Error creating HDF output file: %s.\n"; const char *err2 = "Error in processing the configuration file: %s.\n"; const char *err3 = "Error in reading the input file: %s.\n"; - const char *err4 = "Error in creating or opening external file.\n"; + const char *err4 = "Error in creating or opening external file.\n"; const char *err5 = "Error in creating the output data set. Dataset with the same name may exist at the specified path\n"; const char *err6 = "Error in writing the output data set.\n"; H5E_BEGIN_TRY { if ((file_id = H5Fopen(opt->outfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) { - if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) + if ((file_id = H5Fcreate(opt->outfile, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) == FAIL) { (void) fprintf(stderr, err1, opt->outfile); return (-1); } } } H5E_END_TRY; - + for (k = 0; k < opt->fcount; k++) { in = &(opt->infiles[k].in); if (opt->infiles[k].config == 1) - { + { if (processConfigurationFile(opt->infiles[k].configfile, in, &strm) == -1) { (void) fprintf(stderr, err2, opt->infiles[k].configfile); @@ -2246,14 +2246,14 @@ process(struct Options *opt) { (void) fprintf(stderr, err3, opt->infiles[k].datafile); return (-1); - } - + } + for (j=0; j<in->rank;j++) numOfElements *= in->sizeOfDimension[j]; /* disable error reporting */ H5E_BEGIN_TRY { - + /* create parent groups */ if (in->path.count > 1) { @@ -2265,15 +2265,15 @@ process(struct Options *opt) { group_id = H5Gcreate(handle, in->path.group[j++], 0); for (; j<in->path.count-1; j++) - group_id = H5Gcreate(group_id, in->path.group[j], 0); + group_id = H5Gcreate(group_id, in->path.group[j], 0); handle = group_id; break; - } + } handle = group_id; j++; } } - else + else { handle = file_id; j=0; @@ -2281,25 +2281,25 @@ process(struct Options *opt) /*enable error reporting */ } H5E_END_TRY; - + /*create data type */ intype = createInputDataType(in); - outtype = createOutputDataType(in); - + outtype = createOutputDataType(in); + /* create property list */ - proplist = H5Pcreate (H5P_DATASET_CREATE); + proplist = H5Pcreate (H5P_DATASET_CREATE); if (in->configOptionVector[CHUNK] == 1) { - H5Pset_layout (proplist, H5D_CHUNKED); + H5Pset_layout (proplist, H5D_CHUNKED); /* not reqd chunking is implied if set_chunk is used */ H5Pset_chunk (proplist, in->rank, in->sizeOfChunk); } - + if (in->configOptionVector[COMPRESS] == 1) { H5Pset_deflate (proplist, (unsigned) in->compressionParam); } - + if (in->configOptionVector[EXTERNAL] == 1) { /* creating the external file if it doesnt exist */ @@ -2308,13 +2308,13 @@ process(struct Options *opt) (void) fprintf(stderr, err4); H5Pclose(proplist); H5Sclose(dataspace); - H5Fclose(file_id); - return (-1); + H5Fclose(file_id); + return (-1); } HDfclose(extfile); H5Pset_external (proplist, in->externFilename, (off_t)0, numOfElements * in->inputSize / 8); } - + /* create dataspace */ if (in->configOptionVector[EXTEND] == 1) { @@ -2324,38 +2324,38 @@ process(struct Options *opt) { dataspace = H5Screate_simple(in->rank, in->sizeOfDimension, NULL); } - + /* disable error reporting */ H5E_BEGIN_TRY { /* create data set */ - if ((dataset = H5Dcreate(handle, in->path.group[j], outtype, dataspace, proplist)) < 0) + if ((dataset = H5Dcreate(handle, in->path.group[j], outtype, dataspace, proplist)) < 0) { (void) fprintf(stderr, err5); H5Pclose(proplist); H5Sclose(dataspace); - H5Fclose(file_id); - return (-1); + H5Fclose(file_id); + return (-1); } - + /*enable error reporting */ } H5E_END_TRY; /* write dataset */ - if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0) + if (H5Dwrite(dataset, intype, H5S_ALL, H5S_ALL, H5P_DEFAULT, (VOIDP)in->data) < 0) { (void) fprintf(stderr, err6); H5Dclose(dataset); H5Pclose(proplist); H5Sclose(dataspace); - H5Fclose(file_id); - return (-1); - } - + H5Fclose(file_id); + return (-1); + } + H5Dclose(dataset); - H5Pclose(proplist); - H5Sclose(dataspace); + H5Pclose(proplist); + H5Sclose(dataspace); } - H5Fclose(file_id); + H5Fclose(file_id); return (0); } diff --git a/tools/h5import/h5import.h b/tools/h5import/h5import.h index 353e548..cf318fc 100755 --- a/tools/h5import/h5import.h +++ b/tools/h5import/h5import.h @@ -13,9 +13,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * - * Data and structure definitions for h5import - * + * + * Data and structure definitions for h5import + * */ /* @@ -39,7 +39,7 @@ #define MAX_NUM_DIMENSION 32 #define BASE_10 10 -#define CHUNK 0 +#define CHUNK 0 #define COMPRESS 1 #define EXTEND 2 #define EXTERNAL 3 @@ -51,8 +51,8 @@ #define OUTPUT_CLASS 9 #define OUTPUT_SIZE 10 #define OUTPUT_ARCH 11 -#define OUTPUT_B_ORDER 12 -#define COMPRESS_PARAM 13 +#define OUTPUT_B_ORDER 12 +#define COMPRESS_PARAM 13 /* data types */ #define H5DT_INT8 signed char @@ -75,7 +75,7 @@ struct path_info struct Input { - struct path_info path; + struct path_info path; int inputClass; int inputSize; int rank; @@ -85,7 +85,7 @@ struct Input int outputArchitecture; int outputByteOrder; hsize_t* sizeOfChunk; - hsize_t* maxsizeOfDimension; + hsize_t* maxsizeOfDimension; int compressionType; int compressionParam; char *externFilename; @@ -105,7 +105,7 @@ struct Options { struct infilesformat infiles[30]; /* structure to hold the list of input file names. Limited to 30*/ char outfile[256]; /* output file name */ - int fcount; /* number of input files */ + int fcount; /* number of input files */ }; char keytable[NUM_KEYS][30] = { @@ -147,7 +147,7 @@ static int state_table[15][8] = /* state 5: outfile */ {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR}, - + /* state 6: -h[elp] */ {ERR, ERR, ERR, ERR, ERR, ERR, ERR, ERR}, @@ -177,9 +177,9 @@ static int state_table[15][8] = }; -/* +/* * - * Function declarations for h5import + * Function declarations for h5import * */ void usage(char *); diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 48670c5..e6c29e5 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -19,7 +19,7 @@ * * Description: * This program creates that can be - * used to test the h5import program. + * used to test the h5import program. * */ /* @@ -38,24 +38,24 @@ main(void) float rowo4 = (float)11.0e0, colo4 = (float)21.0e0, plno4 = (float)51.0e0; float rowi4 = (float)1.0e0, coli4 = (float)2.0e0, plni4 = (float)5.0e0; - int b32i3[5][3][4]; + int b32i3[5][3][4]; int row4i[3], col4i[4], pln4i[5]; int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; #ifndef WIN32 - long_long b64i2[3][4], b64i3[5][3][4]; + long_long b64i2[3][4], b64i3[5][3][4]; long_long row4i64[3], col4i64[4], pln4i64[5]; long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ; long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; #endif - short b16i3[5][3][4]; + short b16i3[5][3][4]; short row4i16[3], col4i16[4], pln4i16[5]; short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ; short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ; - char b8i3[5][3][4]; + char b8i3[5][3][4]; char row4i8[3], col4i8[4], pln4i8[5]; char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; @@ -65,7 +65,7 @@ main(void) double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; - + /* * initialize the row, column, and plane vectors * @@ -74,7 +74,7 @@ main(void) * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71 */ - + /* * build array elements - rank 2 * @@ -84,16 +84,16 @@ main(void) row4[0] = rowo4; col4[0] = colo4; pln4[0] = plno4; - + row8[0] = rowo8; col8[0] = colo8; pln8[0] = plno8; - + row4i[0] = rowo4i; col4i[0] = colo4i; pln4i[0] = plno4i; -#ifndef WIN32 +#ifndef WIN32 row4i64[0] = rowo4i64; col4i64[0] = colo4i64; pln4i64[0] = plno4i64; @@ -102,11 +102,11 @@ main(void) row4i16[0] = rowo4i16; col4i16[0] = colo4i16; pln4i16[0] = plno4i16; - + row4i8[0] = rowo4i8; col4i8[0] = colo4i8; pln4i8[0] = plno4i8; - + for (i = 1; i < nrow; i++) { row4[i] = row4[i - 1] + rowi4; @@ -116,18 +116,18 @@ main(void) row4i64[i] = row4i64[i - 1] + rowi4i64; #endif row4i16[i] = row4i16[i - 1] + rowi4i16; - row4i8[i] = row4i8[i - 1] + rowi4i8; + row4i8[i] = row4i8[i - 1] + rowi4i8; } - + for (j = 1; j < ncol; j++) { col4[j] = col4[j - 1] + coli4; col8[j] = col8[j - 1] + coli8; col4i[j] = col4i[j - 1] + coli4i; #ifndef WIN32 - col4i64[j] = col4i64[j - 1] + coli4i64; + col4i64[j] = col4i64[j - 1] + coli4i64; #endif - col4i16[j] = col4i16[j - 1] + coli4i16; + col4i16[j] = col4i16[j - 1] + coli4i16; col4i8[j] = col4i8[j - 1] + coli4i8; } for (k = 1; k < npln; k++) @@ -138,7 +138,7 @@ main(void) #ifndef WIN32 pln4i64[k] = pln4i64[k - 1] + plni4i64; #endif - pln4i16[k] = pln4i16[k - 1] + plni4i16; + pln4i16[k] = pln4i16[k - 1] + plni4i16; pln4i8[k] = pln4i8[k - 1] + plni4i8; } @@ -147,7 +147,7 @@ main(void) for (j = 0; j < ncol; j++) { #ifndef WIN32 - b64i2[i][j] = row4i64[i] + col4i64[j]; + b64i2[i][j] = row4i64[i] + col4i64[j]; #endif } } @@ -175,13 +175,13 @@ main(void) } } } - + /* * binary 32-bit file - rank 2 & 3 */ #ifndef UNICOS - + sp = fopen("txtin16", "w"); for (k = 0; k < npln; k++) @@ -204,7 +204,7 @@ main(void) (void) fclose(sp); sp = fopen("bin32", "w"); - for (k = 0; k < npln; k++) + for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) (void) fwrite((char *) &b32i3[k][i][j], sizeof(int), 1, sp); @@ -212,7 +212,7 @@ main(void) sp = fopen("buin32", "w"); - for (k = 0; k < npln; k++) + for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) for (j = 0; j < ncol; j++) (void) fwrite((char *) &b32i3[k][i][j], sizeof(unsigned int), 1, sp); @@ -234,7 +234,7 @@ main(void) (void) fwrite((char *) &b32r3[k][i][j], sizeof(float), 1, sp); (void) fclose(sp); - + sp = fopen("bin16", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) @@ -261,7 +261,7 @@ main(void) sp); (void) fclose(sp); #endif - + sp = fopen("bin8", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) @@ -269,13 +269,13 @@ main(void) (void) fwrite((char *) &b8i3[k][i][j], sizeof(char), 1, sp); (void) fclose(sp); - + #endif /* * binary 64-bit file - rank 2 & 3 */ - + sp = fopen("bfp64", "w"); for (k = 0; k < npln; k++) for (i = 0; i < nrow; i++) diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 01756a5..3d9cbd1 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -39,11 +39,11 @@ static struct long_options l_opts[] = { /*------------------------------------------------------------------------- * Function: usage * - * Purpose: Print the usage message + * Purpose: Print the usage message * * Return: void * - * Programmer: + * Programmer: * * Modifications: * @@ -62,11 +62,11 @@ usage (const char *prog) * * Purpose: Parse the command line for the h5dumper. * - * Return: Success: + * Return: Success: * * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: + * Programmer: * * Modifications: * diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index 0b4b37d..5e4d885 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -63,11 +63,11 @@ static struct long_options l_opts[] = { /*------------------------------------------------------------------------- * Function: usage * - * Purpose: Print the usage message + * Purpose: Print the usage message * * Return: void * - * Programmer: + * Programmer: * * Modifications: * @@ -94,11 +94,11 @@ usage (const char *prog) * * Purpose: Parse the command line for the h5dumper. * - * Return: Success: + * Return: Success: * * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: + * Programmer: * * Modifications: * @@ -146,7 +146,7 @@ parse_command_line (int argc, const char *argv[]) * Return: Success: 0 * Failure: 1 * - * Programmer: + * Programmer: * * Modifications: * @@ -315,7 +315,7 @@ main (int argc, const char *argv[]) } } - /* copy the HDF5 from starting at usize to starting at newubsize: + /* copy the HDF5 from starting at usize to starting at newubsize: * makes room at 'from' for new ub */ /* if no current ub, usize is 0 */ copy_some_to_file (h5fid, ofid, usize, newubsize, @@ -362,7 +362,7 @@ main (int argc, const char *argv[]) * Return: Success: last byte written in the output. * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: + * Programmer: * * Modifications: * @@ -478,10 +478,10 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, /*------------------------------------------------------------------------- * Function: compute_user_block_size * - * Purpose: Find the offset of the HDF5 header after the user block: + * Purpose: Find the offset of the HDF5 header after the user block: * align at 0, 512, 1024, etc. * ublock_size: the size of the user block (bytes). - * + * * Return: Success: the location of the header == the size of the * padded user block. * Failure: none @@ -489,7 +489,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, * Return: Success: last byte written in the output. * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: + * Programmer: * * Modifications: * diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index ada206b..a3a99ca 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -237,7 +237,7 @@ float dset2_1[10], dset2_2[3][5]; H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); - + /* dset2.2 */ dims[0] = 3; dims[1] = 5; space = H5Screate_simple(2, dims, NULL); @@ -367,7 +367,7 @@ char *bp; H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); - + /* dset2.2 */ dims[0] = 3; dims[1] = 5; space = H5Screate_simple(2, dims, NULL); @@ -392,7 +392,7 @@ char *bp; memset(buf,'\0',512); bp = buf; for (u = 0; u < strlen(pattern); u++) { - *bp++ = pattern[u%10]; + *bp++ = pattern[u%10]; } HDwrite(fd,buf,512); @@ -511,7 +511,7 @@ char *bp; H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2_1); H5Sclose(space); H5Dclose(dataset); - + /* dset2.2 */ dims[0] = 3; dims[1] = 5; space = H5Screate_simple(2, dims, NULL); @@ -536,7 +536,7 @@ char *bp; memset(buf,'\0',1024); bp = buf; for (i = 0; i < 513; i++) { - *bp++ = pattern[i%10]; + *bp++ = pattern[i%10]; } HDwrite(fd,buf,1024); @@ -566,10 +566,10 @@ char *bp; /* fill buf with pattern */ bp = buf; for (i = 0; i < size; i++) { - *bp++ = pattern[i%10]; + *bp++ = pattern[i%10]; } - + HDwrite(fd,buf,size); close(fd); @@ -595,9 +595,9 @@ char *bp; /* fill buf with pattern */ bp = buf; for (i = 0; i < size; i++) { - *bp++ = (char) i & 0xff; + *bp++ = (char) i & 0xff; } - + HDwrite(fd,buf,size); close(fd); diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index e68d6ac..e235cb5 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -55,18 +55,18 @@ static struct long_options l_opts[] = { {"delet", no_arg, 'd'}, {"dele", no_arg, 'd'}, {"del", no_arg, 'd'}, - {"de", no_arg, 'd'}, + {"de", no_arg, 'd'}, { NULL, 0, '\0' } }; /*------------------------------------------------------------------------- * Function: usage * - * Purpose: Print the usage message + * Purpose: Print the usage message * * Return: void * - * Programmer: + * Programmer: * * Modifications: * @@ -89,11 +89,11 @@ usage(const char *prog) * * Purpose: Parse the command line for the h5dumper. * - * Return: Success: + * Return: Success: * * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: + * Programmer: * * Modifications: * @@ -148,7 +148,7 @@ parse_command_line(int argc, const char *argv[]) * Return: Success: 0 * Failure: 1 * - * Programmer: + * Programmer: * * Modifications: * @@ -207,7 +207,7 @@ main(int argc, const char *argv[]) /* no user block to remove: message? */ error_msg(progname, "\"%s\" has no user block: no change to file\n", input_file); exit(EXIT_SUCCESS); - + } res = stat(input_file, &sbuf); @@ -260,14 +260,14 @@ main(int argc, const char *argv[]) } - /* copy from 0 to 'usize - 1' into ufid */ + /* copy from 0 to 'usize - 1' into ufid */ if (!do_delete) { copy_to_file( ifid, ufid, 0, (ssize_t) usize); } - /* copy from usize to end of file into h5fid, + /* copy from usize to end of file into h5fid, * starting at end of user block if present - */ + */ copy_to_file( ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize) ); @@ -279,12 +279,12 @@ main(int argc, const char *argv[]) } /* - * Copy 'how_much' bytes from the input file to the output file, + * Copy 'how_much' bytes from the input file to the output file, * starting at byte 'where' in the input file. - * + * * Returns the size of the output file. */ -hsize_t +hsize_t copy_to_file( int infid, int ofid, ssize_t where, ssize_t how_much ) { char buf[1024]; off_t to; diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index 75f4a64..851d01f 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -42,11 +42,11 @@ static struct long_options l_opts[] = { /*------------------------------------------------------------------------- * Function: usage * - * Purpose: Print the usage message + * Purpose: Print the usage message * * Return: void * - * Programmer: + * Programmer: * * Modifications: * @@ -68,11 +68,11 @@ usage (const char *prog) * * Purpose: Parse the command line for the h5dumper. * - * Return: Success: + * Return: Success: * * Failure: Exits program with EXIT_FAILURE value. * - * Programmer: + * Programmer: * * Modifications: * @@ -116,7 +116,7 @@ parse_command_line (int argc, const char *argv[]) * Return: Success: 0 * Failure: 1 * - * Programmer: + * Programmer: * * Modifications: * diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index b2d377d..7957383 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -151,7 +151,7 @@ sym_insert(H5G_stat_t *sb, const char *name) /* Don't add it if the link count is 1 because such an object can only * have one name. */ if (sb->nlink<2) return; - + /* Extend the table */ if (idtab_g.nobjs>=idtab_g.nalloc) { idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc); @@ -187,7 +187,7 @@ static char * sym_lookup(H5G_stat_t *sb) { int n; - + if (sb->nlink<2) return NULL; /*only one name possible*/ for (n=0; n<idtab_g.nobjs; n++) { if (idtab_g.obj[n].id==sb->objno) @@ -217,7 +217,7 @@ static int display_string(FILE *stream, const char *s, hbool_t escape_spaces) { int nprint=0; - + for (/*void*/; s && *s; s++) { switch (*s) { case '"': @@ -543,9 +543,9 @@ display_int_type(hid_t type, int ind) const char *order_s=NULL; /* byte order string */ H5T_sign_t sign; /* sign scheme value */ const char *sign_s=NULL; /* sign scheme string */ - + if (H5T_INTEGER!=H5Tget_class(type)) return FALSE; - + /* Byte order */ if (H5Tget_size(type)>1) { order = H5Tget_order(type); @@ -574,7 +574,7 @@ display_int_type(hid_t type, int ind) } else { sign_s = " unknown-sign"; } - + /* Print size, order, and sign on first line, precision and padding * information on the subsequent lines */ printf("%lu-bit%s%s integer", @@ -613,9 +613,9 @@ display_float_type(hid_t type, int ind) const char *norm_s=NULL; /* normalization string */ H5T_pad_t pad; /* internal padding value */ const char *pad_s=NULL; /* internal padding string */ - + if (H5T_FLOAT!=H5Tget_class(type)) return FALSE; - + /* Byte order */ if (H5Tget_size(type)>1) { order = H5Tget_order(type); @@ -656,7 +656,7 @@ display_float_type(hid_t type, int ind) norm_s = ", unknown normalization"; break; } - printf("\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", + printf("\n%*s(significant for %lu bit%s at bit %lu%s)", ind, "", (unsigned long)msize, 1==msize?"":"s", (unsigned long)mpos, norm_s); printf("\n%*s(exponent for %lu bit%s at bit %lu, bias is 0x%lx)", @@ -713,7 +713,7 @@ display_cmpd_type(hid_t type, int ind) unsigned nmembs; /* number of members */ int n; /* miscellaneous counters */ unsigned i; /* miscellaneous counters */ - + if (H5T_COMPOUND!=H5Tget_class(type)) return FALSE; printf("struct {"); nmembs=H5Tget_nmembers(type); @@ -768,7 +768,7 @@ display_enum_type(hid_t type, int ind) size_t dst_size; /* destination value type size */ unsigned i; /* miscellaneous counters */ size_t j; - + if (H5T_ENUM!=H5Tget_class(type)) return FALSE; nmembs = H5Tget_nmembers(type); assert(nmembs>0); @@ -776,7 +776,7 @@ display_enum_type(hid_t type, int ind) printf("enum "); display_type(super, ind+4); printf(" {"); - + /* Determine what data type to use for the native values. To simplify * things we entertain three possibilities: * 1. long_long -- the largest native signed integer @@ -867,7 +867,7 @@ display_string_type(hid_t type, int UNUSED ind) const char *pad_s=NULL; H5T_cset_t cset; const char *cset_s=NULL; - + if (H5T_STRING!=H5Tget_class(type)) return FALSE; /* Padding */ @@ -969,7 +969,7 @@ display_reference_type(hid_t type, int UNUSED ind) printf("%lu-byte unknown reference", (unsigned long)H5Tget_size(type)); } - + return TRUE; } @@ -995,7 +995,7 @@ display_opaque_type(hid_t type, int ind) { char *tag; size_t size; - + if (H5T_OPAQUE!=H5Tget_class(type)) return FALSE; size = H5Tget_size(type); @@ -1028,7 +1028,7 @@ static hbool_t display_vlen_type(hid_t type, int ind) { hid_t super; - + if (H5T_VLEN!=H5Tget_class(type)) return FALSE; printf("variable length of\n%*s", ind+4, ""); @@ -1086,7 +1086,7 @@ display_array_type(hid_t type, int ind) } else { fputs(" [SCALAR]", stdout); } - + /* Print parent type */ putchar(' '); @@ -1095,7 +1095,7 @@ display_array_type(hid_t type, int ind) H5Tclose(super); return TRUE; } - + /*------------------------------------------------------------------------- * Function: display_bitfield_type * @@ -1167,7 +1167,7 @@ display_type(hid_t type, int ind) { H5T_class_t data_class = H5Tget_class(type); H5G_stat_t sb; - + /* Bad data type */ if (type<0) { printf("<ERROR>"); @@ -1183,7 +1183,7 @@ display_type(hid_t type, int ind) printf("shared "); } } - + /* Print the type */ if ((!simple_output_g && display_native_type(type, ind)) || display_ieee_type(type, ind) || @@ -1231,7 +1231,7 @@ dump_dataset_values(hid_t dset) h5dump_t info; char string_prefix[64]; static char fmt_double[16], fmt_float[16]; - + /* Set to all default values and then override */ memset(&info, 0, sizeof info); @@ -1242,7 +1242,7 @@ dump_dataset_values(hid_t dset) info.line_multi_new = 0; info.line_pre = " "; info.line_cont = " "; - + info.arr_pre = ""; info.arr_suf = ""; info.arr_sep = " "; @@ -1252,10 +1252,10 @@ dump_dataset_values(hid_t dset) info.cmpd_sep = " "; if (label_g) info.cmpd_name = "%s="; - + info.elmt_suf1 = " "; info.str_locale = ESCAPE_HTML; - + } else { info.idx_fmt = "(%s)"; info.line_ncols = width_g; @@ -1274,15 +1274,15 @@ dump_dataset_values(hid_t dset) info.dset_format = "DSET-%lu:"H5_PRINTF_HADDR_FMT"-"; info.dset_hidefileno = 0; - + info.obj_format = "-%lu:"H5_PRINTF_HADDR_FMT; info.obj_hidefileno = 0; - + info.dset_blockformat_pre = "%sBlk%lu: "; info.dset_ptformat_pre = "%sPt%lu: "; - + info.line_indent = ""; - + if (hexdump_g) { /* Print all data in hexadecimal format if the `-x' or `--hexdump' * command line switch was given. */ @@ -1298,8 +1298,8 @@ dump_dataset_values(hid_t dset) info.line_pre = string_prefix; info.line_suf = "\""; } - - /* Print all the values. */ + + /* Print all the values. */ printf(" Data:\n"); if (h5tools_dump_dset(stdout, &info, dset, -1, NULL, -1) < 0) { printf(" Unable to print data.\n"); @@ -1386,7 +1386,7 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) info.line_pre = " "; info.line_cont = " "; info.str_repeat = 8; - + } else { printf(" Data:\n"); info.idx_fmt = "(%s)"; @@ -1394,7 +1394,7 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) info.line_cont = " %s "; info.str_repeat = 8; } - + info.line_ncols = width_g; if (label_g) info.cmpd_name = "%s="; if (string_g && 1==H5Tget_size(type) && @@ -1424,16 +1424,16 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) if (H5Aread(attr, p_type, buf)>=0) h5tools_dump_mem(stdout, &info, attr, p_type, space, buf, -1); free(buf); - H5Tclose(p_type); + H5Tclose(p_type); } - + H5Sclose(space); H5Tclose(type); H5Aclose(attr); } else { putchar('\n'); } - + return 0; } @@ -1529,7 +1529,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) int n, max_len; /* max extern file name length */ double utilization; /* percent utilization of storage */ int i; - + if (verbose_g>0) { dcpl = H5Dget_create_plist(dset); space = H5Dget_space(dset); @@ -1563,7 +1563,7 @@ dataset_list2(hid_t dset, const char UNUSED *name) printf(", %1.2f%% utilization", utilization); } putchar('\n'); - + /* Print information about external strorage */ if ((nf = H5Pget_external_count(dcpl))>0) { for (i=0, max_len=0; i<nf; i++) { @@ -1668,7 +1668,7 @@ static herr_t group_list2(hid_t grp, const char *name) { iter_t iter; - + if (recursive_g) { iter.container = name; H5Giterate(grp, ".", NULL, list, &iter); @@ -1729,7 +1729,7 @@ static hid_t link_open(hid_t location, const char *name) { char buf[64]; - + if (H5Gget_linkval (location, name, sizeof(buf), buf)<0) return -1; if (NULL==HDmemchr(buf, 0, sizeof(buf))) { strcpy(buf+sizeof(buf)-4, "..."); @@ -1769,7 +1769,7 @@ list (hid_t group, const char *name, void *_iter) herr_t status; iter_t *iter = (iter_t*)_iter; int n; - + /* Print the object name, either full name or base name */ fullname = fix_name(iter->container, name); if (fullname_g) { @@ -1805,7 +1805,7 @@ list (hid_t group, const char *name, void *_iter) } else { sym_insert(&sb, fullname); } - + /* Open the object. Not all objects can be opened. If this is the case * then return right away. */ if (sb.type>=0 && @@ -1814,13 +1814,13 @@ list (hid_t group, const char *name, void *_iter) printf(" *ERROR*\n"); goto done; } - - /* List the first line of information for the object. */ + + /* List the first line of information for the object. */ if (sb.type>=0 && dispatch_g[sb.type].list1) { (dispatch_g[sb.type].list1)(obj); } putchar('\n'); - + /* Show detailed information about the object, beginning with information * which is common to all objects. */ if (verbose_g>0 && H5G_LINK!=sb.type) { @@ -1848,8 +1848,8 @@ list (hid_t group, const char *name, void *_iter) if (sb.type>=0 && dispatch_g[sb.type].list2) { (dispatch_g[sb.type].list2)(obj, fullname); } - - /* Close the object. */ + + /* Close the object. */ done: if (sb.type>=0 && obj>=0 && dispatch_g[sb.type].close) { (dispatch_g[sb.type].close)(obj); @@ -2010,7 +2010,7 @@ static void leave(int ret) { h5tools_close(); - + exit(ret); } @@ -2085,7 +2085,7 @@ main (int argc, const char *argv[]) } else if (!strcmp(argv[argno], "--full")) { fullname_g = TRUE; } else if (!strcmp(argv[argno], "--group")) { - grp_literal_g = TRUE; + grp_literal_g = TRUE; } else if (!strcmp(argv[argno], "--label")) { label_g = TRUE; } else if (!strcmp(argv[argno], "--recursive")) { diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 09d83b9..5b5f8c3 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -17,7 +17,7 @@ /*------------------------------------------------------------------------- * File: h5repack.c - * Purpose: Public API functions + * Purpose: Public API functions *------------------------------------------------------------------------- */ @@ -37,7 +37,7 @@ static void aux_initglb_filter(pack_opt_t *options) { int k; options->filter_g.filtn = -1; - for ( k=0; k<CDVALUES; k++) + for ( k=0; k<CDVALUES; k++) options->filter_g.cd_values[k] = -1; } @@ -45,12 +45,12 @@ static void aux_initglb_filter(pack_opt_t *options) /*------------------------------------------------------------------------- * Function: h5repack * - * Purpose: locate all high-level HDF5 objects in the file + * Purpose: locate all high-level HDF5 objects in the file * and compress/chunk them using options * * Algorythm: 2 traversals are made to the file; the 1st builds a list of * the objects, the 2nd makes a copy of them, using the options; - * the reason for the 1st traversal is to check for invalid + * the reason for the 1st traversal is to check for invalid * object name requests * * Return: 0, ok, -1, fail @@ -61,23 +61,23 @@ static void aux_initglb_filter(pack_opt_t *options) * *------------------------------------------------------------------------- */ -int h5repack(const char* infile, - const char* outfile, +int h5repack(const char* infile, + const char* outfile, pack_opt_t *options) { /* check input */ if (check_options(options)<0) return -1; - + /* check for objects in input that are in the file */ if (check_objects(infile,options)<0) return -1; - + /* copy the objects */ if (copy_objects(infile,outfile,options)<0) return -1; - + return 0; } @@ -93,7 +93,7 @@ int h5repack(const char* infile, *------------------------------------------------------------------------- */ -int h5repack_init (pack_opt_t *options, +int h5repack_init (pack_opt_t *options, int verbose) { memset(options,0,sizeof(pack_opt_t)); @@ -118,7 +118,7 @@ int h5repack_end (pack_opt_t *options) /*------------------------------------------------------------------------- * Function: h5repack_addfilter * - * Purpose: add a compression -f option to table + * Purpose: add a compression -f option to table * Example: -f dset:GZIP=6 * * Return: 0, ok, -1, fail @@ -126,7 +126,7 @@ int h5repack_end (pack_opt_t *options) *------------------------------------------------------------------------- */ -int h5repack_addfilter(const char* str, +int h5repack_addfilter(const char* str, pack_opt_t *options) { obj_list_t *obj_list=NULL; /*one object list for the -f and -c option entry */ @@ -172,10 +172,10 @@ int h5repack_addfilter(const char* str, */ -int h5repack_addlayout(const char* str, +int h5repack_addlayout(const char* str, pack_opt_t *options) { - + obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */ int n_objs; /*number of objects in the current -t or -c option entry */ pack_info_t pack; /*info about layout to extract from parse */ @@ -188,7 +188,7 @@ int h5repack_addlayout(const char* str, is present with other objects <%s>\n",str); return -1; } - + /* parse the layout option */ obj_list=parse_layout(str,&n_objs,&pack,options); if (obj_list==NULL) @@ -198,7 +198,7 @@ int h5repack_addlayout(const char* str, if (options->all_layout==1 ) { options->layout_g=pack.layout; - if (pack.layout==H5D_CHUNKED) + if (pack.layout==H5D_CHUNKED) { /* -2 means the NONE option, remove chunking and set the global layout to contiguous */ @@ -210,7 +210,7 @@ int h5repack_addlayout(const char* str, else { options->chunk_g.rank=pack.chunk.rank; - for (j = 0; j < pack.chunk.rank; j++) + for (j = 0; j < pack.chunk.rank; j++) options->chunk_g.chunk_lengths[j] = pack.chunk.chunk_lengths[j]; } } @@ -249,7 +249,7 @@ static int check_options(pack_opt_t *options) * objects to layout *------------------------------------------------------------------------- */ - if (options->verbose) + if (options->verbose) { printf("Objects to modify layout are...\n"); if (options->all_layout==1) { @@ -271,22 +271,22 @@ static int check_options(pack_opt_t *options) printf(" Apply %s layout to all\n", slayout); if (H5D_CHUNKED==options->layout_g) { printf("with dimension ["); - for ( j = 0; j < options->chunk_g.rank; j++) + for ( j = 0; j < options->chunk_g.rank; j++) printf("%d ",(int)options->chunk_g.chunk_lengths[j]); printf("]\n"); } } }/* verbose */ - for ( i = 0; i < options->op_tbl->nelems; i++) + for ( i = 0; i < options->op_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; - + if (options->op_tbl->objs[i].chunk.rank>0) { if (options->verbose){ - printf(" <%s> with chunk size ",name); - for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) + printf(" <%s> with chunk size ",name); + for ( k = 0; k < options->op_tbl->objs[i].chunk.rank; k++) printf("%d ",(int)options->op_tbl->objs[i].chunk.chunk_lengths[k]); printf("\n"); } @@ -295,26 +295,26 @@ static int check_options(pack_opt_t *options) else if (options->op_tbl->objs[i].chunk.rank==-2) { if (options->verbose) - printf(" <%s> %s\n",name,"NONE (contigous)"); + printf(" <%s> %s\n",name,"NONE (contigous)"); has_ck=1; } } - + if (options->all_layout==1 && has_ck){ printf("Error: Invalid chunking input: all option\ is present with other objects\n"); return -1; } - + /*------------------------------------------------------------------------- * objects to filter *------------------------------------------------------------------------- */ - - if (options->verbose) + + if (options->verbose) { printf("Objects to apply filter are...\n"); - if (options->all_filter==1) + if (options->all_filter==1) { H5Z_filter_t filtn=options->filter_g.filtn; switch (filtn) @@ -336,14 +336,14 @@ static int check_options(pack_opt_t *options) } } /* verbose */ - for ( i = 0; i < options->op_tbl->nelems; i++) + for ( i = 0; i < options->op_tbl->nelems; i++) { pack_info_t pack = options->op_tbl->objs[i]; char* name = pack.path; for ( j=0; j<pack.nfilters; j++) { - if (options->verbose) + if (options->verbose) { printf(" <%s> with %s filter\n", name, @@ -354,13 +354,13 @@ static int check_options(pack_opt_t *options) } /* j */ } /* i */ - + if (options->all_filter==1 && has_cp){ printf("Error: Invalid compression input: all option\ is present with other objects\n"); return -1; } - + return 0; } @@ -380,7 +380,7 @@ static int check_options(pack_opt_t *options) */ void read_info(const char *filename, - pack_opt_t *options) + pack_opt_t *options) { char stype[10]; @@ -390,15 +390,15 @@ void read_info(const char *filename, int i, rc=1; char *srcdir = getenv("srcdir"); /* the source directory */ char data_file[512]=""; /* buffer to hold name of existing file */ - + /* compose the name of the file to open, using the srcdir, if appropriate */ if (srcdir){ strcpy(data_file,srcdir); strcat(data_file,"/"); - } + } strcat(data_file,filename); - + if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { printf( "Cannot open options file %s", filename); exit(1); @@ -410,12 +410,12 @@ void read_info(const char *filename, rc=fscanf(fp, "%s", stype); if (rc==-1) break; - + /*------------------------------------------------------------------------- * filter *------------------------------------------------------------------------- */ - if (strcmp(stype,"-f") == 0) { + if (strcmp(stype,"-f") == 0) { /* find begining of info */ i=0; c='0'; @@ -434,7 +434,7 @@ void read_info(const char *filename, if (feof(fp)) break; if (c==10 /*eol*/) break; } - comp_info[i-1]='\0'; /*cut the last " */ + comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addfilter(comp_info,options)==-1){ printf( "Could not add compression option. Exiting\n"); @@ -445,8 +445,8 @@ void read_info(const char *filename, * layout *------------------------------------------------------------------------- */ - else if (strcmp(stype,"-l") == 0) { - + else if (strcmp(stype,"-l") == 0) { + /* find begining of info */ i=0; c='0'; while( c!=' ' ) @@ -464,7 +464,7 @@ void read_info(const char *filename, if (feof(fp)) break; if (c==10 /*eol*/) break; } - comp_info[i-1]='\0'; /*cut the last " */ + comp_info[i-1]='\0'; /*cut the last " */ if (h5repack_addlayout(comp_info,options)==-1){ printf( "Could not add chunck option. Exiting\n"); diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 315079d..fb99718 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -38,17 +38,17 @@ /* a list of names */ typedef struct { - char obj[MAX_NC_NAME]; + char obj[MAX_NC_NAME]; } obj_list_t; -/* - the type of filter and additional parameter +/* + the type of filter and additional parameter type can be one of the filters H5Z_FILTER_NONE 0, uncompress if compressed - H5Z_FILTER_DEFLATE 1 , deflation like gzip + H5Z_FILTER_DEFLATE 1 , deflation like gzip H5Z_FILTER_SHUFFLE 2 , shuffle the data H5Z_FILTER_FLETCHER32 3 , letcher32 checksum of EDC - H5Z_FILTER_SZIP 4 , szip compression + H5Z_FILTER_SZIP 4 , szip compression */ #define CDVALUES 2 @@ -57,15 +57,15 @@ typedef struct { H5Z_filter_t filtn; /* filter identification number */ int cd_values[CDVALUES]; /* filter client data values */ /* extra input for szip, selects the coding method - entropy coding method: EC=0 - nearest neighbor coding method: NN=1 + entropy coding method: EC=0 + nearest neighbor coding method: NN=1 */ - int szip_coding; + int szip_coding; } filter_info_t; /* chunk lengths along each dimension and rank */ typedef struct { - hsize_t chunk_lengths[MAX_VAR_DIMS]; + hsize_t chunk_lengths[MAX_VAR_DIMS]; int rank; } chunk_info_t; @@ -141,29 +141,29 @@ int h5repack_cmpdcpl (const char *fname1, */ -int check_objects(const char* fname, +int check_objects(const char* fname, pack_opt_t *options); -int copy_objects(const char* fnamein, +int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options); -void print_objlist(const char *filename, - int nobjects, +void print_objlist(const char *filename, + int nobjects, trav_info_t *travi ); -int do_copy_objects(hid_t fidin, - hid_t fidout, +int do_copy_objects(hid_t fidin, + hid_t fidout, trav_table_t *travt, pack_opt_t *options); -int copy_attr(hid_t loc_in, - hid_t loc_out, +int copy_attr(hid_t loc_in, + hid_t loc_out, pack_opt_t *options ); -int do_copy_refobjs(hid_t fidin, - hid_t fidout, +int do_copy_refobjs(hid_t fidin, + hid_t fidout, trav_table_t *travt, pack_opt_t *options); /* repack options */ @@ -235,13 +235,13 @@ pack_info_t* options_get_object( const char *path, *------------------------------------------------------------------------- */ -obj_list_t* parse_filter(const char *str, - int *n_objs, +obj_list_t* parse_filter(const char *str, + int *n_objs, filter_info_t *filt, pack_opt_t *options); -obj_list_t* parse_layout(const char *str, - int *n_objs, +obj_list_t* parse_layout(const char *str, + int *n_objs, pack_info_t *pack, /* info about object */ pack_opt_t *options); @@ -283,23 +283,23 @@ int parse_number(char *str); int make_testfiles(void); -int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, +int write_dset( hid_t loc_id, + int rank, + hsize_t *dims, const char *dset_name, - hid_t type_id, + hid_t type_id, void *buf ); -int write_attr(hid_t loc_id, - int rank, - hsize_t *dims, +int write_attr(hid_t loc_id, + int rank, + hsize_t *dims, const char *attr_name, - hid_t type_id, + hid_t type_id, void *buf); -void write_attr_in(hid_t loc_id, +void write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t fid, /* for reference create */ int make_diffs /* flag to modify data buffers */); -void write_dset_in(hid_t loc_id, +void write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id, int make_diffs /* flag to modify data buffers */); @@ -312,15 +312,15 @@ void write_dset_in(hid_t loc_id, */ int make_dset(hid_t loc_id, const char *name, - hid_t sid, + hid_t sid, hid_t dcpl, void *buf); -int make_attr(hid_t loc_id, - int rank, - hsize_t *dims, +int make_attr(hid_t loc_id, + int rank, + hsize_t *dims, const char *attr_name, - hid_t type_id, + hid_t type_id, void *buf); diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 05ea7fa..5b0520d 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -26,16 +26,16 @@ /*------------------------------------------------------------------------- * Function: print_obj * - * Purpose: print name and filters of an object + * Purpose: print name and filters of an object * *------------------------------------------------------------------------- */ static void print_obj(hid_t dcpl_id, char *name) { - char str[255]; + char str[255]; #if defined (PRINT_DEBUG ) - char temp[255]; -#endif + char temp[255]; +#endif int nfilters; /* number of filters */ unsigned filt_flags; /* filter flags */ H5Z_filter_t filtn; /* filter identification number */ @@ -47,7 +47,7 @@ static void print_obj(hid_t dcpl_id, char *name) strcpy(str,"\0"); /* get information about input filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return; for ( i=0; i<nfilters; i++) @@ -55,20 +55,20 @@ static void print_obj(hid_t dcpl_id, char *name) cd_nelmts = NELMTS(cd_values); #ifdef H5_WANT_H5_V1_6_COMPAT - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name); #else - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name, NULL); #endif /* H5_WANT_H5_V1_6_COMPAT */ @@ -83,7 +83,7 @@ static void print_obj(hid_t dcpl_id, char *name) #if defined (PRINT_DEBUG) { - unsigned level=cd_values[0]; + unsigned level=cd_values[0]; sprintf(temp,"(%d)",level); strcat(str,temp); } @@ -96,12 +96,12 @@ static void print_obj(hid_t dcpl_id, char *name) #if defined (PRINT_DEBUG) { unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ - unsigned ppb=cd_values[1]; + unsigned ppb=cd_values[1]; sprintf(temp,"(%d,",ppb); strcat(str,temp); - if (options_mask & H5_SZIP_EC_OPTION_MASK) + if (options_mask & H5_SZIP_EC_OPTION_MASK) strcpy(temp,"EC) "); - else if (options_mask & H5_SZIP_NN_OPTION_MASK) + else if (options_mask & H5_SZIP_NN_OPTION_MASK) strcpy(temp,"NN) "); } strcat(str,temp); @@ -132,7 +132,7 @@ static void print_obj(hid_t dcpl_id, char *name) /*------------------------------------------------------------------------- * Function: copy_objects * - * Purpose: duplicate all HDF5 objects in the file + * Purpose: duplicate all HDF5 objects in the file * * Return: 0, ok, -1 no * @@ -143,16 +143,16 @@ static void print_obj(hid_t dcpl_id, char *name) *------------------------------------------------------------------------- */ -int copy_objects(const char* fnamein, +int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options) { - hid_t fidin; - hid_t fidout=(-1); + hid_t fidin; + hid_t fidout=(-1); trav_table_t *travt=NULL; /*------------------------------------------------------------------------- - * open the files + * open the files *------------------------------------------------------------------------- */ if ((fidin=H5Fopen(fnamein,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ){ @@ -224,7 +224,7 @@ out: /*------------------------------------------------------------------------- * Function: do_copy_objects * - * Purpose: duplicate all HDF5 objects in the file + * Purpose: duplicate all HDF5 objects in the file * * Return: 0, ok, -1 no * @@ -237,21 +237,21 @@ out: *------------------------------------------------------------------------- */ -int do_copy_objects(hid_t fidin, - hid_t fidout, +int do_copy_objects(hid_t fidin, + hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in=(-1); /* group ID */ - hid_t grp_out=(-1); /* group ID */ - hid_t dset_in=(-1); /* read dataset ID */ - hid_t dset_out=(-1); /* write dataset ID */ - hid_t type_in=(-1); /* named type ID */ - hid_t type_out=(-1); /* named type ID */ - hid_t dcpl_id=(-1); /* dataset creation property list ID */ - hid_t dcpl_out=(-1); /* dataset creation property list ID */ - hid_t space_id=(-1); /* space ID */ - hid_t ftype_id=(-1); /* file data type ID */ + hid_t grp_in=(-1); /* group ID */ + hid_t grp_out=(-1); /* group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t type_out=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t dcpl_out=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ void *buf=NULL; /* data buffer */ @@ -281,22 +281,22 @@ int do_copy_objects(hid_t fidin, if (options->verbose) printf(" %-10s %s\n", "group",travt->objs[i].name ); - if ((grp_out=H5Gcreate(fidout,travt->objs[i].name, 0))<0) + if ((grp_out=H5Gcreate(fidout,travt->objs[i].name, 0))<0) goto error; - if((grp_in = H5Gopen (fidin,travt->objs[i].name))<0) + if((grp_in = H5Gopen (fidin,travt->objs[i].name))<0) goto error; /*------------------------------------------------------------------------- * copy attrs *------------------------------------------------------------------------- */ - if (copy_attr(grp_in,grp_out,options)<0) + if (copy_attr(grp_in,grp_out,options)<0) goto error; - - if (H5Gclose(grp_out)<0) + + if (H5Gclose(grp_out)<0) goto error; - if (H5Gclose(grp_in)<0) + if (H5Gclose(grp_in)<0) goto error; @@ -308,15 +308,15 @@ int do_copy_objects(hid_t fidin, */ case H5G_DATASET: - if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) + if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) goto error; - if ((space_id=H5Dget_space(dset_in))<0) + if ((space_id=H5Dget_space(dset_in))<0) goto error; - if ((ftype_id=H5Dget_type (dset_in))<0) + if ((ftype_id=H5Dget_type (dset_in))<0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_in))<0) + if ((dcpl_id=H5Dget_create_plist(dset_in))<0) goto error; - if ((dcpl_out = H5Pcopy (dcpl_id))<0) + if ((dcpl_out = H5Pcopy (dcpl_id))<0) goto error; if ( (rank=H5Sget_simple_extent_ndims(space_id))<0) goto error; @@ -324,12 +324,12 @@ int do_copy_objects(hid_t fidin, if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0) goto error; nelmts=1; - for (j=0; j<rank; j++) + for (j=0; j<rank; j++) nelmts*=dims[j]; - + if (options->verbose) print_obj(dcpl_id,travt->objs[i].name ); - + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) goto error; @@ -340,7 +340,7 @@ int do_copy_objects(hid_t fidin, * check for external files *------------------------------------------------------------------------- */ - if ((next=H5Pget_external_count (dcpl_id))<0) + if ((next=H5Pget_external_count (dcpl_id))<0) goto error; if (next) { @@ -348,8 +348,8 @@ int do_copy_objects(hid_t fidin, } /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration + * check if the dataset creation property list has filters that + * are not registered in the current configuration * 1) the external filters GZIP and SZIP might not be available * 2) the internal filters might be turned off *------------------------------------------------------------------------- @@ -365,10 +365,10 @@ int do_copy_objects(hid_t fidin, */ if ( (H5T_REFERENCE!=H5Tget_class(mtype_id))) { - + /* get the storage size of the input dataset */ dsize_in=H5Dget_storage_size(dset_in); - + /*------------------------------------------------------------------------- * read to memory *------------------------------------------------------------------------- @@ -382,7 +382,7 @@ int do_copy_objects(hid_t fidin, } if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto error; - + /*------------------------------------------------------------------------- * apply the filter *------------------------------------------------------------------------- @@ -391,7 +391,7 @@ int do_copy_objects(hid_t fidin, goto error; }/*nelmts*/ - + /*------------------------------------------------------------------------- * create; * disable error checking in case the dataset cannot be created with the @@ -405,9 +405,9 @@ int do_copy_objects(hid_t fidin, if (dset_out==FAIL) { - if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) + if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) goto error; - + if (options->verbose) printf("Warning: Could not apply the filter to <%s>\n", travt->objs[i].name); } @@ -425,16 +425,16 @@ int do_copy_objects(hid_t fidin, * copy attrs *------------------------------------------------------------------------- */ - if (copy_attr(dset_in,dset_out,options)<0) + if (copy_attr(dset_in,dset_out,options)<0) goto error; /*close */ - if (H5Dclose(dset_out)<0) + if (H5Dclose(dset_out)<0) goto error; - + if (buf) free(buf); - + }/*H5T_STD_REF_OBJ*/ }/*can_read*/ @@ -443,19 +443,19 @@ int do_copy_objects(hid_t fidin, * close *------------------------------------------------------------------------- */ - if (H5Tclose(ftype_id)<0) + if (H5Tclose(ftype_id)<0) goto error; - if (H5Tclose(mtype_id)<0) + if (H5Tclose(mtype_id)<0) goto error; - if (H5Pclose(dcpl_id)<0) + if (H5Pclose(dcpl_id)<0) goto error; - if (H5Pclose(dcpl_out)<0) + if (H5Pclose(dcpl_out)<0) goto error; - if (H5Sclose(space_id)<0) + if (H5Sclose(space_id)<0) goto error; - if (H5Dclose(dset_in)<0) + if (H5Dclose(dset_in)<0) goto error; - + break; /*------------------------------------------------------------------------- @@ -464,25 +464,25 @@ int do_copy_objects(hid_t fidin, */ case H5G_TYPE: - if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) + if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) goto error; - if ((type_out = H5Tcopy(type_in))<0) + if ((type_out = H5Tcopy(type_in))<0) goto error; - if ((H5Tcommit(fidout,travt->objs[i].name,type_out))<0) + if ((H5Tcommit(fidout,travt->objs[i].name,type_out))<0) goto error; /*------------------------------------------------------------------------- * copy attrs *------------------------------------------------------------------------- */ - if (copy_attr(type_in,type_out,options)<0) + if (copy_attr(type_in,type_out,options)<0) goto error; - - if (H5Tclose(type_in)<0) + + if (H5Tclose(type_in)<0) goto error; - if (H5Tclose(type_out)<0) + if (H5Tclose(type_out)<0) goto error; if (options->verbose) @@ -500,12 +500,12 @@ int do_copy_objects(hid_t fidin, { H5G_stat_t statbuf; char *targbuf=NULL; - + if (H5Gget_objinfo(fidin,travt->objs[i].name,FALSE,&statbuf)<0) goto error; - + targbuf = malloc(statbuf.linklen); - + if (H5Gget_linkval(fidin,travt->objs[i].name,statbuf.linklen,targbuf)<0) goto error; @@ -513,11 +513,11 @@ int do_copy_objects(hid_t fidin, H5G_LINK_SOFT, targbuf, /* current name of object */ travt->objs[i].name /* new name of object */ - )<0) + )<0) goto error; - + free(targbuf); - + if (options->verbose) printf(" %-10s %s\n","link",travt->objs[i].name ); @@ -530,31 +530,31 @@ int do_copy_objects(hid_t fidin, break; } } - + /*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group + * the root is a special case, we get an ID for the root group * and copy its attributes using that ID * it must be done last, because the attributes might contain references to * objects in the object list *------------------------------------------------------------------------- */ - if ((grp_out = H5Gopen(fidout,"/"))<0) + if ((grp_out = H5Gopen(fidout,"/"))<0) goto error; - - if ((grp_in = H5Gopen(fidin,"/"))<0) + + if ((grp_in = H5Gopen(fidin,"/"))<0) goto error; - - if (copy_attr(grp_in,grp_out,options)<0) + + if (copy_attr(grp_in,grp_out,options)<0) goto error; - - if (H5Gclose(grp_out)<0) + + if (H5Gclose(grp_out)<0) goto error; - if (H5Gclose(grp_in)<0) + if (H5Gclose(grp_in)<0) goto error; - + return 0; - + error: H5E_BEGIN_TRY { H5Gclose(grp_in); @@ -578,7 +578,7 @@ error: /*------------------------------------------------------------------------- * Function: copy_attr * - * Purpose: copy attributes located in LOC_IN, which is obtained either from + * Purpose: copy attributes located in LOC_IN, which is obtained either from * loc_id = H5Gopen( fid, name); * loc_id = H5Dopen( fid, name); * loc_id = H5Topen( fid, name); @@ -592,15 +592,15 @@ error: *------------------------------------------------------------------------- */ -int copy_attr(hid_t loc_in, - hid_t loc_out, +int copy_attr(hid_t loc_in, + hid_t loc_out, pack_opt_t *options ) { - hid_t attr_id=-1; /* attr ID */ - hid_t attr_out=-1; /* attr ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file data type ID */ + hid_t attr_id=-1; /* attr ID */ + hid_t attr_out=-1; /* attr ID */ + hid_t space_id=-1; /* space ID */ + hid_t ftype_id=-1; /* file data type ID */ hid_t mtype_id=-1; /* memory data type ID */ size_t msize; /* memory size of type */ void *buf=NULL; /* data buffer */ @@ -611,44 +611,44 @@ int copy_attr(hid_t loc_in, int n, j; unsigned u; - if ((n = H5Aget_num_attrs(loc_in))<0) + if ((n = H5Aget_num_attrs(loc_in))<0) goto error; - + for ( u = 0; u < (unsigned)n; u++) { - /* set data buffer to NULL each iteration - we might not use it in the case of references + /* set data buffer to NULL each iteration + we might not use it in the case of references */ - buf=NULL; + buf=NULL; /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ /* open attribute */ - if ((attr_id = H5Aopen_idx(loc_in, u))<0) + if ((attr_id = H5Aopen_idx(loc_in, u))<0) goto error; - + /* get name */ - if (H5Aget_name( attr_id, 255, name )<0) + if (H5Aget_name( attr_id, 255, name )<0) goto error; /* get the file datatype */ if ((ftype_id = H5Aget_type( attr_id )) < 0 ) goto error; - + /* get the dataspace handle */ if ((space_id = H5Aget_space( attr_id )) < 0 ) goto error; - + /* get dimensions */ if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 ) goto error; - + nelmts=1; - for (j=0; j<rank; j++) + for (j=0; j<rank; j++) nelmts*=dims[j]; - + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) goto error; @@ -657,20 +657,20 @@ int copy_attr(hid_t loc_in, /*------------------------------------------------------------------------- * object references are a special case - * we cannot just copy the buffers, but instead we recreate the reference - * this is done on a second sweep of the file that just copies + * we cannot just copy the buffers, but instead we recreate the reference + * this is done on a second sweep of the file that just copies * the referenced objects *------------------------------------------------------------------------- */ - if ( ! H5Tequal(mtype_id, H5T_STD_REF_OBJ)) + if ( ! H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { - - + + /*------------------------------------------------------------------------- * read to memory *------------------------------------------------------------------------- */ - + buf=(void *) HDmalloc((unsigned)(nelmts*msize)); if ( buf==NULL){ printf( "cannot read into memory\n" ); @@ -678,32 +678,32 @@ int copy_attr(hid_t loc_in, } if (H5Aread(attr_id,mtype_id,buf)<0) goto error; - + /*------------------------------------------------------------------------- - * copy + * copy *------------------------------------------------------------------------- */ - + if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0) goto error; if(H5Awrite(attr_out,mtype_id,buf)<0) goto error; - + /*close*/ - if (H5Aclose(attr_out)<0) + if (H5Aclose(attr_out)<0) goto error; - - + + if (buf) free(buf); - - + + } /*H5T_STD_REF_OBJ*/ - + if (options->verbose) printf(" %-13s %s\n", "attr", name); - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -715,7 +715,7 @@ int copy_attr(hid_t loc_in, if (H5Aclose(attr_id)<0) goto error; } /* u */ - + return 0; error: diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 28771a9..0b5ff2b 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -25,26 +25,26 @@ * *------------------------------------------------------------------------- */ -static +static int aux_find_obj(const char* name, /* object name from traverse list */ - pack_opt_t *options, /* repack options */ + pack_opt_t *options, /* repack options */ pack_info_t *obj /*OUT*/) /* info about object to filter */ { char *pdest; int result; int i; - - for ( i=0; i<options->op_tbl->nelems; i++) + + for ( i=0; i<options->op_tbl->nelems; i++) { if (strcmp(options->op_tbl->objs[i].path,name)==0) { *obj = options->op_tbl->objs[i]; return i; } - + pdest = strstr(name,options->op_tbl->objs[i].path); result = (int)(pdest - name); - + /* found at position 1, meaning without '/' */ if( pdest != NULL && result==1 ) { @@ -52,7 +52,7 @@ int aux_find_obj(const char* name, /* object name from traverse list */ return i; } }/*i*/ - + return -1; } @@ -79,11 +79,11 @@ int aux_assign_obj(const char* name, /* object name from traverse lis init_packobject(&tmp); idx = aux_find_obj(name,options,&tmp); - + /* name was on input */ if (idx>=0) { - + /* applying to all objects */ if (options->all_layout) { @@ -93,7 +93,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis { case H5D_CHUNKED: tmp.chunk.rank=options->chunk_g.rank; - for ( i=0; i<tmp.chunk.rank; i++) + for ( i=0; i<tmp.chunk.rank; i++) tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i]; break; default: @@ -107,15 +107,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis { case H5D_CHUNKED: tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank; - for ( i=0; i<tmp.chunk.rank; i++) + for ( i=0; i<tmp.chunk.rank; i++) tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i]; break; default: break; }/*switch*/ - + } - + /* applying to all objects */ if (options->all_filter) { @@ -126,29 +126,29 @@ int aux_assign_obj(const char* name, /* object name from traverse lis else { tmp.nfilters=options->op_tbl->objs[idx].nfilters; - for ( i=0; i<tmp.nfilters; i++) + for ( i=0; i<tmp.nfilters; i++) { tmp.filter[i] = options->op_tbl->objs[idx].filter[i]; } } - - + + } /* if idx */ - + /* no input name */ else { - + if (options->all_filter) { /* assign the global filter */ tmp.nfilters=1; tmp.filter[0]=options->filter_g; } - - + + if (options->all_layout) { /* assign the global layout info to the OBJ info */ @@ -157,21 +157,21 @@ int aux_assign_obj(const char* name, /* object name from traverse lis { case H5D_CHUNKED: tmp.chunk.rank=options->chunk_g.rank; - for ( i=0; i<tmp.chunk.rank; i++) + for ( i=0; i<tmp.chunk.rank; i++) tmp.chunk.chunk_lengths[i]=options->chunk_g.chunk_lengths[i]; break; default: break; }/*switch*/ - + } - - + + } - + *obj = tmp; return 1; - + } @@ -179,7 +179,7 @@ int aux_assign_obj(const char* name, /* object name from traverse lis /*------------------------------------------------------------------------- * Function: apply_filters * - * Purpose: apply the filters in the object to the property list; + * Purpose: apply the filters in the object to the property list; * do extra checking in the case of SZIP; delete all filters in the case * of H5Z_FILTER_NONE present in the PACK_INFO_T filter array * @@ -197,7 +197,7 @@ int apply_filters(const char* name, /* object name from traverse list */ hid_t dcpl_id, /* dataset creation property list */ hid_t type_id, /* dataset datatype */ pack_opt_t *options) /* repack options */ -{ +{ int nfilters; /* number of filters in DCPL */ unsigned aggression; /* the deflate level */ hsize_t nelmts; /* number of elements in dataset */ @@ -206,31 +206,31 @@ int apply_filters(const char* name, /* object name from traverse list */ H5D_layout_t layout; int i; pack_info_t obj; - - + + if (rank==0) goto out; - + /*------------------------------------------------------------------------- * initialize the assigment object *------------------------------------------------------------------------- */ init_packobject(&obj); - - + + /*------------------------------------------------------------------------- * find options *------------------------------------------------------------------------- */ if (aux_assign_obj(name,options,&obj)==0) return 0; - - + + /* check for datasets too small */ if ((size=H5Tget_size(type_id))==0) return 0; nelmts=1; - for (i=0; i<rank; i++) + for (i=0; i<rank; i++) nelmts*=dims[i]; if (nelmts*size < options->threshold ) { @@ -239,9 +239,9 @@ int apply_filters(const char* name, /* object name from traverse list */ name,(int)options->threshold); return 0; } - + /* get information about input filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; /*------------------------------------------------------------------------- * check if we have filters in the pipeline @@ -250,7 +250,7 @@ int apply_filters(const char* name, /* object name from traverse list */ *------------------------------------------------------------------------- */ if (nfilters && obj.nfilters ) { - if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0) return -1; } @@ -262,9 +262,9 @@ int apply_filters(const char* name, /* object name from traverse list */ */ if (obj.layout == -1 ) { - if ((layout = H5Pget_layout(dcpl_id))<0) + if ((layout = H5Pget_layout(dcpl_id))<0) return -1; - + if (layout==H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0) @@ -278,23 +278,23 @@ int apply_filters(const char* name, /* object name from traverse list */ - + /*------------------------------------------------------------------------- - * the type of filter and additional parameter + * the type of filter and additional parameter * type can be one of the filters * H5Z_FILTER_NONE 0, uncompress if compressed - * H5Z_FILTER_DEFLATE 1 , deflation like gzip + * H5Z_FILTER_DEFLATE 1 , deflation like gzip * H5Z_FILTER_SHUFFLE 2 , shuffle the data * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC - * H5Z_FILTER_SZIP 4 , szip compression - * H5Z_FILTER_NBIT 5 , nbit compression - * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression + * H5Z_FILTER_SZIP 4 , szip compression + * H5Z_FILTER_NBIT 5 , nbit compression + * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression *------------------------------------------------------------------------- */ - + if (obj.nfilters) { - + /*------------------------------------------------------------------------- * filters require CHUNK layout; if we do not have one define a default *------------------------------------------------------------------------- @@ -302,19 +302,19 @@ int apply_filters(const char* name, /* object name from traverse list */ if (obj.layout==-1) { obj.chunk.rank=rank; - for (i=0; i<rank; i++) + for (i=0; i<rank; i++) obj.chunk.chunk_lengths[i] = dims[i]; } - + for ( i=0; i<obj.nfilters; i++) { switch (obj.filter[i].filtn) { default: break; - + /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE 1 , deflation like gzip + * H5Z_FILTER_DEFLATE 1 , deflation like gzip *------------------------------------------------------------------------- */ case H5Z_FILTER_DEFLATE: @@ -325,31 +325,31 @@ int apply_filters(const char* name, /* object name from traverse list */ if(H5Pset_deflate(dcpl_id,aggression)<0) return -1; break; - + /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP 4 , szip compression + * H5Z_FILTER_SZIP 4 , szip compression *------------------------------------------------------------------------- */ case H5Z_FILTER_SZIP: { unsigned options_mask; unsigned pixels_per_block; - + pixels_per_block=obj.filter[i].cd_values[0]; if (obj.filter[i].szip_coding==0) options_mask=H5_SZIP_NN_OPTION_MASK; - else + else options_mask=H5_SZIP_EC_OPTION_MASK; - + /* set up for szip data */ if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0) return -1; - if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0) + if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0) return -1; - + } break; - + /*------------------------------------------------------------------------- * H5Z_FILTER_SHUFFLE 2 , shuffle the data *------------------------------------------------------------------------- @@ -357,10 +357,10 @@ int apply_filters(const char* name, /* object name from traverse list */ case H5Z_FILTER_SHUFFLE: if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; - if (H5Pset_shuffle(dcpl_id)<0) + if (H5Pset_shuffle(dcpl_id)<0) return -1; break; - + /*------------------------------------------------------------------------- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC *------------------------------------------------------------------------- @@ -368,7 +368,7 @@ int apply_filters(const char* name, /* object name from traverse list */ case H5Z_FILTER_FLETCHER32: if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; - if (H5Pset_fletcher32(dcpl_id)<0) + if (H5Pset_fletcher32(dcpl_id)<0) return -1; break; /*----------- ------------------------------------------------------------- @@ -378,7 +378,7 @@ int apply_filters(const char* name, /* object name from traverse list */ case H5Z_FILTER_NBIT: if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; - if (H5Pset_nbit(dcpl_id)<0) + if (H5Pset_nbit(dcpl_id)<0) return -1; break; /*----------- ------------------------------------------------------------- @@ -389,39 +389,39 @@ int apply_filters(const char* name, /* object name from traverse list */ aggression=obj.filter[i].cd_values[0]; if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; - if (H5Pset_scaleoffset(dcpl_id,aggression,2)<0) + if (H5Pset_scaleoffset(dcpl_id,aggression,2)<0) return -1; break; } /* switch */ }/*i*/ - + } /*obj.nfilters*/ - + /*------------------------------------------------------------------------- - * layout + * layout *------------------------------------------------------------------------- */ - + if (obj.layout>=0) { /* a layout was defined */ - if (H5Pset_layout(dcpl_id, obj.layout)<0) + if (H5Pset_layout(dcpl_id, obj.layout)<0) return -1; - + if (H5D_CHUNKED==obj.layout) { /* set up chunk */ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; } else if (H5D_COMPACT==obj.layout) { - if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0) + if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0) return -1; } - + } - + return 0; - + out: if (options->verbose) printf("Warning: Filter could not be applied to <%s>\n",name); @@ -440,7 +440,7 @@ out: *------------------------------------------------------------------------- */ -int print_filters(hid_t dcpl_id) +int print_filters(hid_t dcpl_id) { int nfilters; /* number of filters */ unsigned filt_flags; /* filter flags */ @@ -453,31 +453,31 @@ int print_filters(hid_t dcpl_id) int i; /* get information about filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; - - for (i=0; i<nfilters; i++) + + for (i=0; i<nfilters; i++) { cd_nelmts = NELMTS(cd_values); #ifdef H5_WANT_H5_V1_6_COMPAT - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name); #else - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name, NULL); #endif /* H5_WANT_H5_V1_6_COMPAT */ - + f_name[sizeof(f_name)-1] = '\0'; sprintf(s, "Filter-%d:", i); printf(" %-10s %s-%u %s {", s, @@ -488,8 +488,8 @@ int print_filters(hid_t dcpl_id) printf("%s%u", cd_num?", ":"", cd_values[cd_num]); } printf("}\n"); - } - + } + return 0; } diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 3f65e63..ab7e5b2 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -34,21 +34,21 @@ * *------------------------------------------------------------------------- */ -int check_objects(const char* fname, +int check_objects(const char* fname, pack_opt_t *options) { - hid_t fid; + hid_t fid; int i; trav_table_t *travt=NULL; /*------------------------------------------------------------------------- - * open the file + * open the file *------------------------------------------------------------------------- */ /* disable out reporting */ H5E_BEGIN_TRY { - + /* Open the files */ if ((fid=H5Fopen(fname,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ){ printf("h5repack: <%s>: %s\n", fname, H5FOPENERROR ); @@ -74,18 +74,18 @@ int check_objects(const char* fname, * compare with user supplied list *------------------------------------------------------------------------- */ - + if (options->verbose) { printf("Opening file <%s>. Searching for objects to modify...\n",fname); } - - for ( i = 0; i < options->op_tbl->nelems; i++) + + for ( i = 0; i < options->op_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; if (options->verbose) printf(" <%s>",name); - + /* the input object names are present in the file and are valid */ if (h5trav_getindext(name,travt)<0) { @@ -109,41 +109,41 @@ int check_objects(const char* fname, int ppb=options->op_tbl->objs[i].filter->cd_values[0]; hsize_t dims[H5S_MAX_RANK]; int rank; - hid_t did; - hid_t sid; + hid_t did; + hid_t sid; if (options->op_tbl->objs[i].chunk.rank>0) { rank=options->op_tbl->objs[i].chunk.rank; - for (j=0; j<rank; j++) + for (j=0; j<rank; j++) csize*=(int)options->op_tbl->objs[i].chunk.chunk_lengths[j]; } else { - if ((did=H5Dopen(fid,travt->objs[i].name))<0) + if ((did=H5Dopen(fid,travt->objs[i].name))<0) goto out; - if ((sid=H5Dget_space(did))<0) + if ((sid=H5Dget_space(did))<0) goto out; if ( (rank=H5Sget_simple_extent_ndims(sid))<0) goto out; HDmemset(dims, 0, sizeof dims); if ( H5Sget_simple_extent_dims(sid,dims,NULL)<0) goto out; - for (j=0; j<rank; j++) + for (j=0; j<rank; j++) csize*=(int)dims[j]; - if (H5Sclose(sid)<0) + if (H5Sclose(sid)<0) goto out; - if (H5Dclose(did)<0) + if (H5Dclose(did)<0) goto out; - } - + } + if (csize < ppb ) { printf("Warning: SZIP settins, chunk size is smaller than pixels per block...Exiting\n"); goto out; } - - + + } break; @@ -181,8 +181,8 @@ out: * *------------------------------------------------------------------------- */ -void print_objlist(const char *filename, - int nobjects, +void print_objlist(const char *filename, + int nobjects, trav_info_t *info ) { int i; diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 8771328..665f8e1 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -22,7 +22,7 @@ static void usage(void); * * Purpose: h5repack main program * - * Return: 1, error, 0, no error + * Return: 1, error, 0, no error * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -47,7 +47,7 @@ int main(int argc, char **argv) /* initialize options */ h5repack_init (&options,0); - for ( i = 1; i < argc; i++) + for ( i = 1; i < argc; i++) { if (strcmp(argv[i], "-h") == 0) { usage(); @@ -56,14 +56,14 @@ int main(int argc, char **argv) if (strcmp(argv[i], "-i") == 0) { infile = argv[++i]; } - else if (strcmp(argv[i], "-o") == 0) { - outfile = argv[++i]; + else if (strcmp(argv[i], "-o") == 0) { + outfile = argv[++i]; } - else if (strcmp(argv[i], "-v") == 0) { + else if (strcmp(argv[i], "-v") == 0) { options.verbose = 1; } - else if (strcmp(argv[i], "-f") == 0) { - + else if (strcmp(argv[i], "-f") == 0) { + /* add the -f filter option */ if (h5repack_addfilter(argv[i+1],&options)<0) exit(1); @@ -71,17 +71,17 @@ int main(int argc, char **argv) /* jump to next */ ++i; } - else if (strcmp(argv[i], "-l") == 0) { - + else if (strcmp(argv[i], "-l") == 0) { + /* parse the -l layout option */ if (h5repack_addlayout(argv[i+1],&options)<0) exit(1); - + /* jump to next */ ++i; } - else if (strcmp(argv[i], "-m") == 0) { + else if (strcmp(argv[i], "-m") == 0) { options.threshold = parse_number(argv[i+1]); if ((int)options.threshold==-1) { printf("Error: Invalid treshold size <%s>\n",argv[i+1]); @@ -89,23 +89,23 @@ int main(int argc, char **argv) } ++i; } - - else if (strcmp(argv[i], "-e") == 0) { + + else if (strcmp(argv[i], "-e") == 0) { read_info(argv[++i],&options); } - + else if (argv[i][0] == '-') { usage(); exit(1); } } - if (infile == NULL || outfile == NULL) + if (infile == NULL || outfile == NULL) { usage(); exit(1); } - + /* pack it */ ret=h5repack(infile,outfile,&options); @@ -128,7 +128,7 @@ int main(int argc, char **argv) *------------------------------------------------------------------------- */ -static +static void usage(void) { printf("h5repack -i input -o output [-h] [-v] [-f 'filter'] [-l 'layout'][-m number][-e file] \n"); diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index d85e1f5..7bb6d10 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -31,21 +31,21 @@ void init_packobject(pack_info_t *obj) { int j, k; - + strcpy(obj->path,"\0"); for ( j=0; j<H5_REPACK_MAX_NFILTERS; j++) { obj->filter[j].filtn = -1; obj->filter[j].szip_coding = -1; - for ( k=0; k<CDVALUES; k++) + for ( k=0; k<CDVALUES; k++) obj->filter[j].cd_values[k] = -1; } obj->chunk.rank = -1; obj->refobj_id = -1; obj->layout = H5D_LAYOUT_ERROR; obj->nfilters = 0; - - + + } /*------------------------------------------------------------------------- @@ -58,7 +58,7 @@ void init_packobject(pack_info_t *obj) *------------------------------------------------------------------------- */ -static void aux_tblinsert_filter(pack_opttbl_t *table, +static void aux_tblinsert_filter(pack_opttbl_t *table, int I, filter_info_t filt) { @@ -83,14 +83,14 @@ static void aux_tblinsert_filter(pack_opttbl_t *table, *------------------------------------------------------------------------- */ -static void aux_tblinsert_layout(pack_opttbl_t *table, +static void aux_tblinsert_layout(pack_opttbl_t *table, int I, pack_info_t *pack) { int k; - + table->objs[I].layout = pack->layout; - if (H5D_CHUNKED==pack->layout) + if (H5D_CHUNKED==pack->layout) { /* -2 means the NONE option, remove chunking and set the layout to contiguous */ @@ -103,7 +103,7 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, else { table->objs[I].chunk.rank = pack->chunk.rank; - for (k = 0; k < pack->chunk.rank; k++) + for (k = 0; k < pack->chunk.rank; k++) table->objs[I].chunk.chunk_lengths[k] = pack->chunk.chunk_lengths[k]; } } @@ -123,14 +123,14 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, static int aux_inctable(pack_opttbl_t *table, int n_objs ) { int i; - + table->size += n_objs; table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs==NULL) { printf("Error: not enough memory for options table\n"); return -1; } - for (i = table->nelems; i < table->size; i++) + for (i = table->nelems; i < table->size; i++) { init_packobject(&table->objs[i]); } @@ -155,7 +155,7 @@ int options_table_init( pack_opttbl_t **tbl ) printf("Error: not enough memory for options table\n"); return -1; } - + table->size = 30; table->nelems = 0; table->objs = (pack_info_t*) malloc(table->size * sizeof(pack_info_t)); @@ -163,12 +163,12 @@ int options_table_init( pack_opttbl_t **tbl ) printf("Error: not enough memory for options table\n"); return -1; } - - for ( i=0; i<table->size; i++) + + for ( i=0; i<table->size; i++) { init_packobject(&table->objs[i]); } - + *tbl = table; return 0; } @@ -207,22 +207,22 @@ int options_add_layout( obj_list_t *obj_list, pack_opttbl_t *table ) { int i, j, I, added=0, found=0; - + /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems+n_objs >= table->size) + if (table->nelems+n_objs >= table->size) { if (aux_inctable(table,n_objs)<0) return -1; } - + /* search if this object is already in the table; "path" is the key */ if (table->nelems>0) { /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) + for (j = 0; j < n_objs; j++) { /* linear table search */ - for (i = 0; i < table->nelems; i++) + for (i = 0; i < table->nelems; i++) { /*already on the table */ if (strcmp(obj_list[j].obj,table->objs[i].path)==0) @@ -242,47 +242,47 @@ int options_add_layout( obj_list_t *obj_list, } } /* if */ } /* i */ - + if (found==0) { /* keep the grow in a temp var */ - I = table->nelems + added; + I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_layout(table,I,pack); } /* cases where we have an already inserted name but there is a new name also example: - -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 - dset1 is already inserted, but dset2 must also be + -f dset1:GZIP=1 -l dset1,dset2:CHUNK=20x20 + dset1 is already inserted, but dset2 must also be */ else if (found==1 && strcmp(obj_list[j].obj,table->objs[i].path)!=0) { /* keep the grow in a temp var */ - I = table->nelems + added; + I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_layout(table,I,pack); } - } /* j */ + } /* j */ } - + /* first time insertion */ else { /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) + for (j = 0; j < n_objs; j++) { - I = table->nelems + added; + I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_layout(table,I,pack); } } - + table->nelems+= added; - + return 0; } @@ -303,24 +303,24 @@ int options_add_filter(obj_list_t *obj_list, filter_info_t filt, pack_opttbl_t *table ) { - + int i, j, I, added=0, found=0; - + /* increase the size of the collection by N_OBJS if necessary */ - if (table->nelems+n_objs >= table->size) + if (table->nelems+n_objs >= table->size) { if (aux_inctable(table,n_objs)<0) return -1; } - + /* search if this object is already in the table; "path" is the key */ if (table->nelems>0) { /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) + for (j = 0; j < n_objs; j++) { /* linear table search */ - for (i = 0; i < table->nelems; i++) + for (i = 0; i < table->nelems; i++) { /*already on the table */ if (strcmp(obj_list[j].obj,table->objs[i].path)==0) @@ -331,11 +331,11 @@ int options_add_filter(obj_list_t *obj_list, break; } /* if */ } /* i */ - + if (found==0) { /* keep the grow in a temp var */ - I = table->nelems + added; + I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_filter(table,I,filt); @@ -343,34 +343,34 @@ int options_add_filter(obj_list_t *obj_list, /* cases where we have an already inserted name but there is a new name also example: -l dset1:CHUNK=20x20 -f dset1,dset2:GZIP=1 - dset1 is already inserted, but dset2 must also be + dset1 is already inserted, but dset2 must also be */ else if (found==1 && strcmp(obj_list[j].obj,table->objs[i].path)!=0) { /* keep the grow in a temp var */ - I = table->nelems + added; + I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_filter(table,I,filt); } - } /* j */ + } /* j */ } - + /* first time insertion */ else { /* go tru the supplied list of names */ - for (j = 0; j < n_objs; j++) + for (j = 0; j < n_objs; j++) { - I = table->nelems + added; + I = table->nelems + added; added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_filter(table,I,filt); } } - + table->nelems+= added; - + return 0; } @@ -388,8 +388,8 @@ pack_info_t* options_get_object( const char *path, pack_opttbl_t *table ) { int i; - - for ( i = 0; i < table->nelems; i++) + + for ( i = 0; i < table->nelems; i++) { /* found it */ if (strcmp(table->objs[i].path,path)==0) @@ -397,7 +397,7 @@ pack_info_t* options_get_object( const char *path, return (&table->objs[i]); } } - + return NULL; } diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 1fd61ca..7e82fde 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -36,9 +36,9 @@ * FLET, to apply the HDF5 checksum filter * NBIT, to apply the HDF5 NBIT filter (NBIT compression) * S+O, to apply the HDF5 scale+offset filter (compression) - * NONE, to remove the filter + * NONE, to remove the filter * - * Examples: + * Examples: * "GZIP=6" * "A,B:NONE" * @@ -50,8 +50,8 @@ */ -obj_list_t* parse_filter(const char *str, - int *n_objs, +obj_list_t* parse_filter(const char *str, + int *n_objs, filter_info_t *filt, pack_opt_t *options) { @@ -59,10 +59,10 @@ obj_list_t* parse_filter(const char *str, char c; size_t len=strlen(str); int j, m, n, k, l, end_obj=-1, no_param=0; - char sobj[MAX_NC_NAME]; + char sobj[MAX_NC_NAME]; char scomp[10]; char stype[5]; - char smask[3]; + char smask[3]; obj_list_t* obj_list=NULL; unsigned pixels_per_block; @@ -91,7 +91,7 @@ obj_list_t* parse_filter(const char *str, /* apply to all objects */ options->all_filter=1; } - + n++; obj_list=malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) @@ -106,7 +106,7 @@ obj_list_t* parse_filter(const char *str, { c = str[j]; sobj[k]=c; - if ( c==',' || j==end_obj-1) + if ( c==',' || j==end_obj-1) { if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; strcpy(obj_list[n].obj,sobj); @@ -130,7 +130,7 @@ obj_list_t* parse_filter(const char *str, { c = str[i]; scomp[k]=c; - if ( c=='=' || i==len-1) + if ( c=='=' || i==len-1) { if ( c=='=') { /*one more parameter */ scomp[k]='\0'; /*cut space */ @@ -139,11 +139,11 @@ obj_list_t* parse_filter(const char *str, SZIP=8,EC SZIP=8,NN */ - + if (strcmp(scomp,"SZIP")==0) { l=-1; /* mask index check */ - for ( m=0,u=i+1; u<len; u++,m++) + for ( m=0,u=i+1; u<len; u++,m++) { if (str[u]==',') { @@ -159,7 +159,7 @@ obj_list_t* parse_filter(const char *str, } if (l==-1) stype[m]=c; - else + else { smask[l]=c; l++; @@ -168,7 +168,7 @@ obj_list_t* parse_filter(const char *str, smask[l]='\0'; i=len-1; /* end */ (*n_objs)--; /* we counted an extra ',' */ - if (strcmp(smask,"NN")==0) + if (strcmp(smask,"NN")==0) filt->szip_coding=0; else if (strcmp(smask,"EC")==0) filt->szip_coding=1; @@ -177,17 +177,17 @@ obj_list_t* parse_filter(const char *str, printf("Input Error: szip mask must be 'NN' or 'EC' \n"); exit(1); } - + } } - + } /* u */ } /*if */ - + else { /* here we could have 1 or 2 digits */ - for ( m=0,u=i+1; u<len; u++,m++) + for ( m=0,u=i+1; u<len; u++,m++) { c = str[u]; if (!isdigit(c)){ @@ -202,7 +202,7 @@ obj_list_t* parse_filter(const char *str, } /*if */ - + filt->cd_values[j++]=atoi(stype); i+=m; /* jump */ } @@ -313,7 +313,7 @@ obj_list_t* parse_filter(const char *str, switch (filt->filtn) { - + case H5Z_FILTER_DEFLATE: if (filt->cd_values[0]<0 || filt->cd_values[0]>9 ){ if (obj_list) free(obj_list); @@ -321,8 +321,8 @@ obj_list_t* parse_filter(const char *str, exit(1); } break; - - + + case H5Z_FILTER_SZIP: pixels_per_block=filt->cd_values[0]; if ((pixels_per_block%2)==1) { @@ -385,7 +385,7 @@ const char* get_sfilter(H5Z_filter_t filtn) exit(1); } return NULL; -} +} /*------------------------------------------------------------------------- @@ -393,14 +393,14 @@ const char* get_sfilter(H5Z_filter_t filtn) * * Purpose: read layout info * - * Return: a list of names, the number of names and its chunking info for + * Return: a list of names, the number of names and its chunking info for * chunked. NULL, on error * the layout type can be: * CHUNK, to apply chunking layout * CONTI, to apply continuous layout * COMPA, to apply compact layout * - * Example: + * Example: * "AA,B,CDE:CHUNK=10X10" * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu @@ -409,8 +409,8 @@ const char* get_sfilter(H5Z_filter_t filtn) * *------------------------------------------------------------------------- */ -obj_list_t* parse_layout(const char *str, - int *n_objs, +obj_list_t* parse_layout(const char *str, + int *n_objs, pack_info_t *pack, /* info about layout needed */ pack_opt_t *options) { @@ -419,7 +419,7 @@ obj_list_t* parse_layout(const char *str, char c; size_t len=strlen(str); int j, n, k, end_obj=-1, c_index; - char sobj[MAX_NC_NAME]; + char sobj[MAX_NC_NAME]; char sdim[10]; char slayout[10]; @@ -427,7 +427,7 @@ obj_list_t* parse_layout(const char *str, memset(sdim, '\0', sizeof(sdim)); memset(sobj, '\0', sizeof(sobj)); memset(slayout, '\0', sizeof(slayout)); - + /* check for the end of object list and number of objects */ for ( i=0, n=0; i<len; i++) { @@ -445,7 +445,7 @@ obj_list_t* parse_layout(const char *str, if (end_obj==-1) { /* missing : chunk all */ options->all_layout=1; } - + n++; obj_list=malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) @@ -460,7 +460,7 @@ obj_list_t* parse_layout(const char *str, { c = str[j]; sobj[k]=c; - if ( c==',' || j==end_obj-1) + if ( c==',' || j==end_obj-1) { if ( c==',') sobj[k]='\0'; else sobj[k+1]='\0'; strcpy(obj_list[n].obj,sobj); @@ -481,11 +481,11 @@ obj_list_t* parse_layout(const char *str, /* get layout info */ for ( j=end_obj+1, n=0; n<=5; j++,n++) { - if (n==5) + if (n==5) { slayout[n]='\0'; /*cut string */ if (strcmp(slayout,"COMPA")==0) - pack->layout=H5D_COMPACT; + pack->layout=H5D_COMPACT; else if (strcmp(slayout,"CONTI")==0) pack->layout=H5D_CONTIGUOUS; else if (strcmp(slayout,"CHUNK")==0) @@ -501,7 +501,7 @@ obj_list_t* parse_layout(const char *str, slayout[n]=c; } } /* j */ - + if ( pack->layout==H5D_CHUNKED ) { @@ -510,7 +510,7 @@ obj_list_t* parse_layout(const char *str, * get chunk info *------------------------------------------------------------------------- */ - k=0; + k=0; if (j>(int)len) { @@ -524,8 +524,8 @@ obj_list_t* parse_layout(const char *str, c = str[i]; sdim[k]=c; k++; /*increment sdim index */ - - if (!isdigit(c) && c!='x' + + if (!isdigit(c) && c!='x' && c!='N' && c!='O' && c!='N' && c!='E' ){ if (obj_list) free(obj_list); @@ -533,11 +533,11 @@ obj_list_t* parse_layout(const char *str, sdim,str); exit(1); } - - if ( c=='x' || i==len-1) + + if ( c=='x' || i==len-1) { - if ( c=='x') { - sdim[k-1]='\0'; + if ( c=='x') { + sdim[k-1]='\0'; k=0; pack->chunk.chunk_lengths[c_index]=atoi(sdim); if (pack->chunk.chunk_lengths[c_index]==0) { @@ -549,7 +549,7 @@ obj_list_t* parse_layout(const char *str, c_index++; } else if (i==len-1) { /*no more parameters */ - sdim[k]='\0'; + sdim[k]='\0'; k=0; if (strcmp(sdim,"NONE")==0) { @@ -570,10 +570,10 @@ obj_list_t* parse_layout(const char *str, } /*if c=='x' || i==len-1 */ } /*i*/ - + } /*H5D_CHUNKED*/ - + return obj_list; } @@ -600,7 +600,7 @@ int parse_number(char *str) int n; char c; size_t len=strlen(str); - + for ( i=0; i<len; i++) { c = str[i]; @@ -608,7 +608,7 @@ int parse_number(char *str) return -1; } } - str[i]='\0'; + str[i]='\0'; n=atoi(str); return n; } diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index 28c6c0b..99cd49f 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -19,14 +19,14 @@ #include "H5private.h" #include "h5repack.h" -static const char* MapIdToName(hid_t refobj_id, +static const char* MapIdToName(hid_t refobj_id, trav_table_t *travt); static void close_obj(H5G_obj_t obj_type, hid_t obj_id); -static int copy_refs_attr(hid_t loc_in, - hid_t loc_out, +static int copy_refs_attr(hid_t loc_in, + hid_t loc_out, pack_opt_t *options, trav_table_t *travt, hid_t fidout /* for saving references */ @@ -35,7 +35,7 @@ static int copy_refs_attr(hid_t loc_in, /*------------------------------------------------------------------------- * Function: do_copy_refobjs * - * Purpose: duplicate all referenced HDF5 objects in the file + * Purpose: duplicate all referenced HDF5 objects in the file * and create hard links * * Return: 0, ok, -1 no @@ -47,19 +47,19 @@ static int copy_refs_attr(hid_t loc_in, *------------------------------------------------------------------------- */ -int do_copy_refobjs(hid_t fidin, - hid_t fidout, +int do_copy_refobjs(hid_t fidin, + hid_t fidout, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in=(-1); /* read group ID */ - hid_t grp_out=(-1); /* write group ID */ - hid_t dset_in=(-1); /* read dataset ID */ - hid_t dset_out=(-1); /* write dataset ID */ - hid_t type_in=(-1); /* named type ID */ - hid_t dcpl_id=(-1); /* dataset creation property list ID */ - hid_t space_id=(-1); /* space ID */ - hid_t ftype_id=(-1); /* file data type ID */ + hid_t grp_in=(-1); /* read group ID */ + hid_t grp_out=(-1); /* write group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ @@ -72,7 +72,7 @@ int do_copy_refobjs(hid_t fidin, * browse *------------------------------------------------------------------------- */ - + for ( i = 0; i < travt->nobjs; i++) { switch ( travt->objs[i].type ) @@ -82,7 +82,7 @@ int do_copy_refobjs(hid_t fidin, *------------------------------------------------------------------------- */ case H5G_GROUP: - + /*------------------------------------------------------------------------- * check for hard links *------------------------------------------------------------------------- @@ -92,37 +92,37 @@ int do_copy_refobjs(hid_t fidin, { for ( j=0; j<travt->objs[i].nlinks; j++) { - H5Glink(fidout, + H5Glink(fidout, H5G_LINK_HARD, travt->objs[i].name, travt->objs[i].links[j].new_name); } } - + break; - + /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ case H5G_DATASET: - - if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) + + if ((dset_in=H5Dopen(fidin,travt->objs[i].name))<0) goto error; - if ((space_id=H5Dget_space(dset_in))<0) + if ((space_id=H5Dget_space(dset_in))<0) goto error; - if ((ftype_id=H5Dget_type (dset_in))<0) + if ((ftype_id=H5Dget_type (dset_in))<0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_in))<0) + if ((dcpl_id=H5Dget_create_plist(dset_in))<0) goto error; if ( (rank=H5Sget_simple_extent_ndims(space_id))<0) goto error; if ( H5Sget_simple_extent_dims(space_id,dims,NULL)<0) goto error; nelmts=1; - for (j=0; j<rank; j++) + for (j=0; j<rank; j++) nelmts*=dims[j]; - + if ((mtype_id=h5tools_get_native_type(ftype_id))<0) goto error; @@ -133,11 +133,11 @@ int do_copy_refobjs(hid_t fidin, * check for external files *------------------------------------------------------------------------- */ - if ((next=H5Pget_external_count (dcpl_id))<0) + if ((next=H5Pget_external_count (dcpl_id))<0) goto error; /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration + * check if the dataset creation property list has filters that + * are not registered in the current configuration * 1) the external filters GZIP and SZIP might not be available * 2) the internal filters might be turned off *------------------------------------------------------------------------- @@ -152,10 +152,10 @@ int do_copy_refobjs(hid_t fidin, /*------------------------------------------------------------------------- * object references are a special case - * we cannot just copy the buffers, but instead we recreate the reference + * we cannot just copy the buffers, but instead we recreate the reference *------------------------------------------------------------------------- */ - if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) + if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { H5G_obj_t obj_type; hid_t refobj_id; @@ -178,7 +178,7 @@ int do_copy_refobjs(hid_t fidin, } if (H5Dread(dset_in,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto error; - + if ((obj_type = H5Rget_obj_type(dset_in,H5R_OBJECT,buf))<0) goto error; refbuf=HDmalloc((unsigned)nelmts*msize); @@ -192,7 +192,7 @@ int do_copy_refobjs(hid_t fidin, if ((refobj_id = H5Rdereference(dset_in,H5R_OBJECT,&buf[u]))<0) continue; } H5E_END_TRY; - /* get the name. a valid name could only occur in the + /* get the name. a valid name could only occur in the second traversal of the file */ if ((refname=MapIdToName(refobj_id,travt))!=NULL) { @@ -207,30 +207,30 @@ int do_copy_refobjs(hid_t fidin, close_obj(obj_type,refobj_id); }/* u */ }/*nelmts*/ - + /*------------------------------------------------------------------------- * create/write dataset/close *------------------------------------------------------------------------- */ - if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) + if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) goto error; if (nelmts) { if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0) goto error; } - + if (buf) free(buf); if (refbuf) free(refbuf); - + }/*H5T_STD_REF_OBJ*/ /*------------------------------------------------------------------------- * dataset region references *------------------------------------------------------------------------- */ - else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) + else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) { H5G_obj_t obj_type; hid_t refobj_id; @@ -254,12 +254,12 @@ int do_copy_refobjs(hid_t fidin, goto error; if ((obj_type = H5Rget_obj_type(dset_in,H5R_DATASET_REGION,buf))<0) goto error; - + /*------------------------------------------------------------------------- * create output *------------------------------------------------------------------------- */ - + refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */ if ( refbuf==NULL){ printf( "cannot allocate memory\n" ); @@ -271,8 +271,8 @@ int do_copy_refobjs(hid_t fidin, if ((refobj_id = H5Rdereference(dset_in,H5R_DATASET_REGION,&buf[u]))<0) continue; } H5E_END_TRY; - - /* get the name. a valid name could only occur in the + + /* get the name. a valid name could only occur in the second traversal of the file */ if ((refname=MapIdToName(refobj_id,travt))!=NULL) { @@ -282,7 +282,7 @@ int do_copy_refobjs(hid_t fidin, /* create the reference, we need the space_id */ if (H5Rcreate(&refbuf[u],fidout,refname,H5R_DATASET_REGION,region_id)<0) goto error; - if (H5Sclose(region_id)<0) + if (H5Sclose(region_id)<0) goto error; if (options->verbose) printf("object <%s> region reference created to <%s>\n", @@ -292,18 +292,18 @@ int do_copy_refobjs(hid_t fidin, close_obj(obj_type,refobj_id); }/* u */ }/*nelmts*/ - + /*------------------------------------------------------------------------- * create/write dataset/close *------------------------------------------------------------------------- */ - if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) + if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) goto error; if (nelmts) { if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,refbuf)<0) goto error; } - + if (buf) free(buf); if (refbuf) @@ -317,19 +317,19 @@ int do_copy_refobjs(hid_t fidin, */ else { - if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0) + if ((dset_out=H5Dopen(fidout,travt->objs[i].name))<0) goto error; } assert(dset_out!=FAIL); - + /*------------------------------------------------------------------------- * copy referenced objects in attributes *------------------------------------------------------------------------- */ - if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0) + if (copy_refs_attr(dset_in,dset_out,options,travt,fidout)<0) goto error; - + /*------------------------------------------------------------------------- * check for hard links @@ -338,92 +338,92 @@ int do_copy_refobjs(hid_t fidin, if (travt->objs[i].nlinks) { for ( j=0; j<travt->objs[i].nlinks; j++){ - H5Glink(fidout, + H5Glink(fidout, H5G_LINK_HARD, travt->objs[i].name, travt->objs[i].links[j].new_name); } } - if (H5Dclose(dset_out)<0) + if (H5Dclose(dset_out)<0) goto error; }/*can_read*/ - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - - if (H5Tclose(ftype_id)<0) + + if (H5Tclose(ftype_id)<0) goto error; - if (H5Tclose(mtype_id)<0) + if (H5Tclose(mtype_id)<0) goto error; - if (H5Pclose(dcpl_id)<0) + if (H5Pclose(dcpl_id)<0) goto error; - if (H5Sclose(space_id)<0) + if (H5Sclose(space_id)<0) goto error; - if (H5Dclose(dset_in)<0) + if (H5Dclose(dset_in)<0) goto error; - + break; - + /*------------------------------------------------------------------------- * H5G_TYPE *------------------------------------------------------------------------- */ case H5G_TYPE: - - if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) + + if ((type_in = H5Topen (fidin,travt->objs[i].name))<0) goto error; - - if (H5Tclose(type_in)<0) + + if (H5Tclose(type_in)<0) goto error; - + break; - + /*------------------------------------------------------------------------- * H5G_LINK *------------------------------------------------------------------------- */ - + case H5G_LINK: - + /*nothing to do */ break; - + default: - + break; } } - - - + + + /*------------------------------------------------------------------------- - * the root is a special case, we get an ID for the root group + * the root is a special case, we get an ID for the root group * and copy its attributes using that ID * it must be done last, because the attributes might contain references to * objects in the object list *------------------------------------------------------------------------- */ - - if ((grp_out = H5Gopen(fidout,"/"))<0) + + if ((grp_out = H5Gopen(fidout,"/"))<0) goto error; - - if ((grp_in = H5Gopen(fidin,"/"))<0) + + if ((grp_in = H5Gopen(fidin,"/"))<0) goto error; - - if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0) + + if (copy_refs_attr(grp_in,grp_out,options,travt,fidout)<0) goto error; - - if (H5Gclose(grp_out)<0) + + if (H5Gclose(grp_out)<0) goto error; - if (H5Gclose(grp_in)<0) + if (H5Gclose(grp_in)<0) goto error; - + return 0; - + error: H5E_BEGIN_TRY { H5Gclose(grp_in); @@ -437,7 +437,7 @@ error: H5Tclose(type_in); } H5E_END_TRY; return -1; - + } @@ -445,7 +445,7 @@ error: * Function: copy_refs_attr * * Purpose: duplicate all referenced HDF5 located in attributes - * relative to LOC_IN, which is obtained either from + * relative to LOC_IN, which is obtained either from * loc_id = H5Gopen( fid, name); * loc_id = H5Dopen( fid, name); * loc_id = H5Topen( fid, name); @@ -459,17 +459,17 @@ error: *------------------------------------------------------------------------- */ -static int copy_refs_attr(hid_t loc_in, - hid_t loc_out, +static int copy_refs_attr(hid_t loc_in, + hid_t loc_out, pack_opt_t *options, trav_table_t *travt, hid_t fidout /* for saving references */ ) { - hid_t attr_id=-1; /* attr ID */ - hid_t attr_out=-1; /* attr ID */ - hid_t space_id=-1; /* space ID */ - hid_t ftype_id=-1; /* file data type ID */ + hid_t attr_id=-1; /* attr ID */ + hid_t attr_out=-1; /* attr ID */ + hid_t space_id=-1; /* space ID */ + hid_t ftype_id=-1; /* file data type ID */ hid_t mtype_id=-1; /* memory data type ID */ size_t msize; /* memory size of type */ hsize_t nelmts; /* number of elements in dataset */ @@ -479,9 +479,9 @@ static int copy_refs_attr(hid_t loc_in, int n, j; unsigned u; - if ((n = H5Aget_num_attrs(loc_in))<0) + if ((n = H5Aget_num_attrs(loc_in))<0) goto error; - + for ( u = 0; u < (unsigned)n; u++) { @@ -490,32 +490,32 @@ static int copy_refs_attr(hid_t loc_in, *------------------------------------------------------------------------- */ /* open attribute */ - if ((attr_id = H5Aopen_idx(loc_in, u))<0) + if ((attr_id = H5Aopen_idx(loc_in, u))<0) goto error; - + /* get name */ - if (H5Aget_name( attr_id, 255, name )<0) + if (H5Aget_name( attr_id, 255, name )<0) goto error; /* get the file datatype */ if ((ftype_id = H5Aget_type( attr_id )) < 0 ) goto error; - + /* get the dataspace handle */ if ((space_id = H5Aget_space( attr_id )) < 0 ) goto error; - + /* get dimensions */ if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 ) goto error; - + /*------------------------------------------------------------------------- * elements *------------------------------------------------------------------------- */ nelmts=1; - for (j=0; j<rank; j++) + for (j=0; j<rank; j++) nelmts*=dims[j]; if ((mtype_id=h5tools_get_native_type(ftype_id))<0) @@ -526,10 +526,10 @@ static int copy_refs_attr(hid_t loc_in, /*------------------------------------------------------------------------- * object references are a special case - * we cannot just copy the buffers, but instead we recreate the reference + * we cannot just copy the buffers, but instead we recreate the reference *------------------------------------------------------------------------- */ - if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) + if (H5Tequal(mtype_id, H5T_STD_REF_OBJ)) { H5G_obj_t obj_type; hid_t refobj_id; @@ -537,7 +537,7 @@ static int copy_refs_attr(hid_t loc_in, unsigned k; const char* refname; hobj_ref_t *buf=NULL; - + /*------------------------------------------------------------------------- * read input to memory *------------------------------------------------------------------------- @@ -552,7 +552,7 @@ static int copy_refs_attr(hid_t loc_in, } if (H5Aread(attr_id,mtype_id,buf)<0) goto error; - + if ((obj_type = H5Rget_obj_type(attr_id,H5R_OBJECT,buf))<0) goto error; refbuf=HDmalloc((unsigned)nelmts*msize); @@ -566,7 +566,7 @@ static int copy_refs_attr(hid_t loc_in, if ((refobj_id = H5Rdereference(attr_id,H5R_OBJECT,&buf[k]))<0) goto error; } H5E_END_TRY; - /* get the name. a valid name could only occur in the + /* get the name. a valid name could only occur in the second traversal of the file */ if ((refname=MapIdToName(refobj_id,travt))!=NULL) { @@ -579,34 +579,34 @@ static int copy_refs_attr(hid_t loc_in, close_obj(obj_type,refobj_id); }/* k */ }/*nelmts*/ - + /*------------------------------------------------------------------------- - * copy + * copy *------------------------------------------------------------------------- */ - + if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0) goto error; if (nelmts) { if(H5Awrite(attr_out,mtype_id,refbuf)<0) goto error; } - - if (H5Aclose(attr_out)<0) + + if (H5Aclose(attr_out)<0) goto error; if (refbuf) free(refbuf); if (buf) free(buf); - + }/*H5T_STD_REF_OBJ*/ /*------------------------------------------------------------------------- * dataset region references *------------------------------------------------------------------------- */ - else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) + else if (H5Tequal(mtype_id, H5T_STD_REF_DSETREG)) { H5G_obj_t obj_type; hid_t refobj_id; @@ -619,8 +619,8 @@ static int copy_refs_attr(hid_t loc_in, * read input to memory *------------------------------------------------------------------------- */ - - if (nelmts) + + if (nelmts) { buf=(void *) HDmalloc((unsigned)(nelmts*msize)); if ( buf==NULL){ @@ -631,12 +631,12 @@ static int copy_refs_attr(hid_t loc_in, goto error; if ((obj_type = H5Rget_obj_type(attr_id,H5R_DATASET_REGION,buf))<0) goto error; - + /*------------------------------------------------------------------------- * create output *------------------------------------------------------------------------- */ - + refbuf=HDcalloc(sizeof(hdset_reg_ref_t),(size_t)nelmts); /*init to zero */ if ( refbuf==NULL){ printf( "cannot allocate memory\n" ); @@ -648,7 +648,7 @@ static int copy_refs_attr(hid_t loc_in, if ((refobj_id = H5Rdereference(attr_id,H5R_DATASET_REGION,&buf[k]))<0) continue; } H5E_END_TRY; - /* get the name. a valid name could only occur in the + /* get the name. a valid name could only occur in the second traversal of the file */ if ((refname=MapIdToName(refobj_id,travt))!=NULL) { @@ -658,7 +658,7 @@ static int copy_refs_attr(hid_t loc_in, /* create the reference, we need the space_id */ if (H5Rcreate(&refbuf[k],fidout,refname,H5R_DATASET_REGION,region_id)<0) goto error; - if (H5Sclose(region_id)<0) + if (H5Sclose(region_id)<0) goto error; if (options->verbose) printf("object <%s> region reference created to <%s>\n",name,refname); @@ -666,19 +666,19 @@ static int copy_refs_attr(hid_t loc_in, close_obj(obj_type,refobj_id); }/* k */ }/*nelmts */ - + /*------------------------------------------------------------------------- - * copy + * copy *------------------------------------------------------------------------- */ - + if ((attr_out=H5Acreate(loc_out,name,ftype_id,space_id,H5P_DEFAULT))<0) goto error; if (nelmts) { if(H5Awrite(attr_out,mtype_id,refbuf)<0) goto error; } - if (H5Aclose(attr_out)<0) + if (H5Aclose(attr_out)<0) goto error; if (refbuf) free(refbuf); @@ -696,7 +696,7 @@ static int copy_refs_attr(hid_t loc_in, if (H5Sclose(space_id)<0) goto error; if (H5Aclose(attr_id)<0) goto error; } /* u */ - + return 0; error: @@ -720,9 +720,9 @@ error: static void close_obj(H5G_obj_t obj_type, hid_t obj_id) { - H5E_BEGIN_TRY + H5E_BEGIN_TRY { - switch (obj_type) + switch (obj_type) { case H5G_GROUP: H5Gclose(obj_id); @@ -736,7 +736,7 @@ static void close_obj(H5G_obj_t obj_type, hid_t obj_id) default: break; } - } H5E_END_TRY; + } H5E_END_TRY; } /*------------------------------------------------------------------------- @@ -747,7 +747,7 @@ static void close_obj(H5G_obj_t obj_type, hid_t obj_id) *------------------------------------------------------------------------- */ -static const char* MapIdToName(hid_t refobj_id, +static const char* MapIdToName(hid_t refobj_id, trav_table_t *travt) { hid_t id; @@ -769,18 +769,18 @@ static const char* MapIdToName(hid_t refobj_id, /* linear search */ for ( i=0; i<travt->nobjs; i++) { - switch ( travt->objs[i].type ) + switch ( travt->objs[i].type ) { default: break; - + /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ - + case H5G_DATASET: - + if ((id = H5Dopen(fid,travt->objs[i].name))<0) return NULL; if(H5Gget_objinfo(id, ".", 0, &objstat) <0) diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 983371e..6653233 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -33,9 +33,9 @@ */ int has_filter(hid_t dcpl_id, - H5Z_filter_t filtnin) + H5Z_filter_t filtnin) { - + int nfilters; /* number of filters */ unsigned filt_flags; /* filter flags */ H5Z_filter_t filtn; /* filter identification number */ @@ -44,37 +44,37 @@ int has_filter(hid_t dcpl_id, char f_name[256]; /* filter name */ int have=0; /* flag, filter is present */ int i; /* index */ - + /* if no information about the input filter is requested return exit */ if (filtnin==-1) - return 1; - + return 1; + /* get information about filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; /* if we do not have filters and the requested filter is NONE, return 1 */ if (!nfilters && filtnin==H5Z_FILTER_NONE) return 1; - - for (i=0; i<nfilters; i++) + + for (i=0; i<nfilters; i++) { cd_nelmts = NELMTS(cd_values); #ifdef H5_WANT_H5_V1_6_COMPAT - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name); #else - filtn = H5Pget_filter(dcpl_id, - (unsigned)i, - &filt_flags, + filtn = H5Pget_filter(dcpl_id, + (unsigned)i, + &filt_flags, &cd_nelmts, - cd_values, - sizeof(f_name), + cd_values, + sizeof(f_name), f_name, NULL); #endif /* H5_WANT_H5_V1_6_COMPAT */ @@ -82,7 +82,7 @@ int has_filter(hid_t dcpl_id, if (filtnin==filtn) have=1; - } + } return have; } @@ -92,7 +92,7 @@ int has_filter(hid_t dcpl_id, * Function: has_layout * * Purpose: verify which layout is present in the property list DCPL_ID - * + * * H5D_COMPACT = 0 * H5D_CONTIGUOUS = 1 * H5D_CHUNKED = 2 @@ -107,44 +107,44 @@ int has_filter(hid_t dcpl_id, */ int has_layout(hid_t dcpl_id, - pack_info_t *obj) + pack_info_t *obj) { hsize_t chsize[64]; /* chunk size in elements */ H5D_layout_t layout; /* layout */ int nfilters; /* number of filters */ int rank; /* rank */ int i; /* index */ - + /* if no information about the input layout is requested return exit */ if (obj==NULL) return 1; - + /* check if we have filters in the input object */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; - + /* a non chunked layout was requested on a filtered object; avoid the test */ if (nfilters && obj->layout!=H5D_CHUNKED) return 1; - + /* get layout */ - if ((layout = H5Pget_layout(dcpl_id))<0) + if ((layout = H5Pget_layout(dcpl_id))<0) return -1; - + if (obj->layout != layout) return 0; - + if (layout==H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0) return -1; if (obj->chunk.rank != rank) return 0; - for ( i=0; i<rank; i++) + for ( i=0; i<rank; i++) if (chsize[i] != obj->chunk.chunk_lengths[i]) return 0; } - + return 1; } @@ -168,9 +168,9 @@ int h5repack_verify(const char *fname, pack_opt_t *options) { hid_t fid; /* file ID */ - hid_t dset_id=-1; /* dataset ID */ - hid_t dcpl_id=-1; /* dataset creation property list ID */ - hid_t space_id=-1; /* space ID */ + hid_t dset_id=-1; /* dataset ID */ + hid_t dcpl_id=-1; /* dataset creation property list ID */ + hid_t space_id=-1; /* space ID */ int ret=1, i, j; trav_table_t *travt=NULL; @@ -178,7 +178,7 @@ int h5repack_verify(const char *fname, if ((fid=H5Fopen(fname,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) return -1; - for ( i=0; i<options->op_tbl->nelems; i++) + for ( i=0; i<options->op_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; pack_info_t *obj = &options->op_tbl->objs[i]; @@ -187,13 +187,13 @@ int h5repack_verify(const char *fname, * open *------------------------------------------------------------------------- */ - if ((dset_id=H5Dopen(fid,name))<0) + if ((dset_id=H5Dopen(fid,name))<0) goto error; - if ((space_id=H5Dget_space(dset_id))<0) + if ((space_id=H5Dget_space(dset_id))<0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_id))<0) + if ((dcpl_id=H5Dget_create_plist(dset_id))<0) goto error; - + /*------------------------------------------------------------------------- * filter check *------------------------------------------------------------------------- @@ -215,11 +215,11 @@ int h5repack_verify(const char *fname, * close *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl_id)<0) + if (H5Pclose(dcpl_id)<0) goto error; - if (H5Sclose(space_id)<0) + if (H5Sclose(space_id)<0) goto error; - if (H5Dclose(dset_id)<0) + if (H5Dclose(dset_id)<0) goto error; } @@ -232,10 +232,10 @@ int h5repack_verify(const char *fname, if (options->all_filter==1 || options->all_layout==1) { - + /* init table */ trav_table_init(&travt); - + /* get the list of objects in the file */ if (h5trav_gettable(fid,travt)<0) goto error; @@ -247,16 +247,16 @@ int h5repack_verify(const char *fname, switch ( travt->objs[i].type ) { case H5G_DATASET: - + /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ - if ((dset_id=H5Dopen(fid,name))<0) + if ((dset_id=H5Dopen(fid,name))<0) goto error; - if ((space_id=H5Dget_space(dset_id))<0) + if ((space_id=H5Dget_space(dset_id))<0) goto error; - if ((dcpl_id=H5Dget_create_plist(dset_id))<0) + if ((dcpl_id=H5Dget_create_plist(dset_id))<0) goto error; /*------------------------------------------------------------------------- @@ -280,35 +280,35 @@ int h5repack_verify(const char *fname, if (has_layout(dcpl_id,&pack)==0) ret=0; } - - + + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl_id)<0) + if (H5Pclose(dcpl_id)<0) goto error; - if (H5Sclose(space_id)<0) + if (H5Sclose(space_id)<0) goto error; - if (H5Dclose(dset_id)<0) + if (H5Dclose(dset_id)<0) goto error; - + break; default: break; } /* switch */ - + } /* i */ - + /* free table */ trav_table_free(travt); } - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + if (H5Fclose(fid)<0) return -1; @@ -345,12 +345,12 @@ error: int h5repack_cmpdcpl(const char *fname1, const char *fname2) { - hid_t fid1=-1; /* file ID */ - hid_t fid2=-1; /* file ID */ - hid_t dset1=-1; /* dataset ID */ - hid_t dset2=-1; /* dataset ID */ - hid_t dcpl1=-1; /* dataset creation property list ID */ - hid_t dcpl2=-1; /* dataset creation property list ID */ + hid_t fid1=-1; /* file ID */ + hid_t fid2=-1; /* file ID */ + hid_t dset1=-1; /* dataset ID */ + hid_t dset2=-1; /* dataset ID */ + hid_t dcpl1=-1; /* dataset creation property list ID */ + hid_t dcpl2=-1; /* dataset creation property list ID */ trav_table_t *travt1=NULL; trav_table_t *travt2=NULL; int ret=1, i; @@ -362,7 +362,7 @@ int h5repack_cmpdcpl(const char *fname1, /* disable error reporting */ H5E_BEGIN_TRY { - + /* Open the files */ if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT))<0 ) { @@ -411,25 +411,25 @@ int h5repack_cmpdcpl(const char *fname1, *------------------------------------------------------------------------- */ case H5G_DATASET: - if ((dset1=H5Dopen(fid1,travt1->objs[i].name))<0) + if ((dset1=H5Dopen(fid1,travt1->objs[i].name))<0) goto error; - if ((dset2=H5Dopen(fid2,travt1->objs[i].name))<0) + if ((dset2=H5Dopen(fid2,travt1->objs[i].name))<0) goto error; - if ((dcpl1=H5Dget_create_plist(dset1))<0) + if ((dcpl1=H5Dget_create_plist(dset1))<0) goto error; - if ((dcpl2=H5Dget_create_plist(dset2))<0) + if ((dcpl2=H5Dget_create_plist(dset2))<0) goto error; /*------------------------------------------------------------------------- * compare the property lists *------------------------------------------------------------------------- */ - if ((ret=H5Pequal(dcpl1,dcpl2))<0) + if ((ret=H5Pequal(dcpl1,dcpl2))<0) goto error; if (ret==0) { - printf("Property lists for <%s> are different\n",travt1->objs[i].name); + printf("Property lists for <%s> are different\n",travt1->objs[i].name); goto error; } @@ -437,15 +437,15 @@ int h5repack_cmpdcpl(const char *fname1, * close *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl1)<0) + if (H5Pclose(dcpl1)<0) goto error; - if (H5Pclose(dcpl2)<0) + if (H5Pclose(dcpl2)<0) goto error; - if (H5Dclose(dset1)<0) + if (H5Dclose(dset1)<0) goto error; - if (H5Dclose(dset2)<0) + if (H5Dclose(dset2)<0) goto error; - + break; } /*switch*/ @@ -476,7 +476,7 @@ int h5repack_cmpdcpl(const char *fname1, error: H5E_BEGIN_TRY { H5Pclose(dcpl1); - H5Pclose(dcpl2); + H5Pclose(dcpl2); H5Dclose(dset1); H5Dclose(dset2); H5Fclose(fid1); diff --git a/tools/h5repack/testh5repack_attr.c b/tools/h5repack/testh5repack_attr.c index a1dad92..f18bbc2 100644 --- a/tools/h5repack/testh5repack_attr.c +++ b/tools/h5repack/testh5repack_attr.c @@ -19,7 +19,7 @@ /*------------------------------------------------------------------------- * Function: write_attr_in * - * Purpose: write attributes in LOC_ID (dataset, group, named datatype) + * Purpose: write attributes in LOC_ID (dataset, group, named datatype) * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -28,28 +28,28 @@ *------------------------------------------------------------------------- */ - -void write_attr_in(hid_t loc_id, + +void write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t fid, /* for reference create */ int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t + typedef struct s_t { char a; double b; } s_t; - typedef enum + typedef enum { RED, GREEN } e_t; hid_t attr_id; - hid_t space_id; - hid_t type_id; + hid_t space_id; + hid_t type_id; herr_t status; int val, i, j, k, n; float f; @@ -98,7 +98,7 @@ void write_attr_in(hid_t loc_id, * 1D attributes *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -109,11 +109,11 @@ void write_attr_in(hid_t loc_id, for (i=0; i<2; i++) for (j=0; j<2; j++) { - buf1[i][j]='z'; + buf1[i][j]='z'; } } - /* - buf1[2][2]= {"ab","de"}; + /* + buf1[2][2]= {"ab","de"}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <string> and <string> @@ -139,8 +139,8 @@ void write_attr_in(hid_t loc_id, for (i=0; i<2; i++) buf2[i]=buf2[1]=0; } - /* - buf2[2]= {1,2}; + /* + buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <bitfield> and <bitfield> @@ -160,8 +160,8 @@ void write_attr_in(hid_t loc_id, *------------------------------------------------------------------------- */ - /* - buf2[2]= {1,2}; + /* + buf2[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <opaque> and <opaque> @@ -181,7 +181,7 @@ void write_attr_in(hid_t loc_id, * H5T_COMPOUND *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) @@ -189,9 +189,9 @@ void write_attr_in(hid_t loc_id, buf3[i].a=0; buf3[i].b=0; } } - - /* - buf3[2]= {{1,2},{3,4}}; + + /* + buf3[2]= {{1,2},{3,4}}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <compound> and <compound> @@ -208,7 +208,7 @@ void write_attr_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); make_attr(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -230,10 +230,10 @@ void write_attr_in(hid_t loc_id, { for (i=0; i<2; i++) { - buf45[i]=GREEN; + buf45[i]=GREEN; } } - /* + /* buf45[2]= {RED,RED}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> @@ -253,7 +253,7 @@ void write_attr_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; @@ -270,7 +270,7 @@ void write_attr_in(hid_t loc_id, ((int *)buf5[1].p)[0]=0; ((int *)buf5[1].p)[1]=0; } - /* + /* $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> position vlen of </g1> vlen of </g1> difference @@ -301,10 +301,10 @@ void write_attr_in(hid_t loc_id, for (i=0; i<2; i++) for (j=0; j<3; j++) { - buf6[i][j]=0; + buf6[i][j]=0; } } - /* + /* buf6[2][3]= {{1,2,3},{4,5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> @@ -331,12 +331,12 @@ position array of </g1> array of </g1> difference { for (i=0; i<2; i++) { - buf7[i]=0; - buf8[i]=0; + buf7[i]=0; + buf8[i]=0; } } - /* - buf7[2]= {1,2}; + /* + buf7[2]= {1,2}; buf8[2]= {1,2}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> @@ -367,7 +367,7 @@ position array of </g1> array of </g1> difference memset(buf12, 'z', sizeof buf12); } - /* + /* buf12[6][2]= {"ab","cd","ef","gh","ij","kl"}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <string2D> and <string2D> @@ -402,8 +402,8 @@ position array of </g1> array of </g1> difference memset(buf22,0,sizeof buf22); } - /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <bitfield2D> and <bitfield2D> position bitfield2D of </g1> bitfield2D of </g1> difference @@ -426,8 +426,8 @@ position array of </g1> array of </g1> difference *------------------------------------------------------------------------- */ - /* - buf22[3][2]= {{1,2},{3,4},{5,6}}; + /* + buf22[3][2]= {{1,2},{3,4},{5,6}}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <opaque2D> and <opaque2D> position opaque2D of </g1> opaque2D of </g1> difference @@ -453,7 +453,7 @@ position array of </g1> array of </g1> difference memset(buf32,0,sizeof buf32); } - /* + /* buf32[6]= {{1,2},{3,4},{5,6},{7,8},{9,10},{11,12}}; $h5diff file7.h5 file6.h5 g1 g1 -v Attribute: <opaque2D> and <opaque2D> @@ -473,7 +473,7 @@ position array of </g1> array of </g1> difference H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); make_attr(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -496,7 +496,7 @@ position array of </g1> array of </g1> difference for (i=0; i<3; i++) for (j=0; j<2; j++) { - if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; + if (make_diffs) buf452[i][j]=GREEN; else buf452[i][j]=RED; } /* @@ -550,7 +550,7 @@ position enum2D of </g1> enum2D of </g1> difference [ 2 1 ] 10 0 10 [ 2 1 ] 11 0 11 */ - + space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); attr_id = H5Acreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT); @@ -571,8 +571,8 @@ position enum2D of </g1> enum2D of </g1> difference { memset(buf62,0,sizeof buf62); } - /* - buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; + /* + buf62[6][3]= {{1,2,3},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18}}; $h5diff file7.h5 file6.h5 g1 g1 -v Group: </g1> and </g1> Attribute: <array2D> and <array2D> @@ -636,7 +636,7 @@ position float2D of </g1> float2D of </g1> difference make_attr(loc_id,2,dims2,"integer2D",H5T_NATIVE_INT,buf72); make_attr(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- * 3D attributes *------------------------------------------------------------------------- @@ -850,7 +850,7 @@ position bitfield3D of </g1> bitfield3D of </g1> difference H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); make_attr(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -920,7 +920,7 @@ position enum3D of </g1> enum3D of </g1> difference * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) { @@ -949,7 +949,7 @@ position vlen3D of </g1> vlen3D of </g1> difference [ 1 0 1 ] 9 0 9 [ 1 1 0 ] 10 0 10 etc -*/ +*/ space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); attr_id = H5Acreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT); @@ -1023,7 +1023,7 @@ etc [ 1 1 0 ] 9 0 9 [ 1 1 1 ] 10 0 10 etc -*/ +*/ make_attr(loc_id,3,dims3,"integer3D",H5T_NATIVE_INT,buf73); make_attr(loc_id,3,dims3,"float3D",H5T_NATIVE_FLOAT,buf83); } diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c index 4f12c40..16962af 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -24,15 +24,15 @@ * Purpose: detects szip encoder, prints "yes" or "no" to stdout. * Intended to be used in test scripts. * - * Return: + * Return: * - * Programmer: + * Programmer: * - * Date: + * Date: * * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index 8781ae7..862257a 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -22,7 +22,7 @@ static void make_dset_reg_ref(hid_t loc_id); /*------------------------------------------------------------------------- * Function: write_dset_in * - * Purpose: write datasets in LOC_ID + * Purpose: write datasets in LOC_ID * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -31,28 +31,28 @@ static void make_dset_reg_ref(hid_t loc_id); *------------------------------------------------------------------------- */ - -void write_dset_in(hid_t loc_id, + +void write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t file_id, int make_diffs /* flag to modify data buffers */) { /* Compound datatype */ - typedef struct s_t + typedef struct s_t { char a; double b; } s_t; - typedef enum + typedef enum { RED, GREEN } e_t; hid_t dset_id; - hid_t space_id; - hid_t type_id; + hid_t space_id; + hid_t type_id; hid_t plist_id; herr_t status; int val, i, j, k, n; @@ -100,22 +100,22 @@ void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- - * 1D + * 1D *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ - + if (make_diffs) { for (i=0; i<2; i++) for (j=0; j<2; j++) { - buf1[i][j]='z'; + buf1[i][j]='z'; } } @@ -172,7 +172,7 @@ void write_dset_in(hid_t loc_id, { for (i=0; i<2; i++) { - buf45[i]=GREEN; + buf45[i]=GREEN; } } @@ -181,7 +181,7 @@ void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,1,dims,"compound",type_id,buf3); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -211,7 +211,7 @@ void write_dset_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ buf5[0].len = 1; @@ -250,7 +250,7 @@ void write_dset_in(hid_t loc_id, for (i=0; i<2; i++) for (j=0; j<3; j++) { - buf6[i][j]=0; + buf6[i][j]=0; } } @@ -267,8 +267,8 @@ void write_dset_in(hid_t loc_id, { for (i=0; i<2; i++) { - buf7[i]=0; - buf8[i]=0; + buf7[i]=0; + buf8[i]=0; } } @@ -277,7 +277,7 @@ void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- - * 2D + * 2D *------------------------------------------------------------------------- */ @@ -302,7 +302,7 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf22,0,sizeof buf22); @@ -336,7 +336,7 @@ void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,2,dims2,"compound2D",type_id,buf32); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -380,7 +380,7 @@ void write_dset_in(hid_t loc_id, else ((int *)buf52[i][j].p)[l] = n++; } } - + space_id = H5Screate_simple(2,dims2,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); dset_id = H5Dcreate(loc_id,"vlen2D",type_id,space_id,H5P_DEFAULT); @@ -412,7 +412,7 @@ void write_dset_in(hid_t loc_id, *------------------------------------------------------------------------- */ - + if (make_diffs) { memset(buf72,0,sizeof buf72); @@ -435,9 +435,9 @@ void write_dset_in(hid_t loc_id, write_dset(loc_id,2,dims2,"float2D",H5T_NATIVE_FLOAT,buf82); - + /*------------------------------------------------------------------------- - * 3D + * 3D *------------------------------------------------------------------------- */ @@ -513,7 +513,7 @@ void write_dset_in(hid_t loc_id, H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_DOUBLE); write_dset(loc_id,3,dims3,"compound3D",type_id,buf33); status = H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- @@ -545,7 +545,7 @@ void write_dset_in(hid_t loc_id, * H5T_VLEN *------------------------------------------------------------------------- */ - + /* Allocate and initialize VL dataset to write */ n=0; for (i = 0; i < 4; i++) { @@ -560,7 +560,7 @@ void write_dset_in(hid_t loc_id, } } } - + space_id = H5Screate_simple(3,dims3,NULL); type_id = H5Tvlen_create(H5T_NATIVE_INT); dset_id = H5Dcreate(loc_id,"vlen3D",type_id,space_id,H5P_DEFAULT); @@ -618,7 +618,7 @@ void write_dset_in(hid_t loc_id, /*------------------------------------------------------------------------- * Function: make_dset_reg_ref * - * Purpose: write dataset region references + * Purpose: write dataset region references * *------------------------------------------------------------------------- */ @@ -646,52 +646,52 @@ static void make_dset_reg_ref(hid_t loc_id) int *dwbuf; /* Buffer for writing numeric data to disk */ int i; /* counting variables */ herr_t ret; /* Generic return value */ - + /* Allocate write & read buffers */ wbuf=calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); dwbuf=malloc(sizeof(int)*SPACE2_DIM1*SPACE2_DIM2); - + /* Create dataspace for datasets */ sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL); - + /* Create a dataset */ dset2=H5Dcreate(loc_id,"dsetreg",H5T_NATIVE_UCHAR,sid2,H5P_DEFAULT); - + for(i=0; i<SPACE2_DIM1*SPACE2_DIM2; i++) - dwbuf[i]=i*3; - + dwbuf[i]=i*3; + /* Write selection to disk */ ret=H5Dwrite(dset2,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,dwbuf); - + /* Close Dataset */ ret = H5Dclose(dset2); - + /* Create dataspace for the reference dataset */ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); - + /* Create a dataset */ dset1=H5Dcreate(loc_id,"refreg",H5T_STD_REF_DSETREG,sid1,H5P_DEFAULT); - + /* Create references */ - + /* Select 6x6 hyperslab for first reference */ start[0]=2; start[1]=2; stride[0]=1; stride[1]=1; count[0]=6; count[1]=6; block[0]=1; block[1]=1; ret = H5Sselect_hyperslab(sid2,H5S_SELECT_SET,start,stride,count,block); - + /* Store dataset region */ ret = H5Rcreate(&wbuf[0],loc_id,"dsetreg",H5R_DATASET_REGION,sid2); - + /* Write selection to disk */ ret=H5Dwrite(dset1,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf); - + /* Close all objects */ ret = H5Sclose(sid1); ret = H5Dclose(dset1); ret = H5Sclose(sid2); - + free(wbuf); free(dwbuf); -} +} diff --git a/tools/h5repack/testh5repack_main.c b/tools/h5repack/testh5repack_main.c index bc80c5a..26dcfc7 100644 --- a/tools/h5repack/testh5repack_main.c +++ b/tools/h5repack/testh5repack_main.c @@ -40,7 +40,7 @@ int main (void) { pack_opt_t pack_options; diff_opt_t diff_options; -#if defined (H5_HAVE_FILTER_SZIP) +#if defined (H5_HAVE_FILTER_SZIP) int szip_can_encode = 0; #endif memset(&diff_options, 0, sizeof (diff_opt_t)); @@ -54,10 +54,10 @@ int main (void) goto error; /*------------------------------------------------------------------------- - * Format of the tests: + * Format of the tests: * - * 1) make a copy of the file with h5repack - * 2) use the h5diff utility to compare the input and output file; + * 1) make a copy of the file with h5repack + * 2) use the h5diff utility to compare the input and output file; * it returns RET==0 if the objects have the same data *------------------------------------------------------------------------- */ @@ -101,7 +101,7 @@ int main (void) if (h5repack_end (&pack_options)<0) TEST_ERROR; PASSED(); - + /*------------------------------------------------------------------------- * file with attributes *------------------------------------------------------------------------- @@ -157,7 +157,7 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); /*------------------------------------------------------------------------- * the remaining files differ in the dcpl's @@ -191,7 +191,7 @@ int main (void) TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif @@ -220,7 +220,7 @@ int main (void) if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif @@ -232,7 +232,7 @@ int main (void) TESTING(" adding szip filter"); -#if defined (H5_HAVE_FILTER_SZIP) +#if defined (H5_HAVE_FILTER_SZIP) if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { szip_can_encode = 1; } @@ -241,7 +241,7 @@ if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { * test an individual object option *------------------------------------------------------------------------- */ - + if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -273,7 +273,7 @@ if (szip_can_encode) { */ TESTING(" adding szip filter to all"); -#if defined (H5_HAVE_FILTER_SZIP) +#if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -287,7 +287,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - + PASSED(); } else { SKIPPED(); @@ -321,7 +321,7 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif @@ -349,14 +349,14 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - - PASSED(); + + PASSED(); #else SKIPPED(); #endif - + TESTING(" adding checksum filter"); #ifdef H5_HAVE_FILTER_FLETCHER32 @@ -380,8 +380,8 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - - PASSED(); + + PASSED(); #else SKIPPED(); #endif @@ -391,7 +391,7 @@ TESTING(" addding shuffle filter to all"); *------------------------------------------------------------------------- */ - + TESTING(" adding checksum filter to all"); #ifdef H5_HAVE_FILTER_FLETCHER32 @@ -410,13 +410,13 @@ TESTING(" addding shuffle filter to all"); TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - - PASSED(); + + PASSED(); #else SKIPPED(); #endif - + TESTING(" filter queue fletcher, shuffle, deflate, szip"); /*------------------------------------------------------------------------- @@ -443,7 +443,7 @@ TESTING(" addding shuffle filter to all"); if (szip_can_encode) { if (h5repack_addfilter("dset1:SZIP=8,NN",&pack_options)<0) TEST_ERROR; -} +} #endif #ifdef H5_HAVE_FILTER_DEFLATE @@ -460,7 +460,7 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" adding layout chunked"); @@ -482,7 +482,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); /*------------------------------------------------------------------------- * test all objects option @@ -503,7 +503,7 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" adding layout contiguous"); @@ -524,7 +524,7 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" adding layout contiguous to all"); @@ -544,8 +544,8 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - - PASSED(); + + PASSED(); TESTING(" adding layout compact"); @@ -566,7 +566,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" adding layout compact to all"); @@ -587,8 +587,8 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - - PASSED(); + + PASSED(); TESTING(" layout compact to contiguous conversion"); @@ -609,8 +609,8 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - + PASSED(); + TESTING(" layout compact to chunk conversion"); /*------------------------------------------------------------------------- @@ -632,7 +632,7 @@ if (szip_can_encode) { PASSED(); TESTING(" layout compact to compact conversion"); - + /*------------------------------------------------------------------------- * layout compact to compact conversion *------------------------------------------------------------------------- @@ -649,8 +649,8 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - + PASSED(); + TESTING(" layout contiguous to compact conversion"); /*------------------------------------------------------------------------- * layout contiguous to compact conversion @@ -668,8 +668,8 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); - + PASSED(); + TESTING(" layout contiguous to chunk conversion"); /*------------------------------------------------------------------------- * layout contiguous to chunk conversion @@ -687,7 +687,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" layout contiguous to contiguous conversion"); @@ -707,7 +707,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" layout chunked to compact conversion"); /*------------------------------------------------------------------------- @@ -726,7 +726,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" layout chunked to contiguous conversion"); @@ -746,7 +746,7 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); TESTING(" layout chunked to chunk conversion"); /*------------------------------------------------------------------------- @@ -765,9 +765,9 @@ if (szip_can_encode) { TEST_ERROR; if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); + - /*------------------------------------------------------------------------- * the following tests assume the input files have filters * FNAME7 "test_szip.h5" @@ -778,10 +778,10 @@ if (szip_can_encode) { *------------------------------------------------------------------------- */ - + TESTING(" copy of szip filter"); - -#if defined (H5_HAVE_FILTER_SZIP) + +#if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -804,7 +804,7 @@ if (szip_can_encode) { TESTING(" removing szip filter"); -#if defined (H5_HAVE_FILTER_SZIP) +#if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -829,7 +829,7 @@ if (szip_can_encode) { TESTING(" copy of deflate filter"); - + #ifdef H5_HAVE_FILTER_DEFLATE if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -864,7 +864,7 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif @@ -872,7 +872,7 @@ if (szip_can_encode) { TESTING(" copy of shuffle filter"); - + #ifdef H5_HAVE_FILTER_SHUFFLE if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -889,7 +889,7 @@ if (szip_can_encode) { #else SKIPPED(); #endif - + TESTING(" removing shuffle filter"); #ifdef H5_HAVE_FILTER_SHUFFLE @@ -906,13 +906,13 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif TESTING(" copy of fletcher filter"); - + #ifdef H5_HAVE_FILTER_FLETCHER32 if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -946,14 +946,14 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif - + TESTING(" copy of nbit filter"); - + #ifdef H5_HAVE_FILTER_NBIT if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -987,7 +987,7 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif @@ -1008,12 +1008,12 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif TESTING(" copy of scaleoffset filter"); - + #ifdef H5_HAVE_FILTER_SCALEOFFSET if (h5repack_init (&pack_options, 0)<0) TEST_ERROR; @@ -1047,7 +1047,7 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif @@ -1068,13 +1068,13 @@ if (szip_can_encode) { if (h5repack_end (&pack_options)<0) TEST_ERROR; - PASSED(); + PASSED(); #else SKIPPED(); #endif /*------------------------------------------------------------------------- - * file with all filters + * file with all filters * dset_all * dset_deflate * dset_szip @@ -1082,7 +1082,7 @@ if (szip_can_encode) { * dset_fletcher32 *------------------------------------------------------------------------- */ - + TESTING(" filter conversion from deflate to szip"); @@ -1140,7 +1140,7 @@ if (szip_can_encode) { SKIPPED(); #endif - + /*------------------------------------------------------------------------- * test the NONE global option *------------------------------------------------------------------------- @@ -1168,17 +1168,17 @@ if (szip_can_encode) { #else SKIPPED(); #endif - - + + /*------------------------------------------------------------------------- * end *------------------------------------------------------------------------- */ puts("All h5repack tests passed."); - + return 0; - + error: puts("***** H5REPACK TESTS FAILED *****"); return 1; diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c index 608fdd9..9adecc7 100644 --- a/tools/h5repack/testh5repack_make.c +++ b/tools/h5repack/testh5repack_make.c @@ -42,7 +42,7 @@ int make_fill(hid_t loc_id); /*------------------------------------------------------------------------- * Function: make_testfiles * - * Purpose: make a test file with all types of HDF5 objects, + * Purpose: make a test file with all types of HDF5 objects, * datatypes and filters * *------------------------------------------------------------------------- @@ -54,7 +54,7 @@ int make_testfiles(void) TESTING(" generating datasets"); /*------------------------------------------------------------------------- - * create a file for general copy test + * create a file for general copy test *------------------------------------------------------------------------- */ if((loc_id = H5Fcreate(FNAME0,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) @@ -187,11 +187,11 @@ int make_testfiles(void) goto out; if(H5Fclose(loc_id)<0) return -1; - - - PASSED(); - return 0; - + + + PASSED(); + return 0; + out: H5Fclose(loc_id); return -1; @@ -202,7 +202,7 @@ out: /*------------------------------------------------------------------------- * Function: make_all_objects * - * Purpose: make a test file with all types of HDF5 objects, datatypes + * Purpose: make a test file with all types of HDF5 objects, datatypes * *------------------------------------------------------------------------- */ @@ -210,17 +210,17 @@ int make_all_objects(hid_t loc_id) { hid_t dset_id; hid_t group_id; - hid_t type_id; + hid_t type_id; hid_t root_id; hid_t space_id; hsize_t dims[1]={2}; /* Compound datatype */ - typedef struct s_t + typedef struct s_t { int a; float b; } s_t; - + /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- @@ -232,7 +232,7 @@ int make_all_objects(hid_t loc_id) /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- - */ + */ group_id = H5Gcreate(loc_id,"g1",0); root_id = H5Gopen(loc_id, "/"); @@ -248,16 +248,16 @@ int make_all_objects(hid_t loc_id) /* Commit compound datatype and close it */ H5Tcommit(loc_id, "type", type_id); H5Tclose(type_id); - + /*------------------------------------------------------------------------- * H5G_LINK *------------------------------------------------------------------------- */ - + H5Glink(loc_id, H5G_LINK_SOFT, "dset", "link"); /*------------------------------------------------------------------------- - * write a series of datasetes + * write a series of datasetes *------------------------------------------------------------------------- */ @@ -268,15 +268,15 @@ int make_all_objects(hid_t loc_id) H5Gclose(group_id); H5Gclose(root_id); - return 0; - + return 0; + } /*------------------------------------------------------------------------- * Function: make_attributes * - * Purpose: make a test file with all types of attributes + * Purpose: make a test file with all types of attributes * *------------------------------------------------------------------------- */ @@ -287,8 +287,8 @@ int make_attributes(hid_t loc_id) hid_t root_id; hid_t space_id; hsize_t dims[1]={2}; - - + + /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- @@ -301,7 +301,7 @@ int make_attributes(hid_t loc_id) /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- - */ + */ group_id = H5Gcreate(loc_id,"g1",0); root_id = H5Gopen(loc_id, "/"); @@ -319,8 +319,8 @@ int make_attributes(hid_t loc_id) H5Gclose(group_id); H5Gclose(root_id); - return 0; - + return 0; + } /*------------------------------------------------------------------------- @@ -336,7 +336,7 @@ int make_hlinks(hid_t loc_id) hid_t group2_id; hid_t group3_id; hsize_t dims[2]={3,2}; - int buf[3][2]= {{1,1},{1,2},{2,2}}; + int buf[3][2]= {{1,1},{1,2},{2,2}}; /*------------------------------------------------------------------------- * create a dataset and some hard links to it @@ -356,8 +356,8 @@ int make_hlinks(hid_t loc_id) /*------------------------------------------------------------------------- * create a group and some hard links to it *------------------------------------------------------------------------- - */ - + */ + if ((group1_id = H5Gcreate(loc_id,"g1",0))<0) return -1; if ((group2_id = H5Gcreate(group1_id,"g2",0))<0) @@ -369,13 +369,13 @@ int make_hlinks(hid_t loc_id) return -1; if (H5Glink2(group1_id, "g2", H5G_LINK_HARD, group3_id, "link1 to g2")<0) return -1; - + H5Gclose(group1_id); H5Gclose(group2_id); H5Gclose(group3_id); - return 0; - + return 0; + } @@ -436,9 +436,9 @@ if (szip_can_encode) { goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -471,7 +471,7 @@ int make_deflate(hid_t loc_id) buf[i][j]=n++; } } - + /* create a space */ if((sid = H5Screate_simple(RANK, dims, NULL))<0) return -1; @@ -501,9 +501,9 @@ int make_deflate(hid_t loc_id) goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -550,7 +550,7 @@ int make_shuffle(hid_t loc_id) */ #if defined (H5_HAVE_FILTER_SHUFFLE) /* set the shuffle filter */ - if (H5Pset_shuffle(dcpl)<0) + if (H5Pset_shuffle(dcpl)<0) goto out; if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf)<0) goto out; @@ -564,9 +564,9 @@ int make_shuffle(hid_t loc_id) goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -613,10 +613,10 @@ int make_fletcher32(hid_t loc_id) */ #if defined (H5_HAVE_FILTER_FLETCHER32) /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) goto out; /* set the checksum filter */ - if (H5Pset_fletcher32(dcpl)<0) + if (H5Pset_fletcher32(dcpl)<0) goto out; if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf)<0) goto out; @@ -630,9 +630,9 @@ int make_fletcher32(hid_t loc_id) goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -653,8 +653,8 @@ int make_nbit(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; + hid_t dtid; + hid_t dsid; hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; @@ -684,12 +684,12 @@ int make_nbit(hid_t loc_id) #if defined (H5_HAVE_FILTER_NBIT) /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) { H5Tclose(dtid); goto out; } - if (H5Pset_nbit(dcpl)<0) + if (H5Pset_nbit(dcpl)<0) { H5Tclose(dtid); goto out; @@ -706,7 +706,7 @@ int make_nbit(hid_t loc_id) } H5Dclose(dsid); - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) { H5Tclose(dtid); goto out; @@ -732,9 +732,9 @@ int make_nbit(hid_t loc_id) goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -755,8 +755,8 @@ int make_scaleoffset(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; + hid_t dtid; + hid_t dsid; hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; @@ -781,12 +781,12 @@ int make_scaleoffset(hid_t loc_id) #if defined (H5_HAVE_FILTER_NBIT) /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) { H5Tclose(dtid); goto out; } - if (H5Pset_scaleoffset(dcpl,31,2)<0) + if (H5Pset_scaleoffset(dcpl,31,2)<0) { H5Tclose(dtid); goto out; @@ -824,9 +824,9 @@ int make_scaleoffset(hid_t loc_id) goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -847,8 +847,8 @@ int make_all(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; + hid_t dtid; + hid_t dsid; #if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=8; @@ -875,16 +875,16 @@ int make_all(hid_t loc_id) /* set up chunk */ if(H5Pset_chunk(dcpl, RANK, chunk_dims)<0) goto out; - + #if defined (H5_HAVE_FILTER_SHUFFLE) /* set the shuffle filter */ - if (H5Pset_shuffle(dcpl)<0) + if (H5Pset_shuffle(dcpl)<0) goto out; #endif #if defined (H5_HAVE_FILTER_FLETCHER32) /* set the checksum filter */ - if (H5Pset_fletcher32(dcpl)<0) + if (H5Pset_fletcher32(dcpl)<0) goto out; #endif @@ -916,10 +916,10 @@ if (szip_can_encode) { */ #if defined (H5_HAVE_FILTER_FLETCHER32) /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) goto out; /* set the checksum filter */ - if (H5Pset_fletcher32(dcpl)<0) + if (H5Pset_fletcher32(dcpl)<0) goto out; if (make_dset(loc_id,"dset_fletcher32",sid,dcpl,buf)<0) goto out; @@ -933,7 +933,7 @@ if (szip_can_encode) { #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) goto out; /* set szip data */ if(H5Pset_szip (dcpl,szip_options_mask,szip_pixels_per_block)<0) @@ -951,10 +951,10 @@ if (szip_can_encode) { */ #if defined (H5_HAVE_FILTER_SHUFFLE) /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) goto out; /* set the shuffle filter */ - if (H5Pset_shuffle(dcpl)<0) + if (H5Pset_shuffle(dcpl)<0) goto out; if (make_dset(loc_id,"dset_shuffle",sid,dcpl,buf)<0) goto out; @@ -966,7 +966,7 @@ if (szip_can_encode) { */ #if defined (H5_HAVE_FILTER_DEFLATE) /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) goto out; /* set deflate data */ if(H5Pset_deflate(dcpl, 1)<0) @@ -982,10 +982,10 @@ if (szip_can_encode) { */ #if defined (H5_HAVE_FILTER_NBIT) /* remove the filters from the dcpl */ - if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) + if (H5Premove_filter(dcpl,H5Z_FILTER_ALL)<0) goto out; /* set the shuffle filter */ - if (H5Pset_nbit(dcpl)<0) + if (H5Pset_nbit(dcpl)<0) goto out; dtid = H5Tcopy(H5T_NATIVE_INT); H5Tset_precision(dtid,(H5Tget_precision(dtid)-1)); @@ -1009,9 +1009,9 @@ if (szip_can_encode) { goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -1025,7 +1025,7 @@ out: /*------------------------------------------------------------------------- * Function: make_early * - * Purpose: create a file for the H5D_ALLOC_TIME_EARLY test + * Purpose: create a file for the H5D_ALLOC_TIME_EARLY test * *------------------------------------------------------------------------- */ @@ -1033,10 +1033,10 @@ int make_early(void) { hsize_t dims[1] ={3000}; hsize_t cdims[1]={30}; - hid_t fid=-1; + hid_t fid=-1; hid_t dset_id=-1; - hid_t sid=-1; - hid_t tid=-1; + hid_t sid=-1; + hid_t tid=-1; hid_t dcpl=-1; int i; char name[10]; @@ -1046,7 +1046,7 @@ int make_early(void) return -1; if (H5Fclose(fid)<0) goto out; - + if ((sid = H5Screate_simple(1, dims, NULL))<0) goto out; if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) @@ -1055,47 +1055,47 @@ int make_early(void) goto out; if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY)<0) goto out; - + for (i=0; i<iter; i++) { if ((fid = H5Fopen(FNAME5,H5F_ACC_RDWR,H5P_DEFAULT))<0) goto out; if ((dset_id = H5Dcreate(fid,"early",H5T_NATIVE_DOUBLE,sid,dcpl))<0) goto out; - if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0) + if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0) goto out; sprintf(name,"%d", i); - if ((H5Tcommit(fid,name,tid))<0) + if ((H5Tcommit(fid,name,tid))<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; - if (H5Dclose(dset_id)<0) + if (H5Dclose(dset_id)<0) goto out; - if (H5Gunlink(fid,"early")<0) + if (H5Gunlink(fid,"early")<0) goto out; if (H5Fclose(fid)<0) goto out; } - + /*------------------------------------------------------------------------- * do the same without close/opening the file and creating the dataset *------------------------------------------------------------------------- */ - + if ((fid = H5Fcreate(FNAME6,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) return -1; for (i=0; i<iter; i++) { - if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0) + if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE))<0) goto out; sprintf(name,"%d", i); - if ((H5Tcommit(fid,name,tid))<0) + if ((H5Tcommit(fid,name,tid))<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; } - + if (H5Sclose(sid)<0) goto out; if (H5Pclose(dcpl)<0) @@ -1103,9 +1103,9 @@ int make_early(void) if (H5Fclose(fid)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Tclose(tid); @@ -1201,9 +1201,9 @@ int make_layout(hid_t loc_id) goto out; if(H5Pclose(dcpl)<0) goto out; - - return 0; - + + return 0; + out: H5E_BEGIN_TRY { H5Pclose(dcpl); @@ -1219,7 +1219,7 @@ out: /*------------------------------------------------------------------------- * Function: make a file with an integer dataset with a fill value * - * Purpose: test copy of fill values + * Purpose: test copy of fill values * *------------------------------------------------------------------------- */ @@ -1229,9 +1229,9 @@ int make_fill(hid_t loc_id) hid_t sid; hid_t dcpl; hsize_t dims[2]={3,2}; - int buf[3][2]= {{1,1},{1,2},{2,2}}; + int buf[3][2]= {{1,1},{1,2},{2,2}}; int fillvalue=2; - + /*------------------------------------------------------------------------- * H5T_INTEGER, write a fill value *------------------------------------------------------------------------- @@ -1246,7 +1246,7 @@ int make_fill(hid_t loc_id) H5Dclose(did); H5Sclose(sid); - return 0; - + return 0; + } diff --git a/tools/h5repack/testh5repack_util.c b/tools/h5repack/testh5repack_util.c index f74b414..cad52d3 100644 --- a/tools/h5repack/testh5repack_util.c +++ b/tools/h5repack/testh5repack_util.c @@ -28,7 +28,7 @@ */ int make_dset(hid_t loc_id, const char *name, - hid_t sid, + hid_t sid, hid_t dcpl, void *buf) { @@ -67,37 +67,37 @@ int make_dset(hid_t loc_id, *------------------------------------------------------------------------- */ -int write_dset( hid_t loc_id, - int rank, - hsize_t *dims, +int write_dset( hid_t loc_id, + int rank, + hsize_t *dims, const char *dset_name, - hid_t type_id, + hid_t type_id, void *buf ) { hid_t dset_id; - hid_t space_id; - + hid_t space_id; + /* Create a buf space */ if ((space_id = H5Screate_simple(rank,dims,NULL))<0) return -1; - + /* Create a dataset */ if ((dset_id = H5Dcreate(loc_id,dset_name,type_id,space_id,H5P_DEFAULT))<0) return -1; - + /* Write the buf */ if ( buf ) if (H5Dwrite(dset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) return -1; - + /* Close */ if (H5Dclose(dset_id)<0) return -1; if (H5Sclose(space_id)<0) return -1; - + return 0; - + } @@ -112,37 +112,37 @@ int write_dset( hid_t loc_id, * *------------------------------------------------------------------------- */ - -int make_attr(hid_t loc_id, - int rank, - hsize_t *dims, + +int make_attr(hid_t loc_id, + int rank, + hsize_t *dims, const char *attr_name, - hid_t type_id, + hid_t type_id, void *buf) { hid_t attr_id; - hid_t space_id; - + hid_t space_id; + /* create a space */ if ((space_id = H5Screate_simple(rank,dims,NULL))<0) return -1; - + /* create the attribute */ if ((attr_id = H5Acreate(loc_id,attr_name,type_id,space_id,H5P_DEFAULT))<0) goto out; - + /* write the buffer */ if ( buf ) { if (H5Awrite(attr_id,type_id,buf)<0) goto out; } - + /* close */ H5Aclose(attr_id); H5Sclose(space_id); return 0; - + out: H5E_BEGIN_TRY { H5Aclose(attr_id); diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 1529730..037a7bb 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -75,7 +75,7 @@ void print_manager_output(void) /* If there was something we buffered, let's print it now */ if( (outBuffOffset>0) && g_Parallel) { - printf("%s", outBuff); + printf("%s", outBuff); if(overflow_file) { @@ -121,7 +121,7 @@ static void print_incoming_data(void) MPI_Status Status; do - { + { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); if(incomingMessage) { @@ -160,11 +160,11 @@ h5diff (const char *fname1, int nobjects1, nobjects2; trav_info_t *info1 = NULL; trav_info_t *info2 = NULL; - hid_t file1_id=(-1), file2_id=(-1); + hid_t file1_id=(-1), file2_id=(-1); char filenames[2][1024]; hsize_t nfound = 0; int not_cmp = 0; - + memset(filenames, 0, 1024*2); @@ -276,10 +276,10 @@ h5diff (const char *fname1, * object name was supplied *------------------------------------------------------------------------- */ - + if (objname1) { - + #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -348,8 +348,8 @@ out: /*------------------------------------------------------------------------- * Function: diff_match * - * Purpose: Find common objects; the algorithm used for this search is the - * cosequential match algorithm and is described in + * Purpose: Find common objects; the algorithm used for this search is the + * cosequential match algorithm and is described in * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley. * * Return: Number of differences found @@ -357,7 +357,7 @@ out: * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: May 9, 2003 - * + * * Modifications: Jan 2005 Leon Arber, larber@uiuc.edu * Added support for parallel diffing * @@ -481,7 +481,7 @@ diff_match (hid_t file1_id, struct diff_args args; int havePrintToken = 1; MPI_Status Status; - + /*set all tasks as free */ memset(workerTasks, 1, g_nTasks-1); #endif @@ -512,13 +512,13 @@ diff_match (hid_t file1_id, * may not work in non-homogeneous MPI environments. */ - /*Set up args to pass to worker task. */ + /*Set up args to pass to worker task. */ if(strlen(table->objs[i].name) > 255) { printf("The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } - + strcpy(args.name, table->objs[i].name); args.options = *options; args.type= table->objs[i].type; @@ -571,11 +571,11 @@ diff_match (hid_t file1_id, } /* Print all the data in our incoming queue */ - print_incoming_data(); + print_incoming_data(); } /* check array of tasks to see which ones are free. - * Manager task never does work, so freeTasks[0] is really + * Manager task never does work, so freeTasks[0] is really * worker task 0. */ for(n=1; (n<g_nTasks) && !workerFound; n++) @@ -613,7 +613,7 @@ diff_match (hid_t file1_id, else { /* But first print all the data in our incoming queue */ - print_incoming_data(); + print_incoming_data(); MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); if(Status.MPI_TAG == MPI_TAG_DONE) @@ -670,7 +670,7 @@ diff_match (hid_t file1_id, else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) { MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); - if(havePrintToken) + if(havePrintToken) { MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD); MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); @@ -700,9 +700,9 @@ diff_match (hid_t file1_id, { char data[PRINT_DATA_MAX_SIZE+1]; memset(data, 0, PRINT_DATA_MAX_SIZE+1); - + MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - + printf("%s", data); } else @@ -729,7 +729,7 @@ diff_match (hid_t file1_id, /*------------------------------------------------------------------------- * do the diff for the root. - * this is a special case, we get an ID for the root group and call diff() + * this is a special case, we get an ID for the root group and call diff() * with this ID; it compares only the root group attributes *------------------------------------------------------------------------- */ @@ -819,10 +819,10 @@ diff_compare (hid_t file1_id, * * Purpose: switch between types and choose the diff function * TYPE is either - * H5G_LINK Object is a symbolic link - * H5G_GROUP Object is a group - * H5G_DATASET Object is a dataset - * H5G_TYPE Object is a named data type + * H5G_LINK Object is a symbolic link + * H5G_GROUP Object is a group + * H5G_DATASET Object is a dataset + * H5G_TYPE Object is a named data type * * Return: Number of differences found * @@ -864,10 +864,10 @@ diff (hid_t file1_id, if (options->m_verbose) { if (print_objname (options, (hsize_t)1)) - parallel_print("Dataset: <%s> and <%s>\n", path1, path2); + parallel_print("Dataset: <%s> and <%s>\n", path1, path2); nfound = diff_dataset (file1_id, file2_id, path1, path2, options); /* always print the number of differences found */ - print_found(nfound); + print_found(nfound); } /*------------------------------------------------------------------------- * non verbose, check first if we have differences @@ -887,9 +887,9 @@ diff (hid_t file1_id, if (print_objname (options, nfound)) parallel_print("Dataset: <%s> and <%s>\n", path1, path2); nfound = diff_dataset (file1_id, file2_id, path1, path2, options); - /* print the number of differences found only when found + /* print the number of differences found only when found this is valid for the default mode and report mode */ - print_found(nfound); + print_found(nfound); } /*if nfound */ } /*if quiet */ @@ -902,7 +902,7 @@ diff (hid_t file1_id, nfound = diff_dataset (file1_id, file2_id, path1, path2, options); } } /*else verbose */ - + break; /*------------------------------------------------------------------------- @@ -934,7 +934,7 @@ diff (hid_t file1_id, *------------------------------------------------------------------------- */ if (path1) - diff_attr (type1_id, type2_id, path1, path2, options); + diff_attr (type1_id, type2_id, path1, path2, options); if (H5Tclose (type1_id) < 0) goto out; @@ -1029,7 +1029,7 @@ diff (hid_t file1_id, parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", path1, path2, get_type (type)); options->not_cmp=1; - } + } break; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index a307cb8..9f0a0dc 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -77,10 +77,10 @@ typedef struct { extern "C" { #endif -hsize_t h5diff(const char *fname1, - const char *fname2, - const char *objname1, - const char *objname2, +hsize_t h5diff(const char *fname1, + const char *fname2, + const char *objname1, + const char *objname2, diff_opt_t *options); #ifdef H5_HAVE_PARALLEL @@ -100,75 +100,75 @@ void print_manager_output(void); */ -hsize_t diff_dataset( hid_t file1_id, - hid_t file2_id, - const char *obj1_name, +hsize_t diff_dataset( hid_t file1_id, + hid_t file2_id, + const char *obj1_name, const char *obj2_name, diff_opt_t *options ); -hsize_t diff_datasetid( hid_t dset1_id, - hid_t dset2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_datasetid( hid_t dset1_id, + hid_t dset2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ); -hsize_t diff( hid_t file1_id, - const char *path1, - hid_t file2_id, - const char *path2, - diff_opt_t *options, +hsize_t diff( hid_t file1_id, + const char *path1, + hid_t file2_id, + const char *path2, + diff_opt_t *options, H5G_obj_t type ); -hsize_t diff_compare( hid_t file1_id, - const char *file1_name, - const char *obj1_name, - int nobjects1, +hsize_t diff_compare( hid_t file1_id, + const char *file1_name, + const char *obj1_name, + int nobjects1, trav_info_t *info1, - hid_t file2_id, - const char *file2_name, - const char *obj2_name, - int nobjects2, + hid_t file2_id, + const char *file2_name, + const char *obj2_name, + int nobjects2, trav_info_t *info2, diff_opt_t *options ); -hsize_t diff_match( hid_t file1_id, - int nobjects1, +hsize_t diff_match( hid_t file1_id, + int nobjects1, trav_info_t *info1, - hid_t file2_id, - int nobjects2, - trav_info_t *info2, + hid_t file2_id, + int nobjects2, + trav_info_t *info2, diff_opt_t *options ); -hsize_t diff_array( void *_mem1, - void *_mem2, - hsize_t nelmts, - int rank, - hsize_t *dims, - diff_opt_t *options, - const char *name1, +hsize_t diff_array( void *_mem1, + void *_mem2, + hsize_t nelmts, + int rank, + hsize_t *dims, + diff_opt_t *options, + const char *name1, const char *name2, hid_t m_type, hid_t container1_id, hid_t container2_id); /* dataset where the reference came from*/ -int diff_can_type( hid_t f_type1, /* file data type */ +int diff_can_type( hid_t f_type1, /* file data type */ hid_t f_type2, /* file data type */ - int rank1, + int rank1, int rank2, - hsize_t *dims1, + hsize_t *dims1, hsize_t *dims2, - hsize_t *maxdim1, + hsize_t *maxdim1, hsize_t *maxdim2, - const char *obj1_name, - const char *obj2_name, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ); -int diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, +int diff_attr(hid_t loc1_id, + hid_t loc2_id, + const char *path1, + const char *path2, diff_opt_t *options ); @@ -186,13 +186,13 @@ const char* get_type(int type); const char* get_class(H5T_class_t tclass); const char* get_sign(H5T_sign_t sign); void print_dims( int r, hsize_t *d ); -void print_pos( int *ph, - int per, - hsize_t curr_pos, - hsize_t *acc, - hsize_t *pos, - int rank, - const char *obj1, +void print_pos( int *ph, + int per, + hsize_t curr_pos, + hsize_t *acc, + hsize_t *pos, + int rank, + const char *obj1, const char *obj2 ); int print_objname(diff_opt_t *options, hsize_t nfound); @@ -207,172 +207,172 @@ void print_sizes( const char *obj1, const char *obj2, hsize_t diff_native_uchar(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_char(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); -hsize_t diff_datum(void *_mem1, - void *_mem2, +hsize_t diff_datum(void *_mem1, + void *_mem2, hid_t m_type, - hsize_t i, - int rank, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *options, - const char *obj1, + hsize_t i, + int rank, + hsize_t *acc, + hsize_t *pos, + diff_opt_t *options, + const char *obj1, const char *obj2, hid_t container1_id, hid_t container2_id, /*where the reference came from*/ - int *ph); /*print header */ + int *ph); /*print header */ hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 3632cdb..dd4784d 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -15,7 +15,7 @@ #include <math.h> #include "h5diff.h" #include "ph5diff.h" -#include "H5private.h" +#include "H5private.h" /* local functions */ static void close_obj(H5G_obj_t obj_type, hid_t obj_id); @@ -30,7 +30,7 @@ static hbool_t is_zero(const void *_mem, size_t size); *------------------------------------------------------------------------- */ static int print_data(diff_opt_t *options) -{ +{ return ( (options->m_report || options->m_verbose) && !options->m_quiet)?1:0; } @@ -45,22 +45,22 @@ static int print_data(diff_opt_t *options) * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: November 12, 2003 - * + * *------------------------------------------------------------------------- */ -hsize_t diff_array( void *_mem1, - void *_mem2, - hsize_t nelmts, - int rank, - hsize_t *dims, - diff_opt_t *options, - const char *name1, +hsize_t diff_array( void *_mem1, + void *_mem2, + hsize_t nelmts, + int rank, + hsize_t *dims, + diff_opt_t *options, + const char *name1, const char *name2, hid_t m_type, hid_t container1_id, hid_t container2_id) /* dataset where the reference came from*/ -{ +{ hsize_t nfound=0; /* number of differences found */ size_t size; /* size of datum */ unsigned char *mem1 = (unsigned char*)_mem1; @@ -85,13 +85,13 @@ hsize_t diff_array( void *_mem1, pos[j]=0; - if(H5Tis_variable_str(m_type)) + if(H5Tis_variable_str(m_type)) { - tmp1 = ((unsigned char**)mem1)[0]; - tmp2 = ((unsigned char**)mem2)[0]; + tmp1 = ((unsigned char**)mem1)[0]; + tmp2 = ((unsigned char**)mem2)[0]; nfound+=diff_datum( tmp1, - tmp2, + tmp2, m_type, (hsize_t)0, rank, @@ -109,16 +109,16 @@ hsize_t diff_array( void *_mem1, { - switch (H5Tget_class(m_type)) + switch (H5Tget_class(m_type)) { default: assert(0); break; case H5T_FLOAT: - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) nfound=diff_float(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) nfound=diff_double(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); break; @@ -126,23 +126,23 @@ hsize_t diff_array( void *_mem1, if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) nfound=diff_schar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) nfound=diff_uchar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) nfound=diff_short(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) nfound=diff_ushort(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_INT)) + else if (H5Tequal(m_type, H5T_NATIVE_INT)) nfound=diff_int(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) nfound=diff_uint(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) nfound=diff_long(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) nfound=diff_ulong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) nfound=diff_llong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) nfound=diff_ullong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); break; @@ -198,7 +198,7 @@ hsize_t diff_array( void *_mem1, * The compare of the 2 buffers read from the files is made datum by datum. * * H5T_INTEGER and H5T_FLOAT - * Copy the buffer into a compatible local datum and do a numerical + * Copy the buffer into a compatible local datum and do a numerical * compare of this datum * H5T_COMPOUND * Recursively call this function for each member @@ -207,34 +207,34 @@ hsize_t diff_array( void *_mem1, * H5T_VLEN * Recursively call this function for each element * H5T_STRING - * compare byte by byte in a cycle from 0 to type_size. this type_size is the - * value obtained by the get_size function but it is the string lenght for + * compare byte by byte in a cycle from 0 to type_size. this type_size is the + * value obtained by the get_size function but it is the string lenght for * variable sized strings * H5T_OPAQUE * compare byte by byte in a cycle from 0 to type_size * H5T_BITFIELD * compare byte by byte in a cycle from 0 to type_size * H5T_ENUM - * for each pair of elements being compared, both bit patterns are converted to + * for each pair of elements being compared, both bit patterns are converted to * their corresponding enumeration constant and a string comparison is made * H5T_REFERENCE - * Dereference the object and compare the type (basic object type). + * Dereference the object and compare the type (basic object type). *------------------------------------------------------------------------- */ -hsize_t diff_datum(void *_mem1, - void *_mem2, +hsize_t diff_datum(void *_mem1, + void *_mem2, hid_t m_type, - hsize_t i, - int rank, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *options, - const char *obj1, + hsize_t i, + int rank, + hsize_t *acc, + hsize_t *pos, + diff_opt_t *options, + const char *obj1, const char *obj2, hid_t container1_id, hid_t container2_id, /*where the reference came from*/ - int *ph) /*print header */ + int *ph) /*print header */ { static char fmt_llong[255]; static char fmt_ullong[255]; @@ -245,7 +245,7 @@ hsize_t diff_datum(void *_mem1, unsigned char *mem2 = (unsigned char*)_mem2; unsigned u; hid_t memb_type; - size_t type_size; + size_t type_size; size_t offset; int nmembs; int j; @@ -266,20 +266,20 @@ hsize_t diff_datum(void *_mem1, if (!fmt_llong[0]) { /* Build default formats for long long types */ - sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", + sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullong, "%%%su %%%su %%%su\n", + sprintf(fmt_ullong, "%%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", + sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", + sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); } type_size = H5Tget_size( m_type ); - switch (H5Tget_class(m_type)) + switch (H5Tget_class(m_type)) { default: assert(0); @@ -294,7 +294,7 @@ hsize_t diff_datum(void *_mem1, */ case H5T_COMPOUND: nmembs = H5Tget_nmembers(m_type); - for (j = 0; j < nmembs; j++) + for (j = 0; j < nmembs; j++) { offset = H5Tget_member_offset(m_type, (unsigned)j); memb_type = H5Tget_member_type(m_type, (unsigned)j); @@ -322,11 +322,11 @@ hsize_t diff_datum(void *_mem1, */ case H5T_STRING: { - + H5T_str_t pad; char *s; - - if(H5Tis_variable_str(m_type)) + + if(H5Tis_variable_str(m_type)) { /* mem1 is the pointer into the struct where a `char*' is stored. So we have * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ @@ -334,14 +334,14 @@ hsize_t diff_datum(void *_mem1, if(s!=NULL) size = HDstrlen(s); } - else + else { s = mem1; size = H5Tget_size(m_type); } - + pad = H5Tget_strpad(m_type); - + /* check for NULL pointer for string */ if(s!=NULL) for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++) @@ -349,14 +349,14 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); - + } break; @@ -372,11 +372,11 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); @@ -394,11 +394,11 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); @@ -413,7 +413,7 @@ hsize_t diff_datum(void *_mem1, /* For enumeration types we compare the names instead of the integer values. For each pair of elements being - compared, we convert both bit patterns to their corresponding + compared, we convert both bit patterns to their corresponding enumeration constant and do a string comparison */ { @@ -429,7 +429,7 @@ hsize_t diff_datum(void *_mem1, if (HDstrcmp(enum_name1,enum_name2)!=0) { nfound=1; - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -443,11 +443,11 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); } @@ -473,7 +473,7 @@ hsize_t diff_datum(void *_mem1, /* calculate the number of array elements */ for (u = 0, nelmts = 1; u <ndims; u++) nelmts *= dims[u]; - for (u = 0; u < nelmts; u++) + for (u = 0; u < nelmts; u++) nfound+=diff_datum( mem1 + u * size, mem2 + u * size, /* offset */ @@ -504,7 +504,7 @@ hsize_t diff_datum(void *_mem1, /* get the number of sequence elements */ nelmts = ((hvl_t *)mem1)->len; - for (j = 0; j < (int)nelmts; j++) + for (j = 0; j < (int)nelmts; j++) nfound+=diff_datum( ((char *)(((hvl_t *)mem1)->p)) + j * size, ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */ @@ -542,7 +542,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) + if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) { hid_t region1_id; hid_t region2_id; @@ -583,7 +583,7 @@ hsize_t diff_datum(void *_mem1, * Object references. get the type and OID of the referenced object *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) + else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) { if ((obj1_type = H5Rget_obj_type(container1_id, H5R_OBJECT, _mem1))<0) @@ -622,7 +622,7 @@ hsize_t diff_datum(void *_mem1, options); break; default: - parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>", + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>", obj1, obj2); options->not_cmp=1; break; @@ -646,7 +646,7 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) { char temp1_char; char temp2_char; @@ -658,7 +658,7 @@ hsize_t diff_datum(void *_mem1, { if (abs(temp1_char-temp2_char) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -672,7 +672,7 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -684,10 +684,10 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && + if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && abs(temp1_char-temp2_char) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -698,7 +698,7 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_char != temp2_char) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -713,7 +713,7 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_UCHAR *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) { unsigned char temp1_uchar; unsigned char temp2_uchar; @@ -726,7 +726,7 @@ hsize_t diff_datum(void *_mem1, { if (abs(temp1_uchar-temp2_uchar) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -740,7 +740,7 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -752,10 +752,10 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -766,7 +766,7 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -797,7 +797,7 @@ hsize_t diff_datum(void *_mem1, { if (abs(temp1_short-temp2_short) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -811,7 +811,7 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -823,10 +823,10 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && + if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && abs(temp1_short-temp2_short) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -838,7 +838,7 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_short != temp2_short) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -870,7 +870,7 @@ hsize_t diff_datum(void *_mem1, if (abs(temp1_ushort-temp2_ushort) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -885,7 +885,7 @@ hsize_t diff_datum(void *_mem1, if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -898,11 +898,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && abs(temp1_ushort-temp2_ushort) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -915,7 +915,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_ushort != temp2_ushort) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -933,7 +933,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_INT)) + else if (H5Tequal(m_type, H5T_NATIVE_INT)) { int temp1_int; int temp2_int; @@ -947,7 +947,7 @@ hsize_t diff_datum(void *_mem1, if (abs(temp1_int-temp2_int) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -961,11 +961,11 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), abs(1-temp2_int/temp1_int)); } @@ -975,14 +975,14 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && + if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && abs(temp1_int-temp2_int) > options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), abs(1-temp2_int/temp1_int)); } @@ -991,8 +991,8 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_int != temp2_int) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1000,8 +1000,8 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_INT*/ @@ -1009,13 +1009,13 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_UINT *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) { unsigned int temp1_uint; unsigned int temp2_uint; assert(type_size==sizeof(int)); - + memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); /* -d and !-p */ @@ -1023,8 +1023,8 @@ hsize_t diff_datum(void *_mem1, { if (abs((int)(temp1_uint-temp2_uint)) > options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1038,11 +1038,11 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), abs((int)(1-temp2_uint/temp1_uint))); } @@ -1052,14 +1052,14 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options->percent && + if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options->percent && abs((int)(temp1_uint-temp2_uint)) > options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), abs((int)(1-temp2_uint/temp1_uint))); } @@ -1069,7 +1069,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_uint != temp2_uint) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -1088,13 +1088,13 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_LONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) { long temp1_long; long temp2_long; assert(type_size==sizeof(long)); - + memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); /* -d and !-p */ @@ -1102,8 +1102,8 @@ hsize_t diff_datum(void *_mem1, { if (labs(temp1_long-temp2_long) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1117,8 +1117,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1130,11 +1130,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options->percent && + if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options->percent && labs(temp1_long-temp2_long) > (long)options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1146,7 +1146,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_long != temp2_long) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1155,21 +1155,21 @@ hsize_t diff_datum(void *_mem1, nfound++; } - - + + } /*H5T_NATIVE_LONG*/ /*------------------------------------------------------------------------- * H5T_NATIVE_ULONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) { unsigned long temp1_ulong; unsigned long temp2_ulong; assert(type_size==sizeof(unsigned long)); - + memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); /* -d and !-p */ @@ -1177,8 +1177,8 @@ hsize_t diff_datum(void *_mem1, { if (labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1192,8 +1192,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1205,11 +1205,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options->percent && + if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options->percent && labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1221,7 +1221,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_ulong != temp2_ulong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1229,21 +1229,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_ULONG*/ /*------------------------------------------------------------------------- * H5T_NATIVE_LLONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) { long_long temp1_llong; long_long temp2_llong; assert(type_size==sizeof(long_long)); - + memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); /* -d and !-p */ @@ -1251,8 +1251,8 @@ hsize_t diff_datum(void *_mem1, { if (labs((long)(temp1_llong-temp2_llong)) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1266,8 +1266,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1279,11 +1279,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent && + if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent && labs((long)(temp1_llong-temp2_llong)) > (long)options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1295,7 +1295,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_llong != temp2_llong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -1304,21 +1304,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_LLONG*/ /*------------------------------------------------------------------------- * H5T_NATIVE_ULLONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) { unsigned long_long temp1_ullong; unsigned long_long temp2_ullong; assert(type_size==sizeof(unsigned long_long)); - + memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); /* -d and !-p */ @@ -1326,8 +1326,8 @@ hsize_t diff_datum(void *_mem1, { if (labs((long)(temp1_ullong-temp2_ullong)) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1341,8 +1341,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1354,14 +1354,14 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options->percent && + if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options->percent && labs((long)(temp1_ullong-temp2_ullong)) > (long)options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(fmt_ullongp,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong))); } @@ -1370,8 +1370,8 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_ullong != temp2_ullong) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1379,10 +1379,10 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_ULLONG*/ - + break; /* H5T_INTEGER class */ case H5T_FLOAT: @@ -1391,7 +1391,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) { float temp1_float; float temp2_float; @@ -1407,7 +1407,7 @@ hsize_t diff_datum(void *_mem1, if (fabs(temp1_float-temp2_float) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1422,7 +1422,7 @@ hsize_t diff_datum(void *_mem1, if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1431,15 +1431,15 @@ hsize_t diff_datum(void *_mem1, nfound++; } } - + /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && + if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && fabs(temp1_float-temp2_float) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -1452,7 +1452,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_float != temp2_float) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -1469,7 +1469,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) { double temp1_double; double temp2_double; @@ -1483,7 +1483,7 @@ hsize_t diff_datum(void *_mem1, if (fabs(temp1_double-temp2_double) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1498,7 +1498,7 @@ hsize_t diff_datum(void *_mem1, if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1510,11 +1510,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && + if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -1527,13 +1527,13 @@ hsize_t diff_datum(void *_mem1, else if (temp1_double != temp2_double) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); parallel_print(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double)); - + } nfound++; } @@ -1567,12 +1567,12 @@ hsize_t diff_datum(void *_mem1, hsize_t diff_native_uchar(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) { @@ -1588,7 +1588,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, { if (abs(temp1_uchar-temp2_uchar) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1602,7 +1602,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, { if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1614,10 +1614,10 @@ hsize_t diff_native_uchar(unsigned char *mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1628,7 +1628,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, } else if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1638,7 +1638,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, } return nfound; -} +} /*------------------------------------------------------------------------- @@ -1657,12 +1657,12 @@ hsize_t diff_native_uchar(unsigned char *mem1, hsize_t diff_char(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) { @@ -1675,7 +1675,7 @@ hsize_t diff_char(unsigned char *mem1, if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1685,7 +1685,7 @@ hsize_t diff_char(unsigned char *mem1, } return nfound; -} +} @@ -1703,11 +1703,11 @@ static hbool_t is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *)_mem; - + while (size-- > 0) if (mem[size]) return FALSE; - + return TRUE; } @@ -1719,10 +1719,10 @@ is_zero(const void *_mem, size_t size) *------------------------------------------------------------------------- */ -static +static void close_obj(H5G_obj_t obj_type, hid_t obj_id) { - + switch (obj_type) { case H5G_GROUP: H5Gclose(obj_id); @@ -1764,7 +1764,7 @@ static int diff_region(hid_t region1_id, hid_t region2_id) #if defined (H5DIFF_DEBUG) int i; #endif - + /* * These two functions fail if the region does not have blocks or points, * respectively. They do not currently know how to translate from one to @@ -1780,9 +1780,9 @@ static int diff_region(hid_t region1_id, hid_t region2_id) if (nblocks1!=nblocks2 || npoints1!=npoints2 || ndims1!=ndims2) return 1; - + /* compare block information */ - if (nblocks1 > 0) + if (nblocks1 > 0) { alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]); @@ -1799,30 +1799,30 @@ static int diff_region(hid_t region1_id, hid_t region2_id) ret=HDmemcmp(ptdata1,ptdata2,(size_t)alloc_size); #if defined (H5DIFF_DEBUG) - for (i = 0; i < nblocks1; i++) + for (i = 0; i < nblocks1; i++) { int j; - + /* start coordinates and opposite corner */ for (j = 0; j < ndims1; j++) parallel_print("%s%lu", j ? "," : "(", (unsigned long)ptdata1[i * 2 * ndims1 + j]); - + for (j = 0; j < ndims1; j++) parallel_print("%s%lu", j ? "," : ")-(", (unsigned long)ptdata1[i * 2 * ndims1 + j + ndims1]); - + parallel_print(")\n"); } -#endif - - +#endif + + HDfree(ptdata1); HDfree(ptdata2); } - + /* Print point information */ - if (npoints1 > 0) + if (npoints1 > 0) { alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]); assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ @@ -1834,30 +1834,30 @@ static int diff_region(hid_t region1_id, hid_t region2_id) ptdata2 = malloc((size_t)alloc_size); H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t); H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2); - + ret=HDmemcmp(ptdata1,ptdata2,(size_t)alloc_size); #if defined (H5DIFF_DEBUG) - for (i = 0; i < npoints1; i++) + for (i = 0; i < npoints1; i++) { int j; - + parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i); - + for (j = 0; j < ndims1; j++) parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata1[i * ndims1 + j])); - + parallel_print(")"); } -#endif - +#endif + HDfree(ptdata1); HDfree(ptdata2); } - + return ret; } @@ -1875,11 +1875,11 @@ static int diff_region(hid_t region1_id, hid_t region2_id) hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) @@ -1901,7 +1901,7 @@ hsize_t diff_float(unsigned char *mem1, if (fabs(temp1_float-temp2_float) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1927,7 +1927,7 @@ hsize_t diff_float(unsigned char *mem1, if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1941,7 +1941,7 @@ hsize_t diff_float(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -1952,10 +1952,10 @@ hsize_t diff_float(unsigned char *mem1, memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && + if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && fabs(temp1_float-temp2_float) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1969,8 +1969,8 @@ hsize_t diff_float(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -1980,7 +1980,7 @@ hsize_t diff_float(unsigned char *mem1, if (temp1_float != temp2_float) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2014,11 +2014,11 @@ hsize_t diff_float(unsigned char *mem1, hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) @@ -2041,7 +2041,7 @@ hsize_t diff_double(unsigned char *mem1, if (fabs(temp1_double-temp2_double) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2067,7 +2067,7 @@ hsize_t diff_double(unsigned char *mem1, if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2081,7 +2081,7 @@ hsize_t diff_double(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -2092,10 +2092,10 @@ hsize_t diff_double(unsigned char *mem1, memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && + if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2109,8 +2109,8 @@ hsize_t diff_double(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -2120,7 +2120,7 @@ hsize_t diff_double(unsigned char *mem1, if (temp1_double != temp2_double) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2155,33 +2155,33 @@ hsize_t diff_double(unsigned char *mem1, hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ char temp1_char; char temp2_char; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (abs(temp1_char-temp2_char) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2195,19 +2195,19 @@ hsize_t diff_schar(unsigned char *mem1, return nfound; } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2221,21 +2221,21 @@ hsize_t diff_schar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - - if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && + + if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && abs(temp1_char-temp2_char) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2249,19 +2249,19 @@ hsize_t diff_schar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (temp1_char != temp2_char) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2269,15 +2269,15 @@ hsize_t diff_schar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(char); mem2+=sizeof(char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2295,33 +2295,33 @@ hsize_t diff_schar(unsigned char *mem1, hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned char temp1_uchar; unsigned char temp2_uchar; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (abs(temp1_uchar-temp2_uchar) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2334,21 +2334,21 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2362,21 +2362,21 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && + + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2390,19 +2390,19 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2410,15 +2410,15 @@ hsize_t diff_uchar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned char); mem2+=sizeof(unsigned char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2437,33 +2437,33 @@ hsize_t diff_uchar(unsigned char *mem1, hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ short temp1_short; short temp2_short; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (abs(temp1_short-temp2_short) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2476,21 +2476,21 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2504,23 +2504,23 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - - } - + + + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - - if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && + + if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && abs(temp1_short-temp2_short) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2534,19 +2534,19 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (temp1_short != temp2_short) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2554,15 +2554,15 @@ hsize_t diff_short(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(short); mem2+=sizeof(short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2579,33 +2579,33 @@ hsize_t diff_short(unsigned char *mem1, hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned short temp1_ushort; unsigned short temp2_ushort; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if (abs(temp1_ushort-temp2_ushort) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2618,21 +2618,21 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2646,23 +2646,23 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - - } - + + + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && + + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && abs(temp1_ushort-temp2_ushort) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2676,19 +2676,19 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if (temp1_ushort != temp2_ushort) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2696,15 +2696,15 @@ hsize_t diff_ushort(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned short); mem2+=sizeof(unsigned short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2722,14 +2722,14 @@ hsize_t diff_ushort(unsigned char *mem1, hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ int temp1_int; @@ -2748,7 +2748,7 @@ hsize_t diff_int(unsigned char *mem1, if (abs(temp1_int-temp2_int) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2775,7 +2775,7 @@ hsize_t diff_int(unsigned char *mem1, if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2791,7 +2791,7 @@ hsize_t diff_int(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -2802,10 +2802,10 @@ hsize_t diff_int(unsigned char *mem1, memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && + if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && abs(temp1_int-temp2_int) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2820,8 +2820,8 @@ hsize_t diff_int(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -2831,7 +2831,7 @@ hsize_t diff_int(unsigned char *mem1, if (temp1_int != temp2_int) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2865,14 +2865,14 @@ hsize_t diff_int(unsigned char *mem1, hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned int temp1_uint; @@ -2891,7 +2891,7 @@ hsize_t diff_uint(unsigned char *mem1, if (abs(temp1_uint-temp2_uint) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2918,7 +2918,7 @@ hsize_t diff_uint(unsigned char *mem1, if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2934,7 +2934,7 @@ hsize_t diff_uint(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -2945,10 +2945,10 @@ hsize_t diff_uint(unsigned char *mem1, memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent && + if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent && abs(temp1_uint-temp2_uint) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2963,8 +2963,8 @@ hsize_t diff_uint(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -2974,7 +2974,7 @@ hsize_t diff_uint(unsigned char *mem1, if (temp1_uint != temp2_uint) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3008,14 +3008,14 @@ hsize_t diff_uint(unsigned char *mem1, hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ long temp1_long; @@ -3034,7 +3034,7 @@ hsize_t diff_long(unsigned char *mem1, if (labs(temp1_long-temp2_long) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3061,14 +3061,14 @@ hsize_t diff_long(unsigned char *mem1, if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (labs(temp1_long-temp2_long) > (long)options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3090,7 +3090,7 @@ hsize_t diff_long(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3101,10 +3101,10 @@ hsize_t diff_long(unsigned char *mem1, memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && + if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && labs(temp1_long-temp2_long) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3119,8 +3119,8 @@ hsize_t diff_long(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3130,15 +3130,15 @@ hsize_t diff_long(unsigned char *mem1, if (temp1_long != temp2_long) { - if ( print_data(options) ) + if ( print_data(options) ) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && + + if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && labs(temp1_long-temp2_long) > (long)options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3180,14 +3180,14 @@ hsize_t diff_long(unsigned char *mem1, hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned long temp1_ulong; @@ -3201,15 +3201,15 @@ hsize_t diff_ulong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + if (labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3222,7 +3222,7 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } } @@ -3238,7 +3238,7 @@ hsize_t diff_ulong(unsigned char *mem1, if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3254,7 +3254,7 @@ hsize_t diff_ulong(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3265,10 +3265,10 @@ hsize_t diff_ulong(unsigned char *mem1, memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent && + if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent && labs(temp1_ulong-temp2_ulong) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3283,8 +3283,8 @@ hsize_t diff_ulong(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3294,7 +3294,7 @@ hsize_t diff_ulong(unsigned char *mem1, if (temp1_ulong != temp2_ulong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3328,14 +3328,14 @@ hsize_t diff_ulong(unsigned char *mem1, hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ long_long temp1_llong; @@ -3346,9 +3346,9 @@ hsize_t diff_llong(unsigned char *mem1, if (!fmt_llong[0]) { /* build default formats for long long types */ - sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", + sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", + sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); } @@ -3364,7 +3364,7 @@ hsize_t diff_llong(unsigned char *mem1, if (labs( (long) (temp1_llong-temp2_llong)) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3391,7 +3391,7 @@ hsize_t diff_llong(unsigned char *mem1, if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3407,7 +3407,7 @@ hsize_t diff_llong(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3418,10 +3418,10 @@ hsize_t diff_llong(unsigned char *mem1, memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent && + if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent && labs((long)(temp1_llong-temp2_llong)) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3436,8 +3436,8 @@ hsize_t diff_llong(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3447,7 +3447,7 @@ hsize_t diff_llong(unsigned char *mem1, if (temp1_llong != temp2_llong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3481,11 +3481,11 @@ hsize_t diff_llong(unsigned char *mem1, hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) @@ -3499,9 +3499,9 @@ hsize_t diff_ullong(unsigned char *mem1, if (!fmt_ullong[0]) { /* build default formats for long long types */ - sprintf(fmt_ullong, "%%%su %%%su %%%su\n", + sprintf(fmt_ullong, "%%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", + sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); } @@ -3517,7 +3517,7 @@ hsize_t diff_ullong(unsigned char *mem1, if (labs((long)(temp1_ullong-temp2_ullong)) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3544,7 +3544,7 @@ hsize_t diff_ullong(unsigned char *mem1, if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3560,7 +3560,7 @@ hsize_t diff_ullong(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3571,10 +3571,10 @@ hsize_t diff_ullong(unsigned char *mem1, memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent && + if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent && labs((long)(temp1_ullong-temp2_ullong)) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3589,8 +3589,8 @@ hsize_t diff_ullong(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3600,7 +3600,7 @@ hsize_t diff_ullong(unsigned char *mem1, if (temp1_ullong != temp2_ullong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 56e2af1..aa52d8b 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -14,19 +14,19 @@ #include "h5tools.h" #include "h5diff.h" -#include "H5private.h" +#include "H5private.h" /*------------------------------------------------------------------------- * Function: diff_attr * - * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are - * obtained either from + * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are + * obtained either from * loc_id = H5Gopen( fid, name); * loc_id = H5Dopen( fid, name); * loc_id = H5Topen( fid, name); * - * Return: + * Return: * 0 : no differences found * 1 : differences found * @@ -37,19 +37,19 @@ *------------------------------------------------------------------------- */ -int diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, +int diff_attr(hid_t loc1_id, + hid_t loc2_id, + const char *path1, + const char *path2, diff_opt_t *options ) { - hid_t attr1_id=-1; /* attr ID */ - hid_t attr2_id=-1; /* attr ID */ - hid_t space1_id=-1; /* space ID */ - hid_t space2_id=-1; /* space ID */ - hid_t ftype1_id=-1; /* file data type ID */ - hid_t ftype2_id=-1; /* file data type ID */ + hid_t attr1_id=-1; /* attr ID */ + hid_t attr2_id=-1; /* attr ID */ + hid_t space1_id=-1; /* space ID */ + hid_t space2_id=-1; /* space ID */ + hid_t ftype1_id=-1; /* file data type ID */ + hid_t ftype2_id=-1; /* file data type ID */ hid_t mtype1_id=-1; /* memory data type ID */ hid_t mtype2_id=-1; /* memory data type ID */ size_t msize1; /* memory size of memory type */ @@ -68,9 +68,9 @@ int diff_attr(hid_t loc1_id, hsize_t nfound; int cmp=1; - if ((n1 = H5Aget_num_attrs(loc1_id))<0) + if ((n1 = H5Aget_num_attrs(loc1_id))<0) goto error; - if ((n2 = H5Aget_num_attrs(loc2_id))<0) + if ((n2 = H5Aget_num_attrs(loc2_id))<0) goto error; if (n1!=n2) @@ -80,28 +80,28 @@ int diff_attr(hid_t loc1_id, { /* reset buffers for every attribute, we might goto out and call free */ - buf1=NULL; - buf2=NULL; + buf1=NULL; + buf2=NULL; /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ /* open attribute */ - if ((attr1_id = H5Aopen_idx(loc1_id, (unsigned)i))<0) + if ((attr1_id = H5Aopen_idx(loc1_id, (unsigned)i))<0) goto error; - if ((attr2_id = H5Aopen_idx(loc2_id, (unsigned)i))<0) + if ((attr2_id = H5Aopen_idx(loc2_id, (unsigned)i))<0) goto error; /* get name */ - if (H5Aget_name( attr1_id, 255, name1 )<0) + if (H5Aget_name( attr1_id, 255, name1 )<0) goto error; - if (H5Aget_name( attr2_id, 255, name2 )<0) + if (H5Aget_name( attr2_id, 255, name2 )<0) goto error; if (HDstrcmp(name1,name2)!=0) { - if (options->m_verbose) + if (options->m_verbose) { parallel_print("Different name for attributes: <%s> and <%s>\n", name1, name2); } @@ -135,26 +135,26 @@ int diff_attr(hid_t loc1_id, *------------------------------------------------------------------------- */ - if (diff_can_type(ftype1_id, - ftype2_id, - rank1, + if (diff_can_type(ftype1_id, + ftype2_id, + rank1, rank2, - dims1, + dims1, dims2, - NULL, NULL, - name1, - name2, + NULL, + name1, + name2, options)!=1) { cmp=0; options->not_cmp=1; } /*------------------------------------------------------------------------- - * only attempt to compare if possible + * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (cmp) + if (cmp) { /*------------------------------------------------------------------------- @@ -162,7 +162,7 @@ int diff_attr(hid_t loc1_id, *------------------------------------------------------------------------- */ nelmts1=1; - for (j=0; j<rank1; j++) + for (j=0; j<rank1; j++) nelmts1*=dims1[j]; if ((mtype1_id=h5tools_get_native_type(ftype1_id))<0) @@ -200,8 +200,8 @@ int diff_attr(hid_t loc1_id, /* always print name */ if (options->m_verbose) { - parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); - nfound = diff_array(buf1, + parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -222,7 +222,7 @@ int diff_attr(hid_t loc1_id, { /* shut up temporarily */ options->m_quiet=1; - nfound = diff_array(buf1, + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -235,10 +235,10 @@ int diff_attr(hid_t loc1_id, attr2_id); /* print again */ options->m_quiet=0; - if (nfound) + if (nfound) { - parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); - nfound = diff_array(buf1, + parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -255,7 +255,7 @@ int diff_attr(hid_t loc1_id, /* in quiet mode, just count differences */ else { - nfound = diff_array(buf1, + nfound = diff_array(buf1, buf2, nelmts1, rank1, diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index c4b4a4b..5f28c2b 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -14,13 +14,13 @@ #include "h5diff.h" #include "ph5diff.h" -#include "H5private.h" +#include "H5private.h" #include "h5tools.h" /*------------------------------------------------------------------------- * Function: diff_dataset * - * Purpose: check for comparable datasets and read into a compatible + * Purpose: check for comparable datasets and read into a compatible * memory type * * Return: Number of differences found @@ -31,10 +31,10 @@ * *------------------------------------------------------------------------- */ -hsize_t diff_dataset( hid_t file1_id, - hid_t file2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_dataset( hid_t file1_id, + hid_t file2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { hid_t dset1_id=-1; @@ -64,20 +64,20 @@ hsize_t diff_dataset( hid_t file1_id, } H5E_END_TRY; - if ((dcpl1_id=H5Dget_create_plist(dset1_id))<0) + if ((dcpl1_id=H5Dget_create_plist(dset1_id))<0) goto error; - if ((dcpl2_id=H5Dget_create_plist(dset2_id))<0) + if ((dcpl2_id=H5Dget_create_plist(dset2_id))<0) goto error; /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration + * check if the dataset creation property list has filters that + * are not registered in the current configuration * 1) the external filters GZIP and SZIP might not be available * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1_id)==1) && - (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2_id)==1)) + (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2_id)==1)) { nfound=diff_datasetid(dset1_id, dset2_id, @@ -97,7 +97,7 @@ hsize_t diff_dataset( hid_t file1_id, H5Dclose(dset2_id); /* enable error reporting */ } H5E_END_TRY; - + return nfound; error: @@ -110,7 +110,7 @@ error: H5Dclose(dset2_id); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -121,7 +121,7 @@ error: /*------------------------------------------------------------------------- * Function: diff_datasetid * - * Purpose: check for comparable datasets and read into a compatible + * Purpose: check for comparable datasets and read into a compatible * memory type * * Return: Number of differences found @@ -132,19 +132,19 @@ error: * *------------------------------------------------------------------------- */ -hsize_t diff_datasetid( hid_t dset1_id, - hid_t dset2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_datasetid( hid_t dset1_id, + hid_t dset2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { hid_t space1_id =-1; hid_t space2_id =-1; - hid_t f_type1=-1, f_type2=-1; /* file data type */ + hid_t f_type1=-1, f_type2=-1; /* file data type */ hid_t m_type1=-1, m_type2=-1; /* memory data type */ size_t m_size1, m_size2; /* size of type in memory */ H5T_sign_t sign1, sign2; /* sign of type */ - int rank1, rank2; + int rank1, rank2; void *buf1=NULL, *buf2=NULL; hsize_t nelmts1, nelmts2; hsize_t dims1[H5S_MAX_RANK]; @@ -184,7 +184,7 @@ hsize_t diff_datasetid( hid_t dset1_id, goto error; /*------------------------------------------------------------------------- - * Get the file data type + * Get the file data type *------------------------------------------------------------------------- */ @@ -206,7 +206,7 @@ hsize_t diff_datasetid( hid_t dset1_id, storage_size2=H5Dget_storage_size(dset2_id); if (storage_size1<=0 && storage_size2<=0) { - if (options->m_verbose && obj1_name && obj2_name) + if (options->m_verbose && obj1_name && obj2_name) parallel_print("<%s> and <%s> are empty datasets\n", obj1_name, obj2_name); cmp=0; options->not_cmp=1; @@ -218,16 +218,16 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ - if (diff_can_type(f_type1, - f_type2, - rank1, + if (diff_can_type(f_type1, + f_type2, + rank1, rank2, - dims1, + dims1, dims2, - maxdim1, + maxdim1, maxdim2, - obj1_name, - obj2_name, + obj1_name, + obj2_name, options)!=1) { cmp=0; @@ -238,13 +238,13 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ nelmts1 = 1; - for (i = 0; i < rank1; i++) + for (i = 0; i < rank1; i++) { nelmts1 *= dims1[i]; } - + nelmts2 = 1; - for (i = 0; i < rank2; i++) + for (i = 0; i < rank2; i++) { nelmts2 *= dims2[i]; } @@ -258,7 +258,7 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ - if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) + if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) { printf("Warning: Different storage datatype\n"); printf("<%s> has file datatype ", obj1_name); @@ -285,7 +285,7 @@ hsize_t diff_datasetid( hid_t dset1_id, #if defined (H5DIFF_DEBUG) if (obj1_name) print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif +#endif /*------------------------------------------------------------------------- * check for different signed/unsigned types @@ -306,7 +306,7 @@ hsize_t diff_datasetid( hid_t dset1_id, } /*------------------------------------------------------------------------- - * "upgrade" the smaller memory size + * "upgrade" the smaller memory size *------------------------------------------------------------------------- */ @@ -334,15 +334,15 @@ hsize_t diff_datasetid( hid_t dset1_id, printf("WARNING: Size was upgraded\n"); if (obj1_name) print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif +#endif } assert(m_size1==m_size2); /*------------------------------------------------------------------------- - * only attempt to compare if possible + * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (cmp) + if (cmp) { buf1 = (void *) HDmalloc((unsigned) (nelmts1*m_size1)); @@ -375,7 +375,7 @@ hsize_t diff_datasetid( hid_t dset1_id, if (obj2_name) { name2=diff_basename(obj2_name); } - nfound = diff_array(buf1, + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -401,8 +401,8 @@ hsize_t diff_datasetid( hid_t dset1_id, * close *------------------------------------------------------------------------- */ - - + + if ( buf1) HDfree(buf1); if ( buf2) HDfree(buf2); /* close */ @@ -416,7 +416,7 @@ hsize_t diff_datasetid( hid_t dset1_id, H5Tclose(m_type2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; error: @@ -434,7 +434,7 @@ error: H5Tclose(m_type2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -443,7 +443,7 @@ error: * * Purpose: check for comparable TYPE and SPACE * - * Return: + * Return: * 1, can compare * 0, cannot compare * -1, error @@ -455,20 +455,20 @@ error: *------------------------------------------------------------------------- */ -int diff_can_type( hid_t f_type1, /* file data type */ +int diff_can_type( hid_t f_type1, /* file data type */ hid_t f_type2, /* file data type */ - int rank1, + int rank1, int rank2, - hsize_t *dims1, + hsize_t *dims1, hsize_t *dims2, - hsize_t *maxdim1, + hsize_t *maxdim1, hsize_t *maxdim2, - const char *obj1_name, - const char *obj2_name, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { - - + + H5T_class_t tclass1; H5T_class_t tclass2; int maxdim_diff=0; /* maximum dimensions are different */ @@ -476,21 +476,21 @@ int diff_can_type( hid_t f_type1, /* file data type */ int i; /*------------------------------------------------------------------------- - * check for the same class + * check for the same class *------------------------------------------------------------------------- */ - if ((tclass1=H5Tget_class(f_type1))<0) + if ((tclass1=H5Tget_class(f_type1))<0) return -1; - if ((tclass2=H5Tget_class(f_type2))<0) + if ((tclass2=H5Tget_class(f_type2))<0) return -1; if ( tclass1 != tclass2 ) { if (options->m_verbose && obj1_name) { - printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", - obj1_name, get_class(tclass1), + printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", + obj1_name, get_class(tclass1), obj2_name, get_class(tclass2) ); } return 0; @@ -502,7 +502,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ */ assert(tclass1==tclass2); - switch (tclass1) + switch (tclass1) { case H5T_INTEGER: case H5T_FLOAT: @@ -514,12 +514,12 @@ int diff_can_type( hid_t f_type1, /* file data type */ case H5T_ENUM: case H5T_VLEN: case H5T_REFERENCE: - + break; - + default: /*H5T_TIME */ - if (options->m_verbose && obj1_name ) - printf("Comparison not supported: <%s> and <%s> are of class %s\n", + if (options->m_verbose && obj1_name ) + printf("Comparison not supported: <%s> and <%s> are of class %s\n", obj1_name,obj2_name,get_class(tclass2) ); return 0; } @@ -529,7 +529,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ *------------------------------------------------------------------------- */ - if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) + if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) { printf("Warning: Different storage datatype\n"); printf("<%s> has file datatype ", obj1_name); @@ -544,7 +544,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ * check for the same rank *------------------------------------------------------------------------- */ - + if ( rank1 != rank2 ) { if (options->m_verbose && obj1_name) { @@ -565,9 +565,9 @@ int diff_can_type( hid_t f_type1, /* file data type */ * check for different dimensions *------------------------------------------------------------------------- */ - + assert(rank1==rank2); - for ( i=0; i<rank1; i++) + for ( i=0; i<rank1; i++) { if (maxdim1 && maxdim2) { diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 3311d7c..5370c1a 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -42,14 +42,14 @@ void parallel_print(const char* format, ...) va_start(ap, format); if(!g_Parallel) - vprintf(format, ap); + vprintf(format, ap); else { if(overflow_file == NULL) /*no overflow has occurred yet */ { bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); - + va_end(ap); va_start(ap, format); @@ -57,12 +57,12 @@ void parallel_print(const char* format, ...) if(bytes_written >= (OUTBUFF_SIZE-outBuffOffset)) #else if((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset)) -#endif +#endif { /* Terminate the outbuff at the end of the previous output */ outBuff[outBuffOffset] = '\0'; - - overflow_file = HDtmpfile(); + + overflow_file = HDtmpfile(); if(overflow_file == NULL) fprintf(stderr, "Warning: Could not create overflow file. Output may be truncated.\n"); else @@ -72,7 +72,7 @@ void parallel_print(const char* format, ...) outBuffOffset += bytes_written; } else - bytes_written = HDvfprintf(overflow_file, format, ap); + bytes_written = HDvfprintf(overflow_file, format, ap); } va_end(ap); @@ -91,13 +91,13 @@ void parallel_print(const char* format, ...) * *------------------------------------------------------------------------- */ -void print_pos( int *ph, - int per, - hsize_t curr_pos, - hsize_t *acc, - hsize_t *pos, - int rank, - const char *obj1, +void print_pos( int *ph, + int per, + hsize_t curr_pos, + hsize_t *acc, + hsize_t *pos, + int rank, + const char *obj1, const char *obj2 ) { int i; @@ -108,19 +108,19 @@ void print_pos( int *ph, *ph=0; if (per) { - parallel_print("%-15s %-15s %-15s %-15s %-15s\n", - "position", - (obj1!=NULL) ? obj1 : " ", + parallel_print("%-15s %-15s %-15s %-15s %-15s\n", + "position", + (obj1!=NULL) ? obj1 : " ", (obj2!=NULL) ? obj2 : " ", - "difference", + "difference", "relative"); parallel_print("------------------------------------------------------------------------\n"); } else { - parallel_print("%-15s %-15s %-15s %-20s\n", - "position", - (obj1!=NULL) ? obj1 : " ", + parallel_print("%-15s %-15s %-15s %-20s\n", + "position", + (obj1!=NULL) ? obj1 : " ", (obj2!=NULL) ? obj2 : " ", "difference"); parallel_print("------------------------------------------------------------\n"); @@ -134,7 +134,7 @@ void print_pos( int *ph, } assert( curr_pos == 0 ); - parallel_print("[ " ); + parallel_print("[ " ); for ( i = 0; i < rank; i++) { /* HDfprintf(stdout,"%Hu ", pos[i] ); */ @@ -157,8 +157,8 @@ void print_pos( int *ph, void print_dims( int r, hsize_t *d ) { int i; - parallel_print("[ " ); - for ( i=0; i<r; i++ ) + parallel_print("[ " ); + for ( i=0; i<r; i++ ) parallel_print("%d ",(int)d[i] ); parallel_print("] " ); } @@ -166,7 +166,7 @@ void print_dims( int r, hsize_t *d ) /*------------------------------------------------------------------------- * Function: print_type * - * Purpose: Print name of datatype + * Purpose: Print name of datatype * * Return: void * @@ -180,7 +180,7 @@ void print_dims( int r, hsize_t *d ) */ void print_type(hid_t type) { - switch (H5Tget_class(type)) + switch (H5Tget_class(type)) { default: return; @@ -241,7 +241,7 @@ void print_type(hid_t type) printf("undefined integer"); } break; - + case H5T_FLOAT: if (H5Tequal(type, H5T_IEEE_F32BE)) { printf("H5T_IEEE_F32BE"); @@ -263,7 +263,7 @@ void print_type(hid_t type) printf("undefined float"); } break; - + }/*switch*/ } @@ -272,7 +272,7 @@ void print_type(hid_t type) /*------------------------------------------------------------------------- * Function: diff_basename * - * Purpose: Returns a pointer to the last component absolute name + * Purpose: Returns a pointer to the last component absolute name * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -284,7 +284,7 @@ const char* diff_basename(const char *name) { size_t i; - + if (name==NULL) return NULL; @@ -292,11 +292,11 @@ diff_basename(const char *name) i = strlen(name); while (i>0 && '/'==name[i-1]) --i; - + /* Skip backward over base name */ while (i>0 && '/'!=name[i-1]) --i; - + return(name+i); } @@ -326,7 +326,7 @@ get_type(int type) return("H5G_LINK"); default: return("user defined type"); - } + } } /*------------------------------------------------------------------------- @@ -338,7 +338,7 @@ get_type(int type) * * Date: May 9, 2003 * - * Comments: + * Comments: * *------------------------------------------------------------------------- */ @@ -353,7 +353,7 @@ get_sign(H5T_sign_t sign) return("H5T_SGN_NONE"); case H5T_SGN_2: return("H5T_SGN_2"); - } + } } @@ -371,7 +371,7 @@ get_sign(H5T_sign_t sign) const char* get_class(H5T_class_t tclass) { - switch (tclass) + switch (tclass) { default: return("Invalid class"); @@ -426,7 +426,7 @@ void print_found(hsize_t nfound) #if defined (H5DIFF_DEBUG) void print_sizes( const char *obj1, const char *obj2, hid_t f_type1, hid_t f_type2, - hid_t m_type1, hid_t m_type2 ) + hid_t m_type1, hid_t m_type2 ) { size_t f_size1, f_size2; /* size of type in file */ size_t m_size1, m_size2; /* size of type in memory */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index ddf476d..b9dd89a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -186,9 +186,9 @@ int UNUSED argc, const char UNUSED *argv[] } else if (!strcmp(driver, drivernames[FAMILY_IDX])) { /* FAMILY Driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS))>=0) { - /* Set member size to be 0 to indicate the current first member size - * is the member size. - */ + /* Set member size to be 0 to indicate the current first member size + * is the member size. + */ H5Pset_fapl_family(fapl, (hsize_t)0, H5P_DEFAULT); if(drivernum) @@ -391,7 +391,7 @@ static size_t h5tools_ncols(const char *s) { register size_t i; - + for (i = 0; *s; s++) if (*s >= ' ') i++; @@ -416,9 +416,9 @@ h5tools_ncols(const char *s) * If a new prefix is printed then the current element number is set back * to zero. * pvn, 2004-07-08 - * Added support for printing array indices: + * Added support for printing array indices: * the indentation is printed before the prefix (printed one indentation - * level before) + * level before) *------------------------------------------------------------------------- */ static void @@ -429,10 +429,10 @@ h5tools_simple_prefix(FILE *stream, const h5dump_t *info, h5tools_str_t str; /*temporary for indentation */ size_t templength = 0; int i, indentlevel = 0; - + if (!ctx->need_prefix) return; - + memset(&prefix, 0, sizeof(h5tools_str_t)); memset(&str, 0, sizeof(h5tools_str_t)); @@ -586,7 +586,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, } else if ((ctx->prev_prefix_len + h5tools_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { - /* + /* * ...but *could* fit on one line otherwise, then we * should end the current line and start this element on its * own line. @@ -627,7 +627,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, */ if (info->line_per_line > 0 && ctx->cur_elmt >= info->line_per_line) ctx->need_prefix = TRUE; - + /* * Each OPTIONAL_LINE_BREAK embedded in the rendered string can cause * the data to split across multiple lines. We display the sections @@ -670,7 +670,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, fputs(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += strlen(OPT(info->elmt_suf2, " ")); } - + /* Print the section */ fputs(section, stream); ctx->cur_column += strlen(section); @@ -695,7 +695,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, * Bill Wendling, Wednesday, 07. March 2001 * Modifications: *------------------------------------------------------------------------- - */ + */ static herr_t h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, struct subset_t *sset, @@ -758,10 +758,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset, for (; count > 0; sset->start[ctx.ndims - 1] += sset->stride[ctx.ndims - 1], count--) { /* calculate the potential number of elements we're going to print */ - H5Sselect_hyperslab(f_space, H5S_SELECT_SET, - sset->start, + H5Sselect_hyperslab(f_space, H5S_SELECT_SET, + sset->start, sset->stride, - sset->count, + sset->count, sset->block); sm_nelmts = H5Sget_select_npoints(f_space); @@ -862,7 +862,7 @@ done: * Robb Matzke, Thursday, July 23, 1998 * Modifications: *------------------------------------------------------------------------- - */ + */ static int h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int indentlevel) @@ -886,7 +886,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, hsize_t sm_nelmts; /*elements per stripmine*/ unsigned char *sm_buf = NULL; /*buffer for raw data */ hid_t sm_space; /*stripmine data space */ - + /* Hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */ hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ @@ -932,7 +932,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, } /* end if */ else ctx.size_last_dim = 0; - + if (p_nelmts == 0) { /* nothing to print */ H5Sclose(f_space); @@ -959,7 +959,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ sm_buf = malloc((size_t)sm_nbytes); - + sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); @@ -1035,7 +1035,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, H5Sclose(sm_space); H5Sclose(f_space); - + free(sm_buf); return SUCCEED; @@ -1079,7 +1079,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, ctx.indent_level = indentlevel; ctx.need_prefix = 1; - + /* Assume entire data space to be printed */ for (i = 0; i < ctx.ndims; i++) ctx.p_min_idx[i] = 0; @@ -1088,7 +1088,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, for (i = 0, nelmts = 1; ctx.ndims != 0 && i < ctx.ndims; i++) nelmts *= ctx.p_max_idx[i] - ctx.p_min_idx[i]; - + if (nelmts == 0) return SUCCEED; /*nothing to print*/ if(ctx.ndims>0) { @@ -1111,7 +1111,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, putc('\n', stream); fputs(OPT(info->line_sep, ""), stream); } - + return SUCCEED; } @@ -1230,7 +1230,7 @@ h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type, hid_t space, void *mem, int indentlevel) { h5dump_t info_dflt; - + /* Use default values */ if (!stream) stream = stdout; @@ -1268,7 +1268,7 @@ void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) int i; assert(ctx->ndims); - + ctx->acc[ctx->ndims-1]=1; for(i=(ctx->ndims-2); i>=0; i--) { diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index ada098b..c5ca4fa 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -59,7 +59,7 @@ typedef struct h5dump_t { * fmt_uchar: The printf() format to use when rendering data which is * typed `unsigned char'. The default is `%u'. This format * is used only if the `ascii' field is zero. - * + * * fmt_short: The printf() format to use when rendering data which is * typed `short'. The default is `%d'. * @@ -82,7 +82,7 @@ typedef struct h5dump_t { * * fmt_double: The printf() format to use when rendering data which is * typed `double'. The default is `%g'. - * + * * fmt_float: The printf() format to use when rendering data which is * typed `float'. The default is `%g'. * @@ -142,7 +142,7 @@ typedef struct h5dump_t { const char *arr_sep; const char *arr_suf; int arr_linebreak; - + /* * Fields associated with compound data types. * @@ -161,8 +161,8 @@ typedef struct h5dump_t { * * suf: A string to print at the end of each compound type. The * default is right curly brace. - * - * end: a string to print after we reach the last element of + * + * end: a string to print after we reach the last element of * each compound type. prints out before the suf. */ const char *cmpd_name; @@ -184,8 +184,8 @@ typedef struct h5dump_t { * * suf: A string to print at the end of each vlen type. The * default is a right parentheses. - * - * end: a string to print after we reach the last element of + * + * end: a string to print after we reach the last element of * each compound type. prints out before the suf. */ const char *vlen_sep; @@ -210,7 +210,7 @@ typedef struct h5dump_t { const char *elmt_fmt; const char *elmt_suf1; const char *elmt_suf2; - + /* * Fields associated with the index values printed at the left edge of * each line of output. @@ -231,7 +231,7 @@ typedef struct h5dump_t { const char *idx_n_fmt; /*index number format */ const char *idx_sep; /*separator between numbers */ const char *idx_fmt; /*entire index format */ - + /* * Fields associated with entire lines. * @@ -259,7 +259,7 @@ typedef struct h5dump_t { * suf: This character string will be appended to each line of * output. It should not contain line feeds. The default * is the empty string. - * + * * sep: A character string to be printed after every line feed * defaulting to the empty string. It should end with a * line feed. @@ -282,7 +282,7 @@ typedef struct h5dump_t { * should the following element begin on the next line? The * default is to start the next element on the same line * unless it wouldn't fit. - * + * * indentlevel: a string that shows how far to indent if extra spacing * is needed. dumper uses it. */ @@ -419,7 +419,7 @@ typedef struct h5tools_context_t { hsize_t sm_pos; /* current stripmine element position */ } h5tools_context_t; - + /* a structure to hold the subsetting particulars for a dataset */ struct subset_t { diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 355ac14..099f132 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -28,8 +28,8 @@ static void print_warning(const char *dname, const char *fname) /*------------------------------------------------------------------------- * Function: h5tools_canreadf * - * Purpose: check if the dataset creation property list has filters that - * are not registered in the current configuration + * Purpose: check if the dataset creation property list has filters that + * are not registered in the current configuration * 1) the external filters GZIP and SZIP might not be available * 2) the internal filters might be turned off * @@ -50,7 +50,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr int i; /* index */ int have_deflate=0; /* assume initially we do not have filters */ int have_szip=0; - int have_shuffle=0; + int have_shuffle=0; int have_fletcher=0; int have_nbit=0; int have_scaleoffset=0; @@ -76,27 +76,27 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr /* get information about filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; /* if we do not have filters, we can read the dataset safely */ if (!nfilters) return 1; - + /* check availability of filters */ - for (i=0; i<nfilters; i++) + for (i=0; i<nfilters; i++) { #ifdef H5_WANT_H5_V1_6_COMPAT - if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0))<0) + if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0))<0) #else - if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0,NULL))<0) + if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0,NULL))<0) #endif return -1; - + switch (filtn) { /*------------------------------------------------------------------------- - * user defined filter + * user defined filter *------------------------------------------------------------------------- */ default: @@ -105,7 +105,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr return 0; /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE 1 , deflation like gzip + * H5Z_FILTER_DEFLATE 1 , deflation like gzip *------------------------------------------------------------------------- */ case H5Z_FILTER_DEFLATE: @@ -117,7 +117,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr } break; /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP 4 , szip compression + * H5Z_FILTER_SZIP 4 , szip compression *------------------------------------------------------------------------- */ case H5Z_FILTER_SZIP: @@ -192,18 +192,18 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr * * Return: 1, can write, 0, cannot, -1 error * - * Programmer: + * Programmer: * * Date: October 5, 2004 * *------------------------------------------------------------------------- */ -int h5tools_can_encode( H5Z_filter_t filtn) +int h5tools_can_encode( H5Z_filter_t filtn) { int have_deflate=0; /* assume initially we do not have filters */ int have_szip=0; - int have_shuffle=0; + int have_shuffle=0; int have_fletcher=0; int have_nbit=0; int have_scaleoffset=0; @@ -247,23 +247,23 @@ int h5tools_can_encode( H5Z_filter_t filtn) } if(H5Zget_filter_info(filtn, &filter_config_flags)<0) return -1; - if ((filter_config_flags & + if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ return -1; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + } else if ((filter_config_flags & + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { /* decoder only: read but not write */ return 0; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + } else if ((filter_config_flags & + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { /* encoder only: write but not read (???) */ return -1; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { + } else if ((filter_config_flags & + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } break; diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index c611715..cd15637 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -37,7 +37,7 @@ * Otherwise the format is more Perl-like * * 'A'*10 - * + * */ #define REPEAT_VERBOSE @@ -156,7 +156,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) (0==nchars && (strcmp(fmt,"%s") ))) { /* Truncation return value as documented by C99, or zero return value with either of the * following conditions, each of which indicates that the proper C99 return value probably - * should have been positive when the format string is + * should have been positive when the format string is * something other than "%s" * Alocate at least twice as much space and try again. */ @@ -403,7 +403,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info) h5tools_str_append(str, info->dset_blockformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)i); - + /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) h5tools_str_append(str, "%s%lu", j ? "," : "(", @@ -435,7 +435,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info) h5tools_str_append(str, info->dset_ptformat_pre , i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)i); - + for (j = 0; j < ndims; j++) h5tools_str_append(str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])); @@ -445,7 +445,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info) free(ptdata); } - + h5tools_str_append(str, "}"); return 0; } @@ -523,7 +523,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch) default: if (isprint(ch)) h5tools_str_append(str, "%c", (char)ch); - else + else h5tools_str_append(str, "\\%03o", ch); break; @@ -596,7 +596,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, int tempint; unsigned short tempushort; short tempshort; - + /* Build default formats for long long types */ if (!fmt_llong[0]) { sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); @@ -618,10 +618,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, } } } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { - memcpy(&tempfloat, vp, sizeof(float)); + memcpy(&tempfloat, vp, sizeof(float)); h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat); } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { - memcpy(&tempdouble, vp, sizeof(double)); + memcpy(&tempdouble, vp, sizeof(double)); h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble); } else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) { @@ -660,7 +660,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, if (info->str_repeat > 0) while (i + j < size && s[i] == s[i + j]) j++; - + /* * Print the opening quote. If the repeat count is high enough to * warrant printing the number of repeats instead of enumerating @@ -677,10 +677,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, quote = '"'; h5tools_str_append(str, "%s%c", i ? " " : "", quote); } - + /* Print the character */ h5tools_print_char(str, info, (unsigned char)(s[i])); - + /* Print the repeat count */ if (info->str_repeat && j > info->str_repeat) { #ifdef REPEAT_VERBOSE @@ -731,7 +731,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { if (sizeof(hssize_t) == sizeof(int)) { - memcpy(&tempint, vp, sizeof(int)); + memcpy(&tempint, vp, sizeof(int)); h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); } else if (sizeof(hssize_t) == sizeof(long)) { memcpy(&templong, vp, sizeof(long)); @@ -910,7 +910,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, temp_nelmts *= dims[k]; assert(temp_nelmts==(hsize_t)((size_t)temp_nelmts)); nelmts = (size_t)temp_nelmts; - } + } /* Print the opening bracket */ h5tools_str_append(str, "%s", OPT(info->arr_pre, "[")); diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 6684adb..e6211da 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -66,7 +66,7 @@ error_msg(const char *progname, const char *fmt, ...) HDfflush(stdout); HDfprintf(stderr, "%s error: ", progname); HDvfprintf(stderr, fmt, ap); - + va_end(ap); } @@ -298,7 +298,7 @@ print_version(const char *progname) /*------------------------------------------------------------------------- * Function: init_table * - * Purpose: allocate and initialize tables for shared groups, datasets, + * Purpose: allocate and initialize tables for shared groups, datasets, * and committed types * * Return: void @@ -353,7 +353,7 @@ init_prefix(char **prefix, size_t prefix_len) /*------------------------------------------------------------------------- * Function: free_table * - * Purpose: free tables for shared groups, datasets, + * Purpose: free tables for shared groups, datasets, * and committed types * * Return: void @@ -386,7 +386,7 @@ free_table(table_t **table) * *------------------------------------------------------------------------- */ -int +int search_obj(table_t *table, haddr_t objno) { int i; @@ -394,13 +394,13 @@ search_obj(table_t *table, haddr_t objno) for (i = 0; i < table->nobjs; i++) if (table->objs[i].objno == objno) return i; - + return FAIL; } /*------------------------------------------------------------------------- - * Function: find_objs + * Function: find_objs * * Purpose: Find objects, committed types and store them in tables * @@ -430,7 +430,7 @@ find_objs(hid_t group, const char *name, void *op_data) H5Gget_objinfo(group, name, TRUE, &statbuf); tmp = HDmalloc(HDstrlen(info->prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, info->prefix); + HDstrcpy(tmp, info->prefix); switch (statbuf.type) { case H5G_GROUP: @@ -445,7 +445,7 @@ find_objs(hid_t group, const char *name, void *op_data) if (statbuf.nlink > info->threshold) { if (search_obj(info->group_table, statbuf.objno) == FAIL) { - add_obj(info->group_table, statbuf.objno, info->prefix); + add_obj(info->group_table, statbuf.objno, info->prefix); H5Giterate(obj, ".", NULL, find_objs, (void *)info); } } else { @@ -468,7 +468,7 @@ find_objs(hid_t group, const char *name, void *op_data) search_obj(info->dset_table, statbuf.objno) == FAIL) add_obj(info->dset_table, statbuf.objno, tmp); - if ((obj = H5Dopen (group, name)) >= 0) { + if ((obj = H5Dopen (group, name)) >= 0) { type = H5Dget_type(obj); if (H5Tcommitted(type) > 0) { @@ -485,7 +485,7 @@ find_objs(hid_t group, const char *name, void *op_data) } else { info->status = 1; } - + break; case H5G_TYPE: @@ -504,9 +504,9 @@ find_objs(hid_t group, const char *name, void *op_data) } else { free(info->type_table->objs[i].objname); info->type_table->objs[i].objname = HDstrdup(tmp); - info->type_table->objs[i].recorded = 1; + info->type_table->objs[i].recorded = 1; - /* named data type */ + /* named data type */ info->type_table->objs[info->type_table->nobjs-1].objflag = 1; } @@ -534,7 +534,7 @@ find_objs(hid_t group, const char *name, void *op_data) * *------------------------------------------------------------------------- */ -void +void dump_table(char* tablename, table_t *table) { int i; @@ -683,7 +683,7 @@ add_obj(table_t *table, haddr_t objno, char *objname) * *------------------------------------------------------------------------- */ -static +static FILE * tmpfile(void) { diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 0c8d83c..a210c0f 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -60,7 +60,7 @@ enum { * and can have more than one short named option specified at one time: * * -aw80 - * + * * in which case those options which expect an argument need to come at the * end. */ @@ -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 { - size_t prefix_len; + size_t prefix_len; char *prefix; unsigned int threshold; /* should be 0 or 1 */ table_t *group_table; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 8094c33..e3578c9 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -14,29 +14,29 @@ #include "h5trav.h" -#include "H5private.h" +#include "H5private.h" /* functions for traversal */ -int traverse( hid_t loc_id, - const char *group_name, - trav_table_t *table, - trav_info_t *info, +int traverse( hid_t loc_id, + const char *group_name, + trav_table_t *table, + trav_info_t *info, int *idx, int print); -herr_t get_nnames( hid_t loc_id, +herr_t get_nnames( hid_t loc_id, const char *group_name ); -herr_t get_name_type( hid_t loc_id, - const char *group_name, - int idx, - char **name, +herr_t get_name_type( hid_t loc_id, + const char *group_name, + int idx, + char **name, H5G_obj_t *type ); /*------------------------------------------------------------------------- * Function: h5trav_getinfo * - * Purpose: get an array of "trav_info_t" , containing the name and type of + * Purpose: get an array of "trav_info_t" , containing the name and type of * objects in the file * * Return: number of object names in file @@ -48,8 +48,8 @@ herr_t get_name_type( hid_t loc_id, *------------------------------------------------------------------------- */ -int h5trav_getinfo(hid_t file_id, - trav_info_t *info, +int h5trav_getinfo(hid_t file_id, + trav_info_t *info, int print ) { @@ -118,7 +118,7 @@ int h5trav_getindex( const char *obj, int nobjs, trav_info_t *info ) int result; int i; - for ( i = 0; i < nobjs; i++) + for ( i = 0; i < nobjs; i++) { if ( strcmp(obj,info[i].name)==0 ) return i; @@ -161,7 +161,7 @@ void h5trav_freeinfo( trav_info_t *info, int nobjs ) /*------------------------------------------------------------------------- * Function: count_names * - * Purpose: operator function + * Purpose: operator function * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -186,7 +186,7 @@ static herr_t count_names( hid_t loc_id, const char *name, void *op_data) /* Define a default zero value for return. This will cause the iterator to continue */ return 0; -} +} /*------------------------------------------------------------------------- * Function: get_nnames @@ -197,7 +197,7 @@ static herr_t count_names( hid_t loc_id, const char *name, void *op_data) * * Date: October 10, 2002 * - * Return: + * Return: * Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. @@ -209,7 +209,7 @@ static herr_t count_names( hid_t loc_id, const char *name, void *op_data) *------------------------------------------------------------------------- */ -herr_t get_nnames( hid_t loc_id, const char *group_name ) +herr_t get_nnames( hid_t loc_id, const char *group_name ) { int nobjs = 0; @@ -224,7 +224,7 @@ herr_t get_nnames( hid_t loc_id, const char *group_name ) /*------------------------------------------------------------------------- * Function: opget_info * - * Purpose: operator function + * Purpose: operator function * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -250,19 +250,19 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data) /* Define 1 for return. This will cause the iterator to stop */ return 1; -} +} /*------------------------------------------------------------------------- * Function: get_name_type * - * Purpose: + * Purpose: * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: October 10, 2002 * - * Return: + * Return: * Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. @@ -274,18 +274,18 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data) *------------------------------------------------------------------------- */ -herr_t get_name_type( hid_t loc_id, - const char *group_name, - int idx, - char **name, - H5G_obj_t *type ) +herr_t get_name_type( hid_t loc_id, + const char *group_name, + int idx, + char **name, + H5G_obj_t *type ) { trav_info_t info; if (H5Giterate( loc_id, group_name, &idx, opget_info, (void *)&info) < 0 ) return -1; - + *name = info.name; *type = info.type; @@ -306,14 +306,14 @@ herr_t get_name_type( hid_t loc_id, *------------------------------------------------------------------------- */ -int traverse( hid_t loc_id, - const char *group_name, - trav_table_t *table, - trav_info_t *info, +int traverse( hid_t loc_id, + const char *group_name, + trav_table_t *table, + trav_info_t *info, int *idx, - int print) + int print) { - + char *name=NULL; H5G_obj_t type; int n_names; @@ -325,20 +325,20 @@ int traverse( hid_t loc_id, /* get the number of names */ if (( n_names = get_nnames( loc_id, group_name )) < 0 ) return -1; - - for ( i = 0; i < n_names; i++) + + for ( i = 0; i < n_names; i++) { if (get_name_type( loc_id, group_name, i, &name, &type ) < 0 ) return -1; - + /* allocate path buffer */ path = (char*) HDmalloc(strlen(group_name) + strlen(name) + 2); - + /* initialize path */ strcpy( path, group_name ); if ( strcmp(group_name,"/")!=0 ) strcat( path, "/" ); - strcat( path, name ); + strcat( path, name ); /* disable error reporting */ H5E_BEGIN_TRY { @@ -354,16 +354,16 @@ int traverse( hid_t loc_id, info[*idx].type = type; (*idx)++; } - - - switch ( type ) + + + switch ( type ) { /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- */ - + case H5G_GROUP: /* increment */ @@ -378,14 +378,14 @@ int traverse( hid_t loc_id, /* print it */ if (print) printf(" %-10s %s\n", "group", path ); - + /* recurse with the absolute name */ inserted_objs += traverse( loc_id, path, table, info, idx, print ); } /* search table group with more than one link to it */ - if (statbuf.nlink > 1) + if (statbuf.nlink > 1) { if ((j = trav_table_search(statbuf.objno, table )) < 0 ) return -1; @@ -404,14 +404,14 @@ int traverse( hid_t loc_id, } } - + break; /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ - + case H5G_DATASET: /* increment */ @@ -430,7 +430,7 @@ int traverse( hid_t loc_id, /* search table dataset with more than one link to it */ - if (statbuf.nlink > 1) + if (statbuf.nlink > 1) { if ((j = trav_table_search(statbuf.objno, table )) < 0 ) return -1; @@ -448,15 +448,15 @@ int traverse( hid_t loc_id, printf(" %-10s %s %s %s\n", "dataset", path, "->", table->objs[j].name ); } /* displayed==1 */ } /* nlink>1 */ - - + + break; /*------------------------------------------------------------------------- * H5G_TYPE *------------------------------------------------------------------------- */ - + case H5G_TYPE: /* increment */ @@ -472,7 +472,7 @@ int traverse( hid_t loc_id, if (print) printf(" %-10s %s\n", "datatype", path ); } - + break; @@ -480,14 +480,14 @@ int traverse( hid_t loc_id, * H5G_LINK *------------------------------------------------------------------------- */ - + case H5G_LINK: { char *targbuf=NULL; - + /* increment */ inserted_objs++; - + /* add object to table */ trav_table_add(statbuf.objno, path, H5G_LINK, table ); @@ -495,7 +495,7 @@ int traverse( hid_t loc_id, { targbuf=malloc(statbuf.linklen); H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf); - if (print) + if (print) printf(" %-10s %s -> %s\n", "link", path, targbuf); if (targbuf) free(targbuf); @@ -506,28 +506,28 @@ int traverse( hid_t loc_id, printf(" %-10s %s ->\n", "link", path); } } - + break; - + default: break; - - } + + } /*------------------------------------------------------------------------- * end switch *------------------------------------------------------------------------- */ - + if ( name ) HDfree( name ); - + if ( path ) HDfree( path ); - + } /* i */ - + return inserted_objs; } @@ -645,7 +645,7 @@ int h5trav_getindext(const char *name, trav_table_t *table) int result; int i, j; - for ( i = 0; i < table->nobjs; i++) + for ( i = 0; i < table->nobjs; i++) { if ( strcmp(name,table->objs[i].name)==0 ) return i; @@ -664,10 +664,10 @@ int h5trav_getindext(const char *name, trav_table_t *table) { if ( strcmp(name,table->objs[i].links[j].new_name)==0 ) return i; - + pdest = strstr( table->objs[i].links[j].new_name, name ); result = (int)(pdest - table->objs[i].links[j].new_name); - + /* found at position 1, meaning without '/' */ if( pdest != NULL && result==1 ) return i; diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index e8e8a3f..cd38a9b 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -24,12 +24,12 @@ /*------------------------------------------------------------------------- * public struct to store name and type of an object - * the TYPE can be: - * H5G_UNKNOWN = -1, - * H5G_LINK, Object is a symbolic link - * H5G_GROUP, Object is a group - * H5G_DATASET, Object is a dataset - * H5G_TYPE, Object is a named data type + * the TYPE can be: + * H5G_UNKNOWN = -1, + * H5G_LINK, Object is a symbolic link + * H5G_GROUP, Object is a group + * H5G_DATASET, Object is a dataset + * H5G_TYPE, Object is a named data type *------------------------------------------------------------------------- */ @@ -117,21 +117,21 @@ void trav_table_init(trav_table_t **table); void trav_table_free(trav_table_t *table); -int trav_table_search(haddr_t objno, +int trav_table_search(haddr_t objno, trav_table_t *table ); -void trav_table_add(haddr_t objno, - char *objname, - H5G_obj_t type, +void trav_table_add(haddr_t objno, + char *objname, + H5G_obj_t type, trav_table_t *table); -void trav_table_addflags(unsigned *flags, - char *objname, - H5G_obj_t type, +void trav_table_addflags(unsigned *flags, + char *objname, + H5G_obj_t type, trav_table_t *table); -void trav_table_addlink(trav_table_t *table, +void trav_table_addlink(trav_table_t *table, int j /* the object index */, char *path ); diff --git a/tools/lib/h5trav_table.c b/tools/lib/h5trav_table.c index 8e794aa..2ebcd6b 100644 --- a/tools/lib/h5trav_table.c +++ b/tools/lib/h5trav_table.c @@ -14,7 +14,7 @@ #include "h5trav.h" -#include "H5private.h" +#include "H5private.h" /*------------------------------------------------------------------------- * Function: trav_table_search @@ -33,11 +33,11 @@ int trav_table_search(haddr_t objno, trav_table_t *table ) { int i; - + for (i = 0; i < table->nobjs; i++) if (table->objs[i].objno == objno) return i; - + return -1; } @@ -56,18 +56,18 @@ int trav_table_search(haddr_t objno, trav_table_t *table ) *------------------------------------------------------------------------- */ -void trav_table_add(haddr_t objno, - char *name, - H5G_obj_t type, +void trav_table_add(haddr_t objno, + char *name, + H5G_obj_t type, trav_table_t *table) { int i; - + if (table->nobjs == table->size) { table->size *= 2; - table->objs = + table->objs = (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t)); - + for (i = table->nobjs; i < table->size; i++) { table->objs[i].objno = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -79,7 +79,7 @@ void trav_table_add(haddr_t objno, table->objs[i].sizelinks = 0; } } - + i = table->nobjs++; table->objs[i].objno = objno; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -105,18 +105,18 @@ void trav_table_add(haddr_t objno, *------------------------------------------------------------------------- */ -void trav_table_addflags(unsigned *flags, - char *name, - H5G_obj_t type, +void trav_table_addflags(unsigned *flags, + char *name, + H5G_obj_t type, trav_table_t *table) { int i; - + if (table->nobjs == table->size) { table->size *= 2; - table->objs = + table->objs = (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t)); - + for (i = table->nobjs; i < table->size; i++) { table->objs[i].objno = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -128,7 +128,7 @@ void trav_table_addflags(unsigned *flags, table->objs[i].sizelinks = 0; } } - + i = table->nobjs++; table->objs[i].objno = 0; table->objs[i].flags[0] = flags[0]; @@ -144,7 +144,7 @@ void trav_table_addflags(unsigned *flags, /*------------------------------------------------------------------------- * Function: trav_table_init * - * Purpose: Initialize the table + * Purpose: Initialize the table * * Return: void * @@ -159,12 +159,12 @@ void trav_table_init( trav_table_t **tbl ) { int i; trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t)); - + table->size = 20; table->nobjs = 0; - table->objs = + table->objs = (trav_obj_t*)HDmalloc(table->size * sizeof(trav_obj_t)); - + for (i = 0; i < table->size; i++) { table->objs[i].objno = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -175,7 +175,7 @@ void trav_table_init( trav_table_t **tbl ) table->objs[i].nlinks = 0; table->objs[i].sizelinks = 0; } - + *tbl = table; } @@ -230,7 +230,7 @@ void trav_table_free( trav_table_t *table ) *------------------------------------------------------------------------- */ -void trav_table_addlink(trav_table_t *table, +void trav_table_addlink(trav_table_t *table, int j /* the object index */, char *path ) { @@ -243,8 +243,8 @@ void trav_table_addlink(trav_table_t *table, /* allocate space if necessary */ if (table->objs[j].nlinks == table->objs[j].sizelinks) { table->objs[j].sizelinks += 2; - table->objs[j].links = - (trav_link_t*)HDrealloc(table->objs[j].links, + table->objs[j].links = + (trav_link_t*)HDrealloc(table->objs[j].links, table->objs[j].sizelinks * sizeof(trav_link_t)); } diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h index 864ae49..3fcc553 100644 --- a/tools/lib/ph5diff.h +++ b/tools/lib/ph5diff.h @@ -18,7 +18,7 @@ #define PRINT_DATA_MAX_SIZE 512 #define OUTBUFF_SIZE PRINT_DATA_MAX_SIZE*4 /* Send from manager to workers */ -#define MPI_TAG_ARGS 1 +#define MPI_TAG_ARGS 1 #define MPI_TAG_PRINT_TOK 2 /*Sent from workers to manager */ @@ -40,9 +40,9 @@ extern FILE* overflow_file; struct diff_args { char name[256]; - H5G_obj_t type; + H5G_obj_t type; diff_opt_t options; -}; +}; struct diffs_found { diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 75004fc..1f1423f 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -20,7 +20,7 @@ * * Purpose: Debugs an existing HDF5 file at a low level. * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ @@ -116,7 +116,7 @@ main(int argc, char *argv[]) fprintf(stderr, "cannot obtain H5F_t pointer\n"); HDexit(2); } - + /* * Parse command arguments. */ @@ -149,7 +149,7 @@ main(int argc, char *argv[]) * Debug a local heap. */ status = H5HL_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); - + } else if (!HDmemcmp (sig, H5HG_MAGIC, H5HG_SIZEOF_MAGIC)) { /* * Debug a global heap collection. @@ -170,7 +170,7 @@ main(int argc, char *argv[]) */ H5B_subid_t subtype = (H5B_subid_t)sig[H5B_SIZEOF_MAGIC]; unsigned ndims; - + switch (subtype) { case H5B_SNODE_ID: status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); @@ -193,7 +193,7 @@ main(int argc, char *argv[]) * B-tree signature. */ H5B2_subid_t subtype = (H5B2_subid_t)sig[H5B2_SIZEOF_MAGIC+1]; - + switch (subtype) { case H5B2_TEST_ID: status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST); @@ -215,7 +215,7 @@ main(int argc, char *argv[]) * B-tree signature. */ H5B2_subid_t subtype = (H5B2_subid_t)sig[H5B2_SIZEOF_MAGIC+1]; - + switch (subtype) { case H5B2_TEST_ID: status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, (unsigned)extra2); @@ -237,7 +237,7 @@ main(int argc, char *argv[]) * B-tree signature. */ H5B2_subid_t subtype = (H5B2_subid_t)sig[H5B2_SIZEOF_MAGIC+1]; - + switch (subtype) { case H5B2_TEST_ID: status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, (unsigned)extra2); @@ -271,7 +271,7 @@ main(int argc, char *argv[]) * B+ tree signature. */ H5BP_subid_t subtype = (H5BP_subid_t)sig[H5BP_SIZEOF_MAGIC+1]; - + switch (subtype) { case H5BP_TEST_ID: status = H5BP_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5BP_TEST); diff --git a/tools/misc/h5import.c b/tools/misc/h5import.c index 0fcc7ed..4192821 100644 --- a/tools/misc/h5import.c +++ b/tools/misc/h5import.c @@ -67,7 +67,7 @@ usage (const char *argv0) /*------------------------------------------------------------------------- * Function: main * - * Purpose: + * Purpose: * * Return: Success: 0 * @@ -104,7 +104,7 @@ main (int argc, char *argv[]) exit (1); } } H5E_END_TRY; - + /* process files from command-line */ for (argno=3; argno<argc; argno++) { @@ -129,8 +129,8 @@ main (int argc, char *argv[]) if ((dset=H5Dcreate (file, dset_name, H5T_NATIVE_SCHAR, space, H5P_DEFAULT))<0) goto next; - - + + next: if (fd>=0) close (fd); fd = -1; diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index c88b5a8..ec83ea7 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -65,9 +65,9 @@ # define MIN3(X,Y,Z) MIN(MIN(X,Y),Z) #endif -/*Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. +/*Make these 2 private properties(defined in H5Fprivate.h) available to h5repart. *The first one updates the member file size in the superblock. The second one - *change file driver from family to sec2. */ + *change file driver from family to sec2. */ #define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" #define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" @@ -136,7 +136,7 @@ get_size (const char *progname, int *argno, int argc, char *argv[]) { off_t retval=-1; char *suffix; - + if (isdigit ((int)(argv[*argno][2]))) { retval = strtol (argv[*argno]+2, &suffix, 10); (*argno)++; @@ -175,9 +175,9 @@ get_size (const char *progname, int *argno, int argc, char *argv[]) * * Purpose: Split an hdf5 file * - * Return: Success: + * Return: Success: * - * Failure: + * Failure: * * Programmer: Robb Matzke * Wednesday, May 13, 1998 @@ -209,7 +209,7 @@ main (int argc, char *argv[]) int src_is_family; /*is source name a family name? */ int src_membno=0; /*source member number */ - + const char *dst_gen_name; /*general destination name */ char dst_name[NAMELEN]; /*destination member name */ int dst_is_family; /*is dst name a family name? */ @@ -456,7 +456,7 @@ main (int argc, char *argv[]) } close (dst); - /* Modify family driver information saved in superblock through private property. + /* Modify family driver information saved in superblock through private property. * These private properties are for this tool only. */ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) { perror ("H5Pcreate"); @@ -467,13 +467,13 @@ main (int argc, char *argv[]) /* The user wants to change file driver from family to sec2. Open the file * with sec2 driver. This property signals the library to ignore the family * driver information saved in the superblock. */ - if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) { + if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) { perror ("H5Pset"); exit (1); } } else { - /* Modify family size saved in superblock through private property. It signals - * library to save the new member size(specified in command line) in superblock. + /* Modify family size saved in superblock through private property. It signals + * library to save the new member size(specified in command line) in superblock. * This private property is for this tool only. */ if(H5Pset_fapl_family(fapl, H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0) { perror ("H5Pset_fapl_family"); @@ -482,23 +482,23 @@ main (int argc, char *argv[]) /* Set the property of the new member size as hsize_t */ hdsize = dst_size; - if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { + if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { perror ("H5Pset"); exit (1); } } - /* If the new file is a family file, try to open file for "read and write" to - * flush metadata. Flushing metadata will update the superblock to the new - * member size. If the original file is a family file and the new file is a sec2 - * file, the property FAMILY_TO_SEC2 will signal the library to switch to sec2 - * driver when the new file is opened. If the original file is a sec2 file and the - * new file can only be a sec2 file, reopen the new file should fail. There's + /* If the new file is a family file, try to open file for "read and write" to + * flush metadata. Flushing metadata will update the superblock to the new + * member size. If the original file is a family file and the new file is a sec2 + * file, the property FAMILY_TO_SEC2 will signal the library to switch to sec2 + * driver when the new file is opened. If the original file is a sec2 file and the + * new file can only be a sec2 file, reopen the new file should fail. There's * nothing to do in this case. */ H5E_BEGIN_TRY { file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); } H5E_END_TRY; - if(file>=0) { + if(file>=0) { if(H5Fclose(file)<0) { perror ("H5Fclose"); exit (1); diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c index 22243b1..913d066 100644 --- a/tools/misc/h5repart_gentest.c +++ b/tools/misc/h5repart_gentest.c @@ -12,11 +12,11 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Raymond Lu<slu@ncsa.uiuc.edu> +/* + * Programmer: Raymond Lu<slu@ncsa.uiuc.edu> * June 1, 2005 - * - * Purpose: Generate a family file of 1024 bytes for each member + * + * Purpose: Generate a family file of 1024 bytes for each member * for h5repart test. */ #include "hdf5.h" @@ -71,23 +71,23 @@ int main(void) perror ("H5Dwrite"); exit (1); } - + if(H5Sclose(space)<0) { perror ("H5Sclose"); exit (1); } - + if(H5Dclose(dset)<0) { perror ("H5Dclose"); exit (1); } - + if(H5Pclose(fapl)<0) { perror ("H5Pclose"); exit (1); } - + if(H5Fclose(file)<0) { perror ("H5Fclose"); exit (1); diff --git a/tools/misc/pdb2hdf.c b/tools/misc/pdb2hdf.c index c6a8951..c3e93aa 100644 --- a/tools/misc/pdb2hdf.c +++ b/tools/misc/pdb2hdf.c @@ -98,7 +98,7 @@ usage: %s [OPTIONS] [PDBFILE ...]\n\ the characters \".h5\". For example, \"/tmp/test/eos.data\" would result\n\ in an HDF5 file called \"eos.h5\" in the current directory.\n", progname); - + } @@ -150,7 +150,7 @@ fix_name(const char *pdb_name, char *hdf_name, size_t size) { char *s; const char *ext; - + if (!pdb_name || !hdf_name) return NULL; if ((s=strrchr(pdb_name, '/'))) pdb_name = s; if (NULL==(ext=strrchr(pdb_name, '.'))) ext = pdb_name + strlen(pdb_name); @@ -189,15 +189,15 @@ fix_type(PDBfile *pdb, const char *s) assert(d); assert(d->size>0); if (d->onescmp) return -1; - - + + if (!strcmp(s, "char")) { /* * Character datatypes. Use whatever sign the native system uses by * default. */ type = H5Tcopy(H5T_NATIVE_CHAR); - + } else if (!strcmp(s, "integer")) { /* * Integer datatypes. PDB supports various sizes of signed or @@ -209,7 +209,7 @@ fix_type(PDBfile *pdb, const char *s) assert(NORMAL_ORDER==d->order_flag || REVERSE_ORDER==d->order_flag); H5Tset_order(type, NORMAL_ORDER==d->order_flag?H5T_ORDER_BE:H5T_ORDER_LE); - + } else if (!strcmp(s, "float") || !strcmp(s, "double")) { /* * Floating-point datatypes @@ -221,14 +221,14 @@ fix_type(PDBfile *pdb, const char *s) H5Tset_precision(type, 8*d->size); assert(d->order); H5Tset_order(type, 1==d->order[0]?H5T_ORDER_BE:H5T_ORDER_LE); - + /* - * format[0] = # of bits per number - * format[1] = # of bits in exponent - * format[2] = # of bits in mantissa - * format[3] = start bit of sign - * format[4] = start bit of exponent - * format[5] = start bit of mantissa + * format[0] = # of bits per number + * format[1] = # of bits in exponent + * format[2] = # of bits in mantissa + * format[3] = start bit of sign + * format[4] = start bit of exponent + * format[5] = start bit of mantissa * format[6] = high order mantissa bit (CRAY needs this) * format[7] = bias of exponent */ @@ -298,7 +298,7 @@ fix_external(hid_t dcpl, const char *pdb_file_name, long nelmts, hsize_t elmt_size, symblock *block) { int i; - + for (i=0; nelmts>0; i++) { hsize_t nbytes = block[i].number * elmt_size; H5Pset_external(dcpl, pdb_file_name, block[i].diskaddr, nbytes); @@ -344,7 +344,7 @@ traverse(PDBfile *pdb, const char *pdb_file_name, hid_t hdf) printf("%s %s\n", _PD_fixname(pdb, list[i]), ep->type); fflush(stdout); } - + if ('/'==list[i][strlen(list[i])-1]) { /* @@ -361,14 +361,14 @@ traverse(PDBfile *pdb, const char *pdb_file_name, hid_t hdf) } else { in_subdir = TRUE; } - + traverse(pdb, pdb_file_name, group); if (!PD_cd(pdb, "..")) { fprintf(stderr, "cannot traverse out of PDB %s\n", list[i]); goto error; } H5Gclose(group); - + } else { /* This is some non-directory PDB object */ @@ -401,7 +401,7 @@ traverse(PDBfile *pdb, const char *pdb_file_name, hid_t hdf) H5Sclose(h_space); H5Tclose(h_type); } - + } for (i=0; i<nitems; i++) { @@ -505,7 +505,7 @@ main(int argc, char *argv[]) exit(1); } H5Pclose(fapl); - + /* * Traverse the PDB file to create the HDF5 file. */ diff --git a/tools/misc/repart_test.c b/tools/misc/repart_test.c index 833a496..faf61cf 100644 --- a/tools/misc/repart_test.c +++ b/tools/misc/repart_test.c @@ -16,7 +16,7 @@ * Programmer: Raymond Lu <slu@ncsa.uiuc.edu> * June 1, 2005 * - * Purpose: This program tests family files after being repartitioned + * Purpose: This program tests family files after being repartitioned * by h5repart. It simply tries to reopen the files with * correct family driver and member size. */ @@ -27,11 +27,11 @@ #define FAMILY_H5REPART_SIZE2 (5*KB) #define MAX(a,b) (a>b ? a:b) -const char *FILENAME[] = { +const char *FILENAME[] = { "fst_family%05d.h5", "scd_family%05d.h5", "family_to_sec2.h5", - NULL + NULL }; herr_t test_family_h5repart_opens(void); @@ -57,14 +57,14 @@ herr_t test_family_h5repart_opens(void) { hid_t file=(-1), fapl=(-1); - + /* open 1st file(single member file) with correct family size(20000 byte) */ if ((fapl=H5Pcreate(H5P_FILE_ACCESS))<0) goto error; if(H5Pset_fapl_family(fapl, (hsize_t)FAMILY_H5REPART_SIZE1, H5P_DEFAULT)<0) goto error; - + if((file=H5Fopen(FILENAME[0], H5F_ACC_RDWR, fapl))<0) goto error; @@ -110,7 +110,7 @@ herr_t test_sec2_h5repart_opens(void) { hid_t file=(-1); - + /* open the sec2 file */ if((file=H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT))<0) goto error; @@ -130,30 +130,30 @@ error: /*------------------------------------------------------------------------- * Function: main - * - * Purpose: Tests h5repart-ed family files - * + * + * Purpose: Tests h5repart-ed family files + * * Return: Success: exit(0) - * + * * Failure: exit(1) - * + * * Programmer: Raymond Lu * June 1, 2005 - * + * * Modifications: * *------------------------------------------------------------------------- */ int main(void) -{ +{ int nerrors=0; - + nerrors += test_family_h5repart_opens()<0 ?1:0; nerrors += test_sec2_h5repart_opens()<0 ?1:0; if (nerrors) goto error; - + return 0; error: |