diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-06-27 14:45:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-06-27 14:45:06 (GMT) |
commit | 7be3afb278aea67ba09a97f4b41c0aaaf5c47983 (patch) | |
tree | 24ed86ab2a5c982fbf182d2ac8cd892c3813bc34 /tools | |
parent | 8d72542a50fac7a747fe0bfec8d2285de8efd29f (diff) | |
download | hdf5-7be3afb278aea67ba09a97f4b41c0aaaf5c47983.zip hdf5-7be3afb278aea67ba09a97f4b41c0aaaf5c47983.tar.gz hdf5-7be3afb278aea67ba09a97f4b41c0aaaf5c47983.tar.bz2 |
[svn-r12440] Purpose:
Code cleanup
Description:
Trim trailing whitespace in Makefile.am and C/C++ source files to make
diffing changes easier.
Platforms tested:
None necessary, whitespace only change
Diffstat (limited to 'tools')
-rw-r--r-- | tools/h5diff/Makefile.am | 2 | ||||
-rw-r--r-- | tools/h5diff/h5diff_common.c | 32 | ||||
-rw-r--r-- | tools/h5diff/h5diff_main.c | 10 | ||||
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 22 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 20 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 14 | ||||
-rw-r--r-- | tools/h5ls/h5ls.c | 6 | ||||
-rw-r--r-- | tools/h5repack/h5repack.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack.h | 8 | ||||
-rw-r--r-- | tools/h5repack/h5repack_copy.c | 22 | ||||
-rw-r--r-- | tools/h5repack/h5repack_filters.c | 18 | ||||
-rw-r--r-- | tools/h5repack/h5repack_list.c | 2 | ||||
-rw-r--r-- | tools/h5repack/h5repack_parse.c | 4 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 264 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 838 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 52 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 20 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 14 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 8 | ||||
-rw-r--r-- | tools/misc/h5stat.c | 30 |
20 files changed, 694 insertions, 694 deletions
diff --git a/tools/h5diff/Makefile.am b/tools/h5diff/Makefile.am index da2e851..382444c 100644 --- a/tools/h5diff/Makefile.am +++ b/tools/h5diff/Makefile.am @@ -47,7 +47,7 @@ ph5diff_SOURCES=ph5diff_main.c h5diff_common.c h5diffgentest_SOURCES=h5diffgentest.c # Programs depend on the main HDF5 library and tools library -LDADD=$(LIBH5TOOLS) $(LIBHDF5) +LDADD=$(LIBH5TOOLS) $(LIBHDF5) # Temporary files. *.h5 are generated by h5diff. They should # be copied to the testfiles/ directory if update is required diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c index 6a24ab6..9ac4d56 100644 --- a/tools/h5diff/h5diff_common.c +++ b/tools/h5diff/h5diff_common.c @@ -25,29 +25,29 @@ *------------------------------------------------------------------------- */ -void parse_input(int argc, const char* argv[], const char** fname1, const char** fname2, +void parse_input(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* options) { int i; const char *s = NULL; - + /* process the command-line */ memset(options, 0, sizeof (diff_opt_t)); - + /*------------------------------------------------------------------------- * initial check of command line options *------------------------------------------------------------------------- */ - + if ( argc==2 && (strcmp("-h",argv[1])==0) ) usage(); - + if ( argc<3 ) { printf("Number of arguments is only %d\n", argc ); usage(); } - + /*------------------------------------------------------------------------- * file names are first *------------------------------------------------------------------------- @@ -144,9 +144,9 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** } /*switch*/ } /*for*/ } /*if*/ - + else /* not single-letter switches */ - + { /* check if it is not a -d, -p parameter */ if ( '-'==argv[i-1][0] && ('d'==argv[i-1][1] ||'p'==argv[i-1][1] )) @@ -169,7 +169,7 @@ void parse_input(int argc, const char* argv[], const char** fname1, const char** } /*objname2*/ } /*else*/ } /*else*/ - + }/*for*/ } @@ -185,14 +185,14 @@ void print_results(diff_opt_t* options) { 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("--------------------------------\n"); @@ -201,7 +201,7 @@ void print_results(diff_opt_t* options) if (!options->m_verbose) printf("Use -v for a list of objects.\n"); } - + } /*------------------------------------------------------------------------- @@ -225,7 +225,7 @@ int check_n_input( const char *str ) { unsigned i; char c; - + for ( i = 0; i < strlen(str); i++) { c = str[i]; @@ -259,18 +259,18 @@ int check_n_input( const char *str ) int check_f_input( const char *str ) { double x; - + /* 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') return -1; - + x=atof(str); if (x==0) return -1; - + return 1; } diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c index 836a335..454a033 100644 --- a/tools/h5diff/h5diff_main.c +++ b/tools/h5diff/h5diff_main.c @@ -58,19 +58,19 @@ int main(int argc, const char *argv[]) const char *objname2 = NULL; hsize_t nfound=0; diff_opt_t options; - + parse_input(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); - + nfound = h5diff(fname1,fname2,objname1,objname2,&options); - + print_results(&options); - + /*------------------------------------------------------------------------- * exit code * >0 if differences, 0 if no differences, <0 if error *------------------------------------------------------------------------- */ - + ret= (nfound==0 ? 0 : 1 ); if (options.err_stat) ret=-1; diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 029e694..11459a4 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -339,7 +339,7 @@ int write_dset( hid_t loc_id, *------------------------------------------------------------------------- */ -static +static void gen_datareg(hid_t fid, int make_diffs /* flag to modify data buffers */) { @@ -367,14 +367,14 @@ void gen_datareg(hid_t fid, for (i=0; i<10*10; i++) { - buf[i]=i; + buf[i]=i; } /* create the data dataset */ sid1 = H5Screate_simple(2,dims1,NULL); did1 = H5Dcreate(fid,"dsetref",H5T_NATIVE_INT,sid1,H5P_DEFAULT); status = H5Dwrite(did1,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf); - + /* create the reference dataset */ sid2 = H5Screate_simple(1,dims2,NULL); did2 = H5Dcreate(fid,"refreg",H5T_STD_REF_DSETREG,sid2,H5P_DEFAULT); @@ -410,13 +410,13 @@ void gen_datareg(hid_t fid, } H5Sselect_elements(sid1,H5S_SELECT_SET,5,(const hsize_t **)coord); H5Sget_select_npoints(sid1); - + /* store second dataset region */ H5Rcreate(&rbuf[1],fid,"dsetref",H5R_DATASET_REGION,sid1); /* write */ status = H5Dwrite(did2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,rbuf); - + /* close, free memory buffers */ status = H5Dclose(did1); status = H5Sclose(sid1); @@ -434,7 +434,7 @@ void gen_datareg(hid_t fid, * *------------------------------------------------------------------------- */ -static +static void write_dset_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t fid, @@ -1025,7 +1025,7 @@ void write_dset_in(hid_t loc_id, * *------------------------------------------------------------------------- */ -static +static void write_attr_in(hid_t loc_id, const char* dset_name, /* for saving reference to dataset*/ hid_t fid, @@ -2092,7 +2092,7 @@ int test_dsetall(const char *file, *------------------------------------------------------------------------- */ static -int test_basic(const char *file1, +int test_basic(const char *file1, const char *file2) { @@ -2152,13 +2152,13 @@ int test_basic(const char *file1, /*------------------------------------------------------------------------- * Function: test_basic * - * Purpose: Compare different HDF5 types (H5G_obj_t): + * Purpose: Compare different HDF5 types (H5G_obj_t): * H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK * *------------------------------------------------------------------------- */ static -int test_types(const char *file1, +int test_types(const char *file1, const char UNUSED *file2) { @@ -2241,7 +2241,7 @@ int test_types(const char *file1, *------------------------------------------------------------------------- */ static -int test_native(const char *file1, +int test_native(const char *file1, const char UNUSED *file2) { diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index c2bc761..7bf0ba3 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -756,9 +756,9 @@ print_datatype(hid_t type,unsigned in_group) } else if (H5Tequal(type, H5T_NATIVE_ULLONG)==TRUE) { printf("H5T_NATIVE_ULLONG"); } else { - + /* byte order */ - if (H5Tget_size(type)>1) + if (H5Tget_size(type)>1) { order = H5Tget_order(type); if (H5T_ORDER_LE==order) { @@ -773,9 +773,9 @@ print_datatype(hid_t type,unsigned in_group) } else { order_s = ""; } - + /* sign */ - if ((sign=H5Tget_sign(type))>=0) + if ((sign=H5Tget_sign(type))>=0) { if (H5T_SGN_NONE==sign) { sign_s = " unsigned"; @@ -787,7 +787,7 @@ print_datatype(hid_t type,unsigned in_group) } else { sign_s = " unknown-sign"; } - + /* print size, order, and sign */ printf("%lu-bit%s%s integer", (unsigned long)(8*H5Tget_size(type)), order_s, sign_s); @@ -816,9 +816,9 @@ print_datatype(hid_t type,unsigned in_group) printf("H5T_NATIVE_LDOUBLE"); #endif } else { - + /* byte order */ - if (H5Tget_size(type)>1) + if (H5Tget_size(type)>1) { order = H5Tget_order(type); if (H5T_ORDER_LE==order) { @@ -833,7 +833,7 @@ print_datatype(hid_t type,unsigned in_group) } else { order_s = ""; } - + /* print size and byte order */ printf("%lu-bit%s floating-point", (unsigned long)(8*H5Tget_size(type)), order_s); @@ -1678,7 +1678,7 @@ dump_named_datatype(hid_t type, const char *name) indentation(indent); printf("%s \"%s\" %s", dump_header_format->datatypebegin, name, dump_header_format->datatypeblockbegin); - + if (H5Tget_class(type) == H5T_COMPOUND) { print_datatype(type,1); } else { @@ -1686,7 +1686,7 @@ dump_named_datatype(hid_t type, const char *name) print_datatype(type,1); printf(";\n"); } - + /* print attributes */ indent += COL; H5Aiterate(type, NULL, dump_attr, NULL); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index e7bf7a7..89652f2 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -5427,20 +5427,20 @@ static void gent_longlinks(void) */ static int gent_ldouble(void) { - hid_t fid; + hid_t fid; hid_t did; hid_t tid; hid_t sid; size_t size; - hsize_t dims[1] = {3}; + hsize_t dims[1] = {3}; long double buf[3] = {1,2,3}; - + if ((fid = H5Fcreate(FILE52, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error; - + if ((sid = H5Screate_simple(1, dims, NULL))<0) goto error; - + if ((tid = H5Tcopy(H5T_NATIVE_LDOUBLE))<0) goto error; @@ -5452,7 +5452,7 @@ static int gent_ldouble(void) if (H5Dwrite(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto error; - + if (H5Sclose(sid)<0) goto error; if (H5Tclose(tid)<0) @@ -5461,7 +5461,7 @@ static int gent_ldouble(void) goto error; if (H5Fclose(fid)<0) goto error; - + return 0; error: diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index a6a7e95..d279ea3 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -2264,10 +2264,10 @@ main (int argc, const char *argv[]) /* list root attributes */ if (verbose_g>0) { - if ((root=H5Gopen(file, "/"))<0) - leave(1); + if ((root=H5Gopen(file, "/"))<0) + leave(1); H5Aiterate(root, NULL, list_attr, NULL); - if (H5Gclose(root)<0) + if (H5Gclose(root)<0) leave(1); } /* list */ diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index f8f7f53..4b0bb7e 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -65,7 +65,7 @@ static void aux_initglb_filter(pack_opt_t *options) int h5repack(const char* infile, const char* outfile, pack_opt_t *options, - int argc, + int argc, const char *argv[]) { /* check input */ diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index e835b66..e859347 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -47,8 +47,8 @@ typedef struct { H5Z_FILTER_SHUFFLE 2 , shuffle the data H5Z_FILTER_FLETCHER32 3 , letcher32 checksum of EDC H5Z_FILTER_SZIP 4 , szip compression - H5Z_FILTER_NBIT 5 , nbit compression - H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression + H5Z_FILTER_NBIT 5 , nbit compression + H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression */ #define CDVALUES 2 @@ -139,13 +139,13 @@ int h5repack_cmpdcpl (const char *fname1, int check_objects(const char* fname, pack_opt_t *options, - int argc, + int argc, const char *argv[]); int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options, - int argc, + int argc, const char *argv[]); void print_objlist(const char *filename, diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 7b11b93..dee6c3f 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -36,7 +36,7 @@ * *------------------------------------------------------------------------- */ -static void print_dataset_info(hid_t dcpl_id, +static void print_dataset_info(hid_t dcpl_id, char *objname, float per) { @@ -143,7 +143,7 @@ static void print_dataset_info(hid_t dcpl_id, strcat(str,temp); printf(FORMAT_OBJ,str,objname); } - + } @@ -166,7 +166,7 @@ static void print_dataset_info(hid_t dcpl_id, int copy_objects(const char* fnamein, const char* fnameout, pack_opt_t *options, - int argc, + int argc, const char *argv[]) { hid_t fidin; @@ -374,7 +374,7 @@ int do_copy_objects(hid_t fidin, if ((next=H5Pget_external_count (dcpl_id))<0) goto error; - if (next) + if (next) fprintf(stderr," <warning: %s has external files, ignoring read...>\n", travt->objs[i].name ); @@ -402,7 +402,7 @@ int do_copy_objects(hid_t fidin, dsize_in=H5Dget_storage_size(dset_in); /*------------------------------------------------------------------------- - * read + * read *------------------------------------------------------------------------- */ if (nelmts) @@ -416,13 +416,13 @@ int do_copy_objects(hid_t fidin, goto error; /*------------------------------------------------------------------------- - * check for datasets too small + * check for datasets too small *------------------------------------------------------------------------- */ - + if (nelmts*msize < options->threshold ) apply_s=0; - + /*------------------------------------------------------------------------- * apply the filter *------------------------------------------------------------------------- @@ -445,7 +445,7 @@ int do_copy_objects(hid_t fidin, dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_out); } H5E_END_TRY; - + if (dset_out==FAIL) { if ((dset_out=H5Dcreate(fidout,travt->objs[i].name,mtype_id,space_id,dcpl_id))<0) @@ -479,14 +479,14 @@ int do_copy_objects(hid_t fidin, else print_dataset_info(dcpl_id,travt->objs[i].name,0); } - + if (apply_s==0 && options->verbose) printf(" <warning: filter not applied to %s. dataset smaller than %d bytes>\n", travt->objs[i].name, (int)options->threshold); if (apply_f==0 && options->verbose) - printf(" <warning: could not apply the filter to %s>\n", + printf(" <warning: could not apply the filter to %s>\n", travt->objs[i].name); /*------------------------------------------------------------------------- diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 9f3b192..75ca771 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -201,7 +201,7 @@ int apply_filters(const char* name, /* object name from traverse list */ if (rank==0) /* scalar dataset, do not apply */ return 0; - + /*------------------------------------------------------------------------- * initialize the assigment object @@ -219,7 +219,7 @@ int apply_filters(const char* name, /* object name from traverse list */ /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; - + /*------------------------------------------------------------------------- * check if we have filters in the pipeline * we want to replace them with the input filters @@ -294,7 +294,7 @@ int apply_filters(const char* name, /* object name from traverse list */ case H5Z_FILTER_DEFLATE: { unsigned aggression; /* the deflate level */ - + aggression = obj.filter[i].cd_values[0]; /* set up for deflated data */ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) @@ -313,9 +313,9 @@ int apply_filters(const char* name, /* object name from traverse list */ unsigned options_mask; unsigned pixels_per_block; - options_mask = obj.filter[i].cd_values[0]; + options_mask = obj.filter[i].cd_values[0]; pixels_per_block = obj.filter[i].cd_values[1]; - + /* set up for szip data */ if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0) return -1; @@ -363,12 +363,12 @@ int apply_filters(const char* name, /* object name from traverse list */ case H5Z_FILTER_SCALEOFFSET: { - H5Z_SO_scale_type_t scale_type; - int scale_factor; - + H5Z_SO_scale_type_t scale_type; + int scale_factor; + scale_type = obj.filter[i].cd_values[0]; scale_factor = obj.filter[i].cd_values[1]; - + if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; if (H5Pset_scaleoffset(dcpl_id,scale_type,scale_factor)<0) diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index f2eb2c9..05156d4 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -36,7 +36,7 @@ */ int check_objects(const char* fname, pack_opt_t *options, - int argc, + int argc, const char *argv[]) { hid_t fid; diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 9760fa2..9243b72 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -189,12 +189,12 @@ obj_list_t* parse_filter(const char *str, /*------------------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET * scaleoffset has the format SOFF=<scale_factor,scale_type> - * scale_type can be + * scale_type can be * integer datatype, H5Z_SO_INT (IN) * float datatype using D-scaling method, H5Z_SO_FLOAT_DSCALE (DS) * float datatype using E-scaling method, H5Z_SO_FLOAT_ESCALE (ES) , not yet implemented * for integer datatypes, scale_factor denotes Minimum Bits - * for float datatypes, scale_factor denotes decimal scale factor + * for float datatypes, scale_factor denotes decimal scale factor * examples * SOFF=31,IN * SOFF=3,DF diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b4c9022..e8c546e 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -91,19 +91,19 @@ void print_manager_output(void) if( (outBuffOffset>0) && g_Parallel) { printf("%s", outBuff); - + if(overflow_file) { int tmp; - + rewind(overflow_file); while((tmp = getc(overflow_file)) >= 0) putchar(tmp); - + fclose(overflow_file); overflow_file = NULL; } - + fflush(stdout); memset(outBuff, 0, OUTBUFF_SIZE); outBuffOffset = 0; @@ -134,7 +134,7 @@ static void print_incoming_data(void) char data[PRINT_DATA_MAX_SIZE+1]; int incomingMessage; MPI_Status Status; - + do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); @@ -142,7 +142,7 @@ static void print_incoming_data(void) { 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); } } while(incomingMessage); @@ -176,9 +176,9 @@ hsize_t h5diff(const char *fname1, hid_t file1_id=(-1), file2_id=(-1); char filenames[2][1024]; hsize_t nfound = 0; - + memset(filenames, 0, 1024*2); - + if (options->m_quiet && (options->m_verbose || options->m_report)) { @@ -186,12 +186,12 @@ hsize_t h5diff(const char *fname1, options->err_stat=1; return 0; } - + /*------------------------------------------------------------------------- * open the files first; if they are not valid, no point in continuing *------------------------------------------------------------------------- */ - + /* disable error reporting */ H5E_BEGIN_TRY { @@ -200,7 +200,7 @@ hsize_t h5diff(const char *fname1, { printf ("h5diff: <%s>: unable to open file\n", fname1); options->err_stat = 1; - + #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -208,14 +208,14 @@ hsize_t h5diff(const char *fname1, phdiff_dismiss_workers(); } #endif - + goto out; } if ((file2_id = H5Fopen (fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { printf ("h5diff: <%s>: unable to open file\n", fname2); options->err_stat = 1; - + #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -223,20 +223,20 @@ hsize_t h5diff(const char *fname1, phdiff_dismiss_workers(); } #endif - + goto out; } /* enable error reporting */ } H5E_END_TRY; - + /*------------------------------------------------------------------------- * get the number of objects in the files *------------------------------------------------------------------------- */ nobjects1 = h5trav_getinfo (file1_id, NULL, 0); nobjects2 = h5trav_getinfo (file2_id, NULL, 0); - + if (nobjects1 < 0 || nobjects2 < 0) { printf ("Error: Could not get get file contents\n"); @@ -250,12 +250,12 @@ hsize_t h5diff(const char *fname1, #endif goto out; } - + /*------------------------------------------------------------------------- * get the list of objects in the files *------------------------------------------------------------------------- */ - + info1 = (trav_info_t *) malloc (nobjects1 * sizeof (trav_info_t)); info2 = (trav_info_t *) malloc (nobjects2 * sizeof (trav_info_t)); if (info1 == NULL || info2 == NULL) @@ -273,18 +273,18 @@ hsize_t h5diff(const char *fname1, #endif goto out; } - + h5trav_getinfo (file1_id, info1, 0); h5trav_getinfo (file2_id, info2, 0); - + /*------------------------------------------------------------------------- * object name was supplied *------------------------------------------------------------------------- */ - + if (objname1) { - + #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -298,31 +298,31 @@ hsize_t h5diff(const char *fname1, file2_id, fname2, objname2, nobjects2, info2, options); } - + /*------------------------------------------------------------------------- * compare all *------------------------------------------------------------------------- */ - + else { - + #ifdef H5_HAVE_PARALLEL if(g_Parallel) { int i; - + if( (strlen(fname1) > 1024) || (strlen(fname2) > 1024)) { fprintf(stderr, "The parallel diff only supports path names up to 1024 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } - + strcpy(filenames[0], fname1); strcpy(filenames[1], fname2); - + /* Alert the worker tasks that there's going to be work. */ - + for(i=1; i<g_nTasks; i++) MPI_Send(filenames, 1024*2, MPI_CHAR, i, MPI_TAG_PARALLEL, MPI_COMM_WORLD); } @@ -330,10 +330,10 @@ hsize_t h5diff(const char *fname1, nfound = diff_match (file1_id, nobjects1, info1, file2_id, nobjects2, info2, options); } - + h5trav_freeinfo (info1, nobjects1); h5trav_freeinfo (info2, nobjects2); - + out: /* close */ H5E_BEGIN_TRY @@ -342,7 +342,7 @@ out: H5Fclose (file2_id); } H5E_END_TRY; - + return nfound; } @@ -366,12 +366,12 @@ out: * *------------------------------------------------------------------------- */ -hsize_t diff_match (hid_t file1_id, +hsize_t diff_match (hid_t file1_id, int nobjects1, trav_info_t * info1, hid_t file2_id, - int nobjects2, - trav_info_t * info2, + int nobjects2, + trav_info_t * info2, diff_opt_t * options) { int more_names_exist = (nobjects1 > 0 && nobjects2 > 0) ? 1 : 0; @@ -383,13 +383,13 @@ hsize_t diff_match (hid_t file1_id, char c1, c2; hsize_t nfound = 0; int i; - + /*------------------------------------------------------------------------- * build the list *------------------------------------------------------------------------- */ trav_table_init (&table); - + while (more_names_exist) { /* criteria is string compare */ @@ -400,7 +400,7 @@ hsize_t diff_match (hid_t file1_id, infile[1] = 1; trav_table_addflags (infile, info1[curr1].name, info1[curr1].type, table); - + curr1++; curr2++; } @@ -420,12 +420,12 @@ hsize_t diff_match (hid_t file1_id, table); curr2++; } - + more_names_exist = (curr1 < nobjects1 && curr2 < nobjects2) ? 1 : 0; - - + + } /* end while */ - + /* list1 did not end */ if (curr1 < nobjects1) { @@ -438,7 +438,7 @@ hsize_t diff_match (hid_t file1_id, curr1++; } } - + /* list2 did not end */ if (curr2 < nobjects2) { @@ -451,12 +451,12 @@ hsize_t diff_match (hid_t file1_id, curr2++; } } - + /*------------------------------------------------------------------------- * print the list *------------------------------------------------------------------------- */ - + if (options->m_verbose) { printf ("\n"); @@ -470,8 +470,8 @@ hsize_t diff_match (hid_t file1_id, } printf ("\n"); } - - + + /*------------------------------------------------------------------------- * do the diff for common objects *------------------------------------------------------------------------- @@ -485,11 +485,11 @@ hsize_t 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 - + for (i = 0; i < table->nobjs; i++) { if (table->objs[i].flags[0] && table->objs[i].flags[1]) @@ -516,18 +516,18 @@ hsize_t diff_match (hid_t file1_id, * an array of bytes in order to be portable. But this * may not work in non-homogeneous MPI environments. */ - + /*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; - + h5diffdebug2("busyTasks=%d\n", busyTasks); /* if there are any outstanding print requests, let's handle one. */ if(busyTasks > 0) @@ -535,7 +535,7 @@ hsize_t diff_match (hid_t file1_id, int incomingMessage; /* check if any tasks freed up, and didn't need to print. */ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status); - + /* first block*/ if(incomingMessage) { @@ -545,16 +545,16 @@ hsize_t diff_match (hid_t file1_id, options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; busyTasks--; } - + /* check to see if the print token was returned. */ if(!havePrintToken) { /* If we don't have the token, someone is probably sending us output */ print_incoming_data(); - + /* check incoming queue for token */ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); - + /* incoming token implies free task. */ if(incomingMessage) { @@ -566,7 +566,7 @@ hsize_t diff_match (hid_t file1_id, havePrintToken = 1; } } - + /* check to see if anyone needs the print token. */ if(havePrintToken) { @@ -580,35 +580,35 @@ hsize_t diff_match (hid_t file1_id, } } } - + /* check array of tasks to see which ones are free. * Manager task never does work, so freeTasks[0] is really * worker task 0. */ - + for(n=1; (n<g_nTasks) && !workerFound; n++) { if(workerTasks[n-1]) { /* send file id's and names to first free worker */ MPI_Send(&args, sizeof(struct diff_args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD); - + /* increment counter for total number of prints. */ busyTasks++; - + /* mark worker as busy */ workerTasks[n-1] = 0; workerFound = 1; } - + } - - + + h5diffdebug2("workerfound is %d \n", workerFound); if(!workerFound) { /* if they were all busy, we've got to wait for one free up before we can move on. * if we don't have the token, some task is currently printing so we'll wait for that task to return it. */ - + if(!havePrintToken) { while(!havePrintToken) { @@ -630,7 +630,7 @@ hsize_t 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) { @@ -644,16 +644,16 @@ hsize_t diff_match (hid_t file1_id, int incomingMessage; MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD); - + do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); - + print_incoming_data(); } while(!incomingMessage); - - + + MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; @@ -672,7 +672,7 @@ hsize_t diff_match (hid_t file1_id, } } h5diffdebug("done with for loop\n"); - + #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -704,7 +704,7 @@ hsize_t diff_match (hid_t file1_id, do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); - + print_incoming_data(); } while(!incomingMessage); @@ -720,12 +720,12 @@ hsize_t diff_match (hid_t file1_id, do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); - + print_incoming_data(); } while(!incomingMessage); - - + + MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; @@ -745,9 +745,9 @@ hsize_t 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 @@ -756,34 +756,34 @@ hsize_t diff_match (hid_t file1_id, MPI_Abort(MPI_COMM_WORLD, 0); } } - + for(i=1; i<g_nTasks; i++) MPI_Send(NULL, 0, MPI_BYTE, i, MPI_TAG_END, MPI_COMM_WORLD); - + /* Print any final data waiting in our queue */ print_incoming_data(); - + } h5diffdebug("done with if block\n"); - + free(workerTasks); #endif /* H5_HAVE_PARALLEL */ } - + /* free table */ trav_table_free (table); - - + + /*------------------------------------------------------------------------- * do the diff for the root. * 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 *------------------------------------------------------------------------- */ - + /* the manager can do this. */ nfound += diff (file1_id, "/", file2_id, "/", options, H5G_GROUP); - + return nfound; } @@ -810,16 +810,16 @@ hsize_t diff_compare (hid_t file1_id, hid_t file2_id, const char *file2_name, const char *obj2_name, - int nobjects2, - trav_info_t * info2, + int nobjects2, + trav_info_t * info2, diff_opt_t * options) { int f1 = 0, f2 = 0; hsize_t nfound = 0; - + int i = h5trav_getindex (obj1_name, nobjects1, info1); int j = h5trav_getindex (obj2_name, nobjects2, info2); - + if (i == -1) { parallel_print ("Object <%s> could not be found in <%s>\n", obj1_name, @@ -837,11 +837,11 @@ hsize_t diff_compare (hid_t file1_id, options->err_stat = 1; return 0; } - + /* use the name with "/" first, as obtained by iterator function */ obj1_name = info1[i].name; obj2_name = info2[j].name; - + /* objects are not the same type */ if (info1[i].type != info2[j].type) { @@ -853,10 +853,10 @@ hsize_t diff_compare (hid_t file1_id, options->not_cmp=1; return 0; } - + nfound = diff (file1_id, obj1_name, file2_id, obj2_name, options, info1[i].type); - + return nfound; } @@ -882,9 +882,9 @@ hsize_t diff_compare (hid_t file1_id, hsize_t diff (hid_t file1_id, const char *path1, - hid_t file2_id, - const char *path2, - diff_opt_t * options, + hid_t file2_id, + const char *path2, + diff_opt_t * options, H5G_obj_t type) { hid_t type1_id=(-1); @@ -895,7 +895,7 @@ hsize_t diff (hid_t file1_id, H5G_stat_t sb1; H5G_stat_t sb2; hsize_t nfound = 0; - + switch (type) { /*------------------------------------------------------------------------- @@ -903,7 +903,7 @@ hsize_t diff (hid_t file1_id, *------------------------------------------------------------------------- */ case H5G_DATASET: - + /*------------------------------------------------------------------------- * verbose, always print name *------------------------------------------------------------------------- @@ -939,7 +939,7 @@ hsize_t diff (hid_t file1_id, print_found(nfound); } /*if nfound */ } /*if quiet */ - + /*------------------------------------------------------------------------- * quiet mode, just count differences *------------------------------------------------------------------------- @@ -949,9 +949,9 @@ hsize_t diff (hid_t file1_id, nfound = diff_dataset (file1_id, file2_id, path1, path2, options); } } /*else verbose */ - + break; - + /*------------------------------------------------------------------------- * H5G_TYPE *------------------------------------------------------------------------- @@ -961,20 +961,20 @@ hsize_t diff (hid_t file1_id, goto out; if ((type2_id = H5Topen (file2_id, path2)) < 0) goto out; - + if ((ret = H5Tequal (type1_id, type2_id)) < 0) goto out; - + /* if H5Tequal is > 0 then the datatypes refer to the same datatype */ nfound = (ret > 0) ? 0 : 1; - + if (print_objname (options, nfound)) parallel_print("Datatype: <%s> and <%s>\n", path1, path2); - + /* always print the number of differences found in verbose mode */ if (options->m_verbose) print_found(nfound); - + /*------------------------------------------------------------------------- * compare attributes * the if condition refers to cases when the dataset is a referenced object @@ -982,14 +982,14 @@ hsize_t diff (hid_t file1_id, */ if (path1) diff_attr (type1_id, type2_id, path1, path2, options); - + if (H5Tclose (type1_id) < 0) goto out; if (H5Tclose (type2_id) < 0) goto out; - + break; - + /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- @@ -999,19 +999,19 @@ hsize_t diff (hid_t file1_id, goto out; if ((grp2_id = H5Gopen (file2_id, path2)) < 0) goto out; - + ret = HDstrcmp (path1, path2); - + /* if "path1" != "path2" then the groups are "different" */ nfound = (ret != 0) ? 1 : 0; - + if (print_objname (options, nfound)) parallel_print("Group: <%s> and <%s>\n", path1, path2); - + /* always print the number of differences found in verbose mode */ if (options->m_verbose) print_found(nfound); - + /*------------------------------------------------------------------------- * compare attributes * the if condition refers to cases when the dataset is a referenced object @@ -1019,15 +1019,15 @@ hsize_t diff (hid_t file1_id, */ if (path1) diff_attr (grp1_id, grp2_id, path1, path2, options); - + if (H5Gclose (grp1_id) < 0) goto out; if (H5Gclose (grp2_id) < 0) goto out; - + break; - - + + /*------------------------------------------------------------------------- * H5G_LINK *------------------------------------------------------------------------- @@ -1036,37 +1036,37 @@ hsize_t diff (hid_t file1_id, { char *buf1 = NULL; char *buf2 = NULL; - + if (H5Gget_objinfo (file1_id, path1, FALSE, &sb1) < 0) goto out; if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0) goto out; - + buf1 = HDmalloc (sb1.linklen); buf2 = HDmalloc (sb2.linklen); - + if (H5Gget_linkval (file1_id, path1, sb1.linklen, buf1) < 0) goto out; if (H5Gget_linkval (file2_id, path2, sb1.linklen, buf2) < 0) goto out; - + ret = HDstrcmp (buf1, buf2); - + /* if "buf1" != "buf2" then the links are "different" */ nfound = (ret != 0) ? 1 : 0; - + if (print_objname (options, nfound)) parallel_print("Soft Link: <%s> and <%s>\n", path1, path2); - + /* always print the number of differences found in verbose mode */ if (options->m_verbose) print_found(nfound); - + HDfree (buf1); HDfree (buf2); } break; - + default: nfound = 0; if (options->m_verbose) @@ -1075,13 +1075,13 @@ hsize_t diff (hid_t file1_id, path1, path2, get_type (type)); options->not_cmp=1; } - + break; } /* switch */ - - + + out: - + /* close */ /* disable error reporting */ H5E_BEGIN_TRY diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 18858d6..62975d9 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -52,7 +52,7 @@ /* local functions */ static void close_obj(H5G_obj_t obj_type, hid_t obj_id); -static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, +static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *options); static hbool_t is_zero(const void *_mem, size_t size); static int ull2float(unsigned long_long ull_value, float *f_value); @@ -65,7 +65,7 @@ static int ull2float(unsigned long_long ull_value, float *f_value); * and do not print in quiet mode *------------------------------------------------------------------------- */ -static +static int print_data(diff_opt_t *options) { return ( (options->m_report || options->m_verbose) && !options->m_quiet)?1:0; @@ -74,11 +74,11 @@ int print_data(diff_opt_t *options) /*------------------------------------------------------------------------- * Function: print_pos * - * Purpose: print in matrix notation, converting from an array index position + * Purpose: print in matrix notation, converting from an array index position * *------------------------------------------------------------------------- */ -static +static void print_pos( int *ph, /* print header */ int per, /* print percentage */ hsize_t curr_pos, @@ -168,10 +168,10 @@ hsize_t diff_array( void *_mem1, int ph=1; /* print header */ hsize_t i; int j; - + /* get the size. */ size = H5Tget_size( m_type ); - + acc[rank-1]=1; for(j=(rank-2); j>=0; j--) { @@ -179,7 +179,7 @@ hsize_t diff_array( void *_mem1, } for ( j = 0; j < rank; j++) pos[j]=0; - + if(H5Tis_variable_str(m_type)) { tmp1 = ((unsigned char**)mem1)[0]; @@ -199,7 +199,7 @@ hsize_t diff_array( void *_mem1, container2_id, &ph); } - + else { switch (H5Tget_class(m_type)) @@ -207,7 +207,7 @@ hsize_t diff_array( void *_mem1, default: assert(0); break; - + case H5T_FLOAT: if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) @@ -215,9 +215,9 @@ hsize_t diff_array( void *_mem1, else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) nfound=diff_double(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); break; - + case H5T_INTEGER: - + 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)) @@ -238,9 +238,9 @@ hsize_t diff_array( void *_mem1, nfound=diff_llong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) nfound=diff_ullong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - + break; - + case H5T_COMPOUND: case H5T_STRING: case H5T_BITFIELD: @@ -249,7 +249,7 @@ hsize_t diff_array( void *_mem1, case H5T_ARRAY: case H5T_VLEN: case H5T_REFERENCE: - + for ( i = 0; i < nelmts; i++) { nfound+=diff_datum( @@ -271,7 +271,7 @@ hsize_t diff_array( void *_mem1, } /* i */ } /* switch */ } /* else */ - + return nfound; } @@ -348,9 +348,9 @@ hsize_t diff_datum(void *_mem1, hsize_t nfound=0; /* differences found */ int ret=0; /* check return error */ float f1, f2, per; - + type_size = H5Tget_size( m_type ); - + switch (H5Tget_class(m_type)) { default: @@ -359,7 +359,7 @@ hsize_t diff_datum(void *_mem1, case H5T_TIME: assert(0); break; - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- @@ -387,17 +387,17 @@ hsize_t diff_datum(void *_mem1, H5Tclose(memb_type); } break; - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- */ case H5T_STRING: { - + H5T_str_t pad; char *s; - + if(H5Tis_variable_str(m_type)) { /* mem1 is the pointer into the struct where a `char*' is stored. So we have @@ -411,9 +411,9 @@ hsize_t diff_datum(void *_mem1, s = (char *)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++) @@ -428,10 +428,10 @@ hsize_t diff_datum(void *_mem1, obj1, obj2, ph); - + } break; - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- @@ -451,16 +451,16 @@ hsize_t diff_datum(void *_mem1, obj1, obj2, ph); - + } break; - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ case H5T_OPAQUE: - + /* byte-by-byte comparison */ for (u=0; u<type_size; u++) nfound+=diff_native_uchar( @@ -474,29 +474,29 @@ hsize_t diff_datum(void *_mem1, obj1, obj2, ph); - + break; - - + + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ case H5T_ENUM: - + /* 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 - enumeration constant and do a string comparison + enumeration constant and do a string comparison */ - + { char enum_name1[1024]; char enum_name2[1024]; - + /* disable error reporting */ H5E_BEGIN_TRY { - + if ((H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1) >= 0) && (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0)) { @@ -529,10 +529,10 @@ hsize_t diff_datum(void *_mem1, /* enable error reporting */ } H5E_END_TRY; } - - + + break; - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- @@ -544,7 +544,7 @@ hsize_t diff_datum(void *_mem1, ndims = H5Tget_array_ndims(m_type); H5Tget_array_dims(m_type, dims, NULL); assert(ndims >= 1 && ndims <= H5S_MAX_RANK); - + /* calculate the number of array elements */ for (u = 0, nelmts = 1; u <ndims; u++) nelmts *= dims[u]; @@ -565,21 +565,21 @@ hsize_t diff_datum(void *_mem1, ph); H5Tclose(memb_type); break; - + /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ case H5T_VLEN: - + /* get the VL sequences's base datatype for each element */ memb_type = H5Tget_super(m_type); size = H5Tget_size(memb_type); - + /* get the number of sequence elements */ nelmts = ((hvl_t *)mem1)->len; - + for (j = 0; j < (int)nelmts; j++) nfound+=diff_datum( ((char *)(((hvl_t *)mem1)->p)) + j * size, @@ -595,14 +595,14 @@ hsize_t diff_datum(void *_mem1, container1_id, container2_id, ph); - + H5Tclose(memb_type); - + break; - - + + case H5T_REFERENCE: - + iszero1=is_zero(_mem1, H5Tget_size(m_type)); iszero2=is_zero(_mem2, H5Tget_size(m_type)); if (iszero1==1 || iszero2==1) @@ -611,18 +611,18 @@ hsize_t diff_datum(void *_mem1, } else { - + /*------------------------------------------------------------------------- * H5T_STD_REF_DSETREG * Dataset region reference *------------------------------------------------------------------------- */ - + if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) { hid_t region1_id; hid_t region2_id; - + if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1))<0) ret= -1; if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2))<0) @@ -631,22 +631,22 @@ hsize_t diff_datum(void *_mem1, ret= -1; if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2))<0) ret= -1; - + if (ret==-1) { options->err_stat=1; return 0; } - + nfound = diff_region(obj1_id,obj2_id,region1_id,region2_id,options); - + close_obj(H5G_DATASET,obj1_id); close_obj(H5G_DATASET,obj2_id); H5Sclose(region1_id); H5Sclose(region2_id); - + }/*dataset reference*/ - - + + /*------------------------------------------------------------------------- * H5T_STD_REF_OBJ * Object references. get the type and OID of the referenced object @@ -654,7 +654,7 @@ hsize_t diff_datum(void *_mem1, */ else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) { - + if ((obj1_type = H5Rget_obj_type(container1_id, H5R_OBJECT, _mem1))<0) ret= -1; if ((obj2_type = H5Rget_obj_type(container2_id, H5R_OBJECT, _mem2))<0) @@ -663,7 +663,7 @@ hsize_t diff_datum(void *_mem1, options->err_stat=1; return 0; } - + /* check object type */ if (obj1_type!=obj2_type) { @@ -671,7 +671,7 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; return 0; } - + if ((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1))<0) ret= -1; if ((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2))<0) @@ -680,7 +680,7 @@ hsize_t diff_datum(void *_mem1, options->err_stat=1; return 0; } - + /* compare */ switch (obj1_type) { case H5G_DATASET: @@ -696,21 +696,21 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; break; } - + close_obj(obj1_type,obj1_id); close_obj(obj2_type,obj2_id); - + }/*object reference*/ - + }/*is zero*/ - - + + break; - - + + case H5T_INTEGER: - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- @@ -780,9 +780,9 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_SCHAR*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_UCHAR *------------------------------------------------------------------------- @@ -792,7 +792,7 @@ hsize_t diff_datum(void *_mem1, unsigned char temp1_uchar; unsigned char temp2_uchar; assert(type_size==sizeof(unsigned char)); - + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); /* -d and !-p */ @@ -820,7 +820,7 @@ hsize_t diff_datum(void *_mem1, print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, - abs(temp1_uchar-temp2_uchar), + abs(temp1_uchar-temp2_uchar), per); } nfound++; @@ -837,7 +837,7 @@ hsize_t diff_datum(void *_mem1, print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, - abs(temp1_uchar-temp2_uchar), + abs(temp1_uchar-temp2_uchar), per); } nfound++; @@ -853,21 +853,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_UCHAR*/ - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_SHORT *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) { short temp1_short; short temp2_short; assert(type_size==sizeof(short)); - + memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); /* -d and !-p */ @@ -928,21 +928,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_SHORT*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_USHORT *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) { unsigned short temp1_ushort; unsigned short temp2_ushort; assert(type_size==sizeof(short)); - + memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); /* -d and !-p */ @@ -950,7 +950,7 @@ hsize_t diff_datum(void *_mem1, { if (abs(temp1_ushort-temp2_ushort) > options->delta) { - + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -1005,19 +1005,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_USHORT*/ - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_INT)) { int temp1_int; int temp2_int; assert(type_size==sizeof(int)); - + memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); /* -d and !-p */ @@ -1043,7 +1043,7 @@ hsize_t diff_datum(void *_mem1, if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(I_FORMAT_P,temp1_int,temp2_int, abs(temp1_int-temp2_int), @@ -1080,19 +1080,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_INT*/ - - + + /*------------------------------------------------------------------------- * 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 */ @@ -1154,19 +1154,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_UINT*/ - - + + /*------------------------------------------------------------------------- * 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 */ @@ -1228,18 +1228,18 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_LONG*/ - + /*------------------------------------------------------------------------- * 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 */ @@ -1300,21 +1300,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_ULONG*/ - + /*------------------------------------------------------------------------- * 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 */ @@ -1343,7 +1343,7 @@ hsize_t diff_datum(void *_mem1, print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong, - (long_long)labs((long)(temp1_llong-temp2_llong)), + (long_long)labs((long)(temp1_llong-temp2_llong)), per); } nfound++; @@ -1360,7 +1360,7 @@ hsize_t diff_datum(void *_mem1, print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong, - (long_long)labs((long)(temp1_llong-temp2_llong)), + (long_long)labs((long)(temp1_llong-temp2_llong)), per); } nfound++; @@ -1377,20 +1377,20 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_LLONG*/ - + /*------------------------------------------------------------------------- * 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 */ @@ -1402,7 +1402,7 @@ hsize_t diff_datum(void *_mem1, { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong, + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); } nfound++; @@ -1414,15 +1414,15 @@ hsize_t diff_datum(void *_mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); - if ( per > options->percent ) + if ( per > options->percent ) { - + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong, - (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), per); } nfound++; @@ -1436,14 +1436,14 @@ hsize_t diff_datum(void *_mem1, PER(f1,f2); if ( per > options->percent && labs((long)(temp1_ullong-temp2_ullong)) > (long)options->delta ) { - + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong, - (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong, + (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), per); } nfound++; @@ -1455,23 +1455,23 @@ hsize_t diff_datum(void *_mem1, { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong, + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong))); } nfound++; } - + } /*H5T_NATIVE_ULLONG*/ - - + + break; /* H5T_INTEGER class */ case H5T_FLOAT: - + /*------------------------------------------------------------------------- * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- */ - + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) { float temp1_float; @@ -1479,7 +1479,7 @@ hsize_t diff_datum(void *_mem1, assert(type_size==sizeof(float)); memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + /* -d and !-p */ if (options->d && !options->p) { @@ -1499,7 +1499,7 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent ) { - + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -1509,7 +1509,7 @@ hsize_t diff_datum(void *_mem1, nfound++; } } - + /* -d and -p */ else if ( options->d && options->p) { @@ -1519,7 +1519,7 @@ hsize_t diff_datum(void *_mem1, if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(F_FORMAT_P,temp1_float,temp2_float,fabs(temp1_float-temp2_float), fabs(1-temp2_float/temp1_float)); } @@ -1528,30 +1528,30 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_float != temp2_float) { - + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(F_FORMAT,temp1_float,temp2_float,fabs(temp1_float-temp2_float)); } nfound++; } - + } /*H5T_NATIVE_FLOAT*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) { double temp1_double; double temp2_double; assert(type_size==sizeof(double)); - + memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); /* -d and !-p */ @@ -1588,7 +1588,7 @@ hsize_t diff_datum(void *_mem1, if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { - + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -1609,16 +1609,16 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_DOUBLE*/ - - + + break; /* H5T_FLOAT class */ - + } /* switch */ - + return nfound; } - - + + /*------------------------------------------------------------------------- * Function: diff_char * @@ -1628,7 +1628,7 @@ hsize_t diff_datum(void *_mem1, * *------------------------------------------------------------------------- */ - + hsize_t diff_char(unsigned char *mem1, unsigned char *mem2, hsize_t i, @@ -1643,10 +1643,10 @@ hsize_t diff_char(unsigned char *mem1, hsize_t nfound=0; /* differences found */ unsigned char temp1_uchar; unsigned char temp2_uchar; - + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (temp1_uchar != temp2_uchar) { if ( print_data(options) ) @@ -1657,12 +1657,12 @@ hsize_t diff_char(unsigned char *mem1, } nfound++; } - + return nfound; } - - - + + + /*------------------------------------------------------------------------- * Function: is_zero * @@ -1676,11 +1676,11 @@ hsize_t diff_char(unsigned char *mem1, 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; } @@ -1713,7 +1713,7 @@ static void close_obj(H5G_obj_t obj_type, hid_t obj_id) /*------------------------------------------------------------------------- * Function: print_region_block * - * Purpose: print start coordinates and opposite corner of a region block + * Purpose: print start coordinates and opposite corner of a region block * * Return: void * @@ -1740,7 +1740,7 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) /*------------------------------------------------------------------------- * Function: print_points * - * Purpose: print points of a region reference + * Purpose: print points of a region reference * * Return: void * @@ -1757,9 +1757,9 @@ void print_points(int i, hsize_t *ptdata, int ndims) parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])); parallel_print(")"); - + } - + /*------------------------------------------------------------------------- * Function: diff_region * @@ -1769,14 +1769,14 @@ void print_points(int i, hsize_t *ptdata, int ndims) * *------------------------------------------------------------------------- */ - -static -hsize_t diff_region(hid_t obj1_id, - hid_t obj2_id, - hid_t region1_id, + +static +hsize_t diff_region(hid_t obj1_id, + hid_t obj2_id, + hid_t region1_id, hid_t region2_id, diff_opt_t *options) - + { hssize_t nblocks1, npoints1; hssize_t nblocks2, npoints2; @@ -1809,7 +1809,7 @@ hsize_t diff_region(hid_t obj1_id, H5E_BEGIN_TRY { nblocks1 = H5Sget_select_hyper_nblocks(region1_id); nblocks2 = H5Sget_select_hyper_nblocks(region2_id); - + npoints1 = H5Sget_select_elem_npoints(region1_id); npoints2 = H5Sget_select_elem_npoints(region2_id); } H5E_END_TRY; @@ -1826,18 +1826,18 @@ hsize_t diff_region(hid_t obj1_id, */ if (nblocks1 > 0) { - + alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]); assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - + ptdata1 = malloc((size_t)alloc_size); H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region1_id, (hsize_t)0, (hsize_t)nblocks1, ptdata1); - + ptdata2 = malloc((size_t)alloc_size); H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region2_id, (hsize_t)0, (hsize_t)nblocks2, ptdata2); - + for (i = 0; i < nblocks1; i++) { /* start coordinates and opposite corner */ @@ -1854,9 +1854,9 @@ hsize_t diff_region(hid_t obj1_id, } } } - - /* print differences if found */ + + /* print differences if found */ if (nfound_b && options->m_verbose) { parallel_print("Referenced dataset %lu %lu\n", @@ -1872,8 +1872,8 @@ hsize_t diff_region(hid_t obj1_id, parallel_print("\n"); } - } - + } + HDfree(ptdata1); HDfree(ptdata2); } @@ -1887,19 +1887,19 @@ hsize_t diff_region(hid_t obj1_id, { alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]); assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ - + ptdata1 = malloc((size_t)alloc_size); H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t); H5Sget_select_elem_pointlist(region1_id, (hsize_t)0, (hsize_t)npoints1, ptdata1); - + 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); - + for (i = 0; i < npoints1; i++) { hsize_t pt1, pt2; - + for (j = 0; j < ndims1; j++) { pt1 = ptdata1[i * ndims1 + j]; @@ -1931,36 +1931,36 @@ hsize_t diff_region(hid_t obj1_id, parallel_print("\n"); } } - } + } #if defined (H5DIFF_DEBUG) 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 - + HDfree(ptdata1); HDfree(ptdata2); } - + nfound_b = nfound_b/ndims1; nfound_p = nfound_p/ndims1; return (nfound_p + nfound_b); } - + /*------------------------------------------------------------------------- * Function: diff_native_uchar * @@ -1982,17 +1982,17 @@ hsize_t diff_native_uchar(unsigned char *mem1, const char *obj2, int *ph) { - + hsize_t nfound=0; /* differences found */ unsigned char temp1_uchar; unsigned char temp2_uchar; float per; - + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + /* -d and !-p */ - + if (options->d && !options->p) { if (abs(temp1_uchar-temp2_uchar) > options->delta) @@ -2050,11 +2050,11 @@ hsize_t diff_native_uchar(unsigned char *mem1, } nfound++; } - + return nfound; - + } - + /*------------------------------------------------------------------------- * Function: diff_float @@ -2075,15 +2075,15 @@ hsize_t diff_float(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ float temp1_float; float temp2_float; hsize_t i; float per; - - + + /* -d and !-p */ if (options->d && !options->p) { @@ -2091,7 +2091,7 @@ hsize_t diff_float(unsigned char *mem1, { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + if (fabs(temp1_float-temp2_float) > options->delta) { if ( print_data(options) ) @@ -2108,7 +2108,7 @@ hsize_t diff_float(unsigned char *mem1, return nfound; } } - + /* !-d and -p */ else if (!options->d && options->p) { @@ -2116,7 +2116,7 @@ hsize_t diff_float(unsigned char *mem1, { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + PER(temp1_float,temp2_float); if ( per > options->percent ) { @@ -2136,16 +2136,16 @@ hsize_t diff_float(unsigned char *mem1, return nfound; } } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + PER(temp1_float,temp2_float); if ( per > options->percent && fabs(temp1_float-temp2_float) > options->delta ) { @@ -2167,12 +2167,12 @@ hsize_t diff_float(unsigned char *mem1, } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + if (temp1_float != temp2_float) { if ( print_data(options) ) @@ -2183,15 +2183,15 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(float); mem2+=sizeof(float); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2216,24 +2216,24 @@ hsize_t diff_double(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ double temp1_double; double temp2_double; hsize_t i; float per; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + if (fabs(temp1_double-temp2_double) > options->delta) { if ( print_data(options) ) @@ -2250,16 +2250,16 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + PER(temp1_double,temp2_double); if ( per > options->percent ) { @@ -2279,16 +2279,16 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + PER(temp1_double,temp2_double); if ( per > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { @@ -2310,12 +2310,12 @@ hsize_t diff_double(unsigned char *mem1, } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + if (temp1_double != temp2_double) { if ( print_data(options) ) @@ -2326,15 +2326,15 @@ hsize_t diff_double(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(double); mem2+=sizeof(double); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2357,24 +2357,24 @@ hsize_t diff_schar(unsigned char *mem1, 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; float per; - - + + /* -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) ) @@ -2391,16 +2391,16 @@ 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)); - + PER(temp1_char,temp2_char); if ( per > options->percent ) { @@ -2420,16 +2420,16 @@ 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)); - + PER(temp1_char,temp2_char); if ( per > options->percent && abs(temp1_char-temp2_char) > options->delta ) { @@ -2448,16 +2448,16 @@ hsize_t diff_schar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } 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) ) @@ -2468,15 +2468,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; } @@ -2501,24 +2501,24 @@ hsize_t diff_uchar(unsigned char *mem1, 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; float per; - - + + /* -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) ) @@ -2534,18 +2534,18 @@ 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)); - + PER(temp1_uchar,temp2_uchar); if ( per > options->percent ) { @@ -2565,16 +2565,16 @@ hsize_t diff_uchar(unsigned char *mem1, 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)); - + PER(temp1_uchar,temp2_uchar); if ( per > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { @@ -2593,16 +2593,16 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } 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) ) @@ -2613,15 +2613,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; } @@ -2644,24 +2644,24 @@ hsize_t diff_short(unsigned char *mem1, 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; float per; - - + + /* -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) ) @@ -2677,18 +2677,18 @@ 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)); - + PER(temp1_short,temp2_short); if ( per > options->percent ) { @@ -2707,19 +2707,19 @@ 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)); - + PER(temp1_short,temp2_short); if ( per > options->percent && abs(temp1_short-temp2_short) > options->delta ) { @@ -2738,16 +2738,16 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } 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) ) @@ -2758,15 +2758,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; } @@ -2790,23 +2790,23 @@ hsize_t diff_ushort(unsigned char *mem1, 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; float per; - + /* -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) ) @@ -2822,18 +2822,18 @@ 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)); - + PER(temp1_ushort,temp2_ushort); if ( per > options->percent ) { @@ -2852,19 +2852,19 @@ 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)); - + PER(temp1_ushort,temp2_ushort); if ( per > options->percent && abs(temp1_ushort-temp2_ushort) > options->delta ) { @@ -2883,16 +2883,16 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } 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) ) @@ -2903,15 +2903,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; } @@ -2936,23 +2936,23 @@ hsize_t diff_int(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ int temp1_int; int temp2_int; hsize_t i; float per; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + if (abs(temp1_int-temp2_int) > options->delta) { if ( print_data(options) ) @@ -2968,13 +2968,13 @@ hsize_t diff_int(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_int, mem1, sizeof(int)); @@ -2998,14 +2998,14 @@ hsize_t diff_int(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_int, mem1, sizeof(int)); @@ -3029,16 +3029,16 @@ hsize_t diff_int(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + if (temp1_int != temp2_int) { if ( print_data(options) ) @@ -3049,15 +3049,15 @@ hsize_t diff_int(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(int); mem2+=sizeof(int); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3082,23 +3082,23 @@ hsize_t diff_uint(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned int temp1_uint; unsigned int temp2_uint; hsize_t i; float per; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + if (abs(temp1_uint-temp2_uint) > options->delta) { if ( print_data(options) ) @@ -3114,18 +3114,18 @@ hsize_t diff_uint(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_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + PER(temp1_uint,temp2_uint); if ( per > options->percent ) { @@ -3144,19 +3144,19 @@ hsize_t diff_uint(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_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + PER(temp1_uint,temp2_uint); if ( per > options->percent && abs(temp1_uint-temp2_uint) > options->delta ) { @@ -3175,16 +3175,16 @@ hsize_t diff_uint(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + if (temp1_uint != temp2_uint) { if ( print_data(options) ) @@ -3195,15 +3195,15 @@ hsize_t diff_uint(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned int); mem2+=sizeof(unsigned int); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3228,7 +3228,7 @@ hsize_t diff_long(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ long temp1_long; @@ -3239,15 +3239,15 @@ hsize_t diff_long(unsigned char *mem1, /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (labs((long)(temp1_long-temp2_long)) > (long)options->delta) { if ( print_data(options) ) @@ -3265,11 +3265,11 @@ hsize_t diff_long(unsigned char *mem1, } } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); @@ -3293,19 +3293,19 @@ hsize_t diff_long(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_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + PER(temp1_long,temp2_long); if ( per > options->percent && labs(temp1_long-temp2_long) > options->delta ) { @@ -3324,16 +3324,16 @@ hsize_t diff_long(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (temp1_long != temp2_long) { if ( print_data(options) ) @@ -3344,15 +3344,15 @@ hsize_t diff_long(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(long); mem2+=sizeof(long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3378,27 +3378,27 @@ hsize_t diff_ulong(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned long temp1_ulong; unsigned long temp2_ulong; hsize_t i; float per; - - + + /* -d and !-p */ if (options->d && !options->p) { - + 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) ) @@ -3414,20 +3414,20 @@ hsize_t diff_ulong(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_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + PER(temp1_ulong,temp2_ulong); if ( per > options->percent ) { @@ -3446,19 +3446,19 @@ hsize_t diff_ulong(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_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + PER(temp1_ulong,temp2_ulong); if ( per > options->percent && labs(temp1_ulong-temp2_ulong) > options->delta ) { @@ -3477,16 +3477,16 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + if (temp1_ulong != temp2_ulong) { if ( print_data(options) ) @@ -3497,15 +3497,15 @@ hsize_t diff_ulong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned long); mem2+=sizeof(unsigned long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3530,23 +3530,23 @@ hsize_t diff_llong(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ long_long temp1_llong; long_long temp2_llong; hsize_t i; float per; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + if (labs( (long) (temp1_llong-temp2_llong)) > options->delta) { if ( print_data(options) ) @@ -3563,18 +3563,18 @@ hsize_t diff_llong(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_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + PER(temp1_llong,temp2_llong); if ( per > options->percent ) { @@ -3593,19 +3593,19 @@ hsize_t diff_llong(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_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + PER(temp1_llong,temp2_llong); if ( per > options->percent && labs((long)(temp1_llong-temp2_llong)) > options->delta ) { @@ -3624,16 +3624,16 @@ hsize_t diff_llong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + if (temp1_llong != temp2_llong) { if ( print_data(options) ) @@ -3645,15 +3645,15 @@ hsize_t diff_llong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(long_long); mem2+=sizeof(long_long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3679,23 +3679,23 @@ hsize_t diff_ullong(unsigned char *mem1, const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned long_long temp1_ullong; unsigned long_long temp2_ullong; hsize_t i; float f1, f2, per; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + if (labs((long)(temp1_ullong-temp2_ullong)) > options->delta) { if ( print_data(options) ) @@ -3712,13 +3712,13 @@ hsize_t diff_ullong(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_ullong, mem1, sizeof(unsigned long_long)); @@ -3744,19 +3744,19 @@ hsize_t diff_ullong(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_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); @@ -3777,16 +3777,16 @@ hsize_t diff_ullong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + if (temp1_ullong != temp2_ullong) { if ( print_data(options) ) @@ -3798,15 +3798,15 @@ hsize_t diff_ullong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned long_long); mem2+=sizeof(unsigned long_long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3824,40 +3824,40 @@ hsize_t diff_ullong(unsigned char *mem1, * *------------------------------------------------------------------------- */ -static +static int ull2float(unsigned long_long ull_value, float *f_value) { hid_t dxpl_id; unsigned char *buf; size_t src_size; size_t dst_size; - - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) + + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) goto error; - + src_size = H5Tget_size(H5T_NATIVE_ULLONG); dst_size = H5Tget_size(H5T_NATIVE_FLOAT); buf = (unsigned char*)calloc(1, MAX(src_size, dst_size)); - + memcpy(buf, &ull_value, src_size); - + /* do conversion */ - if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, 1, buf, NULL, dxpl_id)<0) + if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, 1, buf, NULL, dxpl_id)<0) goto error; - + memcpy(f_value, buf, dst_size); - + if(buf) free(buf); return 0; - + error: H5E_BEGIN_TRY { H5Pclose(dxpl_id); } H5E_END_TRY; if(buf) free(buf); - + return -1; } diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 13acc28..785b345 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -67,21 +67,21 @@ int diff_attr(hid_t loc1_id, int ret=0; hsize_t nfound; int cmp=1; - + if ((n1 = H5Aget_num_attrs(loc1_id))<0) goto error; if ((n2 = H5Aget_num_attrs(loc2_id))<0) goto error; - + if (n1!=n2) return 1; - + for ( i = 0; i < n1; i++) { /* reset buffers for every attribute, we might goto out and call free */ buf1=NULL; buf2=NULL; - + /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- @@ -91,13 +91,13 @@ int diff_attr(hid_t loc1_id, goto error; if ((attr2_id = H5Aopen_idx(loc2_id, (unsigned)i))<0) goto error; - + /* get name */ if (H5Aget_name( attr1_id, 255, name1 )<0) goto error; if (H5Aget_name( attr2_id, 255, name2 )<0) goto error; - + if (HDstrcmp(name1,name2)!=0) { if (options->m_verbose) @@ -109,30 +109,30 @@ int diff_attr(hid_t loc1_id, ret=1; continue; } - + /* get the file datatype */ if ((ftype1_id = H5Aget_type( attr1_id )) < 0 ) goto error; if ((ftype2_id = H5Aget_type( attr2_id )) < 0 ) goto error; - + /* get the dataspace handle */ if ((space1_id = H5Aget_space( attr1_id )) < 0 ) goto error; if ((space2_id = H5Aget_space( attr2_id )) < 0 ) goto error; - + /* get dimensions */ if ( (rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0 ) goto error; if ( (rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0 ) goto error; - + /*------------------------------------------------------------------------- * check for comparable TYPE and SPACE *------------------------------------------------------------------------- */ - + if (diff_can_type(ftype1_id, ftype2_id, rank1, @@ -154,7 +154,7 @@ int diff_attr(hid_t loc1_id, */ if (cmp) { - + /*------------------------------------------------------------------------- * read to memory *------------------------------------------------------------------------- @@ -162,20 +162,20 @@ int diff_attr(hid_t loc1_id, nelmts1=1; for (j=0; j<rank1; j++) nelmts1*=dims1[j]; - + if ((mtype1_id=h5tools_get_native_type(ftype1_id))<0) goto error; - + if ((mtype2_id=h5tools_get_native_type(ftype2_id))<0) goto error; - + if ((msize1=H5Tget_size(mtype1_id))==0) goto error; if ((msize2=H5Tget_size(mtype2_id))==0) goto error; - + assert(msize1==msize2); - + buf1=(void *) HDmalloc((unsigned)(nelmts1*msize1)); buf2=(void *) HDmalloc((unsigned)(nelmts1*msize2)); if ( buf1==NULL || buf2==NULL){ @@ -186,16 +186,16 @@ int diff_attr(hid_t loc1_id, goto error; if (H5Aread(attr2_id,mtype2_id,buf2)<0) goto error; - + /* format output string */ sprintf(np1,"%s of <%s>",name1,path1); sprintf(np2,"%s of <%s>",name2,path2); - + /*------------------------------------------------------------------------- * array compare *------------------------------------------------------------------------- */ - + /* always print name */ if (options->m_verbose) { @@ -212,7 +212,7 @@ int diff_attr(hid_t loc1_id, attr1_id, attr2_id); print_found(nfound); - + } /* check first if we have differences */ else @@ -268,13 +268,13 @@ int diff_attr(hid_t loc1_id, } /*else quiet */ } /*else verbose */ }/*cmp*/ - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + if (H5Tclose(ftype1_id)<0) goto error; if (H5Tclose(ftype2_id)<0) goto error; if (H5Tclose(mtype1_id)<0) goto error; @@ -288,9 +288,9 @@ int diff_attr(hid_t loc1_id, if (buf2) HDfree(buf2); } /* i */ - + return ret; - + error: H5E_BEGIN_TRY { H5Tclose(ftype1_id); @@ -306,7 +306,7 @@ error: if (buf2) HDfree(buf2); } H5E_END_TRY; - + options->err_stat=1; return 0; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index ad49b1a..012552f 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -26,11 +26,11 @@ *------------------------------------------------------------------------- */ #if defined (H5DIFF_DEBUG) -void print_sizes( const char *obj1, +void print_sizes( const char *obj1, const char *obj2, - hid_t f_tid1, + hid_t f_tid1, hid_t f_tid2, - hid_t m_tid1, + hid_t m_tid1, hid_t m_tid2 ) { size_t f_size1, f_size2; /* size of type in file */ @@ -300,7 +300,7 @@ hsize_t diff_datasetid( hid_t did1, */ if ((m_tid1=h5tools_get_native_type(f_tid1))<0) goto error; - + if ((m_tid2=h5tools_get_native_type(f_tid2))<0) goto error; @@ -316,7 +316,7 @@ hsize_t diff_datasetid( hid_t did1, * check for different signed/unsigned types *------------------------------------------------------------------------- */ - + sign1=H5Tget_sign(m_tid1); sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) @@ -325,7 +325,7 @@ hsize_t diff_datasetid( hid_t did1, parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - + cmp=0; options->not_cmp=1; } @@ -366,19 +366,19 @@ hsize_t diff_datasetid( hid_t did1, if ( m_size1 < m_size2 ) { H5Tclose(m_tid1); - + if ((m_tid1=h5tools_get_native_type(f_tid2))<0) goto error; - + m_size1 = H5Tget_size( m_tid1 ); } else { H5Tclose(m_tid2); - + if ((m_tid2=h5tools_get_native_type(f_tid1))<0) goto error; - + m_size2 = H5Tget_size( m_tid2 ); } #if defined (H5DIFF_DEBUG) diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 76a3774..c2c0659 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -38,14 +38,14 @@ void parallel_print(const char* format, ...) { int bytes_written; va_list ap; - + va_start(ap, format); - + if(!g_Parallel) vprintf(format, ap); else { - + if(overflow_file == NULL) /*no overflow has occurred yet */ { #if 0 @@ -57,11 +57,11 @@ void parallel_print(const char* format, ...) #endif va_end(ap); va_start(ap, format); - + #if 0 printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset); #endif - + if ((bytes_written < 0) || #ifdef H5_VSNPRINTF_WORKS (bytes_written >= (OUTBUFF_SIZE-outBuffOffset)) @@ -72,7 +72,7 @@ void parallel_print(const char* format, ...) { /* Terminate the outbuff at the end of the previous output */ outBuff[outBuffOffset] = '\0'; - + overflow_file = HDtmpfile(); if(overflow_file == NULL) fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n"); @@ -84,7 +84,7 @@ void parallel_print(const char* format, ...) } else bytes_written = HDvfprintf(overflow_file, format, ap); - + } va_end(ap); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index a38a435..7fcfd3c 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -536,9 +536,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, * * Pedro Vicente Nunes, THG, 2005-10-19 * pass to the prefix in h5tools_simple_prefix the total position - * instead of the current stripmine position i; this is necessary - * to print the array indices - * new field sm_pos in h5tools_context_t, the current stripmine element position + * instead of the current stripmine position i; this is necessary + * to print the array indices + * new field sm_pos in h5tools_context_t, the current stripmine element position *------------------------------------------------------------------------- */ void @@ -682,7 +682,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai multiline++; /* pass to the prefix in h5tools_simple_prefix the total position - instead of the current stripmine position i; this is necessary + instead of the current stripmine position i; this is necessary to print the array indices */ curr_pos = ctx->sm_pos + i; diff --git a/tools/misc/h5stat.c b/tools/misc/h5stat.c index a396472..4855e68 100644 --- a/tools/misc/h5stat.c +++ b/tools/misc/h5stat.c @@ -100,7 +100,7 @@ static int display_dset_metadata = FALSE; static int display_dset = FALSE; static int display_dtype_metadata = FALSE; static int display_dtype = FALSE; - + static const char *s_opts ="FfhGgDdTV"; static struct long_options l_opts[] = { {"help", no_arg, 'h'}, @@ -158,12 +158,12 @@ static struct long_options l_opts[] = { { NULL, 0, '\0' } }; -static void +static void leave(int ret) { h5tools_close(); - exit(ret); -} + exit(ret); +} static void usage(const char *prog) @@ -176,9 +176,9 @@ static void fprintf(stdout, "\n"); fprintf(stdout, "Please send your comments and questions to help@hdfgroup.org\n"); fprintf(stdout, "\n"); - fprintf(stdout, "Usage: %s [OPTIONS] file\n", prog); + fprintf(stdout, "Usage: %s [OPTIONS] file\n", prog); fprintf(stdout, "\n"); - fprintf(stdout, " OPTIONS\n"); + fprintf(stdout, " OPTIONS\n"); fprintf(stdout, " -h, --help Print a usage message and exit\n"); fprintf(stdout, " -V, --version Print version number and exit\n"); fprintf(stdout, " -f, --file Print file information\n"); @@ -190,7 +190,7 @@ static void fprintf(stdout, " -T, --dtypemetadata Print datatype metadata\n"); fprintf(stdout, "\n"); } - + /*------------------------------------------------------------------------- * Function: ceil_log10 @@ -216,7 +216,7 @@ ceil_log10(unsigned long x) pow10 *= 10; ret++; } /* end while */ - + return(ret); } @@ -573,7 +573,7 @@ printf("walk: fullname = %s\n", fullname); /* Track the layout type for dataset */ (iter->dset_layouts[lout])++; - + num_ext = H5Pget_external_count(dcpl); assert (num_ext >= 0); @@ -581,19 +581,19 @@ printf("walk: fullname = %s\n", fullname); /* Track different filters */ - if ((nfltr=H5Pget_nfilters(dcpl)) >= 0) { + if ((nfltr=H5Pget_nfilters(dcpl)) >= 0) { if (nfltr == 0) iter->dset_comptype[0]++; for (u=0; u < nfltr; u++) { fltr = H5Pget_filter(dcpl, u, 0, 0, 0, 0, 0, NULL); - if (fltr < (H5_NFILTERS_IMPL-1)) + if (fltr < (H5_NFILTERS_IMPL-1)) iter->dset_comptype[fltr]++; else iter->dset_comptype[H5_NFILTERS_IMPL-1]++; /*other filters*/ } } /*endif nfltr */ - + ret = H5Pclose(dcpl); assert(ret >= 0); @@ -670,7 +670,7 @@ parse_start: print_version(progname); leave(EXIT_SUCCESS); break; - + default: usage(progname); leave(EXIT_FAILURE); @@ -889,10 +889,10 @@ main(int argc, const char *argv[]) total += iter.dset_type_info[u].count; } /* end for */ printf("\tTotal dataset datatype count: %lu\n", total); - } + } } /* end if */ } /* display dset */ - + H5Eset_auto_stack(H5E_DEFAULT, func, edata); leave(d_status); |