summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-09-16 15:52:51 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-09-16 15:52:51 (GMT)
commitbdd7d59902483885dd8b883f3b2393e77383e5e8 (patch)
treeaaf20ab132d057b95b3c016d50fc22b77719084b /tools/h5diff
parent8bc0d5ed9019a681e1ea20c24264415d01c1cf2a (diff)
downloadhdf5-bdd7d59902483885dd8b883f3b2393e77383e5e8.zip
hdf5-bdd7d59902483885dd8b883f3b2393e77383e5e8.tar.gz
hdf5-bdd7d59902483885dd8b883f3b2393e77383e5e8.tar.bz2
[svn-r15628] Description:
Remove trailing whitespace from C/C++ source files, with the following script: foreach f (*.[ch] *.cpp) sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f end Tested on: Mac OS X/32 10.5.5 (amazon) No need for h5committest, just whitespace changes...
Diffstat (limited to 'tools/h5diff')
-rw-r--r--tools/h5diff/h5diff_common.c58
-rw-r--r--tools/h5diff/h5diff_main.c10
-rw-r--r--tools/h5diff/h5diffgentest.c88
3 files changed, 78 insertions, 78 deletions
diff --git a/tools/h5diff/h5diff_common.c b/tools/h5diff/h5diff_common.c
index 05111a9..fc073a9 100644
--- a/tools/h5diff/h5diff_common.c
+++ b/tools/h5diff/h5diff_common.c
@@ -54,24 +54,24 @@ static struct long_options l_opts[] = {
*-------------------------------------------------------------------------
*/
-void parse_command_line(int argc,
- const char* argv[],
- const char** fname1,
+void parse_command_line(int argc,
+ const char* argv[],
+ const char** fname1,
const char** fname2,
- const char** objname1,
- const char** objname2,
+ const char** objname1,
+ const char** objname2,
diff_opt_t* options)
{
-
+
int opt;
/* process the command-line */
memset(options, 0, sizeof (diff_opt_t));
-
+
/* parse command line options */
- while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
+ while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF)
{
- switch ((char)opt)
+ switch ((char)opt)
{
default:
usage();
@@ -97,7 +97,7 @@ void parse_command_line(int argc,
break;
case 'd':
options->d=1;
-
+
if ( check_d_input( opt_arg )==-1)
{
printf("<-d %s> is not a valid option\n", opt_arg );
@@ -108,7 +108,7 @@ void parse_command_line(int argc,
break;
case 'p':
-
+
options->p=1;
if ( check_p_input( opt_arg )==-1)
{
@@ -120,7 +120,7 @@ void parse_command_line(int argc,
break;
case 'n':
-
+
options->n=1;
if ( check_n_input( opt_arg )==-1)
{
@@ -129,13 +129,13 @@ void parse_command_line(int argc,
h5diff_exit(EXIT_FAILURE);
}
options->count = atol( opt_arg );
-
+
break;
}
}
-
+
/* check for file names to be processed */
- if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
+ if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
{
error_msg(progname, "missing file names\n");
usage();
@@ -152,7 +152,7 @@ void parse_command_line(int argc,
return;
}
- if ( argv[ opt_ind + 3 ] != NULL)
+ if ( argv[ opt_ind + 3 ] != NULL)
{
*objname2 = argv[ opt_ind + 3 ];
}
@@ -161,7 +161,7 @@ void parse_command_line(int argc,
*objname2 = *objname1;
}
-
+
}
/*-------------------------------------------------------------------------
@@ -176,14 +176,14 @@ void parse_command_line(int argc,
{
if (options->m_quiet || options->err_stat || options->m_contents)
return;
-
+
if (options->cmn_objs==0)
{
printf("No common objects found. Files are not comparable.\n");
if (!options->m_verbose)
printf("Use -v for a list of objects.\n");
}
-
+
if (options->not_cmp==1)
{
printf("--------------------------------\n");
@@ -192,7 +192,7 @@ void parse_command_line(int argc,
if (!options->m_verbose)
printf("Use -v for a list of objects.\n");
}
-
+
}
/*-------------------------------------------------------------------------
@@ -216,7 +216,7 @@ int check_n_input( const char *str )
{
unsigned i;
char c;
-
+
for ( i = 0; i < strlen(str); i++)
{
c = str[i];
@@ -250,18 +250,18 @@ int check_n_input( const char *str )
int check_p_input( const char *str )
{
double x;
-
+
/*
the atof return value on a hexadecimal input is different
on some systems; we do a character check for this
*/
if (strlen(str)>2 && str[0]=='0' && str[1]=='x')
return -1;
-
+
x=atof(str);
if (x<=0)
return -1;
-
+
return 1;
}
@@ -283,18 +283,18 @@ int check_p_input( const char *str )
int check_d_input( const char *str )
{
double x;
-
+
/*
the atof return value on a hexadecimal input is different
on some systems; we do a character check for this
*/
if (strlen(str)>2 && str[0]=='0' && str[1]=='x')
return -1;
-
+
x=atof(str);
if (x <=0)
return -1;
-
+
return 1;
}
@@ -329,7 +329,7 @@ void usage(void)
printf(" -n C, --count=C Print differences up to C number\n");
printf(" -d D, --delta=D Print difference when greater than limit D\n");
printf(" -p R, --relative=R Print difference when greater than relative limit R\n");
-
+
printf("\n");
@@ -356,7 +356,7 @@ void usage(void)
printf(" when the -c flag is present, (contents mode) the objects in file1\n");
printf(" must match exactly the objects in file2\n");
printf("\n");
-
+
printf(" The compare criteria is:\n");
printf(" 1) datasets: numerical array differences 2) groups: name string difference\n");
printf(" 3) datatypes: the return value of H5Tequal 2) links: name string difference\n");
diff --git a/tools/h5diff/h5diff_main.c b/tools/h5diff/h5diff_main.c
index 6d1a508..d0e095d 100644
--- a/tools/h5diff/h5diff_main.c
+++ b/tools/h5diff/h5diff_main.c
@@ -53,19 +53,19 @@
* "Some objects are not comparable"
*
* February 2007
- * Added comparison for dataset regions.
+ * Added comparison for dataset regions.
* Added support for reading and comparing by hyperslabs for large files.
* Inclusion of a relative error formula to compare floating
- * point numbers in order to deal with floating point uncertainty.
+ * point numbers in order to deal with floating point uncertainty.
* Printing of dataset dimensions along with dataset name
- *
+ *
* November 19, 2007
* adopted the syntax h5diff [OPTIONS] file1 file2 [obj1[obj2]]
*
- * Aug 2008
+ * Aug 2008
* Added a "contents" mode check.
* If this mode is present, objects in both files must match (must be exactly the same)
- * If this does not happen, the tool returns an error code of 1
+ * If this does not happen, the tool returns an error code of 1
* (instead of the success code of 0)
*
*-------------------------------------------------------------------------
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index e1a554e..7d9add7 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -95,27 +95,27 @@ static int write_dset(hid_t loc_id,int rank,hsize_t *dims,const char *name,hid_t
*-------------------------------------------------------------------------
*/
-int main(void)
+int main(void)
{
if (test_basic(FILE1, FILE2, FILE11) < 0 )
goto out;
test_types (FILE3);
test_datatypes(FILE4);
-
+
/* generate 2 files, the second call creates a similar file with differences */
test_attributes(FILE5,0);
test_attributes(FILE6,1);
-
+
/* generate 2 files, the second call creates a similar file with differences */
test_datasets(FILE7,0);
test_datasets(FILE8,1);
-
+
/* generate 2 files, the second call creates a similar file with differences */
test_hyperslab(FILE9,0);
test_hyperslab(FILE10,1);
return 0;
-
+
out:
return 1;
}
@@ -146,12 +146,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
fprintf(stderr, "empty file (%s) close failed.\n", fname3);
goto out;
}
-
+
/*-------------------------------------------------------------------------
* create two files
*-------------------------------------------------------------------------
*/
-
+
if (( fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 )
goto out;
if (( fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 )
@@ -179,15 +179,15 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
{
double data1[3][2] = {{1,1}, {1,1}, {0,0}};
double data2[3][2] = {{0,1.1},{1.01,1.001},{0,1}};
- double data3[3][2] = {{100,100},{100,100},{100,100}};
+ double data3[3][2] = {{100,100},{100,100},{100,100}};
double data4[3][2] = {{105,120},{160,95},{80,40}};
-
+
write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1);
write_dset(gid2,2,dims2,"dset2",H5T_NATIVE_DOUBLE,data2);
write_dset(gid1,2,dims2,"dset3",H5T_NATIVE_DOUBLE,data3);
write_dset(gid2,2,dims2,"dset4",H5T_NATIVE_DOUBLE,data4);
write_dset(gid2,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data2);
-
+
}
/*-------------------------------------------------------------------------
* relative error, compare divide by zero, both zero
@@ -195,12 +195,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- int data5[3][2] = {{100,100},{100,0},{0,100}};
+ int data5[3][2] = {{100,100},{100,0},{0,100}};
int data6[3][2] = {{120,80}, {0,100},{0,50}};
-
+
write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5);
write_dset(gid1,2,dims2,"dset6",H5T_NATIVE_INT,data6);
-
+
}
/*-------------------------------------------------------------------------
@@ -209,12 +209,12 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
+ unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
unsigned long_long data8[3][2] = {{120,80}, {0,100},{0,50}};
-
+
write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7);
write_dset(gid1,2,dims2,"dset8",H5T_NATIVE_ULLONG,data8);
-
+
}
/*-------------------------------------------------------------------------
@@ -231,14 +231,14 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- double data9[3][2] = {{100,100},{100,0},{0,100}};
+ double data9[3][2] = {{100,100},{100,0},{0,100}};
double data10[3][2] ={{120,80}, {0,100},{0,50}};
-
+
write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9);
write_dset(gid1,2,dims2,"dset10",H5T_NATIVE_DOUBLE,data10);
-
+
}
-
+
/*-------------------------------------------------------------------------
* test floating point comparison
@@ -250,15 +250,15 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
float data12[3][2] ={{0.00000f,0.00002f},{0.000009f,0.00001f},{0.00000f,0.00001f}};
double data13[3][2] ={{0.000000000,0.000000001},{0.000000001, 0.000000000},{0.000000001,0.000000001}};
double data14[3][2] ={{0.000000000,0.000000002},{0.0000000009,0.000000001},{0.000000000,0.000000001}};
-
+
write_dset(gid1,2,dims2,"fp1",H5T_NATIVE_FLOAT,data11);
write_dset(gid1,2,dims2,"fp2",H5T_NATIVE_FLOAT,data12);
write_dset(gid1,2,dims2,"d1",H5T_NATIVE_DOUBLE,data13);
write_dset(gid1,2,dims2,"d2",H5T_NATIVE_DOUBLE,data14);
-
+
}
-
-
+
+
/*-------------------------------------------------------------------------
* NaNs in H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
@@ -286,7 +286,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp16",H5T_NATIVE_FLOAT,data16);
}
-
+
/*-------------------------------------------------------------------------
* NaNs in H5T_NATIVE_DOUBLE
*-------------------------------------------------------------------------
@@ -314,8 +314,8 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
}
-
-
+
+
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
@@ -450,7 +450,7 @@ TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1
TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1
# 2.5
-TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1
+TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1
# 2.6
TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2
@@ -2508,12 +2508,12 @@ void gen_datareg(hid_t fid,
* Function: test_hyperslab
*
* Purpose: test diff by hyperslabs. create a dataset with 1GB dimensions
- * by iterating trough 1KB hyperslabs
+ * by iterating trough 1KB hyperslabs
*
*-------------------------------------------------------------------------
*/
static
-int test_hyperslab(const char *fname,
+int test_hyperslab(const char *fname,
int make_diffs /* flag to modify data buffers */)
{
hid_t did=-1;
@@ -2533,7 +2533,7 @@ int test_hyperslab(const char *fname,
int i, j, s;
char c;
- /* create */
+ /* create */
fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
@@ -2545,13 +2545,13 @@ int test_hyperslab(const char *fname,
goto out;
if((did = H5Dcreate2(fid, "big", H5T_NATIVE_CHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto out;
- if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
+ if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0)
goto out;
- if((tid = H5Dget_type(did)) < 0)
+ if((tid = H5Dget_type(did)) < 0)
goto out;
if((size = H5Tget_size(tid)) <= 0)
goto out;
-
+
/* create a evenly divided buffer from 0 to 127 */
buf = (char *)HDmalloc((size_t)(nelmts * size));
s = 1024 * 1024 / 127;
@@ -2567,15 +2567,15 @@ int test_hyperslab(const char *fname,
/* make a different hyperslab at this position */
if(make_diffs && i == 512 * 512)
HDmemset(buf, 0, nelmts);
-
+
hs_start[0] = i * GBLL/(1024*1024);
- if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
+ if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size, NULL) < 0)
goto out;
/* write only one hyperslab */
if ( i==512*512)
{
- if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
+ if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0)
goto out;
}
@@ -2626,30 +2626,30 @@ int write_attr(hid_t loc_id,
{
hid_t aid=-1;
hid_t sid=-1;
-
+
/* create a space */
if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
goto out;
-
+
/* create the attribute */
if((aid = H5Acreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
-
+
/* write */
if(buf)
{
if(H5Awrite(aid, tid, buf) < 0)
goto out;
}
-
+
/* close */
H5Aclose(aid);
H5Sclose(sid);
-
+
return SUCCEED;
-
+
out:
-
+
H5Aclose(aid);
H5Sclose(sid);
return FAIL;