diff options
Diffstat (limited to 'tools/h5diff')
-rw-r--r-- | tools/h5diff/h5diff_common.c | 38 | ||||
-rw-r--r-- | tools/h5diff/h5diff_main.c | 8 | ||||
-rw-r--r-- | tools/h5diff/ph5diff_main.c | 38 | ||||
-rw-r--r-- | tools/h5diff/testh5diff.h | 24 | ||||
-rw-r--r-- | tools/h5diff/testh5diff_attr.c | 96 | ||||
-rw-r--r-- | tools/h5diff/testh5diff_basic.c | 64 | ||||
-rw-r--r-- | tools/h5diff/testh5diff_dset.c | 60 | ||||
-rw-r--r-- | tools/h5diff/testh5diff_main.c | 8 | ||||
-rw-r--r-- | tools/h5diff/testh5diff_util.c | 26 |
9 files changed, 181 insertions, 181 deletions
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); |