diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:11:10 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-01-30 04:11:10 (GMT) |
commit | 49d1722c303c7aed3b02052448111a0d1241df7a (patch) | |
tree | 848ea2afd8fa4cb38d60f97ab3cb43b11d5a579b /tools/lib | |
parent | 855dd92b0e72771df86ec81f5334ffd2add1bfb7 (diff) | |
download | hdf5-49d1722c303c7aed3b02052448111a0d1241df7a.zip hdf5-49d1722c303c7aed3b02052448111a0d1241df7a.tar.gz hdf5-49d1722c303c7aed3b02052448111a0d1241df7a.tar.bz2 |
[svn-r18195] Description:
Remove trailing whitespace from source code files.
Tested on:
None - just eyeballed
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 238 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 1202 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 2 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 268 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 16 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 116 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 2 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 4 | ||||
-rw-r--r-- | tools/lib/h5tools_type.c | 26 |
9 files changed, 937 insertions, 937 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 25e5f83..f0c6048 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -53,7 +53,7 @@ print_objname (diff_opt_t * options, hsize_t nfound) /*------------------------------------------------------------------------- * Function: do_print_objname * - * Purpose: print object name + * Purpose: print object name * *------------------------------------------------------------------------- */ @@ -195,7 +195,7 @@ hsize_t h5diff(const char *fname1, HDmemset(filenames, 0, 1024 * 2); - if(options->m_quiet && (options->m_verbose || options->m_report)) + if(options->m_quiet && (options->m_verbose || options->m_report)) { printf("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); options->err_stat=1; @@ -208,10 +208,10 @@ hsize_t h5diff(const char *fname1, */ /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { /* open the files */ - if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { printf("h5diff: <%s>: unable to open file\n", fname1); options->err_stat = 1; @@ -223,7 +223,7 @@ hsize_t h5diff(const char *fname1, #endif goto out; } /* end if */ - if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { printf("h5diff: <%s>: unable to open file\n", fname2); options->err_stat = 1; @@ -264,7 +264,7 @@ hsize_t h5diff(const char *fname1, * object name was supplied *------------------------------------------------------------------------- */ - if( objname1 ) + if( objname1 ) { #ifdef H5_HAVE_PARALLEL if(g_Parallel) @@ -273,13 +273,13 @@ hsize_t h5diff(const char *fname1, #endif assert(objname2); options->cmn_objs = 1; /* eliminate warning */ - nfound = diff_compare(file1_id, - fname1, - objname1, + nfound = diff_compare(file1_id, + fname1, + objname1, info1, - file2_id, - fname2, - objname2, + file2_id, + fname2, + objname2, info2, options); } /* end if */ @@ -289,14 +289,14 @@ hsize_t h5diff(const char *fname1, *------------------------------------------------------------------------- */ - else + else { #ifdef H5_HAVE_PARALLEL - if(g_Parallel) + if(g_Parallel) { int i; - if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) + if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) { fprintf(stderr, "The parallel diff only supports path names up to 1024 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); @@ -311,10 +311,10 @@ hsize_t h5diff(const char *fname1, } /* end if */ #endif - nfound = diff_match(file1_id, - info1, - file2_id, - info2, + nfound = diff_match(file1_id, + info1, + file2_id, + info2, options); } /* end else */ @@ -323,7 +323,7 @@ hsize_t h5diff(const char *fname1, out: /* close */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Fclose(file1_id); H5Fclose(file2_id); @@ -347,7 +347,7 @@ out: * * Date: May 9, 2003 * - * Modifications: + * Modifications: * * Jan 2005 Leon Arber, larber@uiuc.edu * Added support for parallel diffing @@ -355,7 +355,7 @@ out: * Aug 2008 Pedro Vicente, pvn@hdfgroup.org * Added a "contents" mode check. * If this mode is present, objects in both files must match (must be exactly the same) - * If this does not happen, the tool returns an error code of 1 + * If this does not happen, the tool returns an error code of 1 * (instead of the success code of 0) * *------------------------------------------------------------------------- @@ -381,7 +381,7 @@ hsize_t diff_match(hid_t file1_id, curr1 = 0; curr2 = 0; - while(curr1 < info1->nused && curr2 < info2->nused) + while(curr1 < info1->nused && curr2 < info2->nused) { /* criteria is string compare */ int cmp = HDstrcmp(info1->paths[curr1].path, info2->paths[curr2].path); @@ -394,14 +394,14 @@ hsize_t diff_match(hid_t file1_id, curr1++; curr2++; } /* end if */ - else if(cmp < 0) + else if(cmp < 0) { infile[0] = 1; infile[1] = 0; trav_table_addflags(infile, info1->paths[curr1].path, info1->paths[curr1].type, table); curr1++; } /* end else-if */ - else + else { infile[0] = 0; infile[1] = 1; @@ -413,7 +413,7 @@ hsize_t diff_match(hid_t file1_id, /* list1 did not end */ infile[0] = 1; infile[1] = 0; - while(curr1 < info1->nused) + while(curr1 < info1->nused) { trav_table_addflags(infile, info1->paths[curr1].path, info1->paths[curr1].type, table); curr1++; @@ -422,7 +422,7 @@ hsize_t diff_match(hid_t file1_id, /* list2 did not end */ infile[0] = 0; infile[1] = 1; - while(curr2 < info2->nused) + while(curr2 < info2->nused) { trav_table_addflags(infile, info2->paths[curr2].path, info2->paths[curr2].type, table); curr2++; @@ -432,7 +432,7 @@ hsize_t diff_match(hid_t file1_id, * print the list *------------------------------------------------------------------------- */ - if(options->m_verbose) + if(options->m_verbose) { printf("\n"); printf("file1 file2\n"); @@ -458,22 +458,22 @@ hsize_t diff_match(hid_t file1_id, { /* assume equal contents initially */ options->contents = 1; - + /* number of different objects */ if ( info1->nused != info2->nused ) { options->contents = 0; } - - - for( i = 0; i < table->nobjs; i++) + + + for( i = 0; i < table->nobjs; i++) { - if( table->objs[i].flags[0] != table->objs[i].flags[1] ) + if( table->objs[i].flags[0] != table->objs[i].flags[1] ) { options->contents = 0; } } - + } @@ -495,12 +495,12 @@ hsize_t diff_match(hid_t file1_id, HDmemset(workerTasks, 1, (g_nTasks - 1)); #endif - for(i = 0; i < table->nobjs; i++) + for(i = 0; i < table->nobjs; i++) { - if( table->objs[i].flags[0] && table->objs[i].flags[1]) + if( table->objs[i].flags[0] && table->objs[i].flags[1]) { options->cmn_objs = 1; - if(!g_Parallel) + if(!g_Parallel) { nfound += diff(file1_id, table->objs[i].name, @@ -508,7 +508,7 @@ hsize_t diff_match(hid_t file1_id, table->objs[i].name, options, table->objs[i].type); } /* end if */ #ifdef H5_HAVE_PARALLEL - else + else { int workerFound = 0; @@ -522,7 +522,7 @@ hsize_t diff_match(hid_t file1_id, */ /*Set up args to pass to worker task. */ - if(HDstrlen(table->objs[i].name) > 255) + if(HDstrlen(table->objs[i].name) > 255) { printf("The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); @@ -534,7 +534,7 @@ hsize_t diff_match(hid_t file1_id, h5diffdebug2("busyTasks=%d\n", busyTasks); /* if there are any outstanding print requests, let's handle one. */ - if(busyTasks > 0) + if(busyTasks > 0) { int incomingMessage; @@ -542,7 +542,7 @@ hsize_t diff_match(hid_t file1_id, MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status); /* first block*/ - if(incomingMessage) + if(incomingMessage) { workerTasks[Status.MPI_SOURCE - 1] = 1; MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); @@ -552,7 +552,7 @@ hsize_t diff_match(hid_t file1_id, } /* end if */ /* check to see if the print token was returned. */ - if(!havePrintToken) + if(!havePrintToken) { /* If we don't have the token, someone is probably sending us output */ print_incoming_data(); @@ -572,11 +572,11 @@ hsize_t diff_match(hid_t file1_id, } /* end if */ /* check to see if anyone needs the print token. */ - if(havePrintToken) + if(havePrintToken) { /* check incoming queue for print token requests */ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status); - if(incomingMessage) + if(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); @@ -588,9 +588,9 @@ 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++) + for(n = 1; (n < g_nTasks) && !workerFound; n++) { - if(workerTasks[n-1]) + if(workerTasks[n-1]) { /* send file id's and names to first free worker */ MPI_Send(&args, sizeof(args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD); @@ -605,7 +605,7 @@ hsize_t diff_match(hid_t file1_id, } /* end for */ h5diffdebug2("workerfound is %d \n", workerFound); - if(!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 @@ -613,15 +613,15 @@ hsize_t diff_match(hid_t file1_id, * return it. */ - if(!havePrintToken) + if(!havePrintToken) { - while(!havePrintToken) + while(!havePrintToken) { int incomingMessage; print_incoming_data(); MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); - if(incomingMessage) + if(incomingMessage) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); havePrintToken = 1; @@ -633,26 +633,26 @@ hsize_t diff_match(hid_t file1_id, } /* end while */ } /* end if */ /* if we do have the token, check for task to free up, or wait for a task to request it */ - else + else { /* But first print all the data in our incoming queue */ print_incoming_data(); MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - if(Status.MPI_TAG == MPI_TAG_DONE) + if(Status.MPI_TAG == MPI_TAG_DONE) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD); } /* end if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) + else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) { 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 + do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); @@ -664,7 +664,7 @@ hsize_t diff_match(hid_t file1_id, options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD); } /* end else-if */ - else + else { printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); @@ -679,20 +679,20 @@ hsize_t diff_match(hid_t file1_id, h5diffdebug("done with for loop\n"); #ifdef H5_HAVE_PARALLEL - if(g_Parallel) + if(g_Parallel) { /* make sure all tasks are done */ - while(busyTasks > 0) + while(busyTasks > 0) { MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - if(Status.MPI_TAG == MPI_TAG_DONE) + if(Status.MPI_TAG == MPI_TAG_DONE) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; busyTasks--; } /* end if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) + else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; @@ -700,10 +700,10 @@ hsize_t diff_match(hid_t file1_id, busyTasks--; havePrintToken = 1; } /* end else-if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) + else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) { MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); - if(havePrintToken) + if(havePrintToken) { int incomingMessage; @@ -721,12 +721,12 @@ hsize_t diff_match(hid_t file1_id, busyTasks--; } /* end if */ /* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */ - else + else { int source = Status.MPI_SOURCE; int incomingMessage; - do + do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); @@ -741,7 +741,7 @@ hsize_t diff_match(hid_t file1_id, MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD); } /* end else */ } /* end else-if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) + else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; @@ -758,7 +758,7 @@ hsize_t diff_match(hid_t file1_id, printf("%s", data); } /* end else-if */ - else + else { printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); @@ -811,10 +811,10 @@ hsize_t diff_compare(hid_t file1_id, int f1 = 0; int f2 = 0; hsize_t nfound = 0; - + ssize_t i = h5trav_getindex (info1, obj1_name); ssize_t j = h5trav_getindex (info2, obj2_name); - + if (i == -1) { parallel_print ("Object <%s> could not be found in <%s>\n", obj1_name, @@ -832,11 +832,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->paths[i].path; obj2_name = info2->paths[j].path; - + /* objects are not the same type */ if (info1->paths[i].type != info2->paths[j].type) { @@ -847,14 +847,14 @@ 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, + + nfound = diff(file1_id, + obj1_name, + file2_id, + obj2_name, + options, info1->paths[i].type); - + return nfound; } @@ -880,9 +880,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, h5trav_type_t type) { hid_t type1_id = (-1); @@ -891,8 +891,8 @@ hsize_t diff(hid_t file1_id, hid_t grp2_id = (-1); int ret; hsize_t nfound = 0; - - switch(type) + + switch(type) { /*------------------------------------------------------------------------- * H5TRAV_TYPE_DATASET @@ -903,7 +903,7 @@ hsize_t diff(hid_t file1_id, * verbose, always print name *------------------------------------------------------------------------- */ - if(options->m_verbose) + if(options->m_verbose) { if(print_objname(options, (hsize_t)1)) do_print_objname("dataset", path1, path2); @@ -916,9 +916,9 @@ hsize_t diff(hid_t file1_id, * disabling quiet mode *------------------------------------------------------------------------- */ - else + else { - if(options->m_quiet == 0) + if(options->m_quiet == 0) { /* shut up temporarily */ options->m_quiet = 1; @@ -926,7 +926,7 @@ hsize_t diff(hid_t file1_id, /* print again */ options->m_quiet = 0; - if(nfound) + if(nfound) { if(print_objname(options,nfound)) do_print_objname("dataset", path1, path2); @@ -939,7 +939,7 @@ hsize_t diff(hid_t file1_id, nfound = diff_dataset(file1_id, file2_id, path1, path2, options); } /* end else */ break; - + /*------------------------------------------------------------------------- * H5TRAV_TYPE_NAMED_DATATYPE *------------------------------------------------------------------------- @@ -949,20 +949,20 @@ hsize_t diff(hid_t file1_id, goto out; if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 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)) do_print_objname("datatype", 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 @@ -970,30 +970,30 @@ hsize_t diff(hid_t file1_id, */ if(path1) nfound += diff_attr(type1_id, type2_id, path1, path2, options); - + if(H5Tclose(type1_id) < 0) goto out; if(H5Tclose(type2_id) < 0) goto out; break; - + /*------------------------------------------------------------------------- * H5TRAV_TYPE_GROUP *------------------------------------------------------------------------- */ case H5TRAV_TYPE_GROUP: ret = HDstrcmp(path1, path2); - + /* if "path1" != "path2" then the groups are "different" */ nfound = (ret != 0) ? 1 : 0; - + if(print_objname(options, nfound)) do_print_objname("group", path1, path2); /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - + if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0) goto out; if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0) @@ -1006,14 +1006,14 @@ hsize_t diff(hid_t file1_id, */ if(path1) nfound += diff_attr(grp1_id, grp2_id, path1, path2, options); - + if(H5Gclose(grp1_id) < 0) goto out; if(H5Gclose(grp2_id) < 0) goto out; break; - - + + /*------------------------------------------------------------------------- * H5TRAV_TYPE_LINK *------------------------------------------------------------------------- @@ -1022,37 +1022,37 @@ hsize_t diff(hid_t file1_id, { H5L_info_t li1, li2; char *buf1, *buf2; - + if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) goto out; if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) goto out; - + buf1 = HDmalloc(li1.u.val_size); buf2 = HDmalloc(li2.u.val_size); - + if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) goto out; if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 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)) do_print_objname("link", path1, path2); /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - + HDfree(buf1); HDfree(buf2); } break; - + /*------------------------------------------------------------------------- * H5TRAV_TYPE_UDLINK *------------------------------------------------------------------------- @@ -1060,19 +1060,19 @@ hsize_t diff(hid_t file1_id, case H5TRAV_TYPE_UDLINK: { H5L_info_t li1, li2; - + if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) goto out; if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) goto out; - + /* Only external links will have a query function registered */ if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) { char *buf1, *buf2; buf1 = HDmalloc(li1.u.val_size); buf2 = HDmalloc(li2.u.val_size); - + if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { HDfree(buf1); HDfree(buf2); @@ -1083,7 +1083,7 @@ hsize_t diff(hid_t file1_id, HDfree(buf2); goto out; } /* end if */ - + /* If the buffers are the same size, compare them */ if(li1.u.val_size == li2.u.val_size) { if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { @@ -1100,20 +1100,20 @@ hsize_t diff(hid_t file1_id, } else ret = 1; - + /* if "buf1" != "buf2" then the links are "different" */ nfound = (ret != 0) ? 1 : 0; - + if(print_objname(options, nfound)) do_print_objname("external link", path1, path2); - + HDfree(buf1); HDfree(buf2); } /* end if */ else { /* If one or both of these links isn't an external link, we can only * compare information from H5Lget_info since we don't have a query - * function registered for them. + * function registered for them. * * If the link classes or the buffer length are not the * same, the links are "different" @@ -1122,17 +1122,17 @@ hsize_t diff(hid_t file1_id, nfound = 1; else nfound = 0; - + if (print_objname (options, nfound)) do_print_objname ("user defined link", path1, path2); } /* end else */ - + /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); } break; - + default: if(options->m_verbose) printf("Comparison not supported: <%s> and <%s> are of type %s\n", @@ -1140,9 +1140,9 @@ hsize_t diff(hid_t file1_id, options->not_cmp = 1; break; } - + return nfound; - + out: options->err_stat = 1; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index c5646ed..5250c3c 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -71,9 +71,9 @@ /*------------------------------------------------------------------------- * -p relative error formula * - * We assume the true value of a quantity to be A (value in first dataset) - * and the measured or inferred value to be B (value in second dataset). - * The relative error is defined by + * We assume the true value of a quantity to be A (value in first dataset) + * and the measured or inferred value to be B (value in second dataset). + * The relative error is defined by * * B - A * -------- @@ -138,7 +138,7 @@ static int ull2float(unsigned long_long ull_value, float *f_value); * NaN detection *------------------------------------------------------------------------- */ -typedef enum dtype_t +typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE, #if H5_SIZEOF_LONG_DOUBLE !=0 @@ -187,7 +187,7 @@ void print_pos( int *ph, /* print header */ const char *obj2 ) { int i; - + /* print header */ if ( *ph==1 ) { @@ -198,7 +198,7 @@ void print_pos( int *ph, /* print header */ parallel_print("%-11s",""); print_dimensions (rank,dims); parallel_print("\n"); - + if (pp) { parallel_print("%-15s %-15s %-15s %-15s %-15s\n", @@ -219,14 +219,14 @@ void print_pos( int *ph, /* print header */ parallel_print("------------------------------------------------------------\n"); } } /* end print header */ - + for ( i = 0; i < rank; i++) { pos[i] = curr_pos/acc[i]; curr_pos -= acc[i]*pos[i]; } assert( curr_pos == 0 ); - + parallel_print("[ " ); for ( i = 0; i < rank; i++) { @@ -272,11 +272,11 @@ 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--) { @@ -284,7 +284,7 @@ hsize_t diff_array( void *_mem1, } for ( j = 0; j < rank; j++) pos[j]=0; - + if(H5Tis_variable_str(m_type)) { for ( i = 0; i < nelmts; i++) @@ -308,7 +308,7 @@ hsize_t diff_array( void *_mem1, return nfound; } /* i */ } - + else { switch (H5Tget_class(m_type)) @@ -316,22 +316,22 @@ hsize_t diff_array( void *_mem1, default: assert(0); break; - + /*------------------------------------------------------------------------- * float and integer atomic types *------------------------------------------------------------------------- */ - + case H5T_FLOAT: - - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); break; - + case H5T_INTEGER: - + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) nfound=diff_schar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) @@ -352,14 +352,14 @@ hsize_t diff_array( void *_mem1, nfound=diff_llong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) nfound=diff_ullong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - + break; - + /*------------------------------------------------------------------------- * Other types than float and integer *------------------------------------------------------------------------- */ - + case H5T_COMPOUND: case H5T_STRING: case H5T_BITFIELD: @@ -368,7 +368,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( @@ -391,7 +391,7 @@ hsize_t diff_array( void *_mem1, } /* i */ } /* switch */ } /* else */ - + return nfound; } @@ -467,9 +467,9 @@ hsize_t diff_datum(void *_mem1, float f1, f2; double per; int both_zero; - + type_size = H5Tget_size( m_type ); - + switch (H5Tget_class(m_type)) { default: @@ -478,7 +478,7 @@ hsize_t diff_datum(void *_mem1, case H5T_TIME: assert(0); break; - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- @@ -509,7 +509,7 @@ hsize_t diff_datum(void *_mem1, H5Tclose(memb_type); } break; - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -519,7 +519,7 @@ hsize_t diff_datum(void *_mem1, { H5T_str_t pad; char *s; - + /* Get pointer to first string to compare */ s = (char *)mem1; @@ -530,9 +530,9 @@ hsize_t diff_datum(void *_mem1, size = HDstrlen(s); else size = H5Tget_size(m_type); - + pad = H5Tget_strpad(m_type); - + for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++) nfound+=character_compare( mem1 + u, @@ -547,16 +547,16 @@ hsize_t diff_datum(void *_mem1, obj2, ph); } - + } break; - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ case H5T_BITFIELD: - + /* byte-by-byte comparison */ for (u=0; u<type_size; u++) nfound+=character_compare_opt( @@ -571,15 +571,15 @@ 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+=character_compare_opt( @@ -594,29 +594,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 */ - + { 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)) { @@ -650,10 +650,10 @@ hsize_t diff_datum(void *_mem1, /* enable error reporting */ } H5E_END_TRY; } - - + + break; - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- @@ -669,7 +669,7 @@ hsize_t diff_datum(void *_mem1, ndims = H5Tget_array_ndims(m_type); H5Tget_array_dims2(m_type, adims); assert(ndims >= 1 && ndims <= H5S_MAX_RANK); - + /* calculate the number of array elements */ for (u = 0, nelmts = 1; u <ndims; u++) nelmts *= adims[u]; @@ -692,15 +692,15 @@ hsize_t diff_datum(void *_mem1, H5Tclose(memb_type); } break; - - + + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- */ - + case H5T_REFERENCE: - + iszero1=all_zero(_mem1, H5Tget_size(m_type)); iszero2=all_zero(_mem2, H5Tget_size(m_type)); if (iszero1 != iszero2) @@ -709,18 +709,18 @@ hsize_t diff_datum(void *_mem1, } else if (!iszero1 && !iszero2) { - + /*------------------------------------------------------------------------- * 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) @@ -729,22 +729,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); - + H5Oclose(obj1_id); H5Oclose(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 @@ -754,7 +754,7 @@ hsize_t diff_datum(void *_mem1, { H5O_type_t obj1_type; H5O_type_t obj2_type; - + if(H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) ret = -1; if(H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) @@ -763,7 +763,7 @@ hsize_t diff_datum(void *_mem1, options->err_stat = 1; return 0; } /* end if */ - + /* check object type */ if(obj1_type != obj2_type) { @@ -771,7 +771,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) @@ -780,7 +780,7 @@ hsize_t diff_datum(void *_mem1, options->err_stat = 1; return 0; } /* end if */ - + /* compare */ if(obj1_type == H5O_TYPE_DATASET) nfound = diff_datasetid(obj1_id, @@ -793,31 +793,31 @@ hsize_t diff_datum(void *_mem1, obj1, obj2); options->not_cmp = 1; } - + H5Oclose(obj1_id); H5Oclose(obj2_id); - + }/*object reference*/ - + }/*is zero*/ - - + + 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, @@ -834,21 +834,21 @@ hsize_t diff_datum(void *_mem1, container1_id, container2_id, ph); - + H5Tclose(memb_type); - + break; - - + + /*------------------------------------------------------------------------- * H5T_INTEGER *------------------------------------------------------------------------- - */ - + */ + case H5T_INTEGER: - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- @@ -878,7 +878,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -890,9 +890,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -908,7 +908,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -920,9 +920,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) { if ( print_data(options) ) @@ -944,9 +944,9 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_SCHAR*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_UCHAR *------------------------------------------------------------------------- @@ -956,7 +956,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 */ @@ -977,7 +977,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -989,9 +989,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1007,7 +1007,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1019,9 +1019,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) { if ( print_data(options) ) @@ -1043,21 +1043,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 */ @@ -1078,7 +1078,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1090,9 +1090,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1108,7 +1108,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1120,9 +1120,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) { if ( print_data(options) ) @@ -1144,21 +1144,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 */ @@ -1166,7 +1166,7 @@ hsize_t diff_datum(void *_mem1, { if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) { - + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); @@ -1180,7 +1180,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1193,9 +1193,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1211,7 +1211,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1223,9 +1223,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) { if ( print_data(options) ) @@ -1248,19 +1248,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 */ @@ -1281,7 +1281,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1293,9 +1293,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1311,7 +1311,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1323,9 +1323,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) { if ( print_data(options) ) @@ -1348,19 +1348,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 */ @@ -1381,7 +1381,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1393,9 +1393,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1411,7 +1411,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1423,9 +1423,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) { if ( print_data(options) ) @@ -1448,19 +1448,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 */ @@ -1481,7 +1481,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1494,9 +1494,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1512,7 +1512,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1524,9 +1524,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) { if ( print_data(options) ) @@ -1551,18 +1551,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 */ @@ -1583,7 +1583,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1595,9 +1595,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1613,7 +1613,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1625,9 +1625,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) { if ( print_data(options) ) @@ -1649,21 +1649,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 */ @@ -1684,7 +1684,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1696,9 +1696,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1714,7 +1714,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1726,9 +1726,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) { if ( print_data(options) ) @@ -1750,20 +1750,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 */ @@ -1786,7 +1786,7 @@ hsize_t diff_datum(void *_mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1798,12 +1798,12 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { - + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); @@ -1819,7 +1819,7 @@ hsize_t diff_datum(void *_mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1831,16 +1831,16 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta ) { - + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - + parallel_print(SPACES); parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); } @@ -1857,22 +1857,22 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_ULLONG*/ - - + + break; /* H5T_INTEGER class */ - + /*------------------------------------------------------------------------- * H5T_FLOAT *------------------------------------------------------------------------- */ - + case H5T_FLOAT: - - - + + + /*------------------------------------------------------------------------- * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- @@ -1889,7 +1889,7 @@ hsize_t diff_datum(void *_mem1, memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - /* logic for detecting NaNs is different with options -d, -p and no options */ + /* logic for detecting NaNs is different with options -d, -p and no options */ /*------------------------------------------------------------------------- * -d and !-p @@ -1897,18 +1897,18 @@ hsize_t diff_datum(void *_mem1, */ if (options->d && !options->p) { - - + + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + if (ABS(temp1_float-temp2_float) > options->delta) { if ( print_data(options) ) @@ -1919,7 +1919,7 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } /*------------------------------------------------------------------------- @@ -1928,19 +1928,19 @@ hsize_t diff_datum(void *_mem1, */ else if (!options->d && options->p) { - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1952,9 +1952,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta ) { if ( print_data(options) ) @@ -1967,7 +1967,7 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } @@ -1975,22 +1975,22 @@ hsize_t diff_datum(void *_mem1, * -d and -p *------------------------------------------------------------------------- */ - + else if ( options->d && options->p) { - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2003,9 +2003,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2013,22 +2013,22 @@ hsize_t diff_datum(void *_mem1, print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); parallel_print(F_FORMAT_P,temp1_float,temp2_float, - ABS(temp1_float-temp2_float), + ABS(temp1_float-temp2_float), ABS(1-temp2_float/temp1_float)); } nfound++; } - + } /* NaN */ } - + /*------------------------------------------------------------------------- * no -d and -p *------------------------------------------------------------------------- */ else if (equal_float(temp1_float,temp2_float)==FALSE) { - + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); @@ -2038,12 +2038,12 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_FLOAT*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) { double temp1_double; @@ -2053,11 +2053,11 @@ hsize_t diff_datum(void *_mem1, assert(type_size==sizeof(double)); - + memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - /* logic for detecting NaNs is different with options -d, -p and no options */ + /* logic for detecting NaNs is different with options -d, -p and no options */ /*------------------------------------------------------------------------- * -d and !-p @@ -2072,10 +2072,10 @@ hsize_t diff_datum(void *_mem1, */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + if (ABS(temp1_double-temp2_double) > options->delta) { if ( print_data(options) ) @@ -2086,7 +2086,7 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } @@ -2103,12 +2103,12 @@ hsize_t diff_datum(void *_mem1, */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2121,9 +2121,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2136,12 +2136,12 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } - + /*------------------------------------------------------------------------- - * -d and -p + * -d and -p *------------------------------------------------------------------------- */ else if ( options->d && options->p) @@ -2153,12 +2153,12 @@ hsize_t diff_datum(void *_mem1, */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2171,10 +2171,10 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - - if ( per > options->percent && + + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) { if ( print_data(options) ) @@ -2187,12 +2187,12 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } - + /*------------------------------------------------------------------------- - * no -d and -p + * no -d and -p *------------------------------------------------------------------------- */ else if (equal_double(temp1_double,temp2_double)==FALSE) @@ -2206,12 +2206,12 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_DOUBLE*/ - - + + break; /* H5T_FLOAT class */ - + } /* switch */ - + return nfound; } @@ -2250,7 +2250,7 @@ static void print_region_block(int i, hsize_t *ptdata, int ndims) { int j; - + parallel_print(" "); for (j = 0; j < ndims; j++) parallel_print("%s%lu", j ? "," : " (", @@ -2259,7 +2259,7 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) parallel_print("%s%lu", j ? "," : ")-(", (unsigned long)ptdata[i * 2 * ndims + j + ndims]); parallel_print(")"); - + } @@ -2277,13 +2277,13 @@ static void print_points(int i, hsize_t *ptdata, int ndims) { int j; - + parallel_print(" "); for (j = 0; j < ndims; j++) parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])); parallel_print(")"); - + } /*------------------------------------------------------------------------- @@ -2492,10 +2492,10 @@ hsize_t character_compare(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) ) @@ -2506,7 +2506,7 @@ hsize_t character_compare(unsigned char *mem1, } nfound++; } - + return nfound; } @@ -2538,12 +2538,12 @@ hsize_t character_compare_opt(unsigned char *mem1, unsigned char temp2_uchar; double per; int both_zero; - + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + /* -d and !-p */ - + if (options->d && !options->p) { if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) @@ -2597,9 +2597,9 @@ hsize_t character_compare_opt(unsigned char *mem1, } nfound++; } - + return nfound; - + } @@ -2634,13 +2634,13 @@ hsize_t diff_float(unsigned char *mem1, int both_zero; int isnan1; int isnan2; - + /*------------------------------------------------------------------------- - * -d and !-p + * -d and !-p *------------------------------------------------------------------------- */ - + if (options->d && !options->p) { for ( i = 0; i < nelmts; i++) @@ -2656,7 +2656,7 @@ hsize_t diff_float(unsigned char *mem1, isnan2 = my_isnan(FLT_FLOAT,&temp2_float); if ( !isnan1 && !isnan2) - { + { if (ABS(temp1_float-temp2_float) > options->delta) { if ( print_data(options) ) @@ -2676,7 +2676,7 @@ hsize_t diff_float(unsigned char *mem1, } /*------------------------------------------------------------------------- - * !-d and -p + * !-d and -p *------------------------------------------------------------------------- */ else if (!options->d && options->p) @@ -2685,19 +2685,19 @@ hsize_t diff_float(unsigned char *mem1, { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2710,9 +2710,9 @@ hsize_t diff_float(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2732,31 +2732,31 @@ hsize_t diff_float(unsigned char *mem1, return nfound; } /* i */ } - + /*------------------------------------------------------------------------- - * -d and -p + * -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)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2769,9 +2769,9 @@ hsize_t diff_float(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta ) { if ( print_data(options) ) @@ -2784,7 +2784,7 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - + } /* NaN */ mem1+=sizeof(float); mem2+=sizeof(float); @@ -2794,7 +2794,7 @@ hsize_t diff_float(unsigned char *mem1, } /*------------------------------------------------------------------------- - * no -d and -p + * no -d and -p *------------------------------------------------------------------------- */ else @@ -2814,13 +2814,13 @@ hsize_t diff_float(unsigned char *mem1, #endif #endif - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + if (equal_float(temp1_float,temp2_float)==FALSE) { if ( print_data(options) ) @@ -2831,7 +2831,7 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(float); mem2+=sizeof(float); if (options->n && nfound>=options->count) @@ -2854,9 +2854,9 @@ hsize_t diff_float(unsigned char *mem1, #endif - + } - + return nfound; } @@ -2892,13 +2892,13 @@ hsize_t diff_double(unsigned char *mem1, int both_zero; int isnan1; int isnan2; - + /*------------------------------------------------------------------------- - * -d and !-p + * -d and !-p *------------------------------------------------------------------------- */ - + if (options->d && !options->p) { for ( i = 0; i < nelmts; i++) @@ -2914,7 +2914,7 @@ hsize_t diff_double(unsigned char *mem1, isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); if ( !isnan1 && !isnan2) - { + { if (ABS(temp1_double-temp2_double) > options->delta) { if ( print_data(options) ) @@ -2934,7 +2934,7 @@ hsize_t diff_double(unsigned char *mem1, } /*------------------------------------------------------------------------- - * !-d and -p + * !-d and -p *------------------------------------------------------------------------- */ else if (!options->d && options->p) @@ -2943,19 +2943,19 @@ hsize_t diff_double(unsigned char *mem1, { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2968,9 +2968,9 @@ hsize_t diff_double(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2990,31 +2990,31 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } /* i */ } - + /*------------------------------------------------------------------------- - * -d and -p + * -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)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3027,9 +3027,9 @@ hsize_t diff_double(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) { if ( print_data(options) ) @@ -3042,7 +3042,7 @@ hsize_t diff_double(unsigned char *mem1, } nfound++; } - + } /* NaN */ mem1+=sizeof(double); mem2+=sizeof(double); @@ -3052,17 +3052,17 @@ hsize_t diff_double(unsigned char *mem1, } /*------------------------------------------------------------------------- - * no -d and -p + * no -d and -p *------------------------------------------------------------------------- */ else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + if (equal_double(temp1_double,temp2_double)==FALSE) { if ( print_data(options) ) @@ -3073,15 +3073,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; } @@ -3117,17 +3117,17 @@ hsize_t diff_schar(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -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) ) @@ -3144,18 +3144,18 @@ 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 (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3168,9 +3168,9 @@ hsize_t diff_schar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3189,18 +3189,18 @@ 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 (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3213,9 +3213,9 @@ hsize_t diff_schar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) { if ( print_data(options) ) @@ -3233,16 +3233,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) ) @@ -3253,15 +3253,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; } @@ -3296,17 +3296,17 @@ hsize_t diff_uchar(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -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 ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) { if ( print_data(options) ) @@ -3322,20 +3322,20 @@ 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_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3348,9 +3348,9 @@ hsize_t diff_uchar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3369,18 +3369,18 @@ 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_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3393,9 +3393,9 @@ hsize_t diff_uchar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) { if ( print_data(options) ) @@ -3413,16 +3413,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) ) @@ -3433,15 +3433,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; } @@ -3474,16 +3474,16 @@ hsize_t diff_short(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -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) ) @@ -3499,20 +3499,20 @@ 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 (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3525,9 +3525,9 @@ hsize_t diff_short(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3545,21 +3545,21 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3572,9 +3572,9 @@ hsize_t diff_short(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) { if ( print_data(options) ) @@ -3592,16 +3592,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) ) @@ -3612,15 +3612,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; } @@ -3654,16 +3654,16 @@ hsize_t diff_ushort(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -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 ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) { if ( print_data(options) ) @@ -3679,20 +3679,20 @@ 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_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3705,9 +3705,9 @@ hsize_t diff_ushort(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3725,21 +3725,21 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3752,9 +3752,9 @@ hsize_t diff_ushort(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) { if ( print_data(options) ) @@ -3772,16 +3772,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) ) @@ -3792,15 +3792,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; } @@ -3835,16 +3835,16 @@ hsize_t diff_int(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -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) ) @@ -3860,20 +3860,20 @@ 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)); memcpy(&temp2_int, mem2, sizeof(int)); - + PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3886,9 +3886,9 @@ hsize_t diff_int(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3906,21 +3906,21 @@ 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)); memcpy(&temp2_int, mem2, sizeof(int)); - + PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3933,9 +3933,9 @@ hsize_t diff_int(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) { if ( print_data(options) ) @@ -3953,16 +3953,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) ) @@ -3973,15 +3973,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; } @@ -4016,16 +4016,16 @@ hsize_t diff_uint(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -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 ( PDIFF(temp1_uint,temp2_uint) > options->delta) { if ( print_data(options) ) @@ -4041,20 +4041,20 @@ 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_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4066,9 +4066,9 @@ hsize_t diff_uint(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4086,21 +4086,21 @@ 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_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4112,9 +4112,9 @@ hsize_t diff_uint(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) { if ( print_data(options) ) @@ -4132,16 +4132,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) ) @@ -4152,15 +4152,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; } @@ -4195,19 +4195,19 @@ hsize_t diff_long(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -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 (ABS(temp1_long-temp2_long) > options->delta) { if ( print_data(options) ) @@ -4225,18 +4225,18 @@ 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)); memcpy(&temp2_long, mem2, sizeof(long)); - + PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4249,9 +4249,9 @@ hsize_t diff_long(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4269,21 +4269,21 @@ 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 (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4296,9 +4296,9 @@ hsize_t diff_long(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) { if ( print_data(options) ) @@ -4316,16 +4316,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) ) @@ -4336,15 +4336,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; } @@ -4380,20 +4380,20 @@ hsize_t diff_ulong(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -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 ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) { if ( print_data(options) ) @@ -4409,22 +4409,22 @@ 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_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4436,9 +4436,9 @@ hsize_t diff_ulong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4456,21 +4456,21 @@ 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_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4482,9 +4482,9 @@ hsize_t diff_ulong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) { if ( print_data(options) ) @@ -4502,16 +4502,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) ) @@ -4522,15 +4522,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; } @@ -4565,16 +4565,16 @@ hsize_t diff_llong(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -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 (ABS( temp1_llong-temp2_llong) > options->delta) { if ( print_data(options) ) @@ -4590,20 +4590,20 @@ 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 (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4615,9 +4615,9 @@ hsize_t diff_llong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4633,21 +4633,21 @@ 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 (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4659,9 +4659,9 @@ hsize_t diff_llong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) { if ( print_data(options) ) @@ -4677,16 +4677,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) ) @@ -4697,15 +4697,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; } @@ -4741,16 +4741,16 @@ hsize_t diff_ullong(unsigned char *mem1, float f1, f2; double per; int both_zero; - + /* -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 ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long) options->delta) { if ( print_data(options) ) @@ -4766,22 +4766,22 @@ 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); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4793,9 +4793,9 @@ hsize_t diff_ullong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4811,23 +4811,23 @@ 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); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4839,9 +4839,9 @@ hsize_t diff_ullong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta ) { if ( print_data(options) ) @@ -4857,16 +4857,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) ) @@ -4877,15 +4877,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; } @@ -4945,8 +4945,8 @@ error: /*------------------------------------------------------------------------- * Function: equal_double * - * Purpose: use a relative error formula to deal with floating point - * uncertainty + * Purpose: use a relative error formula to deal with floating point + * uncertainty * * Programmer: pvn * October 24, 2006 @@ -4956,8 +4956,8 @@ error: * *------------------------------------------------------------------------- */ -static -hbool_t equal_double(double value, double expected) +static +hbool_t equal_double(double value, double expected) { int both_zero; int is_zero; @@ -4972,7 +4972,7 @@ hbool_t equal_double(double value, double expected) int isnan2 = my_isnan(FLT_DOUBLE,&expected); /*------------------------------------------------------------------------- - * we consider NaN == NaN to be true + * we consider NaN == NaN to be true *------------------------------------------------------------------------- */ if ( isnan1 && isnan2 ) @@ -5008,14 +5008,14 @@ hbool_t equal_double(double value, double expected) return TRUE; else return FALSE; - + } /*------------------------------------------------------------------------- * Function: equal_float * - * Purpose: use a relative error formula to deal with floating point - * uncertainty + * Purpose: use a relative error formula to deal with floating point + * uncertainty * * Programmer: pvn * October 24, 2006 @@ -5025,8 +5025,8 @@ hbool_t equal_double(double value, double expected) * *------------------------------------------------------------------------- */ -static -hbool_t equal_float(float value, float expected) +static +hbool_t equal_float(float value, float expected) { int both_zero; int is_zero; @@ -5041,7 +5041,7 @@ hbool_t equal_float(float value, float expected) int isnan2 = my_isnan(FLT_FLOAT,&expected); /*------------------------------------------------------------------------- - * we consider NaN == NaN to be true + * we consider NaN == NaN to be true *------------------------------------------------------------------------- */ if ( isnan1 && isnan2 ) @@ -5064,7 +5064,7 @@ hbool_t equal_float(float value, float expected) */ #endif - + BOTH_ZERO(value,expected) if (both_zero) return TRUE; @@ -5077,7 +5077,7 @@ hbool_t equal_float(float value, float expected) return TRUE; else return FALSE; - + } @@ -5103,73 +5103,73 @@ my_isnan(dtype_t type, void *val) { int retval = 0; char s[256]; - - if (FLT_FLOAT==type) + + if (FLT_FLOAT==type) { float x; HDmemcpy(&x, val, sizeof(float)); retval = (x!=x); - - } - else if (FLT_DOUBLE==type) + + } + else if (FLT_DOUBLE==type) { double x; HDmemcpy(&x, val, sizeof(double)); retval = (x!=x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 - } - else if (FLT_LDOUBLE==type) + } + else if (FLT_LDOUBLE==type) { long double x; HDmemcpy(&x, val, sizeof(long double)); retval = (x!=x); #endif - } - else + } + else { return 0; } - + /* * Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if * the result contains a NaN string. */ - if (!retval) + if (!retval) { - if (FLT_FLOAT==type) + if (FLT_FLOAT==type) { float x; HDmemcpy(&x, val, sizeof(float)); sprintf(s, "%g", x); - } - else if (FLT_DOUBLE==type) + } + else if (FLT_DOUBLE==type) { double x; HDmemcpy(&x, val, sizeof(double)); sprintf(s, "%g", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 - } - else if (FLT_LDOUBLE==type) + } + else if (FLT_LDOUBLE==type) { long double x; HDmemcpy(&x, val, sizeof(long double)); sprintf(s, "%Lg", x); #endif - } - else + } + else { return 0; } - - if ( HDstrstr(s, "NaN") || - HDstrstr(s, "NAN") || - HDstrstr(s, "nan") || - HDstrstr(s, "-1.#IND") /* WIN32 */ + + if ( HDstrstr(s, "NaN") || + HDstrstr(s, "NAN") || + HDstrstr(s, "nan") || + HDstrstr(s, "-1.#IND") /* WIN32 */ ) { @@ -5180,13 +5180,13 @@ my_isnan(dtype_t type, void *val) } - + #ifdef H5_VMS /* For "float" and "double" on OpenVMS/Alpha, NaN is * actually a valid value of maximal value.*/ - if(!retval) + if(!retval) { - if (FLT_FLOAT==type) + if (FLT_FLOAT==type) { float x; HDmemcpy(&x, val, sizeof(float)); @@ -5195,17 +5195,17 @@ my_isnan(dtype_t type, void *val) double x; HDmemcpy(&x, val, sizeof(double)); retval = (x==DBL_MAX || x==-DBL_MAX); - } else + } else { return 0; } } #endif /*H5_VMS*/ - + return retval; } - + diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index d53b656..cfe98b2 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -93,7 +93,7 @@ hsize_t diff_attr(hid_t loc1_id, goto error; /* use the name on the first file to open the second file */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { if((attr2_id = H5Aopen(loc2_id, name1, H5P_DEFAULT)) < 0) goto error; diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 3f4e6a3..6048796 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -43,35 +43,35 @@ hsize_t diff_dataset( hid_t file1_id, hid_t dcpl1 = -1; hid_t dcpl2 = -1; hsize_t nfound = 0; - + /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- */ /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { /* open the datasets */ - if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) + if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { printf("Cannot open dataset <%s>\n", obj1_name); goto error; } - - if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) + + if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { printf("Cannot open dataset <%s>\n", obj2_name); goto error; } /* enable error reporting */ } H5E_END_TRY; - - + + if ((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; if ((dcpl2 = H5Dget_create_plist(did2)) < 0) goto error; - + /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that * are not registered in the current configuration @@ -93,7 +93,7 @@ hsize_t diff_dataset( hid_t file1_id, *------------------------------------------------------------------------- */ /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl1); H5Pclose(dcpl2); @@ -101,13 +101,13 @@ hsize_t diff_dataset( hid_t file1_id, H5Dclose(did2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; - + error: options->err_stat=1; /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl1); H5Pclose(dcpl2); @@ -115,7 +115,7 @@ error: H5Dclose(did2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -131,47 +131,47 @@ error: * * Date: May 9, 2003 * - * Modifications: + * Modifications: * * October 2006: Read by hyperslabs for big datasets. * * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done - * i.e., if the memory needed to read a dataset is greater than this limit, - * then hyperslab I/O is done instead of one operation I/O + * i.e., if the memory needed to read a dataset is greater than this limit, + * then hyperslab I/O is done instead of one operation I/O * For each dataset, the memory needed is calculated according to * * memory needed = number of elements * size of each element * - * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations + * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations * are done * * H5Dread( input_dataset1 ) * H5Dread( input_dataset2 ) * - * with all elements in the datasets selected. If the memory needed is greater than + * with all elements in the datasets selected. If the memory needed is greater than * H5TOOLS_MALLOCSIZE, then the following operations are done instead: * - * a strip mine is defined for each dimension k (a strip mine is defined as a + * a strip mine is defined for each dimension k (a strip mine is defined as a * hyperslab whose size is memory manageable) according to the formula * * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) * - * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures - * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip - * mine size k is simply defined as its dimension k, but for larger datasets the + * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures + * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip + * mine size k is simply defined as its dimension k, but for larger datasets the * hyperslab size is still memory manageable. - * a cycle is done until the number of elements in the dataset is reached. In each - * iteration, two parameters are defined for the function H5Sselect_hyperslab, + * a cycle is done until the number of elements in the dataset is reached. In each + * iteration, two parameters are defined for the function H5Sselect_hyperslab, * the start and size of each hyperslab, according to * * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) * - * where hyperslab_offset [k] is initially set to zero, and later incremented in - * hyperslab_size[k] offsets. The reason for the operation + * where hyperslab_offset [k] is initially set to zero, and later incremented in + * hyperslab_size[k] offsets. The reason for the operation * * dimension[k] - hyperslab_offset[k] * - * in (2) is that, when using the strip mine size, it assures that the "remaining" part + * in (2) is that, when using the strip mine size, it assures that the "remaining" part * of the dataset that does not fill an entire strip mine is processed. * *------------------------------------------------------------------------- @@ -185,13 +185,13 @@ hsize_t diff_datasetid( hid_t did1, hid_t sid1=-1; hid_t sid2=-1; hid_t f_tid1=-1; - hid_t f_tid2=-1; + hid_t f_tid2=-1; hid_t m_tid1=-1; - hid_t m_tid2=-1; + hid_t m_tid2=-1; size_t m_size1; - size_t m_size2; + size_t m_size2; H5T_sign_t sign1; - H5T_sign_t sign2; + H5T_sign_t sign2; int rank1; int rank2; hsize_t nelmts1; @@ -206,60 +206,60 @@ hsize_t diff_datasetid( hid_t did1, hsize_t storage_size2; hsize_t nfound=0; /* number of differences found */ int cmp=1; /* do diff or not */ - void *buf1=NULL; - void *buf2=NULL; - void *sm_buf1=NULL; + void *buf1=NULL; + void *buf2=NULL; + void *sm_buf1=NULL; void *sm_buf2=NULL; size_t need; /* bytes needed for malloc */ int i; - + /* get the dataspace handle */ if ( (sid1 = H5Dget_space(did1)) < 0 ) goto error; - + /* get rank */ if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 ) goto error; - + /* get the dataspace handle */ if ( (sid2 = H5Dget_space(did2)) < 0 ) goto error; - + /* get rank */ if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 ) goto error; - + /* get dimensions */ if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 ) goto error; - + /* get dimensions */ if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 ) goto error; - + /*------------------------------------------------------------------------- * get the file data type *------------------------------------------------------------------------- */ - + /* get the data type */ if ( (f_tid1 = H5Dget_type(did1)) < 0 ) goto error; - + /* get the data type */ if ( (f_tid2 = H5Dget_type(did2)) < 0 ) goto error; - + /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- */ - + storage_size1=H5Dget_storage_size(did1); storage_size2=H5Dget_storage_size(did2); if (storage_size1<0 || storage_size2<0) goto error; - + if (storage_size1==0 || storage_size2==0) { if (options->m_verbose && obj1_name && obj2_name) @@ -267,12 +267,12 @@ hsize_t diff_datasetid( hid_t did1, cmp=0; options->not_cmp=1; } - + /*------------------------------------------------------------------------- * check for comparable TYPE and SPACE *------------------------------------------------------------------------- */ - + if (diff_can_type(f_tid1, f_tid2, rank1, @@ -288,46 +288,46 @@ hsize_t diff_datasetid( hid_t did1, cmp=0; options->not_cmp=1; } - + /*------------------------------------------------------------------------- * memory type and sizes *------------------------------------------------------------------------- */ if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) goto error; - + if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0) goto error; - + m_size1 = H5Tget_size( m_tid1 ); m_size2 = H5Tget_size( m_tid2 ); - + /*------------------------------------------------------------------------- * check for different signed/unsigned types *------------------------------------------------------------------------- */ - + sign1=H5Tget_sign(m_tid1); sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { 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; } - + /*------------------------------------------------------------------------- * only attempt to compare if possible *------------------------------------------------------------------------- */ if (cmp) { - + /*------------------------------------------------------------------------- * get number of elements *------------------------------------------------------------------------- @@ -337,43 +337,43 @@ hsize_t diff_datasetid( hid_t did1, { nelmts1 *= dims1[i]; } - + nelmts2 = 1; for (i = 0; i < rank2; i++) { nelmts2 *= dims2[i]; } - + assert(nelmts1==nelmts2); - + /*------------------------------------------------------------------------- * "upgrade" the smaller memory size *------------------------------------------------------------------------- */ - + if ( m_size1 != m_size2 ) { 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 ); } } assert(m_size1==m_size2); - + /* print names */ if (obj1_name) { name1=diff_basename(obj1_name); @@ -381,27 +381,27 @@ hsize_t diff_datasetid( hid_t did1, if (obj2_name) { name2=diff_basename(obj2_name); } - - + + /*------------------------------------------------------------------------- * read/compare *------------------------------------------------------------------------- */ - + need = (size_t)(nelmts1*m_size1); /* bytes needed */ if ( need < H5TOOLS_MALLOCSIZE) { buf1 = HDmalloc(need); buf2 = HDmalloc(need); } - + if ( buf1!=NULL && buf2!=NULL) { if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 ) goto error; if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 ) goto error; - + /* array diff */ nfound = diff_array(buf1, buf2, @@ -416,61 +416,61 @@ hsize_t diff_datasetid( hid_t did1, did1, did2); } - + else /* possibly not enough memory, read/compare by hyperslabs */ - + { size_t p_type_nbytes = m_size1; /*size of memory type */ hsize_t p_nelmts = nelmts1; /*total selected elmts */ hsize_t elmtno; /*counter */ int carry; /*counter carry value */ unsigned int vl_data = 0; /*contains VL datatypes */ - + /* stripmine info */ hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ hsize_t sm_nbytes; /*bytes per stripmine */ hsize_t sm_nelmts; /*elements per stripmine*/ hid_t sm_space; /*stripmine data space */ - + /* hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */ hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ hsize_t hs_nelmts; /*elements in request */ hsize_t zero[8]; /*vector of zeros */ - + /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE) vl_data = TRUE; - + /* * determine the strip mine size and allocate a buffer. The strip mine is * a hyperslab whose size is manageable. */ sm_nbytes = p_type_nbytes; - - for (i = rank1; i > 0; --i) + + for (i = rank1; i > 0; --i) { sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } - + sm_buf1 = malloc((size_t)sm_nbytes); sm_buf2 = malloc((size_t)sm_nbytes); - + sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - + /* the stripmine loop */ memset(hs_offset, 0, sizeof hs_offset); memset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ - if (rank1 > 0) + if (rank1 > 0) { - for (i = 0, hs_nelmts = 1; i < rank1; i++) + for (i = 0, hs_nelmts = 1; i < rank1; i++) { hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]); hs_nelmts *= hs_size[i]; @@ -481,22 +481,22 @@ hsize_t diff_datasetid( hid_t did1, goto error; if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) goto error; - } - else + } + else { H5Sselect_all(sid1); H5Sselect_all(sid2); H5Sselect_all(sm_space); hs_nelmts = 1; } /* rank */ - + if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 ) goto error; if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 ) goto error; - - /* get array differences. in the case of hyperslab read, increment the - number of differences found in each hyperslab and pass the + + /* get array differences. in the case of hyperslab read, increment the + number of differences found in each hyperslab and pass the position at the beggining for printing */ nfound += diff_array(sm_buf1, @@ -511,16 +511,16 @@ hsize_t diff_datasetid( hid_t did1, m_tid1, did1, did2); - + /* reclaim any VL memory, if necessary */ if(vl_data) { H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); } - + /* calculate the next hyperslab offset */ - for (i = rank1, carry = 1; i > 0 && carry; --i) + for (i = rank1, carry = 1; i > 0 && carry; --i) { hs_offset[i - 1] += hs_size[i - 1]; if (hs_offset[i - 1] == dims1[i - 1]) @@ -529,7 +529,7 @@ hsize_t diff_datasetid( hid_t did1, carry = 0; } /* i */ } /* elmtno */ - + H5Sclose(sm_space); /* free */ if (sm_buf1!=NULL) @@ -542,24 +542,24 @@ hsize_t diff_datasetid( hid_t did1, free(sm_buf2); sm_buf2=NULL; } - + } /* hyperslab read */ }/*cmp*/ - + /*------------------------------------------------------------------------- * compare attributes * the if condition refers to cases when the dataset is a referenced object *------------------------------------------------------------------------- */ - + if (obj1_name) nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + /* free */ if (buf1!=NULL) { @@ -581,8 +581,8 @@ hsize_t diff_datasetid( hid_t did1, free(sm_buf2); sm_buf2=NULL; } - - H5E_BEGIN_TRY + + H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); @@ -591,12 +591,12 @@ hsize_t diff_datasetid( hid_t did1, H5Tclose(m_tid1); H5Tclose(m_tid2); } H5E_END_TRY; - + return nfound; - + error: options->err_stat=1; - + /* free */ if (buf1!=NULL) { @@ -618,9 +618,9 @@ error: free(sm_buf2); sm_buf2=NULL; } - + /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); @@ -630,7 +630,7 @@ error: H5Tclose(m_tid2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -668,21 +668,21 @@ int diff_can_type( hid_t f_tid1, /* file data type */ int maxdim_diff=0; /* maximum dimensions are different */ int dim_diff=0; /* current dimensions are different */ int i; - + /*------------------------------------------------------------------------- * check for the same class *------------------------------------------------------------------------- */ - + if ((tclass1=H5Tget_class(f_tid1)) < 0) return -1; - + if ((tclass2=H5Tget_class(f_tid2)) < 0) return -1; - + if ( tclass1 != tclass2 ) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", obj1_name, get_class(tclass1), @@ -690,12 +690,12 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } return 0; } - + /*------------------------------------------------------------------------- * check for non supported classes *------------------------------------------------------------------------- */ - + assert(tclass1==tclass2); switch (tclass1) { @@ -709,21 +709,21 @@ int diff_can_type( hid_t f_tid1, /* file data type */ case H5T_ENUM: case H5T_VLEN: case H5T_REFERENCE: - + break; - + default: /*H5T_TIME */ if (options->m_verbose && obj1_name ) printf("Comparison not supported: <%s> and <%s> are of class %s\n", obj1_name,obj2_name,get_class(tclass2) ); return 0; } - + /*------------------------------------------------------------------------- * check for equal file datatype; warning only *------------------------------------------------------------------------- */ - + if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name) { printf("Warning: different storage datatype\n"); @@ -734,15 +734,15 @@ int diff_can_type( hid_t f_tid1, /* file data type */ print_type(f_tid2); printf("\n"); } - + /*------------------------------------------------------------------------- * check for the same rank *------------------------------------------------------------------------- */ - + if ( rank1 != rank2 ) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); @@ -756,12 +756,12 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } return 0; } - + /*------------------------------------------------------------------------- * check for different dimensions *------------------------------------------------------------------------- */ - + assert(rank1==rank2); for ( i=0; i<rank1; i++) { @@ -773,19 +773,19 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( dims1[i] != dims2[i] ) dim_diff=1; } - + /*------------------------------------------------------------------------- * current dimensions *------------------------------------------------------------------------- */ - + if (dim_diff==1) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); - if (maxdim1 && maxdim2) + if (maxdim1 && maxdim2) { printf(", max dimensions "); print_dimensions(rank1,maxdim1); @@ -798,14 +798,14 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } return 0; } - + /*------------------------------------------------------------------------- * maximum dimensions; just give a warning *------------------------------------------------------------------------- */ if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name ) { - if (options->m_verbose) + if (options->m_verbose) { printf( "Warning: different maximum dimensions\n"); printf("<%s> has max dimensions ", obj1_name); @@ -816,7 +816,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ printf("\n"); } } - + return 1; } @@ -878,7 +878,7 @@ void print_sizes( const char *obj1, /*------------------------------------------------------------------------- * Function: print_size * - * Purpose: print dimensions + * Purpose: print dimensions * *------------------------------------------------------------------------- */ @@ -896,7 +896,7 @@ print_size (int rank, hsize_t *dims) } parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]); parallel_print("]\n" ); - + } #endif /* H5DIFF_DEBUG */ diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 4cddbfb..f1e5f54 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -93,7 +93,7 @@ void parallel_print(const char* format, ...) /*------------------------------------------------------------------------- * Function: print_dimensions * - * Purpose: print dimensions + * Purpose: print dimensions * *------------------------------------------------------------------------- */ @@ -110,7 +110,7 @@ print_dimensions (int rank, hsize_t *dims) } parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]); parallel_print("]" ); - + } @@ -192,7 +192,7 @@ void print_type(hid_t type) printf("undefined integer"); } break; - + case H5T_FLOAT: if (H5Tequal(type, H5T_IEEE_F32BE)) { printf("H5T_IEEE_F32BE"); @@ -214,7 +214,7 @@ void print_type(hid_t type) printf("undefined float"); } break; - + }/*switch*/ } @@ -233,19 +233,19 @@ const char* diff_basename(const char *name) { size_t i; - + if (name==NULL) return NULL; - + /* Find the end of the base name */ i = strlen(name); while (i>0 && '/'==name[i-1]) --i; - + /* Skip backward over base name */ while (i>0 && '/'!=name[i-1]) --i; - + return(name+i); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 120d433..71a2449 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -556,11 +556,11 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai *to the ctx->size_last_dim. */ /* binary dump */ - if(bin_output) + if(bin_output) { do_bin_output(stream, nelmts, type, _mem); } /* end if */ - else + else { /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -712,7 +712,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * * Select a hyperslab from the dataset DSET using the parameters * specified in SSET. Dump this out to STREAM. - * + * * Hyperslabs select "count" blocks of size "block", spaced "stride" elements * from each other, starting at coordinate "start". * @@ -727,22 +727,22 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * * Algorithm * - * In a inner loop, the parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices + * In a inner loop, the parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * An outer loop for cases where dimensionality is greater than 2D is made. - * In each iteration, the 2D block is displayed in the inner loop. The remaining + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * An outer loop for cases where dimensionality is greater than 2D is made. + * In each iteration, the 2D block is displayed in the inner loop. The remaining * slower dimensions above the first 2 are incremented one at a time in the outer loop * * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array + * Given an index I(z,y,x) its position from the beginning of an array * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x + * Position of I(z,y,x) = index_z * size_y * size_x * + index_y * size_x * + index_x - * + * *------------------------------------------------------------------------- */ static herr_t @@ -784,14 +784,14 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset hsize_t total_points = 1; /* to print */ hsize_t printed_points = 0; /* printed */ #endif - + ret = FAIL; /* be pessimistic */ f_space = H5Dget_space(dset); - + if (f_space == FAIL) goto done; - + /* * check that everything looks okay. the dimensionality must not be too * great and the dimensionality of the items selected for printing must @@ -838,7 +838,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset total_points *= sset->count[ i ] * sset->block[ i ];; } #endif - + /* initialize temporary start, count and maximum start */ @@ -857,55 +857,55 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset { max_start[ i ] = temp_start[ i ] + sset->count[ i ]; temp_count[ i ] = 1; - + } } - + /* offset loop */ for (n = 0; n < outer_count; n++) { - hsize_t row_counter = 0; + hsize_t row_counter = 0; /* number of read iterations in inner loop, read by rows, to match 2D display */ if (ctx.ndims > 1) { - + /* count is the number of iterations to display all the rows, the block size count times */ count = sset->count[ row_dim ] * sset->block[ row_dim ]; - + /* always 1 row_counter at a time, that is a block of size 1, 1 time */ - temp_count[ row_dim ] = 1; - temp_block[ row_dim ] = 1; - + temp_count[ row_dim ] = 1; + temp_block[ row_dim ] = 1; + /* advance 1 row_counter at a time */ if (sset->block[ row_dim ] > 1 ) temp_stride[ row_dim ] = 1; - - + + } /* for the 1D case */ else { count = 1; } - - + + size_row_block = sset->block[ row_dim ]; - + /* display loop */ - for (; count > 0; + for (; count > 0; temp_start[ row_dim ] += temp_stride[ row_dim ], count--) { - + /* jump rows if size of block exceeded cases where block > 1 only and stride > block */ - if ( size_row_block > 1 && + if ( size_row_block > 1 && row_counter == size_row_block && sset->stride[ row_dim ] > sset->block[ row_dim ] ) @@ -917,7 +917,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset temp_start[ row_dim ] += increase_rows; row_counter = 0; - + } row_counter++; @@ -930,32 +930,32 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset temp_count, temp_block); sm_nelmts = H5Sget_select_npoints(f_space); - + if (sm_nelmts == 0) { /* nothing to print */ ret = SUCCEED; goto done_close; } - + /* * determine the strip mine size and allocate a buffer. the strip mine is * a hyperslab whose size is manageable. */ sm_nbytes = p_type_nbytes = H5Tget_size(p_type); - + if (ctx.ndims > 0) for (i = ctx.ndims; i > 0; --i) { sm_size[i - 1] = MIN(total_size[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } - + assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ sm_buf = malloc((size_t)sm_nelmts * p_type_nbytes); sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - + H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL); - + /* read the data */ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { H5Sclose(f_space); @@ -963,43 +963,43 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset free(sm_buf); return FAIL; } - + /* print the data */ flags = START_OF_DATA; - + if (count == 1) flags |= END_OF_DATA; - + for (i = 0; i < ctx.ndims; i++) ctx.p_max_idx[i] = ctx.p_min_idx[i] + MIN(total_size[i], sm_size[i]); - + /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ H5Sget_select_bounds(f_space,low,high); elmtno=0; - for (i = 0; i < (size_t)ctx.ndims-1; i++) + for (i = 0; i < (size_t)ctx.ndims-1; i++) { hsize_t offset = 1; /* accumulation of the previous dimensions */ - for (j = i+1; j < (size_t)ctx.ndims; j++) + for (j = i+1; j < (size_t)ctx.ndims; j++) offset *= total_size[j]; elmtno+= low[i] * offset; } elmtno+= low[ctx.ndims - 1]; - + /* initialize the current stripmine position; this is necessary to print the array indices */ ctx.sm_pos = elmtno; - + h5tools_dump_simple_data(stream, info, dset, &ctx, flags, sm_nelmts, p_type, sm_buf); free(sm_buf); - + /* we need to jump to next line and update the index */ ctx.need_prefix = 1; - + ctx.continuation++; - - + + #if defined (SANITY_CHECK) printed_points += sm_nelmts; #endif @@ -1011,14 +1011,14 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset { /* dimension for start */ current_outer_dim = (ctx.ndims - 2) -1; - + /* set start to original from current_outer_dim up */ for (i = current_outer_dim + 1; i < ctx.ndims; i++) { temp_start[ i ] = sset->start[ i ]; } - + /* increment start dimension */ do { @@ -1037,9 +1037,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset } } while (current_outer_dim >= 0 && reset_dim); - + } /* ctx.ndims > 1 */ - + } /* outer_count */ #if defined (SANITY_CHECK) @@ -1053,9 +1053,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset putc('\n', stream); fputs(OPT(info->line_sep, ""), stream); } - + ret = SUCCEED; - + done_close: H5Sclose(f_space); done: @@ -1128,7 +1128,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, ctx.indent_level = indentlevel; ctx.need_prefix = 1; ctx.ndims = H5Sget_simple_extent_ndims(f_space); - + if ((size_t)ctx.ndims > NELMTS(sm_size)) { H5Sclose(f_space); return FAIL; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index dad73e7..fb24f76 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -40,7 +40,7 @@ #define H5TOOLS_BUFSIZE (1024 * 1024) #else #define H5TOOLS_BUFSIZE (1024) -#endif +#endif /* * Maximum size used in a call to malloc diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 80839ce..5d42307 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -338,7 +338,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)ctx->pos[i]); - + } } else { /* Scalar */ @@ -851,7 +851,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai obj = H5Rdereference(container, H5R_DATASET_REGION, vp); region = H5Rget_region(container, H5R_DATASET_REGION, vp); - + /* get name of the dataset the region reference points to using H5Rget_name */ H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*)ref_name, 1024); h5tools_str_append(str, info->dset_format, ref_name); diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index b4e6d08..bbd1b8d 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -75,7 +75,7 @@ h5tools_get_little_endian_type(hid_t tid) size = H5Tget_size(tid); sign = H5Tget_sign(tid); - switch( type_class ) + switch( type_class ) { case H5T_INTEGER: { @@ -88,7 +88,7 @@ h5tools_get_little_endian_type(hid_t tid) else if ( size == 8 && sign == H5T_SGN_2) p_type=H5Tcopy(H5T_STD_I64LE); else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8LE); + p_type=H5Tcopy(H5T_STD_U8LE); else if ( size == 2 && sign == H5T_SGN_NONE) p_type=H5Tcopy(H5T_STD_U16LE); else if ( size == 4 && sign == H5T_SGN_NONE) @@ -97,14 +97,14 @@ h5tools_get_little_endian_type(hid_t tid) p_type=H5Tcopy(H5T_STD_U64LE); } break; - + case H5T_FLOAT: if ( size == 4) p_type=H5Tcopy(H5T_IEEE_F32LE); else if ( size == 8) p_type=H5Tcopy(H5T_IEEE_F64LE); break; - + case H5T_TIME: case H5T_BITFIELD: case H5T_OPAQUE: @@ -115,10 +115,10 @@ h5tools_get_little_endian_type(hid_t tid) case H5T_VLEN: case H5T_ARRAY: break; - + default: break; - + } return(p_type); @@ -152,7 +152,7 @@ h5tools_get_big_endian_type(hid_t tid) size = H5Tget_size(tid); sign = H5Tget_sign(tid); - switch( type_class ) + switch( type_class ) { case H5T_INTEGER: { @@ -165,7 +165,7 @@ h5tools_get_big_endian_type(hid_t tid) else if ( size == 8 && sign == H5T_SGN_2) p_type=H5Tcopy(H5T_STD_I64BE); else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8BE); + p_type=H5Tcopy(H5T_STD_U8BE); else if ( size == 2 && sign == H5T_SGN_NONE) p_type=H5Tcopy(H5T_STD_U16BE); else if ( size == 4 && sign == H5T_SGN_NONE) @@ -174,14 +174,14 @@ h5tools_get_big_endian_type(hid_t tid) p_type=H5Tcopy(H5T_STD_U64BE); } break; - + case H5T_FLOAT: if ( size == 4) p_type=H5Tcopy(H5T_IEEE_F32BE); else if ( size == 8) p_type=H5Tcopy(H5T_IEEE_F64BE); break; - + case H5T_TIME: case H5T_BITFIELD: case H5T_OPAQUE: @@ -192,13 +192,13 @@ h5tools_get_big_endian_type(hid_t tid) case H5T_VLEN: case H5T_ARRAY: break; - + default: break; - + } - + return(p_type); } |