summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPeter Cao <xcao@hdfgroup.org>2011-07-15 23:02:50 (GMT)
committerPeter Cao <xcao@hdfgroup.org>2011-07-15 23:02:50 (GMT)
commit877b7aed1b543d2e7fde2d9c2c2eda325d3894c0 (patch)
tree9eaa4845a0a330a3f73ebb6b2cd995232c61898a /tools
parentdc9288a44706fa89558d218325f34dbfdad31d07 (diff)
downloadhdf5-877b7aed1b543d2e7fde2d9c2c2eda325d3894c0.zip
hdf5-877b7aed1b543d2e7fde2d9c2c2eda325d3894c0.tar.gz
hdf5-877b7aed1b543d2e7fde2d9c2c2eda325d3894c0.tar.bz2
[svn-r21105] Fixed two bugs:
- h5repack: h5repack failed to copy dataset if the layout is changed from chunked with unlimited dims to contiguous. (PC -- 2011/07/15) - h5diff: "--delta" option considers two NaN of the same type are different, which is wrong based on http://www.hdfgroup.org/HDF5/doc/RM/Tools.html#Tools-Diff. (PC -- 2011/07/15)
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/h5diffgentest.c77
-rw-r--r--tools/h5diff/testfiles/h5diff_17.txt1
-rw-r--r--tools/h5diff/testfiles/h5diff_basic1.h5bin11976 -> 12248 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh4
-rw-r--r--tools/h5repack/h5repack_copy.c5
-rw-r--r--tools/h5repack/testfiles/h5repack_layout.h5bin29384 -> 27280 bytes
-rw-r--r--tools/lib/h5diff_array.c132
-rw-r--r--tools/lib/h5diff_dset.c7
8 files changed, 132 insertions, 94 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 2f65fca..719707f 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -335,7 +335,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- /* epsilon = 0.0000001 = 1e-7
+ /* epsilon = 0.0000001 = 1e-7
* system epsilon for float : FLT_EPSILON = 1.19209E-07
*/
float data11[3][2] ={{0.000000f,0.0000001f},{0.0000001f, 0.00000022f},{0.0000001f,0.0000001f}};
@@ -416,7 +416,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
data17[5] = 1;
data18[0] = (float) sqrt( (double)-1 );
- data18[1] = (float) sqrt( (double)-1 );
+ data18[1] = (float) sqrt( (double)-10000 );
data18[2] = 1;
data18[3] = 1;
data18[4] = 1;
@@ -424,6 +424,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp17",H5T_NATIVE_DOUBLE,data17);
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
+ write_dset(gid1,1,dims1,"fp18_COPY",H5T_NATIVE_DOUBLE,data18);
}
/*------------------------------------------------------------------------
@@ -932,7 +933,7 @@ int test_attributes(const char *file,
/*-------------------------------------------------------------------------
* Function: test_attributes_verbose_level
*
-* Purpose: Cresting test files for testing attributes along with
+* Purpose: Cresting test files for testing attributes along with
* levels of verbos option
*
*-------------------------------------------------------------------------
@@ -1040,7 +1041,7 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
goto out;
}
-
+
/*----------------------------------------------------------------------
@@ -1121,7 +1122,7 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
/*----------------------------------
* CASE1 - Same attr number, all Same attr name
- * add attr to group
+ * add attr to group
*/
write_attr(f1_gid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata);
write_attr(f1_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f1_attr_fdata);
@@ -1130,8 +1131,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_gid,1,attr_dims,"float1",H5T_NATIVE_FLOAT,f2_attr_fdata);
/*----------------------------------
- * CASE2 - Same attr number, some Same attr name
- * add attr to dset
+ * CASE2 - Same attr number, some Same attr name
+ * add attr to dset
*/
write_attr(f1_did,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata);
write_attr(f1_did,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata);
@@ -1140,8 +1141,8 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_did,1,attr_dims,"float3",H5T_NATIVE_FLOAT,f2_attr_fdata);
/*----------------------------------
- * CASE3 - Same attr number, all different attr name
- * add attr to ntype
+ * CASE3 - Same attr number, all different attr name
+ * add attr to ntype
*/
write_attr(f1_tid,1,attr_dims,"integer1",H5T_NATIVE_INT,f1_attr_idata);
write_attr(f1_tid,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f1_attr_fdata);
@@ -1161,11 +1162,11 @@ static int test_attributes_verbose_level(const char *fname1, const char *fname2)
write_attr(f2_gid2,1,attr_dims,"integer1",H5T_NATIVE_INT,f2_attr_idata);
write_attr(f2_gid2,1,attr_dims,"float2",H5T_NATIVE_FLOAT,f2_attr_fdata);
-
+
/*----------------------------------
* CASE5 - Different attr number, all different attr name
- * add attr to g3
+ * add attr to g3
*/
write_attr(f1_gid3,1,attr_dims,"integer10",H5T_NATIVE_INT,f1_attr_idata);
write_attr(f1_gid3,1,attr_dims,"float11",H5T_NATIVE_FLOAT,f1_attr_fdata);
@@ -1307,10 +1308,10 @@ int test_special_datasets(const char *file,
status = H5Sclose(sid0);
assert(status >= 0);
- /* Create a dataset with zero dimension size in one file but the other one
+ /* Create a dataset with zero dimension size in one file but the other one
* has a dataset with a non-zero dimension size */
if(make_diffs) {
- dims[1] = SPACE1_DIM2 + 4;
+ dims[1] = SPACE1_DIM2 + 4;
}
sid = H5Screate_simple(SPACE1_RANK, dims, NULL);
@@ -2650,9 +2651,9 @@ static int test_group_recurse(const char *fname1, const char *fname2)
}
/*------------------------------
- * external circle route test
+ * external circle route test
* file1/grp11 <-> file2/grp10 via elink_grp_circle link
- */
+ */
/* file1 */
status = H5Lcreate_external(fname2, "/grp11", gid10_f1, "elink_grp_circle", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
@@ -2697,7 +2698,7 @@ out:
/*-------------------------------------------------------------------------
*
-* Purpose:
+* Purpose:
* For testing comparing group member objects recursively via multiple
* linked external links
*
@@ -2865,7 +2866,7 @@ static int test_group_recurse2(void)
fileid4 = H5Fcreate(GRP_RECURSE2_EXT3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
+ * Groups
*/
grp4 = H5Gcreate2(fileid4, "/g4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp4 < 0)
@@ -2902,7 +2903,7 @@ static int test_group_recurse2(void)
fileid3 = H5Fcreate(GRP_RECURSE2_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
+ * Groups
*/
grp2 = H5Gcreate2(fileid3, "g2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp2 < 0)
@@ -2958,7 +2959,7 @@ static int test_group_recurse2(void)
fileid2 = H5Fcreate(GRP_RECURSE2_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
/*-----------------------------------------------
- * Groups
+ * Groups
*/
grp1 = H5Gcreate2(fileid2, "g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (grp1 < 0)
@@ -3087,7 +3088,7 @@ static int test_exclude_obj1(const char *fname1, const char *fname2)
/*-----------------------------------------------------------------------
- * Datasets
+ * Datasets
*------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
@@ -3161,7 +3162,7 @@ out:
*
* Purpose: Create test files for excluding obj.
* different structure and name
-* Test : exclude different objs to verify the rest are same
+* Test : exclude different objs to verify the rest are same
*
* Programmer: Jonathan Kim (July, 21, 2010)
*
@@ -3232,7 +3233,7 @@ static int test_exclude_obj2(const char *fname1, const char *fname2)
/*-----------------------------------------------------------------------
- * Datasets
+ * Datasets
*------------------------------------------------------------------------*/
/* file1 */
status = write_dset(fid1,2,dims2,"dset10",H5T_NATIVE_INT,data1);
@@ -3307,7 +3308,7 @@ out:
/*-------------------------------------------------------------------------
*
* Purpose: Create test files for multiple variable length string/string array
-* along with fixed length string/string array types in
+* along with fixed length string/string array types in
* a compound type dataset.
*
* Programmer: Jonathan Kim (Oct, 26, 2010)
@@ -3493,8 +3494,8 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
/* objref */
hsize_t objref_dims[1]={1};
- /*------------------------------------------
- * compound dataset
+ /*------------------------------------------
+ * compound dataset
*------------------------------------------*/
hid_t sid_comp=0; /* dataspace ID */
hid_t tid1_comp=0; /* datatype ID */
@@ -3640,7 +3641,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
}
/*-----------------------------------------------------------------------
- * Create group
+ * Create group
*------------------------------------------------------------------------*/
gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
if (gid < 0)
@@ -3883,7 +3884,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
/* Write data to compound 3 dataset buffer */
@@ -3894,7 +3895,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
/* Write data to compound 4 dataset buffer */
@@ -3905,7 +3906,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
/* Write data to compound 5 dataset buffer */
@@ -3916,7 +3917,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
/* Write data to compound 6 dataset buffer */
@@ -3927,7 +3928,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
/* Write data to compound 7 dataset buffer */
@@ -3938,7 +3939,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
/* Write data to compound 8 dataset buffer */
@@ -3949,7 +3950,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
/* Write data to compound 9 dataset buffer */
@@ -3966,7 +3967,7 @@ static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int
fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1);
status = FAIL;
goto out;
- }
+ }
H5Dclose(did_comp);
@@ -4049,7 +4050,7 @@ test_enums(const char *fname)
int enum_val = -1;
/* The data in the two arrays cover the following cases:
- *
+ *
* V = valid enum value, I = invalid enum value
*
* 0: I-I (same value)
@@ -4083,7 +4084,7 @@ test_enums(const char *fname)
/*-----------------------------------------------------------------------
* Create enum types
*---------------------------------------------------------------------*/
-
+
tid = H5Tenum_create(H5T_NATIVE_INT);
enum_val = 0;
status = H5Tenum_insert(tid, "YIN", &enum_val);
@@ -4093,7 +4094,7 @@ test_enums(const char *fname)
/*-----------------------------------------------------------------------
* Create datasets containing enum data.
*---------------------------------------------------------------------*/
-
+
status = write_dset(fid, 1, &dims, "dset1", tid, data1);
status = write_dset(fid, 1, &dims, "dset2", tid, data2);
@@ -4105,7 +4106,7 @@ out:
H5Fclose(fid);
if(tid)
H5Tclose(tid);
-
+
return status;
}
diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt
index 5e48dae..4906a2a 100644
--- a/tools/h5diff/testfiles/h5diff_17.txt
+++ b/tools/h5diff/testfiles/h5diff_17.txt
@@ -22,6 +22,7 @@ file1 file2
x /g1/fp16
x /g1/fp17
x /g1/fp18
+ x /g1/fp18_COPY
x /g1/fp19
x /g1/fp19_COPY
x /g1/fp2
diff --git a/tools/h5diff/testfiles/h5diff_basic1.h5 b/tools/h5diff/testfiles/h5diff_basic1.h5
index d97017e..e1396be 100644
--- a/tools/h5diff/testfiles/h5diff_basic1.h5
+++ b/tools/h5diff/testfiles/h5diff_basic1.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index b33e691..fcfcc14 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -629,6 +629,10 @@ TOOLTEST h5diff_609.txt -d 200 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dse
# 6.10: number smaller than smallest difference
TOOLTEST h5diff_610.txt -d 1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+# 6.11: test (NaN == NaN) must be true based on our documentation -- XCAO
+TOOLTEST h5diff_609.txt -d "0.0001" h5diff_basic1.h5 h5diff_basic1.h5 g1/fp18 g1/fp18_COPY
+TOOLTEST h5diff_609.txt --use-system-epsilon h5diff_basic1.h5 h5diff_basic1.h5 g1/fp18 g1/fp18_COPY
+
# ##############################################################################
# # -p
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index 5153cc4..0e9d1dd 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -808,6 +808,11 @@ int do_copy_objects(hid_t fidin,
goto error;
}
+ /* unset the unlimimted dimensions, which cannot be applied to layout other than chunked. */
+ if (options->layout_g != H5D_CHUNKED) {
+ H5Sset_extent_simple( f_space_id, rank, dims, NULL );
+ }
+
/*-------------------------------------------------------------------------
* create the output dataset;
* disable error checking in case the dataset cannot be created with the
diff --git a/tools/h5repack/testfiles/h5repack_layout.h5 b/tools/h5repack/testfiles/h5repack_layout.h5
index 5772a31..2cc44b1 100644
--- a/tools/h5repack/testfiles/h5repack_layout.h5
+++ b/tools/h5repack/testfiles/h5repack_layout.h5
Binary files differ
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 6c5744f..ecfc238 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -234,11 +234,11 @@ hsize_t diff_array( void *_mem1,
size = H5Tget_size( m_type );
type_class = H5Tget_class(m_type);
- /* Fast comparison first for atomic type by memcmp().
+ /* Fast comparison first for atomic type by memcmp().
* It is OK not to list non-atomic type here because it will not be caught
- * by the confition, but it gives more clarity for code planning
+ * by the condition, but it gives more clarity for code planning
*/
- if (type_class != H5T_REFERENCE &&
+ if (type_class != H5T_REFERENCE &&
type_class != H5T_COMPOUND &&
type_class != H5T_STRING &&
type_class != H5T_VLEN &&
@@ -269,7 +269,6 @@ hsize_t diff_array( void *_mem1,
*/
case H5T_FLOAT:
-
if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
nfound=diff_float(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph);
else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
@@ -427,11 +426,11 @@ hsize_t diff_datum(void *_mem1,
type_size = H5Tget_size( m_type );
type_class = H5Tget_class(m_type);
- /* Fast comparison first for atomic type by memcmp().
+ /* Fast comparison first for atomic type by memcmp().
* It is OK not to list non-atomic type here because it will not be caught
- * by the confition, but it gives more clarity for code planning
+ * by the confition, but it gives more clarity for code planning
*/
- if (type_class != H5T_REFERENCE &&
+ if (type_class != H5T_REFERENCE &&
type_class != H5T_COMPOUND &&
type_class != H5T_STRING &&
type_class != H5T_VLEN &&
@@ -513,10 +512,10 @@ hsize_t diff_datum(void *_mem1,
size2 = H5Tget_size(m_type);
}
- /*
+ /*
* compare for shorter string
- * TODO: this code need to be improved to handle the difference
- * of length of strings.
+ * TODO: this code need to be improved to handle the difference
+ * of length of strings.
* For now mimic the previous way.
*/
if(size1 < size2)
@@ -622,7 +621,7 @@ hsize_t diff_datum(void *_mem1,
char enum_name2[1024];
herr_t err1;
- herr_t err2;
+ herr_t err2;
/* disable error reporting */
H5E_BEGIN_TRY {
@@ -1946,8 +1945,8 @@ hsize_t diff_datum(void *_mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -2009,8 +2008,8 @@ hsize_t diff_datum(void *_mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -2075,8 +2074,8 @@ hsize_t diff_datum(void *_mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -2131,7 +2130,6 @@ hsize_t diff_datum(void *_mem1,
*/
if (options->d && !options->p)
{
-
/*-------------------------------------------------------------------------
* detect NaNs
*-------------------------------------------------------------------------
@@ -2158,8 +2156,8 @@ hsize_t diff_datum(void *_mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -2223,8 +2221,8 @@ hsize_t diff_datum(void *_mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -2289,8 +2287,8 @@ hsize_t diff_datum(void *_mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -2299,7 +2297,6 @@ hsize_t diff_datum(void *_mem1,
parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
}
nfound++;
-
}
}
@@ -2373,8 +2370,18 @@ hsize_t diff_datum(void *_mem1,
}
nfound++;
}
-
} /* NaN */
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
@@ -2428,7 +2435,18 @@ hsize_t diff_datum(void *_mem1,
}
} /* NaN */
- }
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ }
+ nfound++;
+ }
+ }
/*-------------------------------------------------------------------------
* -d and -p
@@ -2482,6 +2500,17 @@ hsize_t diff_datum(void *_mem1,
}
} /* NaN */
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
+ {
+ if ( print_data(options) )
+ {
+ print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2);
+ parallel_print(SPACES);
+ parallel_print(F_FORMAT,temp1_double,temp2_double,ABS(temp1_double-temp2_double));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
@@ -2973,8 +3002,8 @@ hsize_t diff_float(unsigned char *mem1,
nfound++;
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3045,8 +3074,8 @@ hsize_t diff_float(unsigned char *mem1,
nfound++;
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3120,8 +3149,8 @@ hsize_t diff_float(unsigned char *mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3210,7 +3239,6 @@ hsize_t diff_double(unsigned char *mem1,
int isnan1=0;
int isnan2=0;
-
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
@@ -3247,8 +3275,8 @@ hsize_t diff_double(unsigned char *mem1,
nfound++;
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3319,8 +3347,8 @@ hsize_t diff_double(unsigned char *mem1,
nfound++;
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3394,8 +3422,8 @@ hsize_t diff_double(unsigned char *mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3530,8 +3558,8 @@ hsize_t diff_ldouble(unsigned char *mem1,
nfound++;
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3602,8 +3630,8 @@ hsize_t diff_ldouble(unsigned char *mem1,
nfound++;
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -3677,8 +3705,8 @@ hsize_t diff_ldouble(unsigned char *mem1,
}
}
- /* one is NaN, assume difference */
- else if ( isnan1==1 || isnan2==1)
+ /* only one is NaN, assume difference */
+ else if (isnan1==1 && isnan2==0 || isnan1==0 && isnan2==1)
{
if ( print_data(options) )
{
@@ -6107,13 +6135,13 @@ static void set_comp_members(hid_t tid, mcomp_t *members)
members->flags = HDcalloc(members->n, sizeof(unsigned char));
members->offsets = HDcalloc(members->n, sizeof(size_t));
members->m = HDcalloc(members->n, sizeof(mcomp_t *));
-
- for (i=0; i< members->n; i++)
+
+ for (i=0; i< members->n; i++)
{
members->ids[i] = H5Tget_member_type( tid, i );
members->flags[i] = H5Tis_variable_str( members->ids[i] );
members->offsets[i] = H5Tget_member_offset( tid, i );
- if (H5Tget_class( members->ids[i])==H5T_COMPOUND)
+ if (H5Tget_class( members->ids[i])==H5T_COMPOUND)
{
members->m[i] = (mcomp_t *)HDmalloc(sizeof(mcomp_t));
set_comp_members(members->ids[i], members->m[i]);
@@ -6126,16 +6154,16 @@ static void set_comp_members(hid_t tid, mcomp_t *members)
* added to improve performance for compound datasets
* clean and close compound members.
*/
-static void free_comp_members(mcomp_t *members)
+static void free_comp_members(mcomp_t *members)
{
int i;
if (!members || members->n<=0 || !members->ids)
return;
- for (i=0; i<members->n; i++)
+ for (i=0; i<members->n; i++)
{
- if (members->m[i])
+ if (members->m[i])
{
free_comp_members(members->m[i]);
HDfree(members->m[i]);
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index 230e7bb..c26c766 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -327,7 +327,7 @@ hsize_t diff_datasetid( hid_t did1,
can_compare=0;
options->not_cmp=1;
}
-
+
/* Check if type is either VLEN-data or VLEN-string to reclaim any
* VLEN memory buffer later */
if( TRUE == h5tools_detect_vlen(m_tid1) )
@@ -390,7 +390,6 @@ hsize_t diff_datasetid( hid_t did1,
* read/compare
*-------------------------------------------------------------------------
*/
-
need = (size_t)(nelmts1 * m_size1); /* bytes needed */
if(need < H5TOOLS_MALLOCSIZE) {
buf1 = HDmalloc(need);
@@ -562,7 +561,7 @@ error:
if (buf1!=NULL)
{
/* reclaim any VL memory, if necessary */
- if(vl_data)
+ if(vl_data)
H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
free(buf1);
buf1=NULL;
@@ -570,7 +569,7 @@ error:
if (buf2!=NULL)
{
/* reclaim any VL memory, if necessary */
- if(vl_data)
+ if(vl_data)
H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
free(buf2);
buf2=NULL;