diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-28 21:53:48 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2016-06-28 21:53:48 (GMT) |
commit | 83724bd7873e3e199a94ba9c3526732d8117e996 (patch) | |
tree | b724d9adeb1130e81bbf3afa8ec705b63067affe /tools/lib | |
parent | b8f809981bb6c378e2a942aad551620feaa47125 (diff) | |
download | hdf5-83724bd7873e3e199a94ba9c3526732d8117e996.zip hdf5-83724bd7873e3e199a94ba9c3526732d8117e996.tar.gz hdf5-83724bd7873e3e199a94ba9c3526732d8117e996.tar.bz2 |
[svn-r30113] Description:
Clean up warnings (from 2774 -> 1560, with my standard debug build)
Tested on:
MacOSX/64 10.11.5 (amazon) w/serial, parallel & production
(h5committest forthcoming)
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/h5diff.c | 3 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 3205 | ||||
-rw-r--r-- | tools/lib/h5diff_util.c | 100 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 88 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 18 | ||||
-rw-r--r-- | tools/lib/h5tools_dump.c | 121 | ||||
-rw-r--r-- | tools/lib/h5tools_filters.c | 79 | ||||
-rw-r--r-- | tools/lib/h5tools_str.c | 240 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.c | 30 | ||||
-rw-r--r-- | tools/lib/h5tools_utils.h | 6 | ||||
-rw-r--r-- | tools/lib/h5trav.c | 8 | ||||
-rw-r--r-- | tools/lib/io_timer.c | 2 |
12 files changed, 1788 insertions, 2112 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b1637a8..79dc51f 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -30,7 +30,8 @@ * 2) when diff was found (normal mode) *------------------------------------------------------------------------- */ -int print_objname (diff_opt_t * options, hsize_t nfound) +H5_ATTR_PURE int +print_objname (diff_opt_t * options, hsize_t nfound) { return ((options->m_verbose || nfound) && !options->m_quiet) ? 1 : 0; } diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index d592528..7897e49 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -106,9 +106,9 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \ both_zero = TRUE; \ - if(!H5_DBL_ABS_EQUAL(0,A)) \ + if(!H5_DBL_ABS_EQUAL(0, (double)A)) \ per = (double)ABS((double)((B) - (A)) / (double)(A)); \ else \ not_comparable = TRUE; \ @@ -119,9 +119,9 @@ static hbool_t not_comparable; per = -1; \ not_comparable = FALSE; \ both_zero = FALSE; \ - if(H5_DBL_ABS_EQUAL(0,A) && H5_DBL_ABS_EQUAL(0,B)) \ + if(H5_DBL_ABS_EQUAL(0, (double)A) && H5_DBL_ABS_EQUAL(0, (double)B)) \ both_zero = TRUE; \ - if(!H5_DBL_ABS_EQUAL(0,A)) \ + if(!H5_DBL_ABS_EQUAL(0, (double)A)) \ per = ABS((double)((TYPE)((B) - (A))) / (double)(A)) ; \ else \ not_comparable = TRUE; \ @@ -597,7 +597,6 @@ static hsize_t diff_datum(void *_mem1, hid_t obj2_id; hsize_t nfound=0; /* differences found */ int ret=0; /* check return error */ - float f1, f2; double per; hbool_t both_zero; @@ -1856,210 +1855,6 @@ static hsize_t diff_datum(void *_mem1, } /*H5T_NATIVE_ULONG*/ - /*------------------------------------------------------------------------- - * H5T_NATIVE_LLONG - *------------------------------------------------------------------------- - */ - - else if (type_size==8 && type_sign!=H5T_SGN_NONE) - { - long long temp1_llong; - long long temp2_llong; - HDassert(type_size==sizeof(long long)); - - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if (ABS(temp1_llong-temp2_llong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - } - else if (temp1_llong != temp2_llong) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - } /*H5T_NATIVE_LLONG*/ - - /*------------------------------------------------------------------------- - * H5T_NATIVE_ULLONG - *------------------------------------------------------------------------- - */ - - else if (type_size==8 && type_sign==H5T_SGN_NONE) - { - unsigned long long temp1_ullong; - unsigned long long temp2_ullong; - HDassert(type_size==sizeof(unsigned long long)); - - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - /* -d and !-p */ - if (options->d && !options->p) - { - if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - } - /* !-d and -p */ - else if (!options->d && options->p) - { - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - } - /* -d and -p */ - else if ( options->d && options->p) - { - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta ) - { - - if ( print_data(options) ) - { - print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); - - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - } - else if (temp1_ullong != temp2_ullong) - { - if ( print_data(options) ) - { - print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - } /*H5T_NATIVE_ULLONG*/ - - break; /* H5T_INTEGER class */ @@ -2495,7 +2290,7 @@ static hsize_t diff_datum(void *_mem1, } } /*H5T_NATIVE_DOUBLE*/ -#if H5_SIZEOF_LONG_DOUBLE !=0 +#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE /*------------------------------------------------------------------------- @@ -2503,7 +2298,7 @@ static hsize_t diff_datum(void *_mem1, *------------------------------------------------------------------------- */ - else if (type_size==8) + else if (type_size == H5_SIZEOF_LONG_DOUBLE) { long double temp1_double; long double temp2_double; @@ -2511,7 +2306,7 @@ static hsize_t diff_datum(void *_mem1, hbool_t isnan2 = FALSE; - HDassert(type_size==sizeof(long double)); + HDassert(type_size == sizeof(long double)); HDmemcpy(&temp1_double, mem1, sizeof(long double)); HDmemcpy(&temp2_double, mem2, sizeof(long double)); @@ -2706,9 +2501,7 @@ static hsize_t diff_datum(void *_mem1, } nfound++; } - } /*H5T_NATIVE_DOUBLE*/ - - + } /*H5T_NATIVE_LDOUBLE*/ #endif /* H5_SIZEOF_LONG_DOUBLE */ @@ -3986,158 +3779,153 @@ static hsize_t diff_schar(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - char temp1_char; - char temp2_char; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_schar start\n"); - - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - if (ABS(temp1_char-temp2_char) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - nfound++; - } - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - PER(temp1_char,temp2_char); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, - ABS(temp1_char-temp2_char)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_char,temp2_char, - ABS(temp1_char-temp2_char), - per); - } - nfound++; - } - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - PER(temp1_char,temp2_char); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, - ABS(temp1_char-temp2_char)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_char,temp2_char, - ABS(temp1_char-temp2_char), - per); - } - nfound++; - } - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_char, mem1, sizeof(char)); - HDmemcpy(&temp2_char, mem2, sizeof(char)); - - if (temp1_char != temp2_char) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); - } - nfound++; - } - - mem1+=sizeof(char); - mem2+=sizeof(char); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_schar finish\n"); + hsize_t nfound=0; /* number of differences found */ + char temp1_char; + char temp2_char; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; + h5difftrace("diff_schar start\n"); + + /* -d and !-p */ + if (options->d && !options->p) + { + + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + if (ABS(temp1_char-temp2_char) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + nfound++; + } + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* !-d and -p */ + else if (!options->d && options->p) + { + + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + PER(temp1_char,temp2_char); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + ABS(temp1_char-temp2_char)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_char,temp2_char, + ABS(temp1_char-temp2_char), + per); + } + nfound++; + } + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* -d and -p */ + else if ( options->d && options->p) + { + + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + PER(temp1_char,temp2_char); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_char,temp2_char, + ABS(temp1_char-temp2_char)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_char,temp2_char, + ABS(temp1_char-temp2_char), + per); + } + nfound++; + } + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } + + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_char, mem1, sizeof(char)); + HDmemcpy(&temp2_char, mem2, sizeof(char)); + + if (temp1_char != temp2_char) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_char,temp2_char,ABS(temp1_char-temp2_char)); + } + nfound++; + } + + mem1+=sizeof(char); + mem2+=sizeof(char); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_schar finish\n"); + + return nfound; } @@ -4165,159 +3953,149 @@ static hsize_t diff_uchar(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned char temp1_uchar; - unsigned char temp2_uchar; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_uchar start\n"); - - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar), - per); - } - nfound++; - } - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, - PDIFF(temp1_uchar,temp2_uchar), - per); - } - nfound++; - } - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); - HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - - if (temp1_uchar != temp2_uchar) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); - } - nfound++; - } - - mem1+=sizeof(unsigned char); - mem2+=sizeof(unsigned char); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_uchar finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned char temp1_uchar; + unsigned char temp2_uchar; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; + h5difftrace("diff_uchar start\n"); + + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar), + per); + } + nfound++; + } + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uchar,temp2_uchar, + PDIFF(temp1_uchar,temp2_uchar), + per); + } + nfound++; + } + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); + HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); + + if (temp1_uchar != temp2_uchar) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uchar,temp2_uchar,PDIFF(temp1_uchar,temp2_uchar)); + } + nfound++; + } + + mem1+=sizeof(unsigned char); + mem2+=sizeof(unsigned char); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_uchar finish\n"); + + return nfound; } /*------------------------------------------------------------------------- @@ -4343,160 +4121,147 @@ static hsize_t diff_short(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - short temp1_short; - short temp2_short; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_short start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - if (ABS(temp1_short-temp2_short) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - nfound++; - } - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - PER(temp1_short,temp2_short); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, - ABS(temp1_short-temp2_short)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_short,temp2_short, - ABS(temp1_short-temp2_short), - per); - } - nfound++; - } - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - PER(temp1_short,temp2_short); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, - ABS(temp1_short-temp2_short)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_short,temp2_short, - ABS(temp1_short-temp2_short), - per); - } - nfound++; - } - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_short, mem1, sizeof(short)); - HDmemcpy(&temp2_short, mem2, sizeof(short)); - - if (temp1_short != temp2_short) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); - } - nfound++; - } - - mem1+=sizeof(short); - mem2+=sizeof(short); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_short finish\n"); + hsize_t nfound=0; /* number of differences found */ + short temp1_short; + short temp2_short; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; + h5difftrace("diff_short start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + if (ABS(temp1_short-temp2_short) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + nfound++; + } + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + PER(temp1_short,temp2_short); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + ABS(temp1_short-temp2_short)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_short,temp2_short, + ABS(temp1_short-temp2_short), + per); + } + nfound++; + } + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } + } + + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + PER(temp1_short,temp2_short); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_short,temp2_short, + ABS(temp1_short-temp2_short)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_short,temp2_short, + ABS(temp1_short-temp2_short), + per); + } + nfound++; + } + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_short, mem1, sizeof(short)); + HDmemcpy(&temp2_short, mem2, sizeof(short)); + + if (temp1_short != temp2_short) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_short,temp2_short,ABS(temp1_short-temp2_short)); + } + nfound++; + } + + mem1+=sizeof(short); + mem2+=sizeof(short); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_short finish\n"); + + return nfound; } @@ -4523,162 +4288,147 @@ static hsize_t diff_ushort(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned short temp1_ushort; - unsigned short temp2_ushort; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_ushort start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort), - per); - } - nfound++; - } - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, - PDIFF(temp1_ushort,temp2_ushort), - per); - } - nfound++; - } - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); - HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - - if (temp1_ushort != temp2_ushort) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); - } - nfound++; - } - - mem1+=sizeof(unsigned short); - mem2+=sizeof(unsigned short); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_ushort finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned short temp1_ushort; + unsigned short temp2_ushort; + hsize_t i; + double per; + hbool_t both_zero; + + h5difftrace("diff_ushort start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - return nfound; -} + if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort), + per); + } + nfound++; + } + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_ushort,temp2_ushort, + PDIFF(temp1_ushort,temp2_ushort), + per); + } + nfound++; + } + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); + HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); + if (temp1_ushort != temp2_ushort) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_ushort,temp2_ushort,PDIFF(temp1_ushort,temp2_ushort)); + } + nfound++; + } + + mem1+=sizeof(unsigned short); + mem2+=sizeof(unsigned short); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_ushort finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -4704,162 +4454,147 @@ static hsize_t diff_int(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - int temp1_int; - int temp2_int; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_int start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - if (ABS(temp1_int-temp2_int) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - nfound++; - } - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - PER(temp1_int,temp2_int); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, - ABS(temp1_int-temp2_int)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_int,temp2_int, - ABS(temp1_int-temp2_int), - per); - } - nfound++; - } - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - PER(temp1_int,temp2_int); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, - ABS(temp1_int-temp2_int)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_int,temp2_int, - ABS(temp1_int-temp2_int), - per); - } - nfound++; - } - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_int, mem1, sizeof(int)); - HDmemcpy(&temp2_int, mem2, sizeof(int)); - - if (temp1_int != temp2_int) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); - } - nfound++; - } - - mem1+=sizeof(int); - mem2+=sizeof(int); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_int finish\n"); + hsize_t nfound=0; /* number of differences found */ + int temp1_int; + int temp2_int; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_int start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + if (ABS(temp1_int-temp2_int) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + nfound++; + } + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + PER(temp1_int,temp2_int); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + ABS(temp1_int-temp2_int)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_int,temp2_int, + ABS(temp1_int-temp2_int), + per); + } + nfound++; + } + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + PER(temp1_int,temp2_int); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_int,temp2_int, + ABS(temp1_int-temp2_int)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_int,temp2_int, + ABS(temp1_int-temp2_int), + per); + } + nfound++; + } + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_int, mem1, sizeof(int)); + HDmemcpy(&temp2_int, mem2, sizeof(int)); + + if (temp1_int != temp2_int) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_int,temp2_int,ABS(temp1_int-temp2_int)); + } + nfound++; + } + + mem1+=sizeof(int); + mem2+=sizeof(int); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_int finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -4885,160 +4620,144 @@ static hsize_t diff_uint(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned int temp1_uint; - unsigned int temp2_uint; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_uint start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - if ( PDIFF(temp1_uint,temp2_uint) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - PER_UNSIGN(signed int,temp1_uint,temp2_uint); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, - PDIFF(temp1_uint,temp2_uint), - per); - } - nfound++; - } - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - PER_UNSIGN(signed int,temp1_uint,temp2_uint); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, - PDIFF(temp1_uint,temp2_uint), - per); - } - nfound++; - } - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); - HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - - if (temp1_uint != temp2_uint) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); - } - nfound++; - } - - mem1+=sizeof(unsigned int); - mem2+=sizeof(unsigned int); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_uint finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned int temp1_uint; + unsigned int temp2_uint; + hsize_t i; + double per; + hbool_t both_zero; + + h5difftrace("diff_uint start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); - return nfound; -} + if ( PDIFF(temp1_uint,temp2_uint) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + + PER_UNSIGN(signed int,temp1_uint,temp2_uint); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, + PDIFF(temp1_uint,temp2_uint), + per); + } + nfound++; + } + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + PER_UNSIGN(signed int,temp1_uint,temp2_uint); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P_NOTCOMP,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT_P,temp1_uint,temp2_uint, + PDIFF(temp1_uint,temp2_uint), + per); + } + nfound++; + } + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); + HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); + + if (temp1_uint != temp2_uint) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(I_FORMAT,temp1_uint,temp2_uint,PDIFF(temp1_uint,temp2_uint)); + } + nfound++; + } + + mem1+=sizeof(unsigned int); + mem2+=sizeof(unsigned int); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_uint finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5064,166 +4783,150 @@ static hsize_t diff_long(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - long temp1_long; - long temp2_long; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_long start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - if (ABS(temp1_long-temp2_long) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); - } - nfound++; - } - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } - } - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - PER(temp1_long,temp2_long); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, - ABS(temp1_long-temp2_long)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_long,temp2_long, - ABS(temp1_long-temp2_long), - per); - } - nfound++; - } - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - PER(temp1_long,temp2_long); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, - ABS(temp1_long-temp2_long)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_long,temp2_long, - ABS(temp1_long-temp2_long), - per); - } - nfound++; - } - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_long, mem1, sizeof(long)); - HDmemcpy(&temp2_long, mem2, sizeof(long)); - - if (temp1_long != temp2_long) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); - } - nfound++; - } - - mem1+=sizeof(long); - mem2+=sizeof(long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_long finish\n"); + hsize_t nfound=0; /* number of differences found */ + long temp1_long; + long temp2_long; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_long start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + + if (ABS(temp1_long-temp2_long) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); + } + nfound++; + } + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + + PER(temp1_long,temp2_long); + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + ABS(temp1_long-temp2_long)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_long,temp2_long, + ABS(temp1_long-temp2_long), + per); + } + nfound++; + } + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + + PER(temp1_long,temp2_long); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P_NOTCOMP,temp1_long,temp2_long, + ABS(temp1_long-temp2_long)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_long,temp2_long, + ABS(temp1_long-temp2_long), + per); + } + nfound++; + } + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_long, mem1, sizeof(long)); + HDmemcpy(&temp2_long, mem2, sizeof(long)); + if (temp1_long != temp2_long) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_long,temp2_long,ABS(temp1_long-temp2_long)); + } + nfound++; + } + + mem1+=sizeof(long); + mem2+=sizeof(long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + + } + h5difftrace("diff_long finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5249,166 +4952,148 @@ static hsize_t diff_ulong(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned long temp1_ulong; - unsigned long temp2_ulong; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_ulong start\n"); - - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, - PDIFF(temp1_ulong,temp2_ulong), - per); - } - nfound++; - } - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, - PDIFF(temp1_ulong,temp2_ulong), - per); - } - nfound++; - } - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); - HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - - if (temp1_ulong != temp2_ulong) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); - } - nfound++; - } - - mem1+=sizeof(unsigned long); - mem2+=sizeof(unsigned long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_ulong finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned long temp1_ulong; + unsigned long temp2_ulong; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_ulong start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, + PDIFF(temp1_ulong,temp2_ulong), + per); + } + nfound++; + } + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULI_FORMAT_P_NOTCOMP,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT_P,temp1_ulong,temp2_ulong, + PDIFF(temp1_ulong,temp2_ulong), + per); + } + nfound++; + } + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); + HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); + + if (temp1_ulong != temp2_ulong) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LI_FORMAT,temp1_ulong,temp2_ulong,PDIFF(temp1_ulong,temp2_ulong)); + } + nfound++; + } + + mem1+=sizeof(unsigned long); + mem2+=sizeof(unsigned long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_ulong finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5434,156 +5119,140 @@ static hsize_t diff_llong(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - long long temp1_llong; - long long temp2_llong; - hsize_t i; - double per; - hbool_t both_zero; - - h5difftrace("diff_llong start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - if (ABS( temp1_llong-temp2_llong) > options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - PER(temp1_llong,temp2_llong); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - else - - if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); - } - nfound++; - } - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_llong, mem1, sizeof(long long)); - HDmemcpy(&temp2_llong, mem2, sizeof(long long)); - - if (temp1_llong != temp2_llong) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); - } - nfound++; - } - - mem1+=sizeof(long long); - mem2+=sizeof(long long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_llong finish\n"); + hsize_t nfound=0; /* number of differences found */ + long long temp1_llong; + long long temp2_llong; + hsize_t i; + double per; + hbool_t both_zero; - return nfound; -} + h5difftrace("diff_llong start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + if (ABS( temp1_llong-temp2_llong) > options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + + PER(temp1_llong,temp2_llong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); + } + nfound++; + } + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + + PER(temp1_llong,temp2_llong); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P_NOTCOMP,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + else + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT_P,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong),per); + } + nfound++; + } + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_llong, mem1, sizeof(long long)); + HDmemcpy(&temp2_llong, mem2, sizeof(long long)); + + if (temp1_llong != temp2_llong) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(LLI_FORMAT,temp1_llong,temp2_llong,ABS(temp1_llong-temp2_llong)); + } + nfound++; + } + + mem1+=sizeof(long long); + mem2+=sizeof(long long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_llong finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5609,161 +5278,145 @@ static hsize_t diff_ullong(unsigned char *mem1, int *ph) { - hsize_t nfound=0; /* number of differences found */ - unsigned long long temp1_ullong; - unsigned long long temp2_ullong; - hsize_t i; - float f1, f2; - double per; - hbool_t both_zero; - - h5difftrace("diff_ullong start\n"); - /* -d and !-p */ - if (options->d && !options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - - /* !-d and -p */ - else if (!options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } - - - } - - /* -d and -p */ - else if ( options->d && options->p) - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - ull2float(temp1_ullong,&f1); - ull2float(temp2_ullong,&f2); - PER(f1,f2); - - if (not_comparable && !both_zero) /* not comparable */ - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - else - - if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta ) - { - if ( print_data(options) ) - { - print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); - } - nfound++; - } - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } - - } - else - { - - for ( i = 0; i < nelmts; i++) - { - HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); - HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - - if (temp1_ullong != temp2_ullong) - { - if ( print_data(options) ) - { - print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); - parallel_print(SPACES); - parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); - } - nfound++; - } - - mem1+=sizeof(unsigned long long); - mem2+=sizeof(unsigned long long); - if (options->n && nfound>=options->count) - return nfound; - } /* nelmts */ - - } - h5difftrace("diff_ullong finish\n"); + hsize_t nfound=0; /* number of differences found */ + unsigned long long temp1_ullong; + unsigned long long temp2_ullong; + hsize_t i; + float f1, f2; + double per; + hbool_t both_zero; + + h5difftrace("diff_ullong start\n"); + /* -d and !-p */ + if (options->d && !options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); - return nfound; -} + if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) options->delta) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* !-d and -p */ + else if (!options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + ull2float(temp1_ullong,&f1); + ull2float(temp2_ullong,&f2); + PER(f1,f2); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + else + if ( per > options->percent ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); + } + nfound++; + } + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + /* -d and -p */ + else if ( options->d && options->p) + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + + ull2float(temp1_ullong,&f1); + ull2float(temp2_ullong,&f2); + PER(f1,f2); + + if (not_comparable && !both_zero) /* not comparable */ + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + else + if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long)options->delta ) + { + if ( print_data(options) ) + { + print_pos(ph,1,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per); + } + nfound++; + } + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } + } + else + { + for ( i = 0; i < nelmts; i++) + { + HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long)); + HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long)); + + if (temp1_ullong != temp2_ullong) + { + if ( print_data(options) ) + { + print_pos(ph,0,hyper_start+i,acc,pos,rank,dims,obj1,obj2); + parallel_print(SPACES); + parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong)); + } + nfound++; + } + + mem1+=sizeof(unsigned long long); + mem2+=sizeof(unsigned long long); + if (options->n && nfound>=options->count) + return nfound; + } /* nelmts */ + } + h5difftrace("diff_ullong finish\n"); + + return nfound; +} /*------------------------------------------------------------------------- @@ -5781,44 +5434,44 @@ static hsize_t diff_ullong(unsigned char *mem1, static int ull2float(unsigned long long ull_value, float *f_value) { - hid_t dxpl_id; - unsigned char *buf = NULL; - size_t src_size; - size_t dst_size; + hid_t dxpl_id; + unsigned char *buf = NULL; + size_t src_size; + size_t dst_size; - h5difftrace("ull2float start\n"); - if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) - goto error; + h5difftrace("ull2float start\n"); + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) + goto error; - src_size = H5Tget_size(H5T_NATIVE_ULLONG); - dst_size = H5Tget_size(H5T_NATIVE_FLOAT); - buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size)); - if(!buf) - goto error; + src_size = H5Tget_size(H5T_NATIVE_ULLONG); + dst_size = H5Tget_size(H5T_NATIVE_FLOAT); + buf = (unsigned char*)HDcalloc((size_t)1, MAX(src_size, dst_size)); + if(!buf) + goto error; - HDmemcpy(buf, &ull_value, src_size); + HDmemcpy(buf, &ull_value, src_size); - /* do conversion */ - if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0) - goto error; + /* do conversion */ + if(H5Tconvert(H5T_NATIVE_ULLONG, H5T_NATIVE_FLOAT, (size_t)1, buf, NULL, dxpl_id)<0) + goto error; - HDmemcpy(f_value, buf, dst_size); + HDmemcpy(f_value, buf, dst_size); - if(buf) - HDfree(buf); - h5difftrace("ull2float finish\n"); + if(buf) + HDfree(buf); + h5difftrace("ull2float finish\n"); - return 0; + return 0; error: - H5E_BEGIN_TRY { - H5Pclose(dxpl_id); - } H5E_END_TRY; - if(buf) - HDfree(buf); - h5difftrace("ull2float errored\n"); - - return -1; + H5E_BEGIN_TRY { + H5Pclose(dxpl_id); + } H5E_END_TRY; + if(buf) + HDfree(buf); + h5difftrace("ull2float errored\n"); + + return -1; } diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 14fbcaa..985a47d 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -186,21 +186,21 @@ void print_type(hid_t type) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE const char* diff_basename(const char *name) { size_t i; - if (name==NULL) + if (name == NULL) return NULL; /* Find the end of the base name */ i = HDstrlen(name); - while (i>0 && '/'==name[i-1]) + while (i > 0 && '/' == name[i - 1]) --i; /* Skip backward over base name */ - while (i>0 && '/'!=name[i-1]) + while (i > 0 && '/' != name[i - 1]) --i; return(name+i); @@ -217,20 +217,25 @@ diff_basename(const char *name) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE H5_ATTR_CONST const char* get_type(h5trav_type_t type) { switch(type) { case H5TRAV_TYPE_DATASET: return("H5G_DATASET"); + case H5TRAV_TYPE_GROUP: return("H5G_GROUP"); + case H5TRAV_TYPE_NAMED_DATATYPE: return("H5G_TYPE"); + case H5TRAV_TYPE_LINK: return("H5G_LINK"); + case H5TRAV_TYPE_UDLINK: return("H5G_UDLINK"); + case H5TRAV_TYPE_UNKNOWN: default: return("unknown type"); @@ -250,19 +255,23 @@ get_type(h5trav_type_t type) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE const char* get_sign(H5T_sign_t sign) { switch (sign) { case H5T_SGN_NONE: return "H5T_SGN_NONE"; + case H5T_SGN_2: return "H5T_SGN_2"; + case H5T_SGN_ERROR: return "H5T_SGN_ERROR"; + case H5T_NSGN: return "H5T_NSGN"; + default: HDassert(0); return "unknown sign value"; @@ -281,38 +290,48 @@ get_sign(H5T_sign_t sign) * *------------------------------------------------------------------------- */ -const char* +H5_ATTR_PURE const char* get_class(H5T_class_t tclass) { - switch (tclass) - { - case H5T_TIME: - return("H5T_TIME"); - case H5T_INTEGER: - return("H5T_INTEGER"); - case H5T_FLOAT: - return("H5T_FLOAT"); - case H5T_STRING: - return("H5T_STRING"); - case H5T_BITFIELD: - return("H5T_BITFIELD"); - case H5T_OPAQUE: - return("H5T_OPAQUE"); - case H5T_COMPOUND: - return("H5T_COMPOUND"); - case H5T_REFERENCE: - return("H5T_REFERENCE"); - case H5T_ENUM: - return("H5T_ENUM"); - case H5T_VLEN: - return("H5T_VLEN"); - case H5T_ARRAY: - return("H5T_ARRAY"); - case H5T_NO_CLASS: - case H5T_NCLASSES: - default: - HDassert(0); - return("Invalid class"); + switch (tclass) { + case H5T_TIME: + return("H5T_TIME"); + + case H5T_INTEGER: + return("H5T_INTEGER"); + + case H5T_FLOAT: + return("H5T_FLOAT"); + + case H5T_STRING: + return("H5T_STRING"); + + case H5T_BITFIELD: + return("H5T_BITFIELD"); + + case H5T_OPAQUE: + return("H5T_OPAQUE"); + + case H5T_COMPOUND: + return("H5T_COMPOUND"); + + case H5T_REFERENCE: + return("H5T_REFERENCE"); + + case H5T_ENUM: + return("H5T_ENUM"); + + case H5T_VLEN: + return("H5T_VLEN"); + + case H5T_ARRAY: + return("H5T_ARRAY"); + + case H5T_NO_CLASS: + case H5T_NCLASSES: + default: + HDassert(0); + return("Invalid class"); } /* end switch */ } /* end get_class() */ @@ -325,10 +344,10 @@ get_class(H5T_class_t tclass) */ void print_found(hsize_t nfound) { - if(g_Parallel) - parallel_print("%"H5_PRINTF_LL_WIDTH"u differences found\n", (unsigned long long)nfound); - else - HDfprintf(stdout,"%Hu differences found\n",nfound); + if(g_Parallel) + parallel_print("%"H5_PRINTF_LL_WIDTH"u differences found\n", (unsigned long long)nfound); + else + HDfprintf(stdout,"%Hu differences found\n",nfound); } @@ -375,3 +394,4 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id, out: return ret; } + diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 22c611f..bfcbfb8 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -47,9 +47,9 @@ int region_output; /* region output */ int oid_output; /* oid output */ int data_output; /* data output */ int attr_data_output; /* attribute data output */ -int packed_bits_num; /* number of packed bits to display */ -int packed_data_offset; /* offset of packed bits to display */ -int packed_data_length; /* lengtht of packed bits to display */ +unsigned packed_bits_num; /* number of packed bits to display */ +unsigned packed_data_offset; /* offset of packed bits to display */ +unsigned packed_data_length; /* length of packed bits to display */ unsigned long long packed_data_mask; /* mask in which packed bits to display */ int enable_error_stack= FALSE; /* re-enable error stack */ @@ -670,7 +670,7 @@ done: * Modifications: *------------------------------------------------------------------------- */ -static size_t +H5_ATTR_PURE static size_t h5tools_count_ncols(const char *s) { register size_t i; @@ -806,7 +806,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ size_t templength = 0; - int i, indentlevel = 0; + unsigned u, indentlevel = 0; if (stream == NULL) return; @@ -828,10 +828,9 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx); /* Write new prefix to output */ - if (ctx->indent_level >= 0) { + if (ctx->indent_level > 0) indentlevel = ctx->indent_level; - } - else { + else /* * This is because sometimes we don't print out all the header * info for the data (like the tattr-2.ddl example). If that happens @@ -839,29 +838,23 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, * just print out the default indent levels. */ indentlevel = ctx->default_indent_level; - } /* when printing array indices, print the indentation before the prefix the prefix is printed one indentation level before */ - if (info->pindex) { - for (i = 0; i < indentlevel - 1; i++) { + if (info->pindex) + for (u = 0; u < indentlevel - 1; u++) PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); - } - } - if (elmtno == 0 && secnum == 0 && info->line_1st) { + if (elmtno == 0 && secnum == 0 && info->line_1st) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); - } - else if (secnum && info->line_cont) { + else if (secnum && info->line_cont) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); - } - else { + else PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); - } templength = h5tools_str_len(&prefix); - for (i = 0; i < indentlevel; i++) { + for (u = 0; u < indentlevel; u++) /*we already made the indent for the array indices case */ if (!info->pindex) { PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); @@ -871,7 +864,6 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, /*we cannot count the prefix for the array indices case */ templength += h5tools_str_len(&str); } - } ctx->cur_column = ctx->prev_prefix_len = templength; ctx->cur_elmt = 0; @@ -901,7 +893,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_t prefix; h5tools_str_t str; /*temporary for indentation */ size_t templength = 0; - int i, indentlevel = 0; + unsigned u, indentlevel = 0; if (stream == NULL) return; @@ -923,7 +915,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_max_idx, ctx); /* Write new prefix to output */ - if (ctx->indent_level >= 0) + if (ctx->indent_level > 0) indentlevel = ctx->indent_level; else /* @@ -937,20 +929,19 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /* when printing array indices, print the indentation before the prefix the prefix is printed one indentation level before */ if (info->pindex) - for (i = 0; i < indentlevel - 1; i++) { + for (u = 0; u < indentlevel - 1; u++) PUTSTREAM(h5tools_str_fmt(&str, (size_t)0, info->line_indent), stream); - } - if (elmtno == 0 && secnum == 0 && info->line_1st) { + if (elmtno == 0 && secnum == 0 && info->line_1st) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_1st), stream); - } else if (secnum && info->line_cont) { + else if (secnum && info->line_cont) PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_cont), stream); - } else + else PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_pre), stream); templength = h5tools_str_len(&prefix); - for (i = 0; i < indentlevel; i++) { + for (u = 0; u < indentlevel; u++) /*we already made the indent for the array indices case */ if (!info->pindex) { PUTSTREAM(h5tools_str_fmt(&prefix, (size_t)0, info->line_indent), stream); @@ -960,7 +951,6 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, /*we cannot count the prefix for the array indices case */ templength += h5tools_str_len(&str); } - } ctx->cur_column = ctx->prev_prefix_len = templength; ctx->cur_elmt = 0; @@ -1300,9 +1290,8 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims) HDassert(ctx->ndims); ctx->acc[ctx->ndims - 1] = 1; - for (i = (ctx->ndims - 2); i >= 0; i--) { + for (i = ((int)ctx->ndims - 2); i >= 0; i--) ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1]; - } for (j = 0; j < ctx->ndims; j++) ctx->pos[j] = 0; } @@ -1537,18 +1526,18 @@ CATCH */ int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) + hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata) { hsize_t *dims1 = NULL; hsize_t *start = NULL; hsize_t *count = NULL; hsize_t numelem; hsize_t total_size[H5S_MAX_RANK]; - int jndx; + unsigned jndx; size_t type_size; hid_t mem_space = -1; void *region_buf = NULL; - int blkndx; + hsize_t blkndx; hid_t sid1 = -1; int ret_value = SUCCEED; @@ -1568,7 +1557,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, } /* Create dataspace for reading buffer */ - if((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) + if((mem_space = H5Screate_simple((int)ndims, dims1, NULL)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed"); if((type_size = H5Tget_size(type_id)) == 0) @@ -1641,7 +1630,8 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, hsize_t nblocks; hsize_t alloc_size; hsize_t *ptdata; - int ndims; + int sndims; + unsigned ndims; hid_t dtype = -1; hid_t type_id = -1; @@ -1650,16 +1640,16 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, nblocks = (hsize_t)snblocks; /* Print block information */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ndims = (unsigned)sndims; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); - if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0) + if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, nblocks, ptdata) < 0) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); if((dtype = H5Dget_type(region_id)) < 0) @@ -1706,10 +1696,10 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id, int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container, - int ndims, hid_t type_id, hssize_t npoints) + unsigned ndims, hid_t type_id, hsize_t npoints) { hsize_t *dims1 = NULL; - int type_size; + size_t type_size; hid_t mem_space = -1; void *region_buf = NULL; int ret_value = SUCCEED; @@ -1764,17 +1754,21 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container) { HERR_INIT(hbool_t, TRUE) - hssize_t npoints; - int ndims; + hssize_t snpoints; + hsize_t npoints; + int sndims; + unsigned ndims; hid_t dtype = -1; hid_t type_id = -1; - if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) + if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ndims = (unsigned)sndims; if((dtype = H5Dget_type(region_id)) < 0) HGOTO_ERROR(FALSE, H5E_tools_min_id_g, "H5Dget_type failed"); @@ -1805,7 +1799,7 @@ CATCH * Return: TRUE if all bytes are zero; FALSE otherwise *------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t h5tools_is_zero(const void *_mem, size_t size) { const unsigned char *mem = (const unsigned char *) _mem; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index ca2b39a..ed93a46 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -40,7 +40,7 @@ #define FLUSHSTREAM(S) if(S != NULL) HDfflush(S) #define PRINTSTREAM(S, F, ...) if(S != NULL) HDfprintf(S, F, __VA_ARGS__) #define PRINTVALSTREAM(S, V) if(S != NULL) HDfprintf(S, V) -#define PUTSTREAM(X,S) if(S != NULL) HDfputs(X, S); +#define PUTSTREAM(X,S) do { if(S != NULL) HDfputs(X, S); } while(0) /* * Strings for output - these were duplicated from the h5dump.h @@ -294,7 +294,7 @@ typedef struct h5tool_format_t { const char *fmt_float; int ascii; int str_locale; - int str_repeat; + unsigned str_repeat; /* * Fields associated with compound array members. @@ -510,9 +510,9 @@ typedef struct h5tools_context_t { hsize_t size_last_dim; /*the size of the last dimension, *needed so we can break after each *row */ - int indent_level; /*the number of times we need some + unsigned indent_level; /*the number of times we need some *extra indentation */ - int default_indent_level; /*this is used when the indent level gets changed */ + unsigned default_indent_level; /*this is used when the indent level gets changed */ hsize_t acc[H5S_MAX_RANK]; /* accumulator position */ hsize_t pos[H5S_MAX_RANK]; /* matrix position */ hsize_t sm_pos; /* current stripmine element position */ @@ -545,9 +545,9 @@ H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format; extern "C" { #endif -H5TOOLS_DLLVAR int packed_bits_num; /* number of packed bits to display */ -H5TOOLS_DLLVAR int packed_data_offset; /* offset of packed bits to display */ -H5TOOLS_DLLVAR int packed_data_length; /* lengtht of packed bits to display */ +H5TOOLS_DLLVAR unsigned packed_bits_num; /* number of packed bits to display */ +H5TOOLS_DLLVAR unsigned packed_data_offset; /* offset of packed bits to display */ +H5TOOLS_DLLVAR unsigned packed_data_length; /* length of packed bits to display */ H5TOOLS_DLLVAR unsigned long long packed_data_mask; /* mask in which packed bits to display */ H5TOOLS_DLLVAR FILE *rawattrstream; /* output stream for raw attribute data */ H5TOOLS_DLLVAR FILE *rawdatastream; /* output stream for raw data */ @@ -597,11 +597,11 @@ H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_form H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts); H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, - hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); + hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata); H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, - FILE* stream, hid_t container, int ndims, hid_t type_id, hssize_t npoints); + FILE* stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t npoints); H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 5fb35bf..cae3107 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -207,10 +207,10 @@ hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, size_t ncols, hsize_t region_elmt_counter/*element counter*/, hsize_t elmt_counter); -int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, +static int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); + unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata); hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, @@ -650,10 +650,10 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) == NULL) -{ + { HERROR(H5E_tools_g, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); HGOTO_DONE(dimension_break); -} + } if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, nblocks, ptdata) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Rget_select_hyper_blocklist failed"); @@ -795,20 +795,20 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id, * hssize_t npoints is the number of points in the region *------------------------------------------------------------------------- */ -int +static int h5tools_print_region_data_points(hid_t region_space, hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx, h5tools_str_t *buffer, size_t ncols, - int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) + unsigned ndims, hid_t type_id, hsize_t npoints, hsize_t *ptdata) { hbool_t dimension_break = TRUE; hsize_t *dims1 = NULL; hsize_t elmtno; /* elemnt index */ hsize_t curr_pos = 0; hsize_t total_size[H5S_MAX_RANK]; - size_t jndx; + hsize_t jndx; unsigned indx; - int type_size; + size_t type_size; int ret_value = SUCCEED; unsigned int region_flags; /* buffer extent flags */ hid_t mem_space = -1; @@ -823,7 +823,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, HDmemset(&ctx, 0, sizeof(ctx)); /* Allocate space for the dimension array */ - if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)) == NULL) + if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for dims"); dims1[0] = npoints; @@ -857,7 +857,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); /* assume entire data space to be printed */ - for (indx = 0; indx < (size_t) ctx.ndims; indx++) + for (indx = 0; indx < ctx.ndims; indx++) ctx.p_min_idx[indx] = 0; init_acc_pos(&ctx, total_size); @@ -866,13 +866,12 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id, if (jndx == npoints - 1) region_flags |= END_OF_DATA; - for (indx = 0; indx < (size_t)ctx.ndims; indx++) + for (indx = 0; indx < ctx.ndims; indx++) ctx.p_max_idx[indx] = cur_ctx->p_max_idx[indx]; ctx.sm_pos = jndx * ndims; - if (ctx.ndims > 0) { - ctx.size_last_dim = (int) (ctx.p_max_idx[ctx.ndims - 1]); - } + if (ctx.ndims > 0) + ctx.size_last_dim = ctx.p_max_idx[ctx.ndims - 1]; else ctx.size_last_dim = 0; @@ -938,11 +937,13 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, hsize_t elmt_counter) { HERR_INIT(hbool_t, TRUE) hbool_t dimension_break = TRUE; - hssize_t npoints; + hssize_t snpoints; + hsize_t npoints; hsize_t alloc_size; hsize_t *ptdata; - int ndims; - hssize_t indx; + int sndims; + unsigned ndims; + hsize_t indx; hid_t dtype = -1; hid_t type_id = -1; @@ -950,12 +951,14 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, HDassert(ctx); HDassert(buffer); - if((npoints = H5Sget_select_elem_npoints(region_space)) <= 0) + if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed"); + npoints = (hsize_t)snpoints; /* Allocate space for the dimension array */ - if((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) + if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0) H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + ndims = (unsigned)sndims; /* Render the region { element begin */ h5tools_str_reset(buffer); @@ -976,12 +979,11 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id, if(NULL == (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "Could not allocate buffer for ptdata"); - H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); - if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0) + if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, npoints, ptdata) < 0) HGOTO_ERROR(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_pointlist failed"); for (indx = 0; indx < npoints; indx++) { - int loop_indx; + unsigned loop_indx; h5tools_str_append(buffer, info->dset_ptformat_pre, indx ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long) indx); @@ -1349,7 +1351,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools } /* initialize temporary start, count and maximum start */ - for (i = 0; i < (size_t) ctx->ndims; i++) { + for (i = 0; i < ctx->ndims; i++) { temp_start[i] = sset->start.data[i]; temp_count[i] = sset->count.data[i]; temp_block[i] = sset->block.data[i]; @@ -1391,12 +1393,11 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools if (ctx->ndims > 2) { /* dimension for start */ - current_outer_dim = (ctx->ndims - 2) - 1; + current_outer_dim = (int)(ctx->ndims - 2) - 1; /* set start to original from current_outer_dim up */ - for (i = current_outer_dim + 1; i < ctx->ndims; i++) { + for (i = (size_t)(current_outer_dim + 1); i < ctx->ndims; i++) temp_start[i] = sset->start.data[i]; - } /* increment start dimension */ do { @@ -1516,6 +1517,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont hid_t f_space = -1; /* file data space */ hsize_t elmtno; /* counter */ size_t i; /* counter */ + int sndims; /* rank of dataspace */ int carry; /* counter carry value */ hsize_t zero[8]; /* vector of zeros */ unsigned int flags; /* buffer extent flags */ @@ -1545,11 +1547,13 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont if (f_space == FAIL) H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); - ctx->ndims = H5Sget_simple_extent_ndims(f_space); + sndims = H5Sget_simple_extent_ndims(f_space); + if(sndims < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + ctx->ndims = (unsigned)sndims; - if ((size_t)ctx->ndims > NELMTS(sm_size)) { + if ((size_t)ctx->ndims > NELMTS(sm_size)) H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed"); - } /* Assume entire data space to be printed */ if (ctx->ndims > 0) @@ -1691,10 +1695,14 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte hid_t type, hid_t space, void *mem) { HERR_INIT(herr_t, SUCCEED) + int sndims; /* rank of dataspace */ unsigned i; /*counters */ hsize_t nelmts; /*total selected elmts */ - ctx->ndims = H5Sget_simple_extent_ndims(space); + sndims = H5Sget_simple_extent_ndims(space); + if(sndims < 0) + H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed"); + ctx->ndims = (unsigned)sndims; if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx)) H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed"); @@ -1712,7 +1720,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte H5_LEAVE(SUCCEED); /* nothing to print */ if (ctx->ndims > 0) { HDassert(ctx->p_max_idx[ctx->ndims - 1] == (hsize_t) ((int) ctx->p_max_idx[ctx->ndims - 1])); - ctx->size_last_dim = (int) (ctx->p_max_idx[ctx->ndims - 1]); + ctx->size_last_dim = ctx->p_max_idx[ctx->ndims - 1]; } /* end if */ else ctx->size_last_dim = 0; @@ -2599,7 +2607,6 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i unsigned i; unsigned nmembs = 0; /*number of members */ int snmembs; - int nchars; /*number of output characters */ hid_t super = -1; /*enum base integer type */ hid_t native = -1; /*native integer datatype */ H5T_sign_t sign_type; /*sign of value type */ @@ -2666,12 +2673,14 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i /* Print members */ for (i = 0; i < nmembs; i++) { + int nchars; /*number of output characters */ + ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, (hsize_t)0, 0); h5tools_str_reset(buffer); h5tools_str_append(buffer, "\"%s\"", name[i]); - nchars = HDstrlen(name[i]); + nchars = (int)HDstrlen(name[i]); h5tools_str_append(buffer, "%*s ", MAX(0, 16 - nchars), ""); if (native < 0) { @@ -2923,6 +2932,8 @@ h5tools_print_virtual_selection(hid_t vspace, h5tools_str_reset(buffer); h5tools_str_append(buffer, "%s", VDS_ALL); break; + case H5S_SEL_ERROR: + case H5S_SEL_N: default: h5tools_str_append(buffer, "Unknown Selection"); } @@ -3632,7 +3643,7 @@ h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, if (cmt_bufsize > 0) { comment = (char *)HDmalloc((size_t)(cmt_bufsize+1)); /* new_size including null terminator */ if(comment) { - cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); + cmt_bufsize = H5Oget_comment(obj_id, comment, (size_t)cmt_bufsize); if(cmt_bufsize > 0) { comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ @@ -3771,49 +3782,39 @@ h5tools_print_dims(h5tools_str_t *buffer, hsize_t *s, int dims) void h5tools_print_packed_bits(h5tools_str_t *buffer, hid_t type) { - int packed_bits_size = 0; - + unsigned packed_bits_size = 0; hid_t n_type = h5tools_get_native_type(type); - if(H5Tget_class(n_type)==H5T_INTEGER) { - if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) { + + if(H5Tget_class(n_type) == H5T_INTEGER) { + if(H5Tequal(n_type, H5T_NATIVE_SCHAR) == TRUE) packed_bits_size = 8 * sizeof(char); - } - else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_UCHAR) == TRUE) packed_bits_size = 8 * sizeof(unsigned char); - } - else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_SHORT) == TRUE) packed_bits_size = 8 * sizeof(short); - } - else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_USHORT) == TRUE) packed_bits_size = 8 * sizeof(unsigned short); - } - else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_INT) == TRUE) packed_bits_size = 8 * sizeof(int); - } - else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_UINT) == TRUE) packed_bits_size = 8 * sizeof(unsigned int); - } - else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_LONG) == TRUE) packed_bits_size = 8 * sizeof(long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_ULONG) == TRUE) packed_bits_size = 8 * sizeof(unsigned long); - } - else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_LLONG) == TRUE) packed_bits_size = 8 * sizeof(long long); - } - else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) { + else if(H5Tequal(n_type, H5T_NATIVE_ULLONG) == TRUE) packed_bits_size = 8 * sizeof(unsigned long long); - } else error_msg("Packed Bit not valid for this datatype"); } - if ((packed_bits_size>0) && (packed_data_offset + packed_data_length) > packed_bits_size) { - error_msg("Packed Bit offset+length value(%d) too large. Max is %d\n", packed_data_offset+packed_data_length, packed_bits_size); + if((packed_bits_size > 0) && (packed_data_offset + packed_data_length) > packed_bits_size) { + error_msg("Packed Bit offset+length value(%u) too large. Max is %d\n", packed_data_offset + packed_data_length, packed_bits_size); packed_data_mask = 0; }; - h5tools_str_append(buffer, "%s %s=%d %s=%d", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length); + h5tools_str_append(buffer, "%s %s=%u %s=%u", PACKED_BITS, PACKED_OFFSET, packed_data_offset, PACKED_LENGTH, packed_data_length); } /*------------------------------------------------------------------------- diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index ccdba26..748eb78 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -147,58 +147,65 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr * *------------------------------------------------------------------------- */ -int h5tools_can_encode(H5Z_filter_t filtn) { - switch (filtn) { +int +h5tools_can_encode(H5Z_filter_t filtn) { + switch (filtn) { /* user defined filter */ default: - return 0; + return 0; case H5Z_FILTER_DEFLATE: #ifndef H5_HAVE_FILTER_DEFLATE - return 0; + return 0; #endif - break; + break; + case H5Z_FILTER_SZIP: #ifndef H5_HAVE_FILTER_SZIP - return 0; + return 0; #else { - unsigned int filter_config_flags; + unsigned int filter_config_flags; - if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) - return -1; - 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)) == 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)) == 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)) { - return 1; - } + if (H5Zget_filter_info(filtn, &filter_config_flags) < 0) + return -1; + 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)) == 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)) == 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)) { + return 1; + } } #endif - break; + break; + case H5Z_FILTER_SHUFFLE: - break; + break; + case H5Z_FILTER_FLETCHER32: - break; + break; + case H5Z_FILTER_NBIT: - break; + break; + case H5Z_FILTER_SCALEOFFSET: - break; - }/*switch*/ + break; + }/*switch*/ - return 1; + return 1; } + diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 13c6a20..6d9a041 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -91,7 +91,7 @@ h5tools_str_close(h5tools_str_t *str) * *------------------------------------------------------------------------- */ -size_t +H5_ATTR_PURE size_t h5tools_str_len(h5tools_str_t *str) { return str->len; @@ -126,14 +126,12 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) va_list ap; /* Make sure we have some memory into which to print */ - if (!str->s || str->nalloc <= 0) { + if (!str->s || str->nalloc <= 0) h5tools_str_reset(str); - } - if (HDstrlen(fmt) == 0) { + if (HDstrlen(fmt) == 0) /* nothing to print */ return str->s; - } /* Format the arguments and append to the value already in `str' */ while (1) { @@ -156,19 +154,18 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) * to lack of buffer size, so try one more time after realloc more * buffer size before return NULL. */ - if (nchars < 0) { + if (nchars < 0) /* failure, such as bad format */ return NULL; - } - if (nchars < 0 || (size_t) nchars >= avail || (0 == nchars && (HDstrcmp(fmt, "%s")))) { + if ((size_t) nchars >= avail || (0 == nchars && (HDstrcmp(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 * something other than "%s" * Alocate at least twice as much space and try again. */ - size_t newsize = MAX(str->len + nchars + 1, 2 * str->nalloc); + size_t newsize = MAX(str->len + (size_t)nchars + 1, 2 * str->nalloc); HDassert(newsize > str->nalloc); /*overflow*/ str->s = (char*)HDrealloc(str->s, newsize); HDassert(str->s); @@ -176,7 +173,7 @@ h5tools_str_append(h5tools_str_t *str/*in,out*/, const char *fmt, ...) } else { /* Success */ - str->len += nchars; + str->len += (size_t)nchars; break; } } @@ -498,41 +495,42 @@ void h5tools_str_dump_space_blocks(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info) { - hssize_t nblocks; - hsize_t alloc_size; - hsize_t *ptdata; - int ndims = H5Sget_simple_extent_ndims(rspace); + hssize_t snblocks; /* * This function fails if the rspace does not have blocks. */ H5E_BEGIN_TRY { - nblocks = H5Sget_select_hyper_nblocks(rspace); + snblocks = H5Sget_select_hyper_nblocks(rspace); } H5E_END_TRY; /* Print block information */ - if (nblocks > 0) { - int i; - + if (snblocks > 0) { + hsize_t nblocks; + hsize_t *ptdata; + hsize_t alloc_size; + unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace); + hsize_t u; + + nblocks = (hsize_t)snblocks; alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); - H5_CHECK_OVERFLOW(nblocks, hssize_t, hsize_t); - H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, (hsize_t)nblocks, ptdata); + H5Sget_select_hyper_blocklist(rspace, (hsize_t)0, nblocks, ptdata); - for (i = 0; i < nblocks; i++) { - int j; + for (u = 0; u < nblocks; u++) { + unsigned v; - h5tools_str_append(str, info->dset_blockformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)i); + h5tools_str_append(str, info->dset_blockformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "", (unsigned long)u); /* Start coordinates and opposite corner */ - for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", - ptdata[i * 2 * ndims + j]); + for (v = 0; v < ndims; v++) + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", + ptdata[u * 2 * ndims + v]); - for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : ")-(", - ptdata[i * 2 * ndims + j + ndims]); + for (v = 0; v < ndims; v++) + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : ")-(", + ptdata[u * 2 * ndims + v + ndims]); h5tools_str_append(str, ")"); } @@ -557,37 +555,38 @@ void h5tools_str_dump_space_points(h5tools_str_t *str, hid_t rspace, const h5tool_format_t *info) { - hssize_t npoints; - hsize_t alloc_size; - hsize_t *ptdata; - int ndims = H5Sget_simple_extent_ndims(rspace); + hssize_t snpoints; /* * This function fails if the rspace does not have points. */ H5E_BEGIN_TRY { - npoints = H5Sget_select_elem_npoints(rspace); + snpoints = H5Sget_select_elem_npoints(rspace); } H5E_END_TRY; /* Print point information */ - if (npoints > 0) { - int i; - + if (snpoints > 0) { + hsize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + unsigned ndims = (unsigned)H5Sget_simple_extent_ndims(rspace); + hsize_t u; + + npoints = (hsize_t)snpoints; alloc_size = npoints * ndims * sizeof(ptdata[0]); HDassert(alloc_size == (hsize_t) ((size_t) alloc_size)); /*check for overflow*/ ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); - H5_CHECK_OVERFLOW(npoints, hssize_t, hsize_t); - H5Sget_select_elem_pointlist(rspace, (hsize_t)0, (hsize_t)npoints, ptdata); + H5Sget_select_elem_pointlist(rspace, (hsize_t)0, npoints, ptdata); - for (i = 0; i < npoints; i++) { - int j; + for (u = 0; u < npoints; u++) { + unsigned v; - h5tools_str_append(str, info->dset_ptformat_pre, i ? "," OPTIONAL_LINE_BREAK " " : "", - (unsigned long)i); + h5tools_str_append(str, info->dset_ptformat_pre, u ? "," OPTIONAL_LINE_BREAK " " : "", + (unsigned long)u); - for (j = 0; j < ndims; j++) - h5tools_str_append(str, "%s" HSIZE_T_FORMAT, j ? "," : "(", - (ptdata[i * ndims + j])); + for (v = 0; v < ndims; v++) + h5tools_str_append(str, "%s" HSIZE_T_FORMAT, v ? "," : "(", + (ptdata[u * ndims + v])); h5tools_str_append(str, ")"); } @@ -676,13 +675,12 @@ void h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, h5tools_context_t *ctx) { - int i, indentlevel = 0; + unsigned u, indentlevel = 0; /* Write new prefix */ - if (ctx->indent_level >= 0) { + if (ctx->indent_level > 0) indentlevel = ctx->indent_level; - } - else { + else /* * This is because sometimes we don't print out all the header * info for the data (like the tattr-2.ddl example). If that happens @@ -690,11 +688,9 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, * just print out the default indent levels. */ indentlevel = ctx->default_indent_level; - } - for (i = 0; i < indentlevel; i++) { + for (u = 0; u < indentlevel; u++) h5tools_str_append(str, "%s", OPT(info->line_indent, "")); - } } /*------------------------------------------------------------------------- @@ -753,22 +749,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai unsigned char *ucp_vp = (unsigned char *)vp; char *cp_vp = (char *)vp; hid_t memb, obj; - unsigned nmembs; static char fmt_llong[8], fmt_ullong[8]; H5T_str_t pad; H5T_class_t type_class; - /* - * some tempvars to store the value before we append it to the string to - * get rid of the memory alignment problem - */ - unsigned long long tempullong; - long long templlong; - unsigned long tempulong; - long templong; - unsigned int tempuint; - int tempint; - /* Build default formats for long long types */ if (!fmt_llong[0]) { HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH); @@ -823,6 +807,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai #endif } break; + case H5T_STRING: { unsigned int i; @@ -843,12 +828,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai pad = H5Tget_strpad(type); /* Check for NULL pointer for string */ - if (s == NULL) { + if (s == NULL) h5tools_str_append(str, "NULL"); - } else { for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { - int j = 1; + unsigned j = 1; /* * Count how many times the next character repeats. If the @@ -865,7 +849,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai * in it's own quote. */ if (info->str_repeat > 0 && j > info->str_repeat) { - if (quote) h5tools_str_append(str, "%c", quote); + if (quote) + h5tools_str_append(str, "%c", quote); quote = '\''; h5tools_str_append(str, "%s%c", i ? " " : "", quote); @@ -888,10 +873,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai quote = '\0'; i += j - 1; } - } - if (quote) h5tools_str_append(str, "%c", quote); + if (quote) + h5tools_str_append(str, "%c", quote); if (i == 0) /*empty string*/ @@ -899,64 +884,64 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* end else */ } break; + case H5T_INTEGER: if (sizeof(char) == nsize) { - /* if ((H5Tequal(type, H5T_NATIVE_SCHAR) || H5Tequal(type, H5T_NATIVE_UCHAR))) */ - if (info->ascii) { + if (info->ascii) h5tools_print_char(str, info, (char) (*ucp_vp)); - } else if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_UCHAR)) */ unsigned char tempuchar; + HDmemcpy(&tempuchar, ucp_vp, sizeof(unsigned char)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned char)) tempuchar = 0; else - tempuchar = (tempuchar >> packed_data_offset) & packed_data_mask; + tempuchar = (unsigned char)((unsigned long long)(tempuchar >> packed_data_offset) & packed_data_mask); } - h5tools_str_append(str, OPT(info->fmt_uchar, "%u"), tempuchar); + h5tools_str_append(str, OPT(info->fmt_uchar, "%hhu"), tempuchar); } else { - /* if (H5Tequal(type, H5T_NATIVE_SCHAR)) */ signed char tempchar; + HDmemcpy(&tempchar, cp_vp, sizeof(char)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(char)) tempchar = 0; else - tempchar = (tempchar >> packed_data_offset) & packed_data_mask; + tempchar = (signed char)((unsigned long long)(tempchar >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_schar, "%hhd"), tempchar); } } /* end if (sizeof(char) == nsize) */ else if (sizeof(int) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_UINT)) */ + unsigned int tempuint; + HDmemcpy(&tempuint, vp, sizeof(unsigned int)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned int)) tempuint = 0; else - tempuint = (tempuint >> packed_data_offset) & packed_data_mask; + tempuint = (unsigned)((tempuint >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_uint, "%u"), tempuint); } else { - /* if (H5Tequal(type, H5T_NATIVE_INT)) */ + int tempint; + HDmemcpy(&tempint, vp, sizeof(int)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(int)) tempint = 0; else - tempint = (tempint >> packed_data_offset) & packed_data_mask; + tempint = (int)((unsigned long long)(tempint >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_int, "%d"), tempint); } } /* end if (sizeof(int) == nsize) */ else if (sizeof(short) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_USHORT)) */ unsigned short tempushort; HDmemcpy(&tempushort, vp, sizeof(unsigned short)); @@ -964,12 +949,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (packed_data_offset >= 8 * sizeof(unsigned short)) tempushort = 0; else - tempushort = (tempushort >> packed_data_offset) & packed_data_mask; + tempushort = (unsigned short)((unsigned long long)(tempushort >> packed_data_offset) & packed_data_mask); } - h5tools_str_append(str, OPT(info->fmt_ushort, "%u"), tempushort); + h5tools_str_append(str, OPT(info->fmt_ushort, "%hu"), tempushort); } else { - /* if (H5Tequal(type, H5T_NATIVE_SHORT)) */ short tempshort; HDmemcpy(&tempshort, vp, sizeof(short)); @@ -977,14 +961,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai if (packed_data_offset >= 8 * sizeof(short)) tempshort = 0; else - tempshort = (tempshort >> packed_data_offset) & packed_data_mask; + tempshort = (short)((unsigned long long)(tempshort >> packed_data_offset) & packed_data_mask); } - h5tools_str_append(str, OPT(info->fmt_short, "%d"), tempshort); + h5tools_str_append(str, OPT(info->fmt_short, "%hd"), tempshort); } } /* end if (sizeof(short) == nsize) */ else if (sizeof(long) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_ULONG)) */ + unsigned long tempulong; + HDmemcpy(&tempulong, vp, sizeof(unsigned long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned long)) @@ -995,20 +980,23 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_ulong, "%lu"), tempulong); } else { - /* if (H5Tequal(type, H5T_NATIVE_LONG)) */ + long templong; + HDmemcpy(&templong, vp, sizeof(long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(long)) templong = 0; else - templong = (templong >> packed_data_offset) & packed_data_mask; + templong = (long)((unsigned long long)(templong >> packed_data_offset) & packed_data_mask); } h5tools_str_append(str, OPT(info->fmt_long, "%ld"), templong); } } /* end if (sizeof(long) == nsize) */ +#if H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG else if (sizeof(long long) == nsize) { if(H5T_SGN_NONE == nsign) { - /* if (H5Tequal(type, H5T_NATIVE_ULLONG)) */ + unsigned long long tempullong; + HDmemcpy(&tempullong, vp, sizeof(unsigned long long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(unsigned long long)) @@ -1019,7 +1007,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_ullong, fmt_ullong), tempullong); } else { - /* if (H5Tequal(type, H5T_NATIVE_LLONG)) */ + long long templlong; + HDmemcpy(&templlong, vp, sizeof(long long)); if (packed_bits_num) { if (packed_data_offset >= 8 * sizeof(long long)) @@ -1030,12 +1019,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_append(str, OPT(info->fmt_llong, fmt_llong), templlong); } } /* end if (sizeof(long long) == nsize) */ +#endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ break; + case H5T_COMPOUND: { + unsigned nmembs; unsigned j; - nmembs = H5Tget_nmembers(type); + nmembs = (unsigned)H5Tget_nmembers(type); h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{")); ctx->indent_level++; @@ -1046,7 +1038,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai else h5tools_str_append(str, "%s", OPT(info->cmpd_end, "")); - if (info->arr_linebreak) h5tools_str_indent(str, info, ctx); + if (info->arr_linebreak) + h5tools_str_indent(str, info, ctx); /* The name */ name = H5Tget_member_name(type, j); @@ -1068,9 +1061,9 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai h5tools_str_indent(str, info, ctx); } h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}")); - } break; + case H5T_ENUM: { char enum_name[1024]; @@ -1090,10 +1083,10 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } } break; + case H5T_REFERENCE: - if (h5tools_str_is_zero(vp, nsize)) { + if (h5tools_str_is_zero(vp, nsize)) h5tools_str_append(str, "NULL"); - } else { if (nsize == H5R_DSET_REG_REF_BUF_SIZE) { /* if (H5Tequal(type, H5T_STD_REF_DSETREG)) */ @@ -1149,6 +1142,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai } /* end else if (H5Tequal(type, H5T_STD_REF_OBJ)) */ } break; + case H5T_ARRAY: { int k, ndims; @@ -1175,7 +1169,8 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai ctx->indent_level++; for (i = 0; i < nelmts; i++) { - if (i) h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); + if (i) + h5tools_str_append(str, "%s", OPT(info->arr_sep, "," OPTIONAL_LINE_BREAK)); if (info->arr_linebreak && i && i % dims[ndims - 1] == 0) { h5tools_str_append(str, "%s", "\n"); @@ -1210,6 +1205,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai H5Tclose(memb); } break; + case H5T_VLEN: { unsigned int i; @@ -1459,31 +1455,33 @@ h5tools_str_is_zero(const void *_mem, size_t size) char * h5tools_str_replace ( const char *string, const char *substr, const char *replacement ) { - char *tok = NULL; - char *newstr = NULL; - char *oldstr = NULL; - char *head = NULL; - - if ( substr == NULL || replacement == NULL ) - return HDstrdup (string); - newstr = HDstrdup (string); - head = newstr; - while ( (tok = HDstrstr ( head, substr ))){ - oldstr = newstr; - newstr = (char *)HDmalloc( HDstrlen( oldstr ) - HDstrlen( substr ) + HDstrlen( replacement ) + 1 ); - - if ( newstr == NULL ){ - HDfree (oldstr); + char *tok = NULL; + char *newstr = NULL; + char *head = NULL; + + if(substr == NULL || replacement == NULL) + return HDstrdup(string); + newstr = HDstrdup(string); + head = newstr; + while((tok = HDstrstr(head, substr))) { + char *oldstr; + + oldstr = newstr; + newstr = (char *)HDmalloc(HDstrlen(oldstr) - HDstrlen(substr) + HDstrlen(replacement) + 1); + + if(newstr == NULL) { + HDfree(oldstr); return NULL; } - HDmemcpy ( newstr, oldstr, tok - oldstr ); - HDmemcpy ( newstr + (tok - oldstr), replacement, HDstrlen ( replacement ) ); - HDmemcpy ( newstr + (tok - oldstr) + HDstrlen( replacement ), tok + HDstrlen ( substr ), HDstrlen ( oldstr ) - HDstrlen ( substr ) - ( tok - oldstr ) ); - HDmemset ( newstr + HDstrlen ( oldstr ) - HDstrlen ( substr ) + HDstrlen ( replacement ) , 0, 1 ); + HDmemcpy(newstr, oldstr, (size_t)(tok - oldstr)); + HDmemcpy(newstr + (tok - oldstr), replacement, HDstrlen(replacement)); + HDmemcpy(newstr + (tok - oldstr) + HDstrlen(replacement), tok + HDstrlen(substr), HDstrlen(oldstr) - HDstrlen(substr) - (size_t)(tok - oldstr)); + HDmemset(newstr + HDstrlen (oldstr) - HDstrlen(substr) + HDstrlen(replacement) , 0, 1); /* move back head right after the last replacement */ - head = newstr + (tok - oldstr) + HDstrlen( replacement ); - HDfree (oldstr); + head = newstr + (tok - oldstr) + HDstrlen(replacement); + HDfree(oldstr); } return newstr; } + diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index b87abf6..0884945 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -34,7 +34,7 @@ #include "h5trav.h" /* global variables */ -int h5tools_nCols = 80; +unsigned h5tools_nCols = 80; /* ``get_option'' variables */ int opt_err = 1; /*get_option prints errors if this is on */ int opt_ind = 1; /*token pointer */ @@ -57,7 +57,7 @@ hsize_t H5TOOLS_BUFSIZE = ( 32 * 1024 * 1024); /* 32 MB */ /* ``parallel_print'' variables */ unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */ char outBuff[OUTBUFF_SIZE]; -int outBuffOffset; +unsigned outBuffOffset; FILE* overflow_file = NULL; /* local functions */ @@ -89,11 +89,11 @@ void parallel_print(const char* format, ...) HDvprintf(format, ap); else { if(overflow_file == NULL) /*no overflow has occurred yet */ { - bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap); + bytes_written = HDvsnprintf(outBuff + outBuffOffset, OUTBUFF_SIZE - outBuffOffset, format, ap); HDva_end(ap); HDva_start(ap, format); - if((bytes_written < 0) || (bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) { + if((bytes_written < 0) || ((unsigned)bytes_written >= (OUTBUFF_SIZE - outBuffOffset))) { /* Terminate the outbuff at the end of the previous output */ outBuff[outBuffOffset] = '\0'; @@ -104,7 +104,7 @@ void parallel_print(const char* format, ...) bytes_written = HDvfprintf(overflow_file, format, ap); } else - outBuffOffset += bytes_written; + outBuffOffset += (unsigned)bytes_written; } else bytes_written = HDvfprintf(overflow_file, format, ap); @@ -376,7 +376,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti *------------------------------------------------------------------------- */ void -indentation(int x) +indentation(unsigned x) { if (x < h5tools_nCols) { while (x-- > 0) @@ -408,7 +408,7 @@ print_version(const char *progname) { PRINTSTREAM(rawoutstream, "%s: Version %u.%u.%u%s%s\n", progname, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, - ((char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); + ((const char *)H5_VERS_SUBRELEASE)[0] ? "-" : "", H5_VERS_SUBRELEASE); } @@ -532,7 +532,7 @@ dump_tables(find_objs_t *info) * *------------------------------------------------------------------------- */ -obj_t * +H5_ATTR_PURE obj_t * search_obj(table_t *table, haddr_t objno) { unsigned u; @@ -680,7 +680,7 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table, static void add_obj(table_t *table, haddr_t objno, const char *objname, hbool_t record) { - unsigned u; + size_t u; /* See if we need to make table larger */ if(table->nobjs == table->size) { @@ -883,12 +883,14 @@ void h5tools_setstatus(int D_status) h5tools_d_status = D_status; } -const char*h5tools_getprogname(void) +H5_ATTR_PURE const char * +h5tools_getprogname(void) { return h5tools_progname; } -int h5tools_getstatus(void) +H5_ATTR_PURE int +h5tools_getstatus(void) { return h5tools_d_status; } @@ -912,7 +914,6 @@ int h5tools_getenv_update_hyperslab_bufsize(void) hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10); if (errno != 0 || hyperslab_bufsize_mb <= 0) { - /* TODO: later when pubilshed HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str); */ @@ -922,13 +923,14 @@ int h5tools_getenv_update_hyperslab_bufsize(void) /* convert MB to byte */ - H5TOOLS_BUFSIZE = hyperslab_bufsize_mb * 1024 * 1024; + H5TOOLS_BUFSIZE = (hsize_t)hyperslab_bufsize_mb * 1024 * 1024; H5TOOLS_MALLOCSIZE = MAX(H5TOOLS_BUFSIZE, H5TOOLS_MALLOCSIZE); } - return (1); + error: return (-1); } + diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h index 3285278..f7ab65b 100644 --- a/tools/lib/h5tools_utils.h +++ b/tools/lib/h5tools_utils.h @@ -35,7 +35,7 @@ extern "C" { H5TOOLS_DLLVAR int g_nTasks; H5TOOLS_DLLVAR unsigned char g_Parallel; H5TOOLS_DLLVAR char outBuff[]; -H5TOOLS_DLLVAR int outBuffOffset; +H5TOOLS_DLLVAR unsigned outBuffOffset; H5TOOLS_DLLVAR FILE * overflow_file; /* Maximum size used in a call to malloc for a dataset */ @@ -119,10 +119,10 @@ typedef struct find_objs_t { table_t *dset_table; } find_objs_t; -H5TOOLS_DLLVAR int h5tools_nCols; /*max number of columns for outputting */ +H5TOOLS_DLLVAR unsigned h5tools_nCols; /*max number of columns for outputting */ /* Definitions of useful routines */ -H5TOOLS_DLL void indentation(int); +H5TOOLS_DLL void indentation(unsigned); H5TOOLS_DLL void print_version(const char *progname); H5TOOLS_DLL void parallel_print(const char* format, ... ); H5TOOLS_DLL void error_msg(const char *fmt, ...); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 86e60c3..66beb0d 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -161,7 +161,7 @@ trav_addr_add(trav_addr_t *visited, haddr_t addr, const char *path) * *------------------------------------------------------------------------- */ -static const char * +H5_ATTR_PURE static const char * trav_addr_visited(trav_addr_t *visited, haddr_t addr) { size_t u; /* Local index variable */ @@ -490,7 +490,7 @@ h5trav_getinfo(hid_t file_id, trav_info_t *info) *------------------------------------------------------------------------- */ -ssize_t +H5_ATTR_PURE ssize_t h5trav_getindex(const trav_info_t *info, const char *obj) { size_t u; /* Local index variable */ @@ -681,7 +681,7 @@ h5trav_gettable(hid_t fid, trav_table_t *table) *------------------------------------------------------------------------- */ -int +H5_ATTR_PURE int h5trav_getindext(const char *name, const trav_table_t *table) { unsigned int i; @@ -1235,7 +1235,7 @@ symlink_visit_add(symlink_trav_t *visited, H5L_type_t type, const char *file, co * *------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t symlink_is_visited(symlink_trav_t *visited, H5L_type_t type, const char *file, const char *path) { size_t u; /* Local index variable */ diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c index b85133d..4d79a9b 100644 --- a/tools/lib/io_timer.c +++ b/tools/lib/io_timer.c @@ -222,7 +222,7 @@ set_time(io_time_t *pt, timer_type t, int start_stop) * Programmer: Bill Wendling, 01. October 2001 * Modifications: */ -double +H5_ATTR_PURE double get_time(io_time_t *pt, timer_type t) { return pt->total_time[t]; |