diff options
Diffstat (limited to 'tools/lib')
-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 |
6 files changed, 598 insertions, 598 deletions
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; |