summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2003-06-02 16:30:40 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2003-06-02 16:30:40 (GMT)
commit6273d8beeea7b50546bef382ce1543bfc026a825 (patch)
tree62e3cfe112d01a7a2286541121ba967f92dc8c04 /tools
parentf04d4aea61c6becc0f0299cc98b4e5b120ce20ab (diff)
downloadhdf5-6273d8beeea7b50546bef382ce1543bfc026a825.zip
hdf5-6273d8beeea7b50546bef382ce1543bfc026a825.tar.gz
hdf5-6273d8beeea7b50546bef382ce1543bfc026a825.tar.bz2
[svn-r6943] Purpose:
bug fix Description: unsigned integers were not printed out correctly Solution: added %u and %lu to the list of formats Platforms tested: Windows 2000 (octopus) Linux 2.4 (rockaway) SunOS 5.7 (arabica) IRIX 6.5 (modi4) Misc. update:
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/h5diff.c36
-rw-r--r--tools/h5diff/h5difftst.c16
-rw-r--r--tools/testfiles/file1.h5bin6240 -> 6240 bytes
-rw-r--r--tools/testfiles/file2.h5bin6288 -> 6288 bytes
-rw-r--r--tools/testfiles/file3.h5bin4352 -> 4352 bytes
-rw-r--r--tools/testfiles/file4.h5bin4352 -> 4352 bytes
-rw-r--r--tools/testfiles/file5.h5bin2936 -> 2936 bytes
-rw-r--r--tools/testfiles/file6.h5bin9976 -> 10520 bytes
-rw-r--r--tools/testfiles/h5diff_16.txt8
9 files changed, 43 insertions, 17 deletions
diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c
index ecb9dd1..682acd0 100644
--- a/tools/h5diff/h5diff.c
+++ b/tools/h5diff/h5diff.c
@@ -29,11 +29,15 @@
#define FFORMAT "%-15.10g %-15.10g %-15.10g\n"
#define IFORMAT "%-15d %-15d %-15d\n"
+#define UIFORMAT "%-15u %-15u %-15u\n"
#define LIFORMAT "%-15ld %-15ld %-15ld\n"
+#define ULIFORMAT "%-15lu %-15lu %-15lu\n"
/* with -p option */
#define FPFORMAT "%-15.10g %-15.10g %-15.10g %-14.10g\n"
#define IPFORMAT "%-15d %-15d %-15d %-14d\n"
+#define UIPFORMAT "%-15u %-15u %-15u %-14u\n"
#define LPIFORMAT "%-15ld %-15ld %-15ld %-14ld\n"
+#define ULPIFORMAT "%-15lu %-15lu %-15lu %-14lu\n"
#define SPACES " "
@@ -1248,13 +1252,13 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
/* Build default formats for long long types */
sprintf(fmt_llong, "%%%sd %%%sd %%%sd\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
sprintf(fmt_ullong, "%%%su %%%su %%%su\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
sprintf(fmt_llongp, "%%%sd %%%sd %%%sd %%%sd\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
sprintf(fmt_ullongp, "%%%su %%%su %%%su %%%su\n",
- H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
+ H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH, H5_PRINTF_LL_WIDTH);
acc[rank-1]=1;
@@ -1713,7 +1717,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
+ printf(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
}
nfound++;
}
@@ -1729,7 +1733,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)),
+ printf(UIPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)),
abs((int)(1-temp2_uint/temp1_uint)));
}
nfound++;
@@ -1747,7 +1751,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)),
+ printf(UIPFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)),
abs((int)(1-temp2_uint/temp1_uint)));
}
nfound++;
@@ -1761,7 +1765,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(IFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
+ printf(UIFORMAT,temp1_uint,temp2_uint,abs((int)(temp1_uint-temp2_uint)));
}
nfound++;
}
@@ -1882,7 +1886,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(LIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
+ printf(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
}
nfound++;
}
@@ -1898,7 +1902,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(LPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)),
+ printf(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)),
labs((long)(1-temp2_ulong/temp1_ulong)));
}
nfound++;
@@ -1916,7 +1920,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(LPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)),
+ printf(ULPIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)),
labs((long)(1-temp2_ulong/temp1_ulong)));
}
nfound++;
@@ -1930,7 +1934,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
{
print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
- printf(LIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
+ printf(ULIFORMAT,temp1_ulong,temp2_ulong,labs((long)(temp1_ulong-temp2_ulong)));
}
nfound++;
}
@@ -2051,7 +2055,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(fmt_ullong,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
+ (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
}
nfound++;
}
@@ -2068,7 +2072,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(fmt_ullongp,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)),
+ (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)),
(unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong)));
}
nfound++;
@@ -2087,7 +2091,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
print_pos(&ph,1,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(fmt_ullongp,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)),
+ (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)),
(unsigned long_long)labs((long)(1-temp2_ullong/temp1_ullong)));
}
nfound++;
@@ -2102,7 +2106,7 @@ int array_diff( void *buf1, void *buf2, hsize_t tot_cnt, int rank, hsize_t *dims
print_pos(&ph,0,i,acc,pos,rank,obj1,obj2);
printf(SPACES);
printf(fmt_ullong,temp1_ullong,temp2_ullong,
- (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
+ (unsigned long_long)labs((long)(temp1_ullong-temp2_ullong)));
}
nfound++;
}
diff --git a/tools/h5diff/h5difftst.c b/tools/h5diff/h5difftst.c
index 344e356..783eb42 100644
--- a/tools/h5diff/h5difftst.c
+++ b/tools/h5diff/h5difftst.c
@@ -14,9 +14,12 @@
#include <stdio.h>
#include <stdlib.h>
+#include <assert.h>
#include "hdf5.h"
#include "H5private.h"
+/*UINT_MAX Maximum value for a variable of type unsigned int. 4294967295 */
+#define UIMAX 4294967295u
/* diff test*/
static int do_test_1(const char *file1, const char *file2);
@@ -71,7 +74,7 @@ int write_dataset( hid_t loc_id, int rank, hsize_t *dims, const char *dset_name,
/* Write the buf */
if ( buf )
- status = H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf);
+ assert(H5Dwrite(dataset_id,type_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)>=0);
/* Close */
status = H5Dclose(dataset_id);
@@ -676,6 +679,9 @@ int do_test_5(const char *file1, const char UNUSED *file2)
long_long buf8b[3][2] = {{1,1},{3,4},{5,6}};
unsigned long_long buf9a[3][2] = {{1,1},{1,1},{1,1}};
unsigned long_long buf9b[3][2] = {{1,1},{3,4},{5,6}};
+
+ unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}};
+ unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}};
/*-------------------------------------------------------------------------
@@ -759,6 +765,14 @@ int do_test_5(const char *file1, const char UNUSED *file2)
write_dataset(file1_id,2,dims,"dset9a",H5T_NATIVE_ULLONG,buf9a);
write_dataset(file1_id,2,dims,"dset9b",H5T_NATIVE_ULLONG,buf9b);
+/*-------------------------------------------------------------------------
+ * H5T_NATIVE_INT
+ *-------------------------------------------------------------------------
+ */
+
+ write_dataset(file1_id,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a);
+ write_dataset(file1_id,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b);
+
/*-------------------------------------------------------------------------
* Close
diff --git a/tools/testfiles/file1.h5 b/tools/testfiles/file1.h5
index 48e27a0..11cd7b4 100644
--- a/tools/testfiles/file1.h5
+++ b/tools/testfiles/file1.h5
Binary files differ
diff --git a/tools/testfiles/file2.h5 b/tools/testfiles/file2.h5
index f93c60b..432d412 100644
--- a/tools/testfiles/file2.h5
+++ b/tools/testfiles/file2.h5
Binary files differ
diff --git a/tools/testfiles/file3.h5 b/tools/testfiles/file3.h5
index aab2d35..2f63b47 100644
--- a/tools/testfiles/file3.h5
+++ b/tools/testfiles/file3.h5
Binary files differ
diff --git a/tools/testfiles/file4.h5 b/tools/testfiles/file4.h5
index d0d9673..c4e511f 100644
--- a/tools/testfiles/file4.h5
+++ b/tools/testfiles/file4.h5
Binary files differ
diff --git a/tools/testfiles/file5.h5 b/tools/testfiles/file5.h5
index c438dad..a1137f2 100644
--- a/tools/testfiles/file5.h5
+++ b/tools/testfiles/file5.h5
Binary files differ
diff --git a/tools/testfiles/file6.h5 b/tools/testfiles/file6.h5
index c36b77e..bb9c043 100644
--- a/tools/testfiles/file6.h5
+++ b/tools/testfiles/file6.h5
Binary files differ
diff --git a/tools/testfiles/h5diff_16.txt b/tools/testfiles/h5diff_16.txt
index 6699e28..eeb5f71 100644
--- a/tools/testfiles/h5diff_16.txt
+++ b/tools/testfiles/h5diff_16.txt
@@ -6,6 +6,8 @@ file1 file2
---------------------------------------
x x /dset0a
x x /dset0b
+ x x /dset10a
+ x x /dset10b
x x /dset1a
x x /dset1b
x x /dset2a
@@ -31,6 +33,12 @@ Comparing </dset0a> with </dset0a>
Comparing </dset0b> with </dset0b>
0 differences found
+Comparing </dset10a> with </dset10a>
+0 differences found
+
+Comparing </dset10b> with </dset10b>
+0 differences found
+
Comparing </dset1a> with </dset1a>
0 differences found