diff options
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 60 | ||||
-rw-r--r-- | tools/lib/h5diff.h | 240 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 928 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 80 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 132 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 72 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 50 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 24 | ||||
-rw-r--r-- | tools/lib/h5tools_filters.c | 46 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 28 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 28 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.h | 4 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 134 | ||||
-rw-r--r-- | tools/lib/h5trav.h | 28 | ||||
-rw-r--r-- | tools/lib/h5trav_table.c | 50 | ||||
-rw-r--r-- | tools/lib/ph5diff.h | 6 |
16 files changed, 955 insertions, 955 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 1529730..037a7bb 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -75,7 +75,7 @@ void print_manager_output(void) /* If there was something we buffered, let's print it now */ if( (outBuffOffset>0) && g_Parallel) { - printf("%s", outBuff); + printf("%s", outBuff); if(overflow_file) { @@ -121,7 +121,7 @@ static void print_incoming_data(void) MPI_Status Status; do - { + { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &incomingMessage, &Status); if(incomingMessage) { @@ -160,11 +160,11 @@ h5diff (const char *fname1, int nobjects1, nobjects2; trav_info_t *info1 = NULL; trav_info_t *info2 = NULL; - hid_t file1_id=(-1), file2_id=(-1); + hid_t file1_id=(-1), file2_id=(-1); char filenames[2][1024]; hsize_t nfound = 0; int not_cmp = 0; - + memset(filenames, 0, 1024*2); @@ -276,10 +276,10 @@ h5diff (const char *fname1, * object name was supplied *------------------------------------------------------------------------- */ - + if (objname1) { - + #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -348,8 +348,8 @@ out: /*------------------------------------------------------------------------- * Function: diff_match * - * Purpose: Find common objects; the algorithm used for this search is the - * cosequential match algorithm and is described in + * Purpose: Find common objects; the algorithm used for this search is the + * cosequential match algorithm and is described in * Folk, Michael; Zoellick, Bill. (1992). File Structures. Addison-Wesley. * * Return: Number of differences found @@ -357,7 +357,7 @@ out: * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: May 9, 2003 - * + * * Modifications: Jan 2005 Leon Arber, larber@uiuc.edu * Added support for parallel diffing * @@ -481,7 +481,7 @@ diff_match (hid_t file1_id, struct diff_args args; int havePrintToken = 1; MPI_Status Status; - + /*set all tasks as free */ memset(workerTasks, 1, g_nTasks-1); #endif @@ -512,13 +512,13 @@ diff_match (hid_t file1_id, * may not work in non-homogeneous MPI environments. */ - /*Set up args to pass to worker task. */ + /*Set up args to pass to worker task. */ if(strlen(table->objs[i].name) > 255) { printf("The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); } - + strcpy(args.name, table->objs[i].name); args.options = *options; args.type= table->objs[i].type; @@ -571,11 +571,11 @@ diff_match (hid_t file1_id, } /* Print all the data in our incoming queue */ - print_incoming_data(); + print_incoming_data(); } /* check array of tasks to see which ones are free. - * Manager task never does work, so freeTasks[0] is really + * Manager task never does work, so freeTasks[0] is really * worker task 0. */ for(n=1; (n<g_nTasks) && !workerFound; n++) @@ -613,7 +613,7 @@ diff_match (hid_t file1_id, else { /* But first print all the data in our incoming queue */ - print_incoming_data(); + print_incoming_data(); MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); if(Status.MPI_TAG == MPI_TAG_DONE) @@ -670,7 +670,7 @@ diff_match (hid_t file1_id, else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) { MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); - if(havePrintToken) + if(havePrintToken) { MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD); MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); @@ -700,9 +700,9 @@ diff_match (hid_t file1_id, { char data[PRINT_DATA_MAX_SIZE+1]; memset(data, 0, PRINT_DATA_MAX_SIZE+1); - + MPI_Recv(data, PRINT_DATA_MAX_SIZE, MPI_CHAR, Status.MPI_SOURCE, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD, &Status); - + printf("%s", data); } else @@ -729,7 +729,7 @@ diff_match (hid_t file1_id, /*------------------------------------------------------------------------- * do the diff for the root. - * this is a special case, we get an ID for the root group and call diff() + * this is a special case, we get an ID for the root group and call diff() * with this ID; it compares only the root group attributes *------------------------------------------------------------------------- */ @@ -819,10 +819,10 @@ diff_compare (hid_t file1_id, * * Purpose: switch between types and choose the diff function * TYPE is either - * H5G_LINK Object is a symbolic link - * H5G_GROUP Object is a group - * H5G_DATASET Object is a dataset - * H5G_TYPE Object is a named data type + * H5G_LINK Object is a symbolic link + * H5G_GROUP Object is a group + * H5G_DATASET Object is a dataset + * H5G_TYPE Object is a named data type * * Return: Number of differences found * @@ -864,10 +864,10 @@ diff (hid_t file1_id, if (options->m_verbose) { if (print_objname (options, (hsize_t)1)) - parallel_print("Dataset: <%s> and <%s>\n", path1, path2); + parallel_print("Dataset: <%s> and <%s>\n", path1, path2); nfound = diff_dataset (file1_id, file2_id, path1, path2, options); /* always print the number of differences found */ - print_found(nfound); + print_found(nfound); } /*------------------------------------------------------------------------- * non verbose, check first if we have differences @@ -887,9 +887,9 @@ diff (hid_t file1_id, if (print_objname (options, nfound)) parallel_print("Dataset: <%s> and <%s>\n", path1, path2); nfound = diff_dataset (file1_id, file2_id, path1, path2, options); - /* print the number of differences found only when found + /* print the number of differences found only when found this is valid for the default mode and report mode */ - print_found(nfound); + print_found(nfound); } /*if nfound */ } /*if quiet */ @@ -902,7 +902,7 @@ diff (hid_t file1_id, nfound = diff_dataset (file1_id, file2_id, path1, path2, options); } } /*else verbose */ - + break; /*------------------------------------------------------------------------- @@ -934,7 +934,7 @@ diff (hid_t file1_id, *------------------------------------------------------------------------- */ if (path1) - diff_attr (type1_id, type2_id, path1, path2, options); + diff_attr (type1_id, type2_id, path1, path2, options); if (H5Tclose (type1_id) < 0) goto out; @@ -1029,7 +1029,7 @@ diff (hid_t file1_id, parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", path1, path2, get_type (type)); options->not_cmp=1; - } + } break; } diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index a307cb8..9f0a0dc 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -77,10 +77,10 @@ typedef struct { extern "C" { #endif -hsize_t h5diff(const char *fname1, - const char *fname2, - const char *objname1, - const char *objname2, +hsize_t h5diff(const char *fname1, + const char *fname2, + const char *objname1, + const char *objname2, diff_opt_t *options); #ifdef H5_HAVE_PARALLEL @@ -100,75 +100,75 @@ void print_manager_output(void); */ -hsize_t diff_dataset( hid_t file1_id, - hid_t file2_id, - const char *obj1_name, +hsize_t diff_dataset( hid_t file1_id, + hid_t file2_id, + const char *obj1_name, const char *obj2_name, diff_opt_t *options ); -hsize_t diff_datasetid( hid_t dset1_id, - hid_t dset2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_datasetid( hid_t dset1_id, + hid_t dset2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ); -hsize_t diff( hid_t file1_id, - const char *path1, - hid_t file2_id, - const char *path2, - diff_opt_t *options, +hsize_t diff( hid_t file1_id, + const char *path1, + hid_t file2_id, + const char *path2, + diff_opt_t *options, H5G_obj_t type ); -hsize_t diff_compare( hid_t file1_id, - const char *file1_name, - const char *obj1_name, - int nobjects1, +hsize_t diff_compare( hid_t file1_id, + const char *file1_name, + const char *obj1_name, + int nobjects1, trav_info_t *info1, - hid_t file2_id, - const char *file2_name, - const char *obj2_name, - int nobjects2, + hid_t file2_id, + const char *file2_name, + const char *obj2_name, + int nobjects2, trav_info_t *info2, diff_opt_t *options ); -hsize_t diff_match( hid_t file1_id, - int nobjects1, +hsize_t diff_match( hid_t file1_id, + int nobjects1, trav_info_t *info1, - hid_t file2_id, - int nobjects2, - trav_info_t *info2, + hid_t file2_id, + int nobjects2, + trav_info_t *info2, diff_opt_t *options ); -hsize_t diff_array( void *_mem1, - void *_mem2, - hsize_t nelmts, - int rank, - hsize_t *dims, - diff_opt_t *options, - const char *name1, +hsize_t diff_array( void *_mem1, + void *_mem2, + hsize_t nelmts, + int rank, + hsize_t *dims, + diff_opt_t *options, + const char *name1, const char *name2, hid_t m_type, hid_t container1_id, hid_t container2_id); /* dataset where the reference came from*/ -int diff_can_type( hid_t f_type1, /* file data type */ +int diff_can_type( hid_t f_type1, /* file data type */ hid_t f_type2, /* file data type */ - int rank1, + int rank1, int rank2, - hsize_t *dims1, + hsize_t *dims1, hsize_t *dims2, - hsize_t *maxdim1, + hsize_t *maxdim1, hsize_t *maxdim2, - const char *obj1_name, - const char *obj2_name, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ); -int diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, +int diff_attr(hid_t loc1_id, + hid_t loc2_id, + const char *path1, + const char *path2, diff_opt_t *options ); @@ -186,13 +186,13 @@ const char* get_type(int type); const char* get_class(H5T_class_t tclass); const char* get_sign(H5T_sign_t sign); void print_dims( int r, hsize_t *d ); -void print_pos( int *ph, - int per, - hsize_t curr_pos, - hsize_t *acc, - hsize_t *pos, - int rank, - const char *obj1, +void print_pos( int *ph, + int per, + hsize_t curr_pos, + hsize_t *acc, + hsize_t *pos, + int rank, + const char *obj1, const char *obj2 ); int print_objname(diff_opt_t *options, hsize_t nfound); @@ -207,172 +207,172 @@ void print_sizes( const char *obj1, const char *obj2, hsize_t diff_native_uchar(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_char(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); -hsize_t diff_datum(void *_mem1, - void *_mem2, +hsize_t diff_datum(void *_mem1, + void *_mem2, hid_t m_type, - hsize_t i, - int rank, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *options, - const char *obj1, + hsize_t i, + int rank, + hsize_t *acc, + hsize_t *pos, + diff_opt_t *options, + const char *obj1, const char *obj2, hid_t container1_id, hid_t container2_id, /*where the reference came from*/ - int *ph); /*print header */ + int *ph); /*print header */ hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph); diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 3632cdb..dd4784d 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -15,7 +15,7 @@ #include <math.h> #include "h5diff.h" #include "ph5diff.h" -#include "H5private.h" +#include "H5private.h" /* local functions */ static void close_obj(H5G_obj_t obj_type, hid_t obj_id); @@ -30,7 +30,7 @@ static hbool_t is_zero(const void *_mem, size_t size); *------------------------------------------------------------------------- */ static int print_data(diff_opt_t *options) -{ +{ return ( (options->m_report || options->m_verbose) && !options->m_quiet)?1:0; } @@ -45,22 +45,22 @@ static int print_data(diff_opt_t *options) * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: November 12, 2003 - * + * *------------------------------------------------------------------------- */ -hsize_t diff_array( void *_mem1, - void *_mem2, - hsize_t nelmts, - int rank, - hsize_t *dims, - diff_opt_t *options, - const char *name1, +hsize_t diff_array( void *_mem1, + void *_mem2, + hsize_t nelmts, + int rank, + hsize_t *dims, + diff_opt_t *options, + const char *name1, const char *name2, hid_t m_type, hid_t container1_id, hid_t container2_id) /* dataset where the reference came from*/ -{ +{ hsize_t nfound=0; /* number of differences found */ size_t size; /* size of datum */ unsigned char *mem1 = (unsigned char*)_mem1; @@ -85,13 +85,13 @@ hsize_t diff_array( void *_mem1, pos[j]=0; - if(H5Tis_variable_str(m_type)) + if(H5Tis_variable_str(m_type)) { - tmp1 = ((unsigned char**)mem1)[0]; - tmp2 = ((unsigned char**)mem2)[0]; + tmp1 = ((unsigned char**)mem1)[0]; + tmp2 = ((unsigned char**)mem2)[0]; nfound+=diff_datum( tmp1, - tmp2, + tmp2, m_type, (hsize_t)0, rank, @@ -109,16 +109,16 @@ hsize_t diff_array( void *_mem1, { - switch (H5Tget_class(m_type)) + switch (H5Tget_class(m_type)) { default: assert(0); break; case H5T_FLOAT: - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) nfound=diff_float(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) nfound=diff_double(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); break; @@ -126,23 +126,23 @@ hsize_t diff_array( void *_mem1, if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) nfound=diff_schar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) nfound=diff_uchar(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) nfound=diff_short(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) nfound=diff_ushort(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_INT)) + else if (H5Tequal(m_type, H5T_NATIVE_INT)) nfound=diff_int(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) nfound=diff_uint(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) nfound=diff_long(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) nfound=diff_ulong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) nfound=diff_llong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) nfound=diff_ullong(mem1,mem2,nelmts,rank,acc,pos,options,name1,name2,&ph); break; @@ -198,7 +198,7 @@ hsize_t diff_array( void *_mem1, * The compare of the 2 buffers read from the files is made datum by datum. * * H5T_INTEGER and H5T_FLOAT - * Copy the buffer into a compatible local datum and do a numerical + * Copy the buffer into a compatible local datum and do a numerical * compare of this datum * H5T_COMPOUND * Recursively call this function for each member @@ -207,34 +207,34 @@ hsize_t diff_array( void *_mem1, * H5T_VLEN * Recursively call this function for each element * H5T_STRING - * compare byte by byte in a cycle from 0 to type_size. this type_size is the - * value obtained by the get_size function but it is the string lenght for + * compare byte by byte in a cycle from 0 to type_size. this type_size is the + * value obtained by the get_size function but it is the string lenght for * variable sized strings * H5T_OPAQUE * compare byte by byte in a cycle from 0 to type_size * H5T_BITFIELD * compare byte by byte in a cycle from 0 to type_size * H5T_ENUM - * for each pair of elements being compared, both bit patterns are converted to + * for each pair of elements being compared, both bit patterns are converted to * their corresponding enumeration constant and a string comparison is made * H5T_REFERENCE - * Dereference the object and compare the type (basic object type). + * Dereference the object and compare the type (basic object type). *------------------------------------------------------------------------- */ -hsize_t diff_datum(void *_mem1, - void *_mem2, +hsize_t diff_datum(void *_mem1, + void *_mem2, hid_t m_type, - hsize_t i, - int rank, - hsize_t *acc, - hsize_t *pos, - diff_opt_t *options, - const char *obj1, + hsize_t i, + int rank, + hsize_t *acc, + hsize_t *pos, + diff_opt_t *options, + const char *obj1, const char *obj2, hid_t container1_id, hid_t container2_id, /*where the reference came from*/ - int *ph) /*print header */ + int *ph) /*print header */ { static char fmt_llong[255]; static char fmt_ullong[255]; @@ -245,7 +245,7 @@ hsize_t diff_datum(void *_mem1, unsigned char *mem2 = (unsigned char*)_mem2; unsigned u; hid_t memb_type; - size_t type_size; + size_t type_size; size_t offset; int nmembs; int j; @@ -266,20 +266,20 @@ hsize_t diff_datum(void *_mem1, if (!fmt_llong[0]) { /* Build default formats for long long types */ - sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", + sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullong, "%%%su %%%su %%%su\n", + sprintf(fmt_ullong, "%%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", + sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", + sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); } type_size = H5Tget_size( m_type ); - switch (H5Tget_class(m_type)) + switch (H5Tget_class(m_type)) { default: assert(0); @@ -294,7 +294,7 @@ hsize_t diff_datum(void *_mem1, */ case H5T_COMPOUND: nmembs = H5Tget_nmembers(m_type); - for (j = 0; j < nmembs; j++) + for (j = 0; j < nmembs; j++) { offset = H5Tget_member_offset(m_type, (unsigned)j); memb_type = H5Tget_member_type(m_type, (unsigned)j); @@ -322,11 +322,11 @@ hsize_t diff_datum(void *_mem1, */ case H5T_STRING: { - + H5T_str_t pad; char *s; - - if(H5Tis_variable_str(m_type)) + + if(H5Tis_variable_str(m_type)) { /* mem1 is the pointer into the struct where a `char*' is stored. So we have * to dereference the pointer to get the `char*' to pass to HDstrlen(). */ @@ -334,14 +334,14 @@ hsize_t diff_datum(void *_mem1, if(s!=NULL) size = HDstrlen(s); } - else + else { s = mem1; size = H5Tget_size(m_type); } - + pad = H5Tget_strpad(m_type); - + /* check for NULL pointer for string */ if(s!=NULL) for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++) @@ -349,14 +349,14 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); - + } break; @@ -372,11 +372,11 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); @@ -394,11 +394,11 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); @@ -413,7 +413,7 @@ hsize_t diff_datum(void *_mem1, /* For enumeration types we compare the names instead of the integer values. For each pair of elements being - compared, we convert both bit patterns to their corresponding + compared, we convert both bit patterns to their corresponding enumeration constant and do a string comparison */ { @@ -429,7 +429,7 @@ hsize_t diff_datum(void *_mem1, if (HDstrcmp(enum_name1,enum_name2)!=0) { nfound=1; - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -443,11 +443,11 @@ hsize_t diff_datum(void *_mem1, mem1 + u, mem2 + u, /* offset */ i, /* index position */ - rank, + rank, acc, pos, - options, - obj1, + options, + obj1, obj2, ph); } @@ -473,7 +473,7 @@ hsize_t diff_datum(void *_mem1, /* calculate the number of array elements */ for (u = 0, nelmts = 1; u <ndims; u++) nelmts *= dims[u]; - for (u = 0; u < nelmts; u++) + for (u = 0; u < nelmts; u++) nfound+=diff_datum( mem1 + u * size, mem2 + u * size, /* offset */ @@ -504,7 +504,7 @@ hsize_t diff_datum(void *_mem1, /* get the number of sequence elements */ nelmts = ((hvl_t *)mem1)->len; - for (j = 0; j < (int)nelmts; j++) + for (j = 0; j < (int)nelmts; j++) nfound+=diff_datum( ((char *)(((hvl_t *)mem1)->p)) + j * size, ((char *)(((hvl_t *)mem2)->p)) + j * size, /* offset */ @@ -542,7 +542,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) + if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) { hid_t region1_id; hid_t region2_id; @@ -583,7 +583,7 @@ hsize_t diff_datum(void *_mem1, * Object references. get the type and OID of the referenced object *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) + else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) { if ((obj1_type = H5Rget_obj_type(container1_id, H5R_OBJECT, _mem1))<0) @@ -622,7 +622,7 @@ hsize_t diff_datum(void *_mem1, options); break; default: - parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>", + parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>", obj1, obj2); options->not_cmp=1; break; @@ -646,7 +646,7 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) { char temp1_char; char temp2_char; @@ -658,7 +658,7 @@ hsize_t diff_datum(void *_mem1, { if (abs(temp1_char-temp2_char) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -672,7 +672,7 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -684,10 +684,10 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && + if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && abs(temp1_char-temp2_char) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -698,7 +698,7 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_char != temp2_char) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -713,7 +713,7 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_UCHAR *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) + else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) { unsigned char temp1_uchar; unsigned char temp2_uchar; @@ -726,7 +726,7 @@ hsize_t diff_datum(void *_mem1, { if (abs(temp1_uchar-temp2_uchar) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -740,7 +740,7 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -752,10 +752,10 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -766,7 +766,7 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -797,7 +797,7 @@ hsize_t diff_datum(void *_mem1, { if (abs(temp1_short-temp2_short) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -811,7 +811,7 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -823,10 +823,10 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && + if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && abs(temp1_short-temp2_short) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -838,7 +838,7 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_short != temp2_short) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -870,7 +870,7 @@ hsize_t diff_datum(void *_mem1, if (abs(temp1_ushort-temp2_ushort) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -885,7 +885,7 @@ hsize_t diff_datum(void *_mem1, if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -898,11 +898,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && abs(temp1_ushort-temp2_ushort) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -915,7 +915,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_ushort != temp2_ushort) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -933,7 +933,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_INT)) + else if (H5Tequal(m_type, H5T_NATIVE_INT)) { int temp1_int; int temp2_int; @@ -947,7 +947,7 @@ hsize_t diff_datum(void *_mem1, if (abs(temp1_int-temp2_int) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -961,11 +961,11 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), abs(1-temp2_int/temp1_int)); } @@ -975,14 +975,14 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && + if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && abs(temp1_int-temp2_int) > options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_int,temp2_int,abs(temp1_int-temp2_int), abs(1-temp2_int/temp1_int)); } @@ -991,8 +991,8 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_int != temp2_int) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1000,8 +1000,8 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_INT*/ @@ -1009,13 +1009,13 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_UINT *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_UINT)) + + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) { unsigned int temp1_uint; unsigned int temp2_uint; assert(type_size==sizeof(int)); - + memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); /* -d and !-p */ @@ -1023,8 +1023,8 @@ hsize_t diff_datum(void *_mem1, { if (abs((int)(temp1_uint-temp2_uint)) > options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1038,11 +1038,11 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), abs((int)(1-temp2_uint/temp1_uint))); } @@ -1052,14 +1052,14 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options->percent && + if ( temp1_uint!=0 && abs((int)(1-temp2_uint/temp1_uint)) > options->percent && abs((int)(temp1_uint-temp2_uint)) > options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)), abs((int)(1-temp2_uint/temp1_uint))); } @@ -1069,7 +1069,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_uint != temp2_uint) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -1088,13 +1088,13 @@ hsize_t diff_datum(void *_mem1, * H5T_NATIVE_LONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_LONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) { long temp1_long; long temp2_long; assert(type_size==sizeof(long)); - + memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); /* -d and !-p */ @@ -1102,8 +1102,8 @@ hsize_t diff_datum(void *_mem1, { if (labs(temp1_long-temp2_long) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1117,8 +1117,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1130,11 +1130,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options->percent && + if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > (long)options->percent && labs(temp1_long-temp2_long) > (long)options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1146,7 +1146,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_long != temp2_long) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1155,21 +1155,21 @@ hsize_t diff_datum(void *_mem1, nfound++; } - - + + } /*H5T_NATIVE_LONG*/ /*------------------------------------------------------------------------- * H5T_NATIVE_ULONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) { unsigned long temp1_ulong; unsigned long temp2_ulong; assert(type_size==sizeof(unsigned long)); - + memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); /* -d and !-p */ @@ -1177,8 +1177,8 @@ hsize_t diff_datum(void *_mem1, { if (labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1192,8 +1192,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1205,11 +1205,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options->percent && + if ( temp1_ulong!=0 && labs((long)(1-temp2_ulong/temp1_ulong)) > (long)options->percent && labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1221,7 +1221,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_ulong != temp2_ulong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1229,21 +1229,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_ULONG*/ /*------------------------------------------------------------------------- * H5T_NATIVE_LLONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) { long_long temp1_llong; long_long temp2_llong; assert(type_size==sizeof(long_long)); - + memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); /* -d and !-p */ @@ -1251,8 +1251,8 @@ hsize_t diff_datum(void *_mem1, { if (labs((long)(temp1_llong-temp2_llong)) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1266,8 +1266,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1279,11 +1279,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent && + if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > (long)options->percent && labs((long)(temp1_llong-temp2_llong)) > (long)options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1295,7 +1295,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_llong != temp2_llong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -1304,21 +1304,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_LLONG*/ /*------------------------------------------------------------------------- * H5T_NATIVE_ULLONG *------------------------------------------------------------------------- */ - - else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) + + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) { unsigned long_long temp1_ullong; unsigned long_long temp2_ullong; assert(type_size==sizeof(unsigned long_long)); - + memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); /* -d and !-p */ @@ -1326,8 +1326,8 @@ hsize_t diff_datum(void *_mem1, { if (labs((long)(temp1_ullong-temp2_ullong)) > (long)options->delta) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1341,8 +1341,8 @@ hsize_t diff_datum(void *_mem1, { if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options->percent ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1354,14 +1354,14 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options->percent && + if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > (long)options->percent && labs((long)(temp1_ullong-temp2_ullong)) > (long)options->delta ) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); - + parallel_print(SPACES); parallel_print(fmt_ullongp,temp1_ullong,temp2_ullong, (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)), (unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong))); } @@ -1370,8 +1370,8 @@ hsize_t diff_datum(void *_mem1, } else if (temp1_ullong != temp2_ullong) { - - if ( print_data(options) ) + + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1379,10 +1379,10 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_ULLONG*/ - + break; /* H5T_INTEGER class */ case H5T_FLOAT: @@ -1391,7 +1391,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) + if (H5Tequal(m_type, H5T_NATIVE_FLOAT)) { float temp1_float; float temp2_float; @@ -1407,7 +1407,7 @@ hsize_t diff_datum(void *_mem1, if (fabs(temp1_float-temp2_float) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1422,7 +1422,7 @@ hsize_t diff_datum(void *_mem1, if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1431,15 +1431,15 @@ hsize_t diff_datum(void *_mem1, nfound++; } } - + /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && + if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && fabs(temp1_float-temp2_float) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -1452,7 +1452,7 @@ hsize_t diff_datum(void *_mem1, else if (temp1_float != temp2_float) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); @@ -1469,7 +1469,7 @@ hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) { double temp1_double; double temp2_double; @@ -1483,7 +1483,7 @@ hsize_t diff_datum(void *_mem1, if (fabs(temp1_double-temp2_double) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1498,7 +1498,7 @@ hsize_t diff_datum(void *_mem1, if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1510,11 +1510,11 @@ hsize_t diff_datum(void *_mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && + if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); @@ -1527,13 +1527,13 @@ hsize_t diff_datum(void *_mem1, else if (temp1_double != temp2_double) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); parallel_print(FFORMAT,temp1_double,temp2_double,fabs(temp1_double-temp2_double)); - + } nfound++; } @@ -1567,12 +1567,12 @@ hsize_t diff_datum(void *_mem1, hsize_t diff_native_uchar(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) { @@ -1588,7 +1588,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, { if (abs(temp1_uchar-temp2_uchar) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1602,7 +1602,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, { if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1614,10 +1614,10 @@ hsize_t diff_native_uchar(unsigned char *mem1, /* -d and -p */ else if ( options->d && options->p) { - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1628,7 +1628,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, } else if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1638,7 +1638,7 @@ hsize_t diff_native_uchar(unsigned char *mem1, } return nfound; -} +} /*------------------------------------------------------------------------- @@ -1657,12 +1657,12 @@ hsize_t diff_native_uchar(unsigned char *mem1, hsize_t diff_char(unsigned char *mem1, unsigned char *mem2, - hsize_t i, - int rank, - hsize_t *acc, + hsize_t i, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) { @@ -1675,7 +1675,7 @@ hsize_t diff_char(unsigned char *mem1, if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1685,7 +1685,7 @@ hsize_t diff_char(unsigned char *mem1, } return nfound; -} +} @@ -1703,11 +1703,11 @@ static hbool_t is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *)_mem; - + while (size-- > 0) if (mem[size]) return FALSE; - + return TRUE; } @@ -1719,10 +1719,10 @@ is_zero(const void *_mem, size_t size) *------------------------------------------------------------------------- */ -static +static void close_obj(H5G_obj_t obj_type, hid_t obj_id) { - + switch (obj_type) { case H5G_GROUP: H5Gclose(obj_id); @@ -1764,7 +1764,7 @@ static int diff_region(hid_t region1_id, hid_t region2_id) #if defined (H5DIFF_DEBUG) int i; #endif - + /* * These two functions fail if the region does not have blocks or points, * respectively. They do not currently know how to translate from one to @@ -1780,9 +1780,9 @@ static int diff_region(hid_t region1_id, hid_t region2_id) if (nblocks1!=nblocks2 || npoints1!=npoints2 || ndims1!=ndims2) return 1; - + /* compare block information */ - if (nblocks1 > 0) + if (nblocks1 > 0) { alloc_size = nblocks1 * ndims1 * 2 * sizeof(ptdata1[0]); @@ -1799,30 +1799,30 @@ static int diff_region(hid_t region1_id, hid_t region2_id) ret=HDmemcmp(ptdata1,ptdata2,(size_t)alloc_size); #if defined (H5DIFF_DEBUG) - for (i = 0; i < nblocks1; i++) + for (i = 0; i < nblocks1; i++) { int j; - + /* start coordinates and opposite corner */ for (j = 0; j < ndims1; j++) parallel_print("%s%lu", j ? "," : "(", (unsigned long)ptdata1[i * 2 * ndims1 + j]); - + for (j = 0; j < ndims1; j++) parallel_print("%s%lu", j ? "," : ")-(", (unsigned long)ptdata1[i * 2 * ndims1 + j + ndims1]); - + parallel_print(")\n"); } -#endif - - +#endif + + HDfree(ptdata1); HDfree(ptdata2); } - + /* Print point information */ - if (npoints1 > 0) + if (npoints1 > 0) { alloc_size = npoints1 * ndims1 * sizeof(ptdata1[0]); assert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/ @@ -1834,30 +1834,30 @@ static int diff_region(hid_t region1_id, hid_t region2_id) ptdata2 = malloc((size_t)alloc_size); H5_CHECK_OVERFLOW(npoints1,hssize_t,hsize_t); H5Sget_select_elem_pointlist(region2_id, (hsize_t)0, (hsize_t)npoints2, ptdata2); - + ret=HDmemcmp(ptdata1,ptdata2,(size_t)alloc_size); #if defined (H5DIFF_DEBUG) - for (i = 0; i < npoints1; i++) + for (i = 0; i < npoints1; i++) { int j; - + parallel_print("%sPt%lu: " , i ? "," : "", (unsigned long)i); - + for (j = 0; j < ndims1; j++) parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata1[i * ndims1 + j])); - + parallel_print(")"); } -#endif - +#endif + HDfree(ptdata1); HDfree(ptdata2); } - + return ret; } @@ -1875,11 +1875,11 @@ static int diff_region(hid_t region1_id, hid_t region2_id) hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) @@ -1901,7 +1901,7 @@ hsize_t diff_float(unsigned char *mem1, if (fabs(temp1_float-temp2_float) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1927,7 +1927,7 @@ hsize_t diff_float(unsigned char *mem1, if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1941,7 +1941,7 @@ hsize_t diff_float(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -1952,10 +1952,10 @@ hsize_t diff_float(unsigned char *mem1, memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && + if ( temp1_float!=0 && fabs(1-temp2_float/temp1_float) > options->percent && fabs(temp1_float-temp2_float) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -1969,8 +1969,8 @@ hsize_t diff_float(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -1980,7 +1980,7 @@ hsize_t diff_float(unsigned char *mem1, if (temp1_float != temp2_float) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2014,11 +2014,11 @@ hsize_t diff_float(unsigned char *mem1, hsize_t diff_double(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) @@ -2041,7 +2041,7 @@ hsize_t diff_double(unsigned char *mem1, if (fabs(temp1_double-temp2_double) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2067,7 +2067,7 @@ hsize_t diff_double(unsigned char *mem1, if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2081,7 +2081,7 @@ hsize_t diff_double(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -2092,10 +2092,10 @@ hsize_t diff_double(unsigned char *mem1, memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && + if ( temp1_double!=0 && fabs(1-temp2_double/temp1_double) > options->percent && fabs(temp1_double-temp2_double) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2109,8 +2109,8 @@ hsize_t diff_double(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -2120,7 +2120,7 @@ hsize_t diff_double(unsigned char *mem1, if (temp1_double != temp2_double) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2155,33 +2155,33 @@ hsize_t diff_double(unsigned char *mem1, hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ char temp1_char; char temp2_char; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (abs(temp1_char-temp2_char) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2195,19 +2195,19 @@ hsize_t diff_schar(unsigned char *mem1, return nfound; } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2221,21 +2221,21 @@ hsize_t diff_schar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - - if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && + + if ( temp1_char!=0 && abs(1-temp2_char/temp1_char) > options->percent && abs(temp1_char-temp2_char) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2249,19 +2249,19 @@ hsize_t diff_schar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (temp1_char != temp2_char) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2269,15 +2269,15 @@ hsize_t diff_schar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(char); mem2+=sizeof(char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2295,33 +2295,33 @@ hsize_t diff_schar(unsigned char *mem1, hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned char temp1_uchar; unsigned char temp2_uchar; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (abs(temp1_uchar-temp2_uchar) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2334,21 +2334,21 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2362,21 +2362,21 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - } - + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && + + if ( temp1_uchar!=0 && abs(1-temp2_uchar/temp1_uchar) > options->percent && abs(temp1_uchar-temp2_uchar) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2390,19 +2390,19 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (temp1_uchar != temp2_uchar) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2410,15 +2410,15 @@ hsize_t diff_uchar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned char); mem2+=sizeof(unsigned char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2437,33 +2437,33 @@ hsize_t diff_uchar(unsigned char *mem1, hsize_t diff_short(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ short temp1_short; short temp2_short; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (abs(temp1_short-temp2_short) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2476,21 +2476,21 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2504,23 +2504,23 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - - } - + + + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - - if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && + + if ( temp1_short!=0 && abs(1-temp2_short/temp1_short) > options->percent && abs(temp1_short-temp2_short) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2534,19 +2534,19 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (temp1_short != temp2_short) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2554,15 +2554,15 @@ hsize_t diff_short(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(short); mem2+=sizeof(short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2579,33 +2579,33 @@ hsize_t diff_short(unsigned char *mem1, hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned short temp1_ushort; unsigned short temp2_ushort; hsize_t i; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if (abs(temp1_ushort-temp2_ushort) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2618,21 +2618,21 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2646,23 +2646,23 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - - } - + + + } + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && + + if ( temp1_ushort!=0 && abs(1-temp2_ushort/temp1_ushort) > options->percent && abs(temp1_ushort-temp2_ushort) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2676,19 +2676,19 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - } - else + + } + else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if (temp1_ushort != temp2_ushort) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2696,15 +2696,15 @@ hsize_t diff_ushort(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned short); mem2+=sizeof(unsigned short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -2722,14 +2722,14 @@ hsize_t diff_ushort(unsigned char *mem1, hsize_t diff_int(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ int temp1_int; @@ -2748,7 +2748,7 @@ hsize_t diff_int(unsigned char *mem1, if (abs(temp1_int-temp2_int) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2775,7 +2775,7 @@ hsize_t diff_int(unsigned char *mem1, if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2791,7 +2791,7 @@ hsize_t diff_int(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -2802,10 +2802,10 @@ hsize_t diff_int(unsigned char *mem1, memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && + if ( temp1_int!=0 && abs(1-temp2_int/temp1_int) > options->percent && abs(temp1_int-temp2_int) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2820,8 +2820,8 @@ hsize_t diff_int(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -2831,7 +2831,7 @@ hsize_t diff_int(unsigned char *mem1, if (temp1_int != temp2_int) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2865,14 +2865,14 @@ hsize_t diff_int(unsigned char *mem1, hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned int temp1_uint; @@ -2891,7 +2891,7 @@ hsize_t diff_uint(unsigned char *mem1, if (abs(temp1_uint-temp2_uint) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2918,7 +2918,7 @@ hsize_t diff_uint(unsigned char *mem1, if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2934,7 +2934,7 @@ hsize_t diff_uint(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -2945,10 +2945,10 @@ hsize_t diff_uint(unsigned char *mem1, memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent && + if ( temp1_uint!=0 && abs(1-temp2_uint/temp1_uint) > options->percent && abs(temp1_uint-temp2_uint) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -2963,8 +2963,8 @@ hsize_t diff_uint(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -2974,7 +2974,7 @@ hsize_t diff_uint(unsigned char *mem1, if (temp1_uint != temp2_uint) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3008,14 +3008,14 @@ hsize_t diff_uint(unsigned char *mem1, hsize_t diff_long(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ long temp1_long; @@ -3034,7 +3034,7 @@ hsize_t diff_long(unsigned char *mem1, if (labs(temp1_long-temp2_long) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3061,14 +3061,14 @@ hsize_t diff_long(unsigned char *mem1, if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (labs(temp1_long-temp2_long) > (long)options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3090,7 +3090,7 @@ hsize_t diff_long(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3101,10 +3101,10 @@ hsize_t diff_long(unsigned char *mem1, memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && + if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && labs(temp1_long-temp2_long) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3119,8 +3119,8 @@ hsize_t diff_long(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3130,15 +3130,15 @@ hsize_t diff_long(unsigned char *mem1, if (temp1_long != temp2_long) { - if ( print_data(options) ) + if ( print_data(options) ) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - - if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && + + if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && labs(temp1_long-temp2_long) > (long)options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3180,14 +3180,14 @@ hsize_t diff_long(unsigned char *mem1, hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ unsigned long temp1_ulong; @@ -3201,15 +3201,15 @@ hsize_t diff_ulong(unsigned char *mem1, for ( i = 0; i < nelmts; i++) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + if (labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3222,7 +3222,7 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } } @@ -3238,7 +3238,7 @@ hsize_t diff_ulong(unsigned char *mem1, if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3254,7 +3254,7 @@ hsize_t diff_ulong(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3265,10 +3265,10 @@ hsize_t diff_ulong(unsigned char *mem1, memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent && + if ( temp1_ulong!=0 && labs(1-temp2_ulong/temp1_ulong) > options->percent && labs(temp1_ulong-temp2_ulong) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3283,8 +3283,8 @@ hsize_t diff_ulong(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3294,7 +3294,7 @@ hsize_t diff_ulong(unsigned char *mem1, if (temp1_ulong != temp2_ulong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3328,14 +3328,14 @@ hsize_t diff_ulong(unsigned char *mem1, hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) - + { hsize_t nfound=0; /* number of differences found */ long_long temp1_llong; @@ -3346,9 +3346,9 @@ hsize_t diff_llong(unsigned char *mem1, if (!fmt_llong[0]) { /* build default formats for long long types */ - sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", + sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", + sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); } @@ -3364,7 +3364,7 @@ hsize_t diff_llong(unsigned char *mem1, if (labs( (long) (temp1_llong-temp2_llong)) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3391,7 +3391,7 @@ hsize_t diff_llong(unsigned char *mem1, if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3407,7 +3407,7 @@ hsize_t diff_llong(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3418,10 +3418,10 @@ hsize_t diff_llong(unsigned char *mem1, memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent && + if ( temp1_llong!=0 && labs((long)(1-temp2_llong/temp1_llong)) > options->percent && labs((long)(temp1_llong-temp2_llong)) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3436,8 +3436,8 @@ hsize_t diff_llong(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3447,7 +3447,7 @@ hsize_t diff_llong(unsigned char *mem1, if (temp1_llong != temp2_llong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3481,11 +3481,11 @@ hsize_t diff_llong(unsigned char *mem1, hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, - int rank, - hsize_t *acc, + int rank, + hsize_t *acc, hsize_t *pos, - diff_opt_t *options, - const char *obj1, + diff_opt_t *options, + const char *obj1, const char *obj2, int *ph) @@ -3499,9 +3499,9 @@ hsize_t diff_ullong(unsigned char *mem1, if (!fmt_ullong[0]) { /* build default formats for long long types */ - sprintf(fmt_ullong, "%%%su %%%su %%%su\n", + sprintf(fmt_ullong, "%%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); - sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", + sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n", H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH); } @@ -3517,7 +3517,7 @@ hsize_t diff_ullong(unsigned char *mem1, if (labs((long)(temp1_ullong-temp2_ullong)) > options->delta) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3544,7 +3544,7 @@ hsize_t diff_ullong(unsigned char *mem1, if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3560,7 +3560,7 @@ hsize_t diff_ullong(unsigned char *mem1, } - } + } /* -d and -p */ else if ( options->d && options->p) @@ -3571,10 +3571,10 @@ hsize_t diff_ullong(unsigned char *mem1, memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent && + if ( temp1_ullong!=0 && labs((long)(1-temp2_ullong/temp1_ullong)) > options->percent && labs((long)(temp1_ullong-temp2_ullong)) > options->delta ) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); @@ -3589,8 +3589,8 @@ hsize_t diff_ullong(unsigned char *mem1, return nfound; } - } - else + } + else { for ( i = 0; i < nelmts; i++) @@ -3600,7 +3600,7 @@ hsize_t diff_ullong(unsigned char *mem1, if (temp1_ullong != temp2_ullong) { - if ( print_data(options) ) + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,obj1,obj2); parallel_print(SPACES); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index 56e2af1..aa52d8b 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -14,19 +14,19 @@ #include "h5tools.h" #include "h5diff.h" -#include "H5private.h" +#include "H5private.h" /*------------------------------------------------------------------------- * Function: diff_attr * - * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are - * obtained either from + * Purpose: compare attributes located in LOC1_ID and LOC2_ID, which are + * obtained either from * loc_id = H5Gopen( fid, name); * loc_id = H5Dopen( fid, name); * loc_id = H5Topen( fid, name); * - * Return: + * Return: * 0 : no differences found * 1 : differences found * @@ -37,19 +37,19 @@ *------------------------------------------------------------------------- */ -int diff_attr(hid_t loc1_id, - hid_t loc2_id, - const char *path1, - const char *path2, +int diff_attr(hid_t loc1_id, + hid_t loc2_id, + const char *path1, + const char *path2, diff_opt_t *options ) { - hid_t attr1_id=-1; /* attr ID */ - hid_t attr2_id=-1; /* attr ID */ - hid_t space1_id=-1; /* space ID */ - hid_t space2_id=-1; /* space ID */ - hid_t ftype1_id=-1; /* file data type ID */ - hid_t ftype2_id=-1; /* file data type ID */ + hid_t attr1_id=-1; /* attr ID */ + hid_t attr2_id=-1; /* attr ID */ + hid_t space1_id=-1; /* space ID */ + hid_t space2_id=-1; /* space ID */ + hid_t ftype1_id=-1; /* file data type ID */ + hid_t ftype2_id=-1; /* file data type ID */ hid_t mtype1_id=-1; /* memory data type ID */ hid_t mtype2_id=-1; /* memory data type ID */ size_t msize1; /* memory size of memory type */ @@ -68,9 +68,9 @@ int diff_attr(hid_t loc1_id, hsize_t nfound; int cmp=1; - if ((n1 = H5Aget_num_attrs(loc1_id))<0) + if ((n1 = H5Aget_num_attrs(loc1_id))<0) goto error; - if ((n2 = H5Aget_num_attrs(loc2_id))<0) + if ((n2 = H5Aget_num_attrs(loc2_id))<0) goto error; if (n1!=n2) @@ -80,28 +80,28 @@ int diff_attr(hid_t loc1_id, { /* reset buffers for every attribute, we might goto out and call free */ - buf1=NULL; - buf2=NULL; + buf1=NULL; + buf2=NULL; /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- */ /* open attribute */ - if ((attr1_id = H5Aopen_idx(loc1_id, (unsigned)i))<0) + if ((attr1_id = H5Aopen_idx(loc1_id, (unsigned)i))<0) goto error; - if ((attr2_id = H5Aopen_idx(loc2_id, (unsigned)i))<0) + if ((attr2_id = H5Aopen_idx(loc2_id, (unsigned)i))<0) goto error; /* get name */ - if (H5Aget_name( attr1_id, 255, name1 )<0) + if (H5Aget_name( attr1_id, 255, name1 )<0) goto error; - if (H5Aget_name( attr2_id, 255, name2 )<0) + if (H5Aget_name( attr2_id, 255, name2 )<0) goto error; if (HDstrcmp(name1,name2)!=0) { - if (options->m_verbose) + if (options->m_verbose) { parallel_print("Different name for attributes: <%s> and <%s>\n", name1, name2); } @@ -135,26 +135,26 @@ int diff_attr(hid_t loc1_id, *------------------------------------------------------------------------- */ - if (diff_can_type(ftype1_id, - ftype2_id, - rank1, + if (diff_can_type(ftype1_id, + ftype2_id, + rank1, rank2, - dims1, + dims1, dims2, - NULL, NULL, - name1, - name2, + NULL, + name1, + name2, options)!=1) { cmp=0; options->not_cmp=1; } /*------------------------------------------------------------------------- - * only attempt to compare if possible + * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (cmp) + if (cmp) { /*------------------------------------------------------------------------- @@ -162,7 +162,7 @@ int diff_attr(hid_t loc1_id, *------------------------------------------------------------------------- */ nelmts1=1; - for (j=0; j<rank1; j++) + for (j=0; j<rank1; j++) nelmts1*=dims1[j]; if ((mtype1_id=h5tools_get_native_type(ftype1_id))<0) @@ -200,8 +200,8 @@ int diff_attr(hid_t loc1_id, /* always print name */ if (options->m_verbose) { - parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); - nfound = diff_array(buf1, + parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -222,7 +222,7 @@ int diff_attr(hid_t loc1_id, { /* shut up temporarily */ options->m_quiet=1; - nfound = diff_array(buf1, + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -235,10 +235,10 @@ int diff_attr(hid_t loc1_id, attr2_id); /* print again */ options->m_quiet=0; - if (nfound) + if (nfound) { - parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); - nfound = diff_array(buf1, + parallel_print( "Attribute: <%s> and <%s>\n",name1,name2); + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -255,7 +255,7 @@ int diff_attr(hid_t loc1_id, /* in quiet mode, just count differences */ else { - nfound = diff_array(buf1, + nfound = diff_array(buf1, buf2, nelmts1, rank1, diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index c4b4a4b..5f28c2b 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -14,13 +14,13 @@ #include "h5diff.h" #include "ph5diff.h" -#include "H5private.h" +#include "H5private.h" #include "h5tools.h" /*------------------------------------------------------------------------- * Function: diff_dataset * - * Purpose: check for comparable datasets and read into a compatible + * Purpose: check for comparable datasets and read into a compatible * memory type * * Return: Number of differences found @@ -31,10 +31,10 @@ * *------------------------------------------------------------------------- */ -hsize_t diff_dataset( hid_t file1_id, - hid_t file2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_dataset( hid_t file1_id, + hid_t file2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { hid_t dset1_id=-1; @@ -64,20 +64,20 @@ hsize_t diff_dataset( hid_t file1_id, } H5E_END_TRY; - if ((dcpl1_id=H5Dget_create_plist(dset1_id))<0) + if ((dcpl1_id=H5Dget_create_plist(dset1_id))<0) goto error; - if ((dcpl2_id=H5Dget_create_plist(dset2_id))<0) + if ((dcpl2_id=H5Dget_create_plist(dset2_id))<0) goto error; /*------------------------------------------------------------------------- - * check if the dataset creation property list has filters that - * are not registered in the current configuration + * check if the dataset creation property list has filters that + * are not registered in the current configuration * 1) the external filters GZIP and SZIP might not be available * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1_id)==1) && - (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2_id)==1)) + (h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2_id)==1)) { nfound=diff_datasetid(dset1_id, dset2_id, @@ -97,7 +97,7 @@ hsize_t diff_dataset( hid_t file1_id, H5Dclose(dset2_id); /* enable error reporting */ } H5E_END_TRY; - + return nfound; error: @@ -110,7 +110,7 @@ error: H5Dclose(dset2_id); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -121,7 +121,7 @@ error: /*------------------------------------------------------------------------- * Function: diff_datasetid * - * Purpose: check for comparable datasets and read into a compatible + * Purpose: check for comparable datasets and read into a compatible * memory type * * Return: Number of differences found @@ -132,19 +132,19 @@ error: * *------------------------------------------------------------------------- */ -hsize_t diff_datasetid( hid_t dset1_id, - hid_t dset2_id, - const char *obj1_name, - const char *obj2_name, +hsize_t diff_datasetid( hid_t dset1_id, + hid_t dset2_id, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { hid_t space1_id =-1; hid_t space2_id =-1; - hid_t f_type1=-1, f_type2=-1; /* file data type */ + hid_t f_type1=-1, f_type2=-1; /* file data type */ hid_t m_type1=-1, m_type2=-1; /* memory data type */ size_t m_size1, m_size2; /* size of type in memory */ H5T_sign_t sign1, sign2; /* sign of type */ - int rank1, rank2; + int rank1, rank2; void *buf1=NULL, *buf2=NULL; hsize_t nelmts1, nelmts2; hsize_t dims1[H5S_MAX_RANK]; @@ -184,7 +184,7 @@ hsize_t diff_datasetid( hid_t dset1_id, goto error; /*------------------------------------------------------------------------- - * Get the file data type + * Get the file data type *------------------------------------------------------------------------- */ @@ -206,7 +206,7 @@ hsize_t diff_datasetid( hid_t dset1_id, storage_size2=H5Dget_storage_size(dset2_id); if (storage_size1<=0 && storage_size2<=0) { - if (options->m_verbose && obj1_name && obj2_name) + if (options->m_verbose && obj1_name && obj2_name) parallel_print("<%s> and <%s> are empty datasets\n", obj1_name, obj2_name); cmp=0; options->not_cmp=1; @@ -218,16 +218,16 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ - if (diff_can_type(f_type1, - f_type2, - rank1, + if (diff_can_type(f_type1, + f_type2, + rank1, rank2, - dims1, + dims1, dims2, - maxdim1, + maxdim1, maxdim2, - obj1_name, - obj2_name, + obj1_name, + obj2_name, options)!=1) { cmp=0; @@ -238,13 +238,13 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ nelmts1 = 1; - for (i = 0; i < rank1; i++) + for (i = 0; i < rank1; i++) { nelmts1 *= dims1[i]; } - + nelmts2 = 1; - for (i = 0; i < rank2; i++) + for (i = 0; i < rank2; i++) { nelmts2 *= dims2[i]; } @@ -258,7 +258,7 @@ hsize_t diff_datasetid( hid_t dset1_id, *------------------------------------------------------------------------- */ - if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) + if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) { printf("Warning: Different storage datatype\n"); printf("<%s> has file datatype ", obj1_name); @@ -285,7 +285,7 @@ hsize_t diff_datasetid( hid_t dset1_id, #if defined (H5DIFF_DEBUG) if (obj1_name) print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif +#endif /*------------------------------------------------------------------------- * check for different signed/unsigned types @@ -306,7 +306,7 @@ hsize_t diff_datasetid( hid_t dset1_id, } /*------------------------------------------------------------------------- - * "upgrade" the smaller memory size + * "upgrade" the smaller memory size *------------------------------------------------------------------------- */ @@ -334,15 +334,15 @@ hsize_t diff_datasetid( hid_t dset1_id, printf("WARNING: Size was upgraded\n"); if (obj1_name) print_sizes(obj1_name,obj2_name,f_type1,f_type2,m_type1,m_type2); -#endif +#endif } assert(m_size1==m_size2); /*------------------------------------------------------------------------- - * only attempt to compare if possible + * only attempt to compare if possible *------------------------------------------------------------------------- */ - if (cmp) + if (cmp) { buf1 = (void *) HDmalloc((unsigned) (nelmts1*m_size1)); @@ -375,7 +375,7 @@ hsize_t diff_datasetid( hid_t dset1_id, if (obj2_name) { name2=diff_basename(obj2_name); } - nfound = diff_array(buf1, + nfound = diff_array(buf1, buf2, nelmts1, rank1, @@ -401,8 +401,8 @@ hsize_t diff_datasetid( hid_t dset1_id, * close *------------------------------------------------------------------------- */ - - + + if ( buf1) HDfree(buf1); if ( buf2) HDfree(buf2); /* close */ @@ -416,7 +416,7 @@ hsize_t diff_datasetid( hid_t dset1_id, H5Tclose(m_type2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; error: @@ -434,7 +434,7 @@ error: H5Tclose(m_type2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -443,7 +443,7 @@ error: * * Purpose: check for comparable TYPE and SPACE * - * Return: + * Return: * 1, can compare * 0, cannot compare * -1, error @@ -455,20 +455,20 @@ error: *------------------------------------------------------------------------- */ -int diff_can_type( hid_t f_type1, /* file data type */ +int diff_can_type( hid_t f_type1, /* file data type */ hid_t f_type2, /* file data type */ - int rank1, + int rank1, int rank2, - hsize_t *dims1, + hsize_t *dims1, hsize_t *dims2, - hsize_t *maxdim1, + hsize_t *maxdim1, hsize_t *maxdim2, - const char *obj1_name, - const char *obj2_name, + const char *obj1_name, + const char *obj2_name, diff_opt_t *options ) { - - + + H5T_class_t tclass1; H5T_class_t tclass2; int maxdim_diff=0; /* maximum dimensions are different */ @@ -476,21 +476,21 @@ int diff_can_type( hid_t f_type1, /* file data type */ int i; /*------------------------------------------------------------------------- - * check for the same class + * check for the same class *------------------------------------------------------------------------- */ - if ((tclass1=H5Tget_class(f_type1))<0) + if ((tclass1=H5Tget_class(f_type1))<0) return -1; - if ((tclass2=H5Tget_class(f_type2))<0) + if ((tclass2=H5Tget_class(f_type2))<0) return -1; if ( tclass1 != tclass2 ) { if (options->m_verbose && obj1_name) { - printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", - obj1_name, get_class(tclass1), + printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", + obj1_name, get_class(tclass1), obj2_name, get_class(tclass2) ); } return 0; @@ -502,7 +502,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ */ assert(tclass1==tclass2); - switch (tclass1) + switch (tclass1) { case H5T_INTEGER: case H5T_FLOAT: @@ -514,12 +514,12 @@ int diff_can_type( hid_t f_type1, /* file data type */ case H5T_ENUM: case H5T_VLEN: case H5T_REFERENCE: - + break; - + default: /*H5T_TIME */ - if (options->m_verbose && obj1_name ) - printf("Comparison not supported: <%s> and <%s> are of class %s\n", + if (options->m_verbose && obj1_name ) + printf("Comparison not supported: <%s> and <%s> are of class %s\n", obj1_name,obj2_name,get_class(tclass2) ); return 0; } @@ -529,7 +529,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ *------------------------------------------------------------------------- */ - if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) + if ( (H5Tequal(f_type1, f_type2)==0) && options->m_verbose && obj1_name) { printf("Warning: Different storage datatype\n"); printf("<%s> has file datatype ", obj1_name); @@ -544,7 +544,7 @@ int diff_can_type( hid_t f_type1, /* file data type */ * check for the same rank *------------------------------------------------------------------------- */ - + if ( rank1 != rank2 ) { if (options->m_verbose && obj1_name) { @@ -565,9 +565,9 @@ int diff_can_type( hid_t f_type1, /* file data type */ * check for different dimensions *------------------------------------------------------------------------- */ - + assert(rank1==rank2); - for ( i=0; i<rank1; i++) + for ( i=0; i<rank1; i++) { if (maxdim1 && maxdim2) { diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 3311d7c..5370c1a 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -42,14 +42,14 @@ void parallel_print(const char* format, ...) va_start(ap, format); if(!g_Parallel) - vprintf(format, ap); + vprintf(format, ap); else { if(overflow_file == NULL) /*no overflow has occurred yet */ { bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); - + va_end(ap); va_start(ap, format); @@ -57,12 +57,12 @@ void parallel_print(const char* format, ...) if(bytes_written >= (OUTBUFF_SIZE-outBuffOffset)) #else if((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset)) -#endif +#endif { /* Terminate the outbuff at the end of the previous output */ outBuff[outBuffOffset] = '\0'; - - overflow_file = HDtmpfile(); + + overflow_file = HDtmpfile(); if(overflow_file == NULL) fprintf(stderr, "Warning: Could not create overflow file. Output may be truncated.\n"); else @@ -72,7 +72,7 @@ void parallel_print(const char* format, ...) outBuffOffset += bytes_written; } else - bytes_written = HDvfprintf(overflow_file, format, ap); + bytes_written = HDvfprintf(overflow_file, format, ap); } va_end(ap); @@ -91,13 +91,13 @@ void parallel_print(const char* format, ...) * *------------------------------------------------------------------------- */ -void print_pos( int *ph, - int per, - hsize_t curr_pos, - hsize_t *acc, - hsize_t *pos, - int rank, - const char *obj1, +void print_pos( int *ph, + int per, + hsize_t curr_pos, + hsize_t *acc, + hsize_t *pos, + int rank, + const char *obj1, const char *obj2 ) { int i; @@ -108,19 +108,19 @@ void print_pos( int *ph, *ph=0; if (per) { - parallel_print("%-15s %-15s %-15s %-15s %-15s\n", - "position", - (obj1!=NULL) ? obj1 : " ", + parallel_print("%-15s %-15s %-15s %-15s %-15s\n", + "position", + (obj1!=NULL) ? obj1 : " ", (obj2!=NULL) ? obj2 : " ", - "difference", + "difference", "relative"); parallel_print("------------------------------------------------------------------------\n"); } else { - parallel_print("%-15s %-15s %-15s %-20s\n", - "position", - (obj1!=NULL) ? obj1 : " ", + parallel_print("%-15s %-15s %-15s %-20s\n", + "position", + (obj1!=NULL) ? obj1 : " ", (obj2!=NULL) ? obj2 : " ", "difference"); parallel_print("------------------------------------------------------------\n"); @@ -134,7 +134,7 @@ void print_pos( int *ph, } assert( curr_pos == 0 ); - parallel_print("[ " ); + parallel_print("[ " ); for ( i = 0; i < rank; i++) { /* HDfprintf(stdout,"%Hu ", pos[i] ); */ @@ -157,8 +157,8 @@ void print_pos( int *ph, void print_dims( int r, hsize_t *d ) { int i; - parallel_print("[ " ); - for ( i=0; i<r; i++ ) + parallel_print("[ " ); + for ( i=0; i<r; i++ ) parallel_print("%d ",(int)d[i] ); parallel_print("] " ); } @@ -166,7 +166,7 @@ void print_dims( int r, hsize_t *d ) /*------------------------------------------------------------------------- * Function: print_type * - * Purpose: Print name of datatype + * Purpose: Print name of datatype * * Return: void * @@ -180,7 +180,7 @@ void print_dims( int r, hsize_t *d ) */ void print_type(hid_t type) { - switch (H5Tget_class(type)) + switch (H5Tget_class(type)) { default: return; @@ -241,7 +241,7 @@ void print_type(hid_t type) printf("undefined integer"); } break; - + case H5T_FLOAT: if (H5Tequal(type, H5T_IEEE_F32BE)) { printf("H5T_IEEE_F32BE"); @@ -263,7 +263,7 @@ void print_type(hid_t type) printf("undefined float"); } break; - + }/*switch*/ } @@ -272,7 +272,7 @@ void print_type(hid_t type) /*------------------------------------------------------------------------- * Function: diff_basename * - * Purpose: Returns a pointer to the last component absolute name + * Purpose: Returns a pointer to the last component absolute name * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -284,7 +284,7 @@ const char* diff_basename(const char *name) { size_t i; - + if (name==NULL) return NULL; @@ -292,11 +292,11 @@ diff_basename(const char *name) i = strlen(name); while (i>0 && '/'==name[i-1]) --i; - + /* Skip backward over base name */ while (i>0 && '/'!=name[i-1]) --i; - + return(name+i); } @@ -326,7 +326,7 @@ get_type(int type) return("H5G_LINK"); default: return("user defined type"); - } + } } /*------------------------------------------------------------------------- @@ -338,7 +338,7 @@ get_type(int type) * * Date: May 9, 2003 * - * Comments: + * Comments: * *------------------------------------------------------------------------- */ @@ -353,7 +353,7 @@ get_sign(H5T_sign_t sign) return("H5T_SGN_NONE"); case H5T_SGN_2: return("H5T_SGN_2"); - } + } } @@ -371,7 +371,7 @@ get_sign(H5T_sign_t sign) const char* get_class(H5T_class_t tclass) { - switch (tclass) + switch (tclass) { default: return("Invalid class"); @@ -426,7 +426,7 @@ void print_found(hsize_t nfound) #if defined (H5DIFF_DEBUG) void print_sizes( const char *obj1, const char *obj2, hid_t f_type1, hid_t f_type2, - hid_t m_type1, hid_t m_type2 ) + hid_t m_type1, hid_t m_type2 ) { size_t f_size1, f_size2; /* size of type in file */ size_t m_size1, m_size2; /* size of type in memory */ diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index ddf476d..b9dd89a 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -186,9 +186,9 @@ int UNUSED argc, const char UNUSED *argv[] } else if (!strcmp(driver, drivernames[FAMILY_IDX])) { /* FAMILY Driver */ if((fapl = H5Pcreate(H5P_FILE_ACCESS))>=0) { - /* Set member size to be 0 to indicate the current first member size - * is the member size. - */ + /* Set member size to be 0 to indicate the current first member size + * is the member size. + */ H5Pset_fapl_family(fapl, (hsize_t)0, H5P_DEFAULT); if(drivernum) @@ -391,7 +391,7 @@ static size_t h5tools_ncols(const char *s) { register size_t i; - + for (i = 0; *s; s++) if (*s >= ' ') i++; @@ -416,9 +416,9 @@ h5tools_ncols(const char *s) * If a new prefix is printed then the current element number is set back * to zero. * pvn, 2004-07-08 - * Added support for printing array indices: + * Added support for printing array indices: * the indentation is printed before the prefix (printed one indentation - * level before) + * level before) *------------------------------------------------------------------------- */ static void @@ -429,10 +429,10 @@ h5tools_simple_prefix(FILE *stream, const h5dump_t *info, h5tools_str_t str; /*temporary for indentation */ size_t templength = 0; int i, indentlevel = 0; - + if (!ctx->need_prefix) return; - + memset(&prefix, 0, sizeof(h5tools_str_t)); memset(&str, 0, sizeof(h5tools_str_t)); @@ -586,7 +586,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, } else if ((ctx->prev_prefix_len + h5tools_ncols(s) + strlen(OPT(info->elmt_suf2, " ")) + strlen(OPT(info->line_suf, ""))) <= ncols) { - /* + /* * ...but *could* fit on one line otherwise, then we * should end the current line and start this element on its * own line. @@ -627,7 +627,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, */ if (info->line_per_line > 0 && ctx->cur_elmt >= info->line_per_line) ctx->need_prefix = TRUE; - + /* * Each OPTIONAL_LINE_BREAK embedded in the rendered string can cause * the data to split across multiple lines. We display the sections @@ -670,7 +670,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, fputs(OPT(info->elmt_suf2, " "), stream); ctx->cur_column += strlen(OPT(info->elmt_suf2, " ")); } - + /* Print the section */ fputs(section, stream); ctx->cur_column += strlen(section); @@ -695,7 +695,7 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, * Bill Wendling, Wednesday, 07. March 2001 * Modifications: *------------------------------------------------------------------------- - */ + */ static herr_t h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, struct subset_t *sset, @@ -758,10 +758,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset, for (; count > 0; sset->start[ctx.ndims - 1] += sset->stride[ctx.ndims - 1], count--) { /* calculate the potential number of elements we're going to print */ - H5Sselect_hyperslab(f_space, H5S_SELECT_SET, - sset->start, + H5Sselect_hyperslab(f_space, H5S_SELECT_SET, + sset->start, sset->stride, - sset->count, + sset->count, sset->block); sm_nelmts = H5Sget_select_npoints(f_space); @@ -862,7 +862,7 @@ done: * Robb Matzke, Thursday, July 23, 1998 * Modifications: *------------------------------------------------------------------------- - */ + */ static int h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t p_type, int indentlevel) @@ -886,7 +886,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, hsize_t sm_nelmts; /*elements per stripmine*/ unsigned char *sm_buf = NULL; /*buffer for raw data */ hid_t sm_space; /*stripmine data space */ - + /* Hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */ hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ @@ -932,7 +932,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, } /* end if */ else ctx.size_last_dim = 0; - + if (p_nelmts == 0) { /* nothing to print */ H5Sclose(f_space); @@ -959,7 +959,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ sm_buf = malloc((size_t)sm_nbytes); - + sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); @@ -1035,7 +1035,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, H5Sclose(sm_space); H5Sclose(f_space); - + free(sm_buf); return SUCCEED; @@ -1079,7 +1079,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, ctx.indent_level = indentlevel; ctx.need_prefix = 1; - + /* Assume entire data space to be printed */ for (i = 0; i < ctx.ndims; i++) ctx.p_min_idx[i] = 0; @@ -1088,7 +1088,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, for (i = 0, nelmts = 1; ctx.ndims != 0 && i < ctx.ndims; i++) nelmts *= ctx.p_max_idx[i] - ctx.p_min_idx[i]; - + if (nelmts == 0) return SUCCEED; /*nothing to print*/ if(ctx.ndims>0) { @@ -1111,7 +1111,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, putc('\n', stream); fputs(OPT(info->line_sep, ""), stream); } - + return SUCCEED; } @@ -1230,7 +1230,7 @@ h5tools_dump_mem(FILE *stream, const h5dump_t *info, hid_t obj_id, hid_t type, hid_t space, void *mem, int indentlevel) { h5dump_t info_dflt; - + /* Use default values */ if (!stream) stream = stdout; @@ -1268,7 +1268,7 @@ void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) int i; assert(ctx->ndims); - + ctx->acc[ctx->ndims-1]=1; for(i=(ctx->ndims-2); i>=0; i--) { diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index ada098b..c5ca4fa 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -59,7 +59,7 @@ typedef struct h5dump_t { * fmt_uchar: The printf() format to use when rendering data which is * typed `unsigned char'. The default is `%u'. This format * is used only if the `ascii' field is zero. - * + * * fmt_short: The printf() format to use when rendering data which is * typed `short'. The default is `%d'. * @@ -82,7 +82,7 @@ typedef struct h5dump_t { * * fmt_double: The printf() format to use when rendering data which is * typed `double'. The default is `%g'. - * + * * fmt_float: The printf() format to use when rendering data which is * typed `float'. The default is `%g'. * @@ -142,7 +142,7 @@ typedef struct h5dump_t { const char *arr_sep; const char *arr_suf; int arr_linebreak; - + /* * Fields associated with compound data types. * @@ -161,8 +161,8 @@ typedef struct h5dump_t { * * suf: A string to print at the end of each compound type. The * default is right curly brace. - * - * end: a string to print after we reach the last element of + * + * end: a string to print after we reach the last element of * each compound type. prints out before the suf. */ const char *cmpd_name; @@ -184,8 +184,8 @@ typedef struct h5dump_t { * * suf: A string to print at the end of each vlen type. The * default is a right parentheses. - * - * end: a string to print after we reach the last element of + * + * end: a string to print after we reach the last element of * each compound type. prints out before the suf. */ const char *vlen_sep; @@ -210,7 +210,7 @@ typedef struct h5dump_t { const char *elmt_fmt; const char *elmt_suf1; const char *elmt_suf2; - + /* * Fields associated with the index values printed at the left edge of * each line of output. @@ -231,7 +231,7 @@ typedef struct h5dump_t { const char *idx_n_fmt; /*index number format */ const char *idx_sep; /*separator between numbers */ const char *idx_fmt; /*entire index format */ - + /* * Fields associated with entire lines. * @@ -259,7 +259,7 @@ typedef struct h5dump_t { * suf: This character string will be appended to each line of * output. It should not contain line feeds. The default * is the empty string. - * + * * sep: A character string to be printed after every line feed * defaulting to the empty string. It should end with a * line feed. @@ -282,7 +282,7 @@ typedef struct h5dump_t { * should the following element begin on the next line? The * default is to start the next element on the same line * unless it wouldn't fit. - * + * * indentlevel: a string that shows how far to indent if extra spacing * is needed. dumper uses it. */ @@ -419,7 +419,7 @@ typedef struct h5tools_context_t { hsize_t sm_pos; /* current stripmine element position */ } h5tools_context_t; - + /* a structure to hold the subsetting particulars for a dataset */ struct subset_t { diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 355ac14..099f132 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -28,8 +28,8 @@ static void print_warning(const char *dname, const char *fname) /*------------------------------------------------------------------------- * Function: h5tools_canreadf * - * Purpose: check if the dataset creation property list has filters that - * are not registered in the current configuration + * Purpose: check if the dataset creation property list has filters that + * are not registered in the current configuration * 1) the external filters GZIP and SZIP might not be available * 2) the internal filters might be turned off * @@ -50,7 +50,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr int i; /* index */ int have_deflate=0; /* assume initially we do not have filters */ int have_szip=0; - int have_shuffle=0; + int have_shuffle=0; int have_fletcher=0; int have_nbit=0; int have_scaleoffset=0; @@ -76,27 +76,27 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr /* get information about filters */ - if ((nfilters = H5Pget_nfilters(dcpl_id))<0) + if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; /* if we do not have filters, we can read the dataset safely */ if (!nfilters) return 1; - + /* check availability of filters */ - for (i=0; i<nfilters; i++) + for (i=0; i<nfilters; i++) { #ifdef H5_WANT_H5_V1_6_COMPAT - if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0))<0) + if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0))<0) #else - if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0,NULL))<0) + if ((filtn = H5Pget_filter(dcpl_id,(unsigned)i,0,0,0,0,0,NULL))<0) #endif return -1; - + switch (filtn) { /*------------------------------------------------------------------------- - * user defined filter + * user defined filter *------------------------------------------------------------------------- */ default: @@ -105,7 +105,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr return 0; /*------------------------------------------------------------------------- - * H5Z_FILTER_DEFLATE 1 , deflation like gzip + * H5Z_FILTER_DEFLATE 1 , deflation like gzip *------------------------------------------------------------------------- */ case H5Z_FILTER_DEFLATE: @@ -117,7 +117,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr } break; /*------------------------------------------------------------------------- - * H5Z_FILTER_SZIP 4 , szip compression + * H5Z_FILTER_SZIP 4 , szip compression *------------------------------------------------------------------------- */ case H5Z_FILTER_SZIP: @@ -192,18 +192,18 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr * * Return: 1, can write, 0, cannot, -1 error * - * Programmer: + * Programmer: * * Date: October 5, 2004 * *------------------------------------------------------------------------- */ -int h5tools_can_encode( H5Z_filter_t filtn) +int h5tools_can_encode( H5Z_filter_t filtn) { int have_deflate=0; /* assume initially we do not have filters */ int have_szip=0; - int have_shuffle=0; + int have_shuffle=0; int have_fletcher=0; int have_nbit=0; int have_scaleoffset=0; @@ -247,23 +247,23 @@ int h5tools_can_encode( H5Z_filter_t filtn) } if(H5Zget_filter_info(filtn, &filter_config_flags)<0) return -1; - if ((filter_config_flags & + if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ return -1; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + } else if ((filter_config_flags & + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_DECODE_ENABLED) { /* decoder only: read but not write */ return 0; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + } else if ((filter_config_flags & + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == H5Z_FILTER_CONFIG_ENCODE_ENABLED) { /* encoder only: write but not read (???) */ return -1; - } else if ((filter_config_flags & - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == - (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { + } else if ((filter_config_flags & + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == + (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) { return 1; } break; diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index c611715..cd15637 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -37,7 +37,7 @@ * Otherwise the format is more Perl-like * * 'A'*10 - * + * */ #define REPEAT_VERBOSE @@ -156,7 +156,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) (0==nchars && (strcmp(fmt,"%s") ))) { /* Truncation return value as documented by C99, or zero return value with either of the * following conditions, each of which indicates that the proper C99 return value probably - * should have been positive when the format string is + * should have been positive when the format string is * something other than "%s" * Alocate at least twice as much space and try again. */ @@ -403,7 +403,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info) h5tools_str_append(str, info->dset_blockformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)i); - + /* Start coordinates and opposite corner */ for (j = 0; j < ndims; j++) h5tools_str_append(str, "%s%lu", j ? "," : "(", @@ -435,7 +435,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info) h5tools_str_append(str, info->dset_ptformat_pre , i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)i); - + for (j = 0; j < ndims; j++) h5tools_str_append(str, "%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])); @@ -445,7 +445,7 @@ h5tools_str_dump_region(h5tools_str_t *str, hid_t region, const h5dump_t *info) free(ptdata); } - + h5tools_str_append(str, "}"); return 0; } @@ -523,7 +523,7 @@ h5tools_print_char(h5tools_str_t *str, const h5dump_t *info, unsigned char ch) default: if (isprint(ch)) h5tools_str_append(str, "%c", (char)ch); - else + else h5tools_str_append(str, "\\%03o", ch); break; @@ -596,7 +596,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, int tempint; unsigned short tempushort; short tempshort; - + /* Build default formats for long long types */ if (!fmt_llong[0]) { sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); @@ -618,10 +618,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, } } } else if (H5Tequal(type, H5T_NATIVE_FLOAT)) { - memcpy(&tempfloat, vp, sizeof(float)); + memcpy(&tempfloat, vp, sizeof(float)); h5tools_str_append(str, OPT(info->fmt_float, "%g"), tempfloat); } else if (H5Tequal(type, H5T_NATIVE_DOUBLE)) { - memcpy(&tempdouble, vp, sizeof(double)); + memcpy(&tempdouble, vp, sizeof(double)); h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble); } else if (info->ascii && (H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) { @@ -660,7 +660,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, if (info->str_repeat > 0) while (i + j < size && s[i] == s[i + j]) j++; - + /* * Print the opening quote. If the repeat count is high enough to * warrant printing the number of repeats instead of enumerating @@ -677,10 +677,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, quote = '"'; h5tools_str_append(str, "%s%c", i ? " " : "", quote); } - + /* Print the character */ h5tools_print_char(str, info, (unsigned char)(s[i])); - + /* Print the repeat count */ if (info->str_repeat && j > info->str_repeat) { #ifdef REPEAT_VERBOSE @@ -731,7 +731,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); } else if (H5Tequal(type, H5T_NATIVE_HSSIZE)) { if (sizeof(hssize_t) == sizeof(int)) { - memcpy(&tempint, vp, sizeof(int)); + memcpy(&tempint, vp, sizeof(int)); h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); } else if (sizeof(hssize_t) == sizeof(long)) { memcpy(&templong, vp, sizeof(long)); @@ -910,7 +910,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5dump_t *info, hid_t container, temp_nelmts *= dims[k]; assert(temp_nelmts==(hsize_t)((size_t)temp_nelmts)); nelmts = (size_t)temp_nelmts; - } + } /* Print the opening bracket */ h5tools_str_append(str, "%s", OPT(info->arr_pre, "[")); diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index 6684adb..e6211da 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -66,7 +66,7 @@ error_msg(const char *progname, const char *fmt, ...) HDfflush(stdout); HDfprintf(stderr, "%s error: ", progname); HDvfprintf(stderr, fmt, ap); - + va_end(ap); } @@ -298,7 +298,7 @@ print_version(const char *progname) /*------------------------------------------------------------------------- * Function: init_table * - * Purpose: allocate and initialize tables for shared groups, datasets, + * Purpose: allocate and initialize tables for shared groups, datasets, * and committed types * * Return: void @@ -353,7 +353,7 @@ init_prefix(char **prefix, size_t prefix_len) /*------------------------------------------------------------------------- * Function: free_table * - * Purpose: free tables for shared groups, datasets, + * Purpose: free tables for shared groups, datasets, * and committed types * * Return: void @@ -386,7 +386,7 @@ free_table(table_t **table) * *------------------------------------------------------------------------- */ -int +int search_obj(table_t *table, haddr_t objno) { int i; @@ -394,13 +394,13 @@ search_obj(table_t *table, haddr_t objno) for (i = 0; i < table->nobjs; i++) if (table->objs[i].objno == objno) return i; - + return FAIL; } /*------------------------------------------------------------------------- - * Function: find_objs + * Function: find_objs * * Purpose: Find objects, committed types and store them in tables * @@ -430,7 +430,7 @@ find_objs(hid_t group, const char *name, void *op_data) H5Gget_objinfo(group, name, TRUE, &statbuf); tmp = HDmalloc(HDstrlen(info->prefix) + HDstrlen(name) + 2); - HDstrcpy(tmp, info->prefix); + HDstrcpy(tmp, info->prefix); switch (statbuf.type) { case H5G_GROUP: @@ -445,7 +445,7 @@ find_objs(hid_t group, const char *name, void *op_data) if (statbuf.nlink > info->threshold) { if (search_obj(info->group_table, statbuf.objno) == FAIL) { - add_obj(info->group_table, statbuf.objno, info->prefix); + add_obj(info->group_table, statbuf.objno, info->prefix); H5Giterate(obj, ".", NULL, find_objs, (void *)info); } } else { @@ -468,7 +468,7 @@ find_objs(hid_t group, const char *name, void *op_data) search_obj(info->dset_table, statbuf.objno) == FAIL) add_obj(info->dset_table, statbuf.objno, tmp); - if ((obj = H5Dopen (group, name)) >= 0) { + if ((obj = H5Dopen (group, name)) >= 0) { type = H5Dget_type(obj); if (H5Tcommitted(type) > 0) { @@ -485,7 +485,7 @@ find_objs(hid_t group, const char *name, void *op_data) } else { info->status = 1; } - + break; case H5G_TYPE: @@ -504,9 +504,9 @@ find_objs(hid_t group, const char *name, void *op_data) } else { free(info->type_table->objs[i].objname); info->type_table->objs[i].objname = HDstrdup(tmp); - info->type_table->objs[i].recorded = 1; + info->type_table->objs[i].recorded = 1; - /* named data type */ + /* named data type */ info->type_table->objs[info->type_table->nobjs-1].objflag = 1; } @@ -534,7 +534,7 @@ find_objs(hid_t group, const char *name, void *op_data) * *------------------------------------------------------------------------- */ -void +void dump_table(char* tablename, table_t *table) { int i; @@ -683,7 +683,7 @@ add_obj(table_t *table, haddr_t objno, char *objname) * *------------------------------------------------------------------------- */ -static +static FILE * tmpfile(void) { diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 0c8d83c..a210c0f 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -60,7 +60,7 @@ enum { * and can have more than one short named option specified at one time: * * -aw80 - * + * * in which case those options which expect an argument need to come at the * end. */ @@ -95,7 +95,7 @@ typedef struct table_t { /*this struct stores the information that is passed to the find_objs function*/ typedef struct find_objs_t { - size_t prefix_len; + size_t prefix_len; char *prefix; unsigned int threshold; /* should be 0 or 1 */ table_t *group_table; diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 8094c33..e3578c9 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -14,29 +14,29 @@ #include "h5trav.h" -#include "H5private.h" +#include "H5private.h" /* functions for traversal */ -int traverse( hid_t loc_id, - const char *group_name, - trav_table_t *table, - trav_info_t *info, +int traverse( hid_t loc_id, + const char *group_name, + trav_table_t *table, + trav_info_t *info, int *idx, int print); -herr_t get_nnames( hid_t loc_id, +herr_t get_nnames( hid_t loc_id, const char *group_name ); -herr_t get_name_type( hid_t loc_id, - const char *group_name, - int idx, - char **name, +herr_t get_name_type( hid_t loc_id, + const char *group_name, + int idx, + char **name, H5G_obj_t *type ); /*------------------------------------------------------------------------- * Function: h5trav_getinfo * - * Purpose: get an array of "trav_info_t" , containing the name and type of + * Purpose: get an array of "trav_info_t" , containing the name and type of * objects in the file * * Return: number of object names in file @@ -48,8 +48,8 @@ herr_t get_name_type( hid_t loc_id, *------------------------------------------------------------------------- */ -int h5trav_getinfo(hid_t file_id, - trav_info_t *info, +int h5trav_getinfo(hid_t file_id, + trav_info_t *info, int print ) { @@ -118,7 +118,7 @@ int h5trav_getindex( const char *obj, int nobjs, trav_info_t *info ) int result; int i; - for ( i = 0; i < nobjs; i++) + for ( i = 0; i < nobjs; i++) { if ( strcmp(obj,info[i].name)==0 ) return i; @@ -161,7 +161,7 @@ void h5trav_freeinfo( trav_info_t *info, int nobjs ) /*------------------------------------------------------------------------- * Function: count_names * - * Purpose: operator function + * Purpose: operator function * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -186,7 +186,7 @@ static herr_t count_names( hid_t loc_id, const char *name, void *op_data) /* Define a default zero value for return. This will cause the iterator to continue */ return 0; -} +} /*------------------------------------------------------------------------- * Function: get_nnames @@ -197,7 +197,7 @@ static herr_t count_names( hid_t loc_id, const char *name, void *op_data) * * Date: October 10, 2002 * - * Return: + * Return: * Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. @@ -209,7 +209,7 @@ static herr_t count_names( hid_t loc_id, const char *name, void *op_data) *------------------------------------------------------------------------- */ -herr_t get_nnames( hid_t loc_id, const char *group_name ) +herr_t get_nnames( hid_t loc_id, const char *group_name ) { int nobjs = 0; @@ -224,7 +224,7 @@ herr_t get_nnames( hid_t loc_id, const char *group_name ) /*------------------------------------------------------------------------- * Function: opget_info * - * Purpose: operator function + * Purpose: operator function * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * @@ -250,19 +250,19 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data) /* Define 1 for return. This will cause the iterator to stop */ return 1; -} +} /*------------------------------------------------------------------------- * Function: get_name_type * - * Purpose: + * Purpose: * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: October 10, 2002 * - * Return: + * Return: * Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. @@ -274,18 +274,18 @@ static herr_t opget_info( hid_t loc_id, const char *name, void *op_data) *------------------------------------------------------------------------- */ -herr_t get_name_type( hid_t loc_id, - const char *group_name, - int idx, - char **name, - H5G_obj_t *type ) +herr_t get_name_type( hid_t loc_id, + const char *group_name, + int idx, + char **name, + H5G_obj_t *type ) { trav_info_t info; if (H5Giterate( loc_id, group_name, &idx, opget_info, (void *)&info) < 0 ) return -1; - + *name = info.name; *type = info.type; @@ -306,14 +306,14 @@ herr_t get_name_type( hid_t loc_id, *------------------------------------------------------------------------- */ -int traverse( hid_t loc_id, - const char *group_name, - trav_table_t *table, - trav_info_t *info, +int traverse( hid_t loc_id, + const char *group_name, + trav_table_t *table, + trav_info_t *info, int *idx, - int print) + int print) { - + char *name=NULL; H5G_obj_t type; int n_names; @@ -325,20 +325,20 @@ int traverse( hid_t loc_id, /* get the number of names */ if (( n_names = get_nnames( loc_id, group_name )) < 0 ) return -1; - - for ( i = 0; i < n_names; i++) + + for ( i = 0; i < n_names; i++) { if (get_name_type( loc_id, group_name, i, &name, &type ) < 0 ) return -1; - + /* allocate path buffer */ path = (char*) HDmalloc(strlen(group_name) + strlen(name) + 2); - + /* initialize path */ strcpy( path, group_name ); if ( strcmp(group_name,"/")!=0 ) strcat( path, "/" ); - strcat( path, name ); + strcat( path, name ); /* disable error reporting */ H5E_BEGIN_TRY { @@ -354,16 +354,16 @@ int traverse( hid_t loc_id, info[*idx].type = type; (*idx)++; } - - - switch ( type ) + + + switch ( type ) { /*------------------------------------------------------------------------- * H5G_GROUP *------------------------------------------------------------------------- */ - + case H5G_GROUP: /* increment */ @@ -378,14 +378,14 @@ int traverse( hid_t loc_id, /* print it */ if (print) printf(" %-10s %s\n", "group", path ); - + /* recurse with the absolute name */ inserted_objs += traverse( loc_id, path, table, info, idx, print ); } /* search table group with more than one link to it */ - if (statbuf.nlink > 1) + if (statbuf.nlink > 1) { if ((j = trav_table_search(statbuf.objno, table )) < 0 ) return -1; @@ -404,14 +404,14 @@ int traverse( hid_t loc_id, } } - + break; /*------------------------------------------------------------------------- * H5G_DATASET *------------------------------------------------------------------------- */ - + case H5G_DATASET: /* increment */ @@ -430,7 +430,7 @@ int traverse( hid_t loc_id, /* search table dataset with more than one link to it */ - if (statbuf.nlink > 1) + if (statbuf.nlink > 1) { if ((j = trav_table_search(statbuf.objno, table )) < 0 ) return -1; @@ -448,15 +448,15 @@ int traverse( hid_t loc_id, printf(" %-10s %s %s %s\n", "dataset", path, "->", table->objs[j].name ); } /* displayed==1 */ } /* nlink>1 */ - - + + break; /*------------------------------------------------------------------------- * H5G_TYPE *------------------------------------------------------------------------- */ - + case H5G_TYPE: /* increment */ @@ -472,7 +472,7 @@ int traverse( hid_t loc_id, if (print) printf(" %-10s %s\n", "datatype", path ); } - + break; @@ -480,14 +480,14 @@ int traverse( hid_t loc_id, * H5G_LINK *------------------------------------------------------------------------- */ - + case H5G_LINK: { char *targbuf=NULL; - + /* increment */ inserted_objs++; - + /* add object to table */ trav_table_add(statbuf.objno, path, H5G_LINK, table ); @@ -495,7 +495,7 @@ int traverse( hid_t loc_id, { targbuf=malloc(statbuf.linklen); H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf); - if (print) + if (print) printf(" %-10s %s -> %s\n", "link", path, targbuf); if (targbuf) free(targbuf); @@ -506,28 +506,28 @@ int traverse( hid_t loc_id, printf(" %-10s %s ->\n", "link", path); } } - + break; - + default: break; - - } + + } /*------------------------------------------------------------------------- * end switch *------------------------------------------------------------------------- */ - + if ( name ) HDfree( name ); - + if ( path ) HDfree( path ); - + } /* i */ - + return inserted_objs; } @@ -645,7 +645,7 @@ int h5trav_getindext(const char *name, trav_table_t *table) int result; int i, j; - for ( i = 0; i < table->nobjs; i++) + for ( i = 0; i < table->nobjs; i++) { if ( strcmp(name,table->objs[i].name)==0 ) return i; @@ -664,10 +664,10 @@ int h5trav_getindext(const char *name, trav_table_t *table) { if ( strcmp(name,table->objs[i].links[j].new_name)==0 ) return i; - + pdest = strstr( table->objs[i].links[j].new_name, name ); result = (int)(pdest - table->objs[i].links[j].new_name); - + /* found at position 1, meaning without '/' */ if( pdest != NULL && result==1 ) return i; diff --git a/tools/lib/h5trav.h b/tools/lib/h5trav.h index e8e8a3f..cd38a9b 100644 --- a/tools/lib/h5trav.h +++ b/tools/lib/h5trav.h @@ -24,12 +24,12 @@ /*------------------------------------------------------------------------- * public struct to store name and type of an object - * the TYPE can be: - * H5G_UNKNOWN = -1, - * H5G_LINK, Object is a symbolic link - * H5G_GROUP, Object is a group - * H5G_DATASET, Object is a dataset - * H5G_TYPE, Object is a named data type + * the TYPE can be: + * H5G_UNKNOWN = -1, + * H5G_LINK, Object is a symbolic link + * H5G_GROUP, Object is a group + * H5G_DATASET, Object is a dataset + * H5G_TYPE, Object is a named data type *------------------------------------------------------------------------- */ @@ -117,21 +117,21 @@ void trav_table_init(trav_table_t **table); void trav_table_free(trav_table_t *table); -int trav_table_search(haddr_t objno, +int trav_table_search(haddr_t objno, trav_table_t *table ); -void trav_table_add(haddr_t objno, - char *objname, - H5G_obj_t type, +void trav_table_add(haddr_t objno, + char *objname, + H5G_obj_t type, trav_table_t *table); -void trav_table_addflags(unsigned *flags, - char *objname, - H5G_obj_t type, +void trav_table_addflags(unsigned *flags, + char *objname, + H5G_obj_t type, trav_table_t *table); -void trav_table_addlink(trav_table_t *table, +void trav_table_addlink(trav_table_t *table, int j /* the object index */, char *path ); diff --git a/tools/lib/h5trav_table.c b/tools/lib/h5trav_table.c index 8e794aa..2ebcd6b 100644 --- a/tools/lib/h5trav_table.c +++ b/tools/lib/h5trav_table.c @@ -14,7 +14,7 @@ #include "h5trav.h" -#include "H5private.h" +#include "H5private.h" /*------------------------------------------------------------------------- * Function: trav_table_search @@ -33,11 +33,11 @@ int trav_table_search(haddr_t objno, trav_table_t *table ) { int i; - + for (i = 0; i < table->nobjs; i++) if (table->objs[i].objno == objno) return i; - + return -1; } @@ -56,18 +56,18 @@ int trav_table_search(haddr_t objno, trav_table_t *table ) *------------------------------------------------------------------------- */ -void trav_table_add(haddr_t objno, - char *name, - H5G_obj_t type, +void trav_table_add(haddr_t objno, + char *name, + H5G_obj_t type, trav_table_t *table) { int i; - + if (table->nobjs == table->size) { table->size *= 2; - table->objs = + table->objs = (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t)); - + for (i = table->nobjs; i < table->size; i++) { table->objs[i].objno = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -79,7 +79,7 @@ void trav_table_add(haddr_t objno, table->objs[i].sizelinks = 0; } } - + i = table->nobjs++; table->objs[i].objno = objno; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -105,18 +105,18 @@ void trav_table_add(haddr_t objno, *------------------------------------------------------------------------- */ -void trav_table_addflags(unsigned *flags, - char *name, - H5G_obj_t type, +void trav_table_addflags(unsigned *flags, + char *name, + H5G_obj_t type, trav_table_t *table) { int i; - + if (table->nobjs == table->size) { table->size *= 2; - table->objs = + table->objs = (trav_obj_t*)HDrealloc(table->objs, table->size * sizeof(trav_obj_t)); - + for (i = table->nobjs; i < table->size; i++) { table->objs[i].objno = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -128,7 +128,7 @@ void trav_table_addflags(unsigned *flags, table->objs[i].sizelinks = 0; } } - + i = table->nobjs++; table->objs[i].objno = 0; table->objs[i].flags[0] = flags[0]; @@ -144,7 +144,7 @@ void trav_table_addflags(unsigned *flags, /*------------------------------------------------------------------------- * Function: trav_table_init * - * Purpose: Initialize the table + * Purpose: Initialize the table * * Return: void * @@ -159,12 +159,12 @@ void trav_table_init( trav_table_t **tbl ) { int i; trav_table_t* table = (trav_table_t*) HDmalloc(sizeof(trav_table_t)); - + table->size = 20; table->nobjs = 0; - table->objs = + table->objs = (trav_obj_t*)HDmalloc(table->size * sizeof(trav_obj_t)); - + for (i = 0; i < table->size; i++) { table->objs[i].objno = 0; table->objs[i].flags[0] = table->objs[i].flags[1] = 0; @@ -175,7 +175,7 @@ void trav_table_init( trav_table_t **tbl ) table->objs[i].nlinks = 0; table->objs[i].sizelinks = 0; } - + *tbl = table; } @@ -230,7 +230,7 @@ void trav_table_free( trav_table_t *table ) *------------------------------------------------------------------------- */ -void trav_table_addlink(trav_table_t *table, +void trav_table_addlink(trav_table_t *table, int j /* the object index */, char *path ) { @@ -243,8 +243,8 @@ void trav_table_addlink(trav_table_t *table, /* allocate space if necessary */ if (table->objs[j].nlinks == table->objs[j].sizelinks) { table->objs[j].sizelinks += 2; - table->objs[j].links = - (trav_link_t*)HDrealloc(table->objs[j].links, + table->objs[j].links = + (trav_link_t*)HDrealloc(table->objs[j].links, table->objs[j].sizelinks * sizeof(trav_link_t)); } diff --git a/tools/lib/ph5diff.h b/tools/lib/ph5diff.h index 864ae49..3fcc553 100644 --- a/tools/lib/ph5diff.h +++ b/tools/lib/ph5diff.h @@ -18,7 +18,7 @@ #define PRINT_DATA_MAX_SIZE 512 #define OUTBUFF_SIZE PRINT_DATA_MAX_SIZE*4 /* Send from manager to workers */ -#define MPI_TAG_ARGS 1 +#define MPI_TAG_ARGS 1 #define MPI_TAG_PRINT_TOK 2 /*Sent from workers to manager */ @@ -40,9 +40,9 @@ extern FILE* overflow_file; struct diff_args { char name[256]; - H5G_obj_t type; + H5G_obj_t type; diff_opt_t options; -}; +}; struct diffs_found { |