diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-16 15:52:51 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-09-16 15:52:51 (GMT) |
commit | bdd7d59902483885dd8b883f3b2393e77383e5e8 (patch) | |
tree | aaf20ab132d057b95b3c016d50fc22b77719084b /tools | |
parent | 8bc0d5ed9019a681e1ea20c24264415d01c1cf2a (diff) | |
download | hdf5-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')
32 files changed, 2040 insertions, 2040 deletions
diff --git a/tools/h5copy/h5copy.c b/tools/h5copy/h5copy.c index a4d1675..e487f2e 100644 --- a/tools/h5copy/h5copy.c +++ b/tools/h5copy/h5copy.c @@ -55,7 +55,7 @@ static void leave(int ret) { h5tools_close(); - + exit(ret); } @@ -118,8 +118,8 @@ usage: h5copy [OPTIONS] [OBJECTS...]\n\ * soft H5O_COPY_EXPAND_SOFT_LINK_FLAG: Expand soft links into new objects * ext H5O_COPY_EXPAND_EXT_LINK_FLAG: Expand external links into new objects * ref H5O_COPY_EXPAND_OBJ_REFERENCE_FLAG: Copy objects that are pointed by references - * noattr H5O_COPY_WITHOUT_ATTR_FLAG Copy object without copying attributes - * allflags Switches all flags from the default to the non-default setting + * noattr H5O_COPY_WITHOUT_ATTR_FLAG Copy object without copying attributes + * allflags Switches all flags from the default to the non-default setting * * Return: Success: SUCCEED * Failure: FAIL @@ -139,7 +139,7 @@ static int parse_flag(const char* str_flag, unsigned *flag) if (strcmp(str_flag,"shallow")==0) { fla = H5O_COPY_SHALLOW_HIERARCHY_FLAG; - } + } else if (strcmp(str_flag,"soft")==0) { fla = H5O_COPY_EXPAND_SOFT_LINK_FLAG; @@ -214,14 +214,14 @@ main (int argc, const char *argv[]) } /* end if */ /* 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) { case 'd': oname_dst = strdup(opt_arg); break; - + case 'f': /* validate flag */ if (parse_flag(opt_arg,&flag)<0) @@ -272,28 +272,28 @@ main (int argc, const char *argv[]) * check for missing file/object names *-------------------------------------------------------------------------*/ - if (fname_src==NULL) + if (fname_src==NULL) { error_msg(progname, "Input file name missing\n"); usage(); leave(EXIT_FAILURE); } - if (fname_dst==NULL) + if (fname_dst==NULL) { error_msg(progname, "Output file name missing\n"); usage(); leave(EXIT_FAILURE); } - if (oname_src==NULL) + if (oname_src==NULL) { error_msg(progname, "Source object name missing\n"); usage(); leave(EXIT_FAILURE); } - if (oname_dst==NULL) + if (oname_dst==NULL) { error_msg(progname, "Destination object name missing\n"); usage(); @@ -304,7 +304,7 @@ main (int argc, const char *argv[]) /*------------------------------------------------------------------------- * open input file *-------------------------------------------------------------------------*/ - + fid_src = h5tools_fopen(fname_src, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, 0); /*------------------------------------------------------------------------- @@ -342,11 +342,11 @@ main (int argc, const char *argv[]) free(fname_dst); leave(EXIT_FAILURE); } - + /*------------------------------------------------------------------------- * print some info *-------------------------------------------------------------------------*/ - + if (verbose) { printf("Copying file <%s> and object <%s> to file <%s> and object <%s>\n", @@ -358,19 +358,19 @@ main (int argc, const char *argv[]) printf("Using %s flag\n", str_flag); } - + /*------------------------------------------------------------------------- * create property lists for copy *-------------------------------------------------------------------------*/ - + /* create property to pass copy options */ - if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) + if ( (ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0) goto error; /* set options for object copy */ if (flag) { - if ( H5Pset_copy_object(ocpl_id, flag) < 0) + if ( H5Pset_copy_object(ocpl_id, flag) < 0) goto error; } @@ -404,7 +404,7 @@ main (int argc, const char *argv[]) ocpl_id, /* Object copy property list */ lcpl_id)<0) /* Link creation property list */ goto error; - + /* close propertis */ if(H5Pclose(ocpl_id)<0) goto error; @@ -427,7 +427,7 @@ main (int argc, const char *argv[]) free(oname_src); h5tools_close(); - + return 0; error: @@ -448,7 +448,7 @@ error: free(oname_src); h5tools_close(); - + return 1; } diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c index 52467d7..7842b38 100644 --- a/tools/h5copy/h5copygentest.c +++ b/tools/h5copy/h5copygentest.c @@ -218,7 +218,7 @@ static void gent_named_vl(hid_t loc_id) { hid_t sid, did, tid; hsize_t dims[1] = {2}; - hvl_t buf[2]; + hvl_t buf[2]; /* allocate and initialize VL dataset to write */ buf[0].len = 1; @@ -264,7 +264,7 @@ static void gent_nested_vl(hid_t loc_id) hid_t sid, did, tid1, tid2; hsize_t dims[1] = {2}; hvl_t buf[2]; - hvl_t *tvl; + hvl_t *tvl; /* allocate and initialize VL dataset to write */ buf[0].len = 1; 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; diff --git a/tools/h5dump/binread.c b/tools/h5dump/binread.c index ab10af0..5abb9af 100644 --- a/tools/h5dump/binread.c +++ b/tools/h5dump/binread.c @@ -18,7 +18,7 @@ #include <stdlib.h> #include <string.h> -/* +/* This program reads binary output from h5dump (-b option). To use change the following 3 symbols accordingly. For example, to read 2 elements of a float type , define @@ -82,7 +82,7 @@ main (int argc, const char *argv[]) { numread = fread( buf, sizeof( TYPE ), nelmts, stream ); printf( "Number of items read = %d\n", numread ); - + for (i = 0; i < nelmts; i++) { printf(FORMAT,buf[i]); diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 2e03a25..8ace682 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -1233,7 +1233,7 @@ dump_dataspace(hid_t space) * *------------------------------------------------------------------------- */ -static herr_t +static herr_t dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t UNUSED *info, void UNUSED *_op_data) { hid_t attr_id; @@ -1390,7 +1390,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED hid_t obj; char *obj_path = NULL; /* Full path of object */ herr_t ret = SUCCEED; - + /* Build the object's path name */ obj_path = HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2); HDassert(obj_path); @@ -1409,33 +1409,33 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void UNUSED goto done; } /* end if */ - switch(oinfo.type) + switch(oinfo.type) { case H5O_TYPE_GROUP: - if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) + if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0) { error_msg(progname, "unable to dump group \"%s\"\n", name); d_status = EXIT_FAILURE; ret = FAIL; - } - else + } + else { char *old_prefix; /* Pointer to previous prefix */ - + /* Keep copy of prefix before iterating into group */ old_prefix = HDstrdup(prefix); HDassert(old_prefix); - + /* Append group name to prefix */ add_prefix(&prefix, &prefix_len, name); - + /* Iterate into group */ dump_function_table->dump_group_function(obj, name); - + /* Restore old prefix name */ HDstrcpy(prefix, old_prefix); HDfree(old_prefix); - + /* Close group */ H5Gclose(obj); } @@ -1775,11 +1775,11 @@ done: * * Programmer: Ruey-Hsia Li * - * Modifications: + * Modifications: * Pedro Vicente, March 27, 2006 * added display of attributes * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for - * other iteration orders + * other iteration orders * *------------------------------------------------------------------------- */ @@ -1789,21 +1789,21 @@ dump_named_datatype(hid_t tid, const char *name) unsigned attr_crt_order_flags; hid_t tcpl_id; /* datatype creation property list ID */ - - + + if ((tcpl_id = H5Tget_create_plist(tid)) < 0) { error_msg(progname, "error in getting creation property list ID\n"); d_status = EXIT_FAILURE; } - + /* query the creation properties for attributes */ - if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) + if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0) { error_msg(progname, "error in getting creation properties\n"); d_status = EXIT_FAILURE; } - + if(H5Pclose(tcpl_id) < 0) { error_msg(progname, "error in closing creation property list ID\n"); d_status = EXIT_FAILURE; @@ -1827,7 +1827,7 @@ dump_named_datatype(hid_t tid, const char *name) /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the datatype's create property list for attributes, then, sort by creation order, otherwise by name */ - + if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL); else @@ -1872,21 +1872,21 @@ dump_group(hid_t gid, const char *name) error_msg(progname, "error in getting group creation property list ID\n"); d_status = EXIT_FAILURE; } - + /* query the group creation properties for attributes */ - if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) + if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { error_msg(progname, "error in getting group creation properties\n"); d_status = EXIT_FAILURE; } /* query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { error_msg(progname, "error in getting group creation properties\n"); d_status = EXIT_FAILURE; } - + if(H5Pclose(gcpl_id) < 0) { error_msg(progname, "error in closing group creation property list ID\n"); d_status = EXIT_FAILURE; @@ -1906,7 +1906,7 @@ dump_group(hid_t gid, const char *name) if(!HDstrcmp(name, "/") && unamedtype) { unsigned u; /* Local index variable */ - + /* dump unamed type in root group */ for(u = 0; u < type_table->nobjs; u++) if(!type_table->objs[u].recorded) { @@ -1923,51 +1923,51 @@ dump_group(hid_t gid, const char *name) if(oinfo.rc > 1) { obj_t *found_obj; /* Found object */ - + found_obj = search_obj(group_table, oinfo.addr); - + if (found_obj == NULL) { indentation(indent); error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__); d_status = EXIT_FAILURE; - } + } else if (found_obj->displayed) { indentation(indent); printf("%s \"%s\"\n", HARDLINK, found_obj->objname); - } + } else { found_obj->displayed = TRUE; /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group for attributes, then, sort by creation order, otherwise by name */ - + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL); else H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL); - + /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group, then, sort by creation order, otherwise by name */ - + if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); else H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); } - } + } - else + else { /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group for attributes, then, sort by creation order, otherwise by name */ - + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL); else - H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL); + H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL); /* if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group, then, sort by creation order, otherwise by name */ @@ -1975,11 +1975,11 @@ dump_group(hid_t gid, const char *name) if((sort_by == H5_INDEX_CRT_ORDER) && (crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Literate(gid, sort_by, sort_order, NULL, dump_all_cb, NULL); else - H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + H5Literate(gid, H5_INDEX_NAME, sort_order, NULL, dump_all_cb, NULL); + - } - + indent -= COL; indentation(indent); end_obj(dump_header_format->groupend, dump_header_format->groupblockend); @@ -1995,10 +1995,10 @@ dump_group(hid_t gid, const char *name) * * Programmer: Ruey-Hsia Li * - * Modifications: + * Modifications: * Pedro Vicente, 2004, added dataset creation property list display * Pedro Vicente, October 4, 2007, added parameters to H5Aiterate2() to allow for - * other iteration orders + * other iteration orders * *------------------------------------------------------------------------- */ @@ -2015,9 +2015,9 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) error_msg(progname, "error in getting creation property list ID\n"); d_status = EXIT_FAILURE; } - + /* query the creation properties for attributes */ - if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) + if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0) { error_msg(progname, "error in getting creation properties\n"); d_status = EXIT_FAILURE; @@ -2037,7 +2037,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if(display_oid) dump_oid(did); - if(display_dcpl) + if(display_dcpl) dump_dcpl(dcpl_id, type, did); if(display_data) @@ -2068,15 +2068,15 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if ( !bin_output ) { - + /* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set in the group for attributes, then, sort by creation order, otherwise by name */ - + if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL); else H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL); - + } indent -= COL; @@ -2218,11 +2218,11 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index) outputformat->pindex=display_index; /* do not print indices for regions */ - if(obj_data == DATASET_DATA) + if(obj_data == DATASET_DATA) { hid_t f_type = H5Dget_type(obj_id); - - if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) + + if (H5Tequal(f_type, H5T_STD_REF_DSETREG)) { outputformat->pindex = 0; } @@ -2540,7 +2540,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) hid_t tid = H5Dget_type( obj_id ); size_t datum_size = H5Tget_size( tid ); hsize_t dims[H5S_MAX_RANK]; - int ndims = H5Sget_simple_extent_dims( sid, dims, NULL); + int ndims = H5Sget_simple_extent_dims( sid, dims, NULL); hsize_t nelmts = 1; hsize_t size; double ratio = 0; @@ -2548,13 +2548,13 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) int ok = 0; /* only print the compression ratio for these filters */ - for ( i = 0; i < nfilters; i++) + for ( i = 0; i < nfilters; i++) { cd_nelmts = NELMTS(cd_values); filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL); - - switch (filtn) + + switch (filtn) { case H5Z_FILTER_DEFLATE: case H5Z_FILTER_SZIP: @@ -2564,10 +2564,10 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) break; } } - + if (ndims && ok ) { - + for (i = 0; i < ndims; i++) { nelmts *= dims[i]; @@ -2580,9 +2580,9 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) if (b!=0) ratio = (double) a / (double) b; - + HDfprintf(stdout, "SIZE %Hu (%.3f:1 COMPRESSION)\n ", storage_size, ratio); - + } else HDfprintf(stdout, "SIZE %Hu\n ", storage_size); @@ -2590,7 +2590,7 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) H5Sclose(sid); H5Tclose(tid); - + } else { @@ -2668,15 +2668,15 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) * FILTERS *------------------------------------------------------------------------- */ - + indentation(indent + COL); printf("%s %s\n", FILTERS, BEGIN); indent += COL; - if (nfilters) + if (nfilters) { - for (i=0; i<nfilters; i++) + for (i=0; i<nfilters; i++) { cd_nelmts = NELMTS(cd_values); filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, @@ -2935,8 +2935,8 @@ dump_fcpl(hid_t fid) else HDstrcpy(dname,"Unknown driver"); - /* Take out this because the driver used can be different from the - * standard output. */ + /* Take out this because the driver used can be different from the + * standard output. */ /*indentation(indent + COL); printf("%s %s\n","FILE_DRIVER", dname);*/ indentation(indent + COL); @@ -3072,11 +3072,11 @@ set_binary_form(const char *form) } /*------------------------------------------------------------------------- - * Function: set_sort_by + * Function: set_sort_by * * Purpose: set the "by" form of sorting by translating from a string input * parameter to a H5_index_t return value - * current sort values are [creation_order | name] + * current sort values are [creation_order | name] * * Return: H5_index_t form of sort or H5_INDEX_UNKNOWN if none found * @@ -3103,11 +3103,11 @@ set_sort_by(const char *form) /*------------------------------------------------------------------------- - * Function: set_sort_order + * Function: set_sort_order * * Purpose: set the order of sorting by translating from a string input * parameter to a H5_iter_order_t return value - * current order values are [ascending | descending ] + * current order values are [ascending | descending ] * * Return: H5_iter_order_t form of order or H5_ITER_UNKNOWN if none found * @@ -3295,7 +3295,7 @@ parse_subset_params(char *dset) * * Pedro Vicente, May 8, 2008 * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of + * added for cases of external links not found, to avoid printing of * objects not found, since external links are dumped on a trial error basis * *------------------------------------------------------------------------- @@ -3307,7 +3307,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe) hid_t dsetid; struct subset_t *sset = (struct subset_t *)data; - if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) + if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { if (pe) { @@ -3319,7 +3319,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe) dump_header_format->datasetblockend); d_status = EXIT_FAILURE; } - + return; } /* end if */ @@ -3374,36 +3374,36 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe) } } - + /*------------------------------------------------------------------------- * check for block overlap *------------------------------------------------------------------------- */ - if(sset) + if(sset) { hid_t sid = H5Dget_space(dsetid); unsigned int ndims = H5Sget_simple_extent_ndims(sid); unsigned int i; - + for ( i = 0; i < ndims; i++) { if ( sset->count[i] > 1 ) { - + if ( sset->stride[i] < sset->block[i] ) { error_msg(progname, "wrong subset selection; blocks overlap\n"); d_status = EXIT_FAILURE; return; - - } - + + } + } - - } + + } H5Sclose(sid); - + } H5Oget_info(dsetid, &oinfo); @@ -3446,14 +3446,14 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe) * Programmer: Bill Wendling * Tuesday, 9. January 2001 * - * Modifications: + * Modifications: * * Pedro Vicente, September 26, 2007 * handle creation order * * Pedro Vicente, May 8, 2008 * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of + * added for cases of external links not found, to avoid printing of * objects not found, since external links are dumped on a trial error basis * *------------------------------------------------------------------------- @@ -3462,9 +3462,9 @@ static void handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe) { hid_t gid; - - - if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) + + + if((gid = H5Gopen2(fid, group, H5P_DEFAULT)) < 0) { if ( pe ) { @@ -3474,22 +3474,22 @@ handle_groups(hid_t fid, const char *group, void UNUSED * data, int pe) end_obj(dump_header_format->groupend, dump_header_format->groupblockend); d_status = EXIT_FAILURE; } - - } - else + + } + else { size_t new_len = HDstrlen(group) + 1; - - if(prefix_len <= new_len) + + if(prefix_len <= new_len) { prefix_len = new_len; prefix = HDrealloc(prefix, prefix_len); } /* end if */ - + HDstrcpy(prefix, group); - + dump_group(gid, group); - + if(H5Gclose(gid) < 0) d_status = EXIT_FAILURE; } /* end else */ @@ -3596,7 +3596,7 @@ handle_links(hid_t fid, const char *links, void UNUSED * data, int pe) * * Pedro Vicente, May 8, 2008 * added a flag PE that prints/not prints error messages - * added for cases of external links not found, to avoid printing of + * added for cases of external links not found, to avoid printing of * objects not found, since external links are dumped on a trial error basis * *------------------------------------------------------------------------- @@ -3606,12 +3606,12 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe) { hid_t type_id; - if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) + if((type_id = H5Topen2(fid, type, H5P_DEFAULT)) < 0) { /* check if type is unamed datatype */ unsigned idx = 0; - while(idx < type_table->nobjs ) + while(idx < type_table->nobjs ) { char name[128]; @@ -3626,7 +3626,7 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe) idx++; } /* end while */ - if(idx == type_table->nobjs) + if(idx == type_table->nobjs) { if ( pe ) { @@ -3639,9 +3639,9 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe) dump_header_format->datatypeblockend); d_status = EXIT_FAILURE; } - - } - else + + } + else { hid_t dsetid = H5Dopen2(fid, type_table->objs[idx].objname, H5P_DEFAULT); type_id = H5Dget_type(dsetid); @@ -3649,8 +3649,8 @@ handle_datatypes(hid_t fid, const char *type, void UNUSED * data, int pe) H5Tclose(type_id); H5Dclose(dsetid); } - } - else + } + else { dump_named_datatype(type_id, type); @@ -3811,7 +3811,7 @@ parse_start: break; case 'o': - + if (bin_form > 0 ) { if (set_output_file(opt_arg, 1) < 0){ @@ -3826,14 +3826,14 @@ parse_start: leave(EXIT_FAILURE); } } - + usingdasho = TRUE; last_was_dset = FALSE; outfname = opt_arg; break; case 'b': - + if ( ( bin_form = set_binary_form(opt_arg)) < 0){ /* failed to set binary form */ usage(progname); @@ -3846,10 +3846,10 @@ parse_start: usage(progname); leave(EXIT_FAILURE); } - + last_was_dset = FALSE; } - + break; case 'q': @@ -3864,14 +3864,14 @@ parse_start: break; case 'z': - + if ( ( sort_order = set_sort_order(opt_arg)) < 0) { /* failed to set "sort order" form */ usage(progname); leave(EXIT_FAILURE); } - + break; /** begin XML parameters **/ @@ -4224,29 +4224,29 @@ main(int argc, const char *argv[]) dump_fcpl(fid); } - if(display_all) + if(display_all) { - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) { error_msg(progname, "unable to open root group\n"); d_status = EXIT_FAILURE; - } - else + } + else { - + dump_function_table->dump_group_function(gid, "/" ); - + } - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) { error_msg(progname, "unable to close root group\n"); d_status = EXIT_FAILURE; } - - } - else + + } + else { /* Note: this option is not supported for XML */ if(doxml) { @@ -5477,7 +5477,7 @@ xml_dump_named_datatype(hid_t type, const char *name) * * Modifications: * Pedro Vicente, October 9, 2007 - * added parameters to H5A(L)iterate to allow for other iteration orders + * added parameters to H5A(L)iterate to allow for other iteration orders * *------------------------------------------------------------------------- */ @@ -5503,21 +5503,21 @@ xml_dump_group(hid_t gid, const char *name) error_msg(progname, "error in getting group creation property list ID\n"); d_status = EXIT_FAILURE; } - + /* query the group creation properties for attributes */ - if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) + if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0) { error_msg(progname, "error in getting group creation properties\n"); d_status = EXIT_FAILURE; } /* query the group creation properties */ - if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) + if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0) { error_msg(progname, "error in getting group creation properties\n"); d_status = EXIT_FAILURE; } - + if(H5Pclose(gcpl_id) < 0) { error_msg(progname, "error in closing group creation property list ID\n"); d_status = EXIT_FAILURE; @@ -5613,7 +5613,7 @@ xml_dump_group(hid_t gid, const char *name) found_obj->displayed = TRUE; /* 1. do all the attributes of the group */ - + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL); else @@ -5677,7 +5677,7 @@ xml_dump_group(hid_t gid, const char *name) free(parentxid); /* 1. do all the attributes of the group */ - + if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL); else @@ -6140,7 +6140,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) } /*------------------------------------------------------------------------- - * Function: xml_dump_dataset + * Function: xml_dump_dataset * * Purpose: Dump a description of an HDF5 dataset in XML. * @@ -6150,7 +6150,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type) * * Modifications: * Pedro Vicente, October 9, 2007 - * added parameters to H5Aiterate2 to allow for other iteration orders + * added parameters to H5Aiterate2 to allow for other iteration orders * *------------------------------------------------------------------------- */ @@ -6639,7 +6639,7 @@ h5_fileaccess(void) return -1; } else if (!HDstrcmp(name, "direct")) { /* Substitute Direct I/O driver with sec2 driver temporarily because - * some output has sec2 driver as the standard. */ + * some output has sec2 driver as the standard. */ if (H5Pset_fapl_sec2(fapl)<0) return -1; } else { /* Unknown driver */ @@ -6700,7 +6700,7 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name) * made by: PVN * * Purpose: Dump an external link - * Since external links are soft links, they are dumped on a trial error + * Since external links are soft links, they are dumped on a trial error * basis, attempting to dump as a dataset, as a group and as a named datatype * Error messages are supressed * @@ -6710,33 +6710,33 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name) static int dump_extlink(const char *filename, const char *targname) { hid_t fid; - - + + fid = h5tools_fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0); - - if (fid < 0) + + if (fid < 0) { goto fail; } - + /* add some indentation to distinguish that these objects are external */ indent += 2*COL; - + handle_datasets(fid, targname, NULL, 0); handle_groups(fid, targname, NULL, 0); handle_datatypes(fid, targname, NULL, 0); - + indent -= 2*COL; - - + + if (H5Fclose(fid) < 0) d_status = EXIT_FAILURE; - - + + return SUCCEED; - + fail: return FAIL; - + } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 2123bb3..d3e1502 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -5539,7 +5539,7 @@ error: /*------------------------------------------------------------------------- * Function: gent_binary * - * Purpose: Generate a file to be used in the binary output test + * Purpose: Generate a file to be used in the binary output test * Contains: * 1) an integer dataset * 2) a float dataset @@ -5564,7 +5564,7 @@ gent_binary(void) * integer *------------------------------------------------------------------------- */ - + did = H5Dcreate2(fid, "integer", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf); H5Dclose(did); @@ -5587,7 +5587,7 @@ gent_binary(void) aid = H5Acreate2(did, "attr", H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, H5P_DEFAULT); H5Aclose(aid); H5Dclose(did); - + /* close */ H5Sclose(sid); @@ -5629,8 +5629,8 @@ gent_bigdims(void) /* create a file */ fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); assert(fid >= 0); - - /* create dataset */ + + /* create dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0) @@ -5641,35 +5641,35 @@ gent_bigdims(void) goto out; if((did = H5Dcreate2(fid, "dset4gb", H5T_NATIVE_SCHAR, f_sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 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; - + /* select an hyperslab */ nelmts = 20; hs_start[0] = GB4LL - 10; hs_size[0] = nelmts; - - if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) + + if((m_sid = H5Screate_simple(1, hs_size, hs_size)) < 0) goto out; - + buf=(char *) malloc((unsigned)(nelmts*size)); - - for(i=0, c=0; i<nelmts; i++, c++) + + for(i=0, c=0; i<nelmts; i++, c++) { buf[i] = c; } - - 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; - if(H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) + if(H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) goto out; - - + + free(buf); buf=NULL; - + /* close */ if(H5Sclose(f_sid) < 0) goto out; @@ -5682,9 +5682,9 @@ gent_bigdims(void) ret = H5Fclose(fid); assert(ret >= 0); - + return; - + out: printf("Error.....\n"); H5E_BEGIN_TRY { @@ -5695,7 +5695,7 @@ out: H5Fclose(fid); } H5E_END_TRY; return; - + } @@ -5735,7 +5735,7 @@ gent_hyperslab(void) * Function: gent_group_creation_order * * Purpose: generate a file with several groups with creation order set and not - * set tru its hierarchy + * set tru its hierarchy * *------------------------------------------------------------------------- */ @@ -5746,118 +5746,118 @@ gent_group_creation_order(void) hid_t gid; /* group ID */ hid_t gcpl_id; /* group creation property list ID */ hid_t fcpl_id; /* file creation property list ID (to set root group order) */ - - if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) + + if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) goto out; - - if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED ) < 0) + + if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED ) < 0) goto out; - - if((fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0) + + if((fid = H5Fcreate(FILE58, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT)) < 0) goto out; - - + + /* create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto out; /*------------------------------------------------------------------------- - * create a group "2" + * create a group "2" *------------------------------------------------------------------------- - */ - + */ + - if((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - - if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + + if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - + /*------------------------------------------------------------------------- * create a group "1" with H5P_CRT_ORDER_TRACKED set *------------------------------------------------------------------------- - */ - if(H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0) + */ + if(H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0) goto out; - if((gid = H5Gcreate2(fid, "1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - - if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + + if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - if(H5Gclose(gid) < 0) + if(H5Gclose(gid) < 0) goto out; - - - if(H5Pclose(gcpl_id) < 0) + + + if(H5Pclose(gcpl_id) < 0) goto out; - if(H5Pclose(fcpl_id) < 0) + if(H5Pclose(fcpl_id) < 0) goto out; - if(H5Fclose(fid) < 0) + if(H5Fclose(fid) < 0) goto out; - + return; - + out: printf("Error.....\n"); H5E_BEGIN_TRY { @@ -5865,17 +5865,17 @@ out: H5Pclose(gcpl_id); H5Pclose(fcpl_id); H5Fclose(fid); - + } H5E_END_TRY; return; - + } /*------------------------------------------------------------------------- * Function: gent_attr_creation_order * - * Purpose: generate a file with several objects with attributes with creation - * order set and not set + * Purpose: generate a file with several objects with attributes with creation + * order set and not set * *------------------------------------------------------------------------- */ @@ -5893,85 +5893,85 @@ gent_attr_creation_order(void) hid_t tcpl_id; /* datatype creation property list ID */ int i; const char *attr_name[3] = {"c", "b", "a" }; - - if((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + + if((fid = H5Fcreate(FILE59, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* create group creation property list */ - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) goto out; /* create dataset creation property list */ - if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; /* create dataset creation property list */ - if((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0) + if((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0) goto out; /* enable attribute creation order tracking on dataset property list */ - if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0) + if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0) goto out; /* enable attribute creation order tracking on group property list */ - if(H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0) + if(H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0) goto out; /* enable attribute creation order tracking on datatype property list */ - if(H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0) + if(H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0) goto out; /* create a dataspace */ - if((sid = H5Screate(H5S_SCALAR)) < 0) + if((sid = H5Screate(H5S_SCALAR)) < 0) goto out; /*------------------------------------------------------------------------- * create a dataset with creation order tracked for attributes and atributes in it *------------------------------------------------------------------------- */ - + /* create a dataset */ - if((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, "dt", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) goto out; /* add attributes */ - for(i = 0; i < 3; i++) + for(i = 0; i < 3; i++) { - if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* close attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; } /* end for */ - - if(H5Dclose(did) < 0) + + if(H5Dclose(did) < 0) goto out; - + /*------------------------------------------------------------------------- * create a dataset without creation order tracked for attributes and atributes in it *------------------------------------------------------------------------- */ - + /* create a dataset */ - if((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((did = H5Dcreate2(fid, "d", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; /* add attributes */ - for(i = 0; i < 3; i++) + for(i = 0; i < 3; i++) { - if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(did, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* close attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; } /* end for */ - - if(H5Dclose(did) < 0) + + if(H5Dclose(did) < 0) goto out; - + /*------------------------------------------------------------------------- @@ -5979,22 +5979,22 @@ gent_attr_creation_order(void) *------------------------------------------------------------------------- */ - if((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "gt", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; - + /* add attributes */ - for(i = 0; i < 3; i++) + for(i = 0; i < 3; i++) { - if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* close attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - + } /* end for */ - - if(H5Gclose(gid) < 0) + + if(H5Gclose(gid) < 0) goto out; /*------------------------------------------------------------------------- @@ -6002,22 +6002,22 @@ gent_attr_creation_order(void) *------------------------------------------------------------------------- */ - if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* add attributes */ - for(i = 0; i < 3; i++) + for(i = 0; i < 3; i++) { - if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* close attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - + } /* end for */ - - if(H5Gclose(gid) < 0) + + if(H5Gclose(gid) < 0) goto out; @@ -6026,25 +6026,25 @@ gent_attr_creation_order(void) *------------------------------------------------------------------------- */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) goto out; - + if((H5Tcommit2(fid, "tt", tid, H5P_DEFAULT, tcpl_id, H5P_DEFAULT)) < 0) goto out; - + /* add attributes */ - for(i = 0; i < 3; i++) + for(i = 0; i < 3; i++) { - if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* close attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - + } /* end for */ - - if(H5Tclose(tid) < 0) + + if(H5Tclose(tid) < 0) goto out; /*------------------------------------------------------------------------- @@ -6052,47 +6052,47 @@ gent_attr_creation_order(void) *------------------------------------------------------------------------- */ - if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) + if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) goto out; - + if((H5Tcommit2(fid, "t", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* add attributes */ - for(i = 0; i < 3; i++) + for(i = 0; i < 3; i++) { - if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(tid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* close attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - + } /* end for */ - - if(H5Tclose(tid) < 0) + + if(H5Tclose(tid) < 0) goto out; /*------------------------------------------------------------------------- * add some attributes to the root group *------------------------------------------------------------------------- */ - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) + if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) goto out; - + /* add attributes */ - for(i = 0; i < 3; i++) + for(i = 0; i < 3; i++) { - if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + if((aid = H5Acreate2(gid, attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; - + /* close attribute */ - if(H5Aclose(aid) < 0) + if(H5Aclose(aid) < 0) goto out; - + } /* end for */ - - if(H5Gclose(gid) < 0) + + if(H5Gclose(gid) < 0) goto out; @@ -6100,22 +6100,22 @@ gent_attr_creation_order(void) * close *------------------------------------------------------------------------- */ - if(H5Sclose(sid) < 0) + if(H5Sclose(sid) < 0) goto out; - if(H5Pclose(dcpl_id) < 0) + if(H5Pclose(dcpl_id) < 0) goto out; - if(H5Pclose(gcpl_id) < 0) + if(H5Pclose(gcpl_id) < 0) goto out; - if(H5Pclose(tcpl_id) < 0) + if(H5Pclose(tcpl_id) < 0) goto out; - if(H5Fclose(fid) < 0) + if(H5Fclose(fid) < 0) goto out; - + return; - + out: printf("Error.....\n"); H5E_BEGIN_TRY { @@ -6126,16 +6126,16 @@ out: H5Pclose(dcpl_id); H5Pclose(tcpl_id); H5Fclose(fid); - + } H5E_END_TRY; return; - + } /*------------------------------------------------------------------------- * Function: gent_fpformat * - * Purpose: Generate a file to be used in the floating point format test + * Purpose: Generate a file to be used in the floating point format test * Contains: * 1) a float dataset * 2) a double dataset @@ -6179,7 +6179,7 @@ gent_fpformat(void) /*------------------------------------------------------------------------- * Function: gent_extlinks * - * Purpose: Generate 2 files to be used in the external links test + * Purpose: Generate 2 files to be used in the external links test * External links point from one HDF5 file to an object (Group, Dataset, or * committed Datatype) in another file. * @@ -6195,7 +6195,7 @@ gent_extlinks(void) /* create two files, a source and a target */ source_fid = H5Fcreate(FILE61, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); target_fid = H5Fcreate(FILE62, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - + /*------------------------------------------------------------------------- * create a Group, a Dataset, and a committed Datatype in the target diff --git a/tools/h5import/h5import.c b/tools/h5import/h5import.c index d1b15bb..6352c52 100755 --- a/tools/h5import/h5import.c +++ b/tools/h5import/h5import.c @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { print_version("h5import"); exit(EXIT_SUCCESS); - + } /* @@ -292,19 +292,19 @@ processDataFile(char *infile, struct Input *in, FILE **strm, hid_t file_id) /*------------------------------------------------------------------------- * special case for opening binary classes in WIN32 * "FP" denotes a floating point binary file, - * "IN" denotes a signed integer binary file, + * "IN" denotes a signed integer binary file, * "UIN" denotes an unsigned integer binary file, *------------------------------------------------------------------------- */ if ( in->inputClass == 4 /* "IN" */ || in->inputClass == 3 /* "FP" */ || - in->inputClass == 7 /* "UIN" */ - + in->inputClass == 7 /* "UIN" */ + ) { #ifdef WIN32 - + if ((*strm = fopen(infile, "rb")) == NULL) { (void) fprintf(stderr, err1, infile); @@ -852,20 +852,20 @@ processStrData(FILE **strm, struct Input *in, hid_t file_id) char str[1024]; char c; int i = 0, j, nlines = 0, line; - + /*------------------------------------------------------------------------- * get number of lines in the input file *------------------------------------------------------------------------- */ - while ( !feof( *strm ) ) + while ( !feof( *strm ) ) { c = fgetc( *strm ); - + if ( c == 10 ) /* eol */ { nlines++; - + } } @@ -890,9 +890,9 @@ processStrData(FILE **strm, struct Input *in, hid_t file_id) goto out; /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { - + /* create parent groups */ if(in->path.count > 1) { j = 0; @@ -913,7 +913,7 @@ processStrData(FILE **strm, struct Input *in, hid_t file_id) handle = file_id; j = 0; } - + /*enable error reporting */ } H5E_END_TRY; @@ -930,11 +930,11 @@ processStrData(FILE **strm, struct Input *in, hid_t file_id) while(!feof(*strm)) { c = fgetc(*strm); - + str[i] = c; - + i++; - + if(c == 10) /* eol */ { char *str2 = str; @@ -960,11 +960,11 @@ processStrData(FILE **strm, struct Input *in, hid_t file_id) i = 0; str[ 0 ] = '\0'; - + } } - + /* close */ H5Dclose(dset_id); H5Sclose(space_id); diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index 9272632..0b0ba9c 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -32,40 +32,40 @@ main(void) int nrow = 3, ncol = 4, npln = 5; int i, j, k; FILE *sp; - + float b32r3[5][3][4]; float row4[3], col4[4], pln4[5]; float rowo4 = (float)11.0e0, colo4 = (float)21.0e0, plno4 = (float)51.0e0; float rowi4 = (float)1.0e0, coli4 = (float)2.0e0, plni4 = (float)5.0e0; - + int b32i3[5][3][4]; int row4i[3], col4i[4], pln4i[5]; int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; - + #ifndef WIN32 long_long b64i2[3][4], b64i3[5][3][4]; long_long row4i64[3], col4i64[4], pln4i64[5]; long_long rowo4i64 = (long_long)11 , colo4i64 = (long_long)21 , plno4i64 = (long_long)51 ; long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; #endif - + short b16i3[5][3][4]; short row4i16[3], col4i16[4], pln4i16[5]; short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ; short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ; - + char b8i3[5][3][4]; char row4i8[3], col4i8[4], pln4i8[5]; char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; - + double b64r3[5][3][4]; double row8[3], col8[4], pln8[5]; double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; - - + + /* * initialize the row, column, and plane vectors * @@ -73,40 +73,40 @@ main(void) * column values start at 21 and increment by 2 => 21, 23, 25, 27 * plane values start at 51 and increment by 5 => 51, 56, 61, 66, 71 */ - - + + /* * build array elements - rank 2 * * element value = sum of row value and col values */ - + row4[0] = rowo4; col4[0] = colo4; pln4[0] = plno4; - + row8[0] = rowo8; col8[0] = colo8; pln8[0] = plno8; - + row4i[0] = rowo4i; col4i[0] = colo4i; pln4i[0] = plno4i; - + #ifndef WIN32 row4i64[0] = rowo4i64; col4i64[0] = colo4i64; pln4i64[0] = plno4i64; #endif - + row4i16[0] = rowo4i16; col4i16[0] = colo4i16; pln4i16[0] = plno4i16; - + row4i8[0] = rowo4i8; col4i8[0] = colo4i8; pln4i8[0] = plno4i8; - + for (i = 1; i < nrow; i++) { row4[i] = row4[i - 1] + rowi4; @@ -157,7 +157,7 @@ main(void) * * element value = sum of row value, col, and plane values */ - + for (i = 0; i < nrow; i++) { for (j = 0; j < ncol; j++) @@ -176,7 +176,7 @@ main(void) } } - + #ifndef UNICOS @@ -222,7 +222,7 @@ main(void) *------------------------------------------------------------------------- */ -#ifdef WIN32 +#ifdef WIN32 sp = fopen("binin32.bin", "wb"); #else sp = fopen("binin32.bin", "w"); @@ -244,7 +244,7 @@ main(void) *------------------------------------------------------------------------- */ -#ifdef WIN32 +#ifdef WIN32 sp = fopen("binuin32.bin", "wb"); #else sp = fopen("binuin32.bin", "w"); @@ -269,7 +269,7 @@ main(void) *------------------------------------------------------------------------- */ -#ifdef WIN32 +#ifdef WIN32 sp = fopen("binin16.bin", "wb"); #else sp = fopen("binin16.bin", "w"); @@ -372,7 +372,7 @@ main(void) { /* test CR+LF (13,10) and EOF (26) in windows */ char bin8w[4] = {13,10,26,0}; - + #ifdef WIN32 sp = fopen("binin8w.bin", "wb"); #else @@ -385,8 +385,8 @@ main(void) printf("error writing file\n"); } fclose(sp); - - + + } diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 91ade4f..eabdb6c 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -65,16 +65,16 @@ int h5repack(const char* infile, /* check input */ if (check_options(options)<0) return -1; - + /* check for objects in input that are in the file */ if (check_objects(infile,options) < 0) return -1; - + /* copy the objects */ if (copy_objects(infile,outfile,options) < 0) return -1; - - + + return 0; } @@ -97,7 +97,7 @@ int h5repack_init (pack_opt_t *options, memset(options,0,sizeof(pack_opt_t)); options->min_comp = 1024; options->verbose = verbose; - + for ( n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { options->filter_g[n].filtn = -1; @@ -105,7 +105,7 @@ int h5repack_init (pack_opt_t *options, for ( k = 0; k < CD_VALUES; k++) options->filter_g[n].cd_values[k] = -1; } - + return (options_table_init(&(options->op_tbl))); } @@ -141,36 +141,36 @@ int h5repack_addfilter(const char* str, int n_objs; /* number of objects in the current -f or -l option entry */ int is_glb; /* is the filter global */ - - + + /* parse the -f option */ obj_list=parse_filter(str,&n_objs,&filter,options,&is_glb); if (obj_list==NULL) { return -1; } - + /* if it applies to all objects */ if (is_glb) { - + int n; - + n = options->n_filter_g++; /* increase # of global filters */ if (options->n_filter_g > H5_REPACK_MAX_NFILTERS) { error_msg(progname, "maximum number of filters exceeded for <%s>\n",str); return -1; - + } - + options->filter_g[n] = filter; } - + else options_add_filter(obj_list,n_objs,filter,options->op_tbl); - + free(obj_list); return 0; } @@ -190,25 +190,25 @@ int h5repack_addfilter(const char* str, int h5repack_addlayout(const char* str, pack_opt_t *options) { - + obj_list_t *obj_list=NULL; /*one object list for the -t and -c option entry */ int n_objs; /*number of objects in the current -t or -c option entry */ pack_info_t pack; /*info about layout to extract from parse */ int j; - + init_packobject(&pack); - + if (options->all_layout==1){ error_msg(progname, "invalid layout input: 'all' option \ is present with other objects <%s>\n",str); return -1; } - + /* parse the layout option */ obj_list=parse_layout(str,&n_objs,&pack,options); if (obj_list==NULL) return -1; - + /* set global layout option */ if (options->all_layout==1 ) { @@ -230,13 +230,13 @@ int h5repack_addlayout(const char* str, } } } - + if (options->all_layout==0) options_add_layout(obj_list, n_objs, &pack, options->op_tbl); - + free(obj_list); return 0; } @@ -252,7 +252,7 @@ int h5repack_addlayout(const char* str, * Programmer: pvn@ncsa.uiuc.edu * * Date: September, 22, 2003 - * + * * Modification: * Peter Cao, July 9, 2007 * Add "-L, --latest" and other options to pack a file with the latest file format @@ -264,7 +264,7 @@ static int check_options(pack_opt_t *options) unsigned int i; int k, j, has_cp=0, has_ck=0; char slayout[30]; - + /*------------------------------------------------------------------------- * objects to layout *------------------------------------------------------------------------- @@ -297,11 +297,11 @@ static int check_options(pack_opt_t *options) } } }/* verbose */ - + for ( i = 0; i < options->op_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; - + if (options->op_tbl->objs[i].chunk.rank>0) { if (options->verbose){ @@ -319,24 +319,24 @@ static int check_options(pack_opt_t *options) has_ck=1; } } - + if (options->all_layout==1 && has_ck){ error_msg(progname, "invalid chunking input: 'all' option\ is present with other objects\n"); return -1; } - + /*------------------------------------------------------------------------- * objects to filter *------------------------------------------------------------------------- */ - + if (options->verbose && have_request(options) /* only print if requested */) { printf("Objects to apply filter are...\n"); if (options->all_filter==1) { - + for (k = 0; k < options->n_filter_g; k++ ) { H5Z_filter_t filtn=options->filter_g[k].filtn; @@ -359,12 +359,12 @@ static int check_options(pack_opt_t *options) }; } } /* verbose */ - + for ( i = 0; i < options->op_tbl->nelems; i++) { pack_info_t pack = options->op_tbl->objs[i]; char* name = pack.path; - + for ( j=0; j<pack.nfilters; j++) { if (options->verbose) @@ -373,12 +373,12 @@ static int check_options(pack_opt_t *options) name, get_sfilter(pack.filter[j].filtn)); } - + has_cp=1; - + } /* j */ } /* i */ - + if (options->all_filter==1 && has_cp){ error_msg(progname, "invalid compression input: 'all' option\ is present with other objects\n"); @@ -420,7 +420,7 @@ static int check_options(pack_opt_t *options) options->ublock_filename); return -1; } - + if ( options->ublock_filename == NULL && options->ublock_size != 0 ) { error_msg(progname, "file name missing for user block\n", @@ -433,13 +433,13 @@ static int check_options(pack_opt_t *options) * verify alignment options; threshold is zero default but alignment not *--------------------------------------------------------------------------------- */ - + if ( options->alignment == 0 && options->threshold != 0 ) { error_msg(progname, "alignment for H5Pset_alignment missing\n"); return -1; } - + return 0; } @@ -464,11 +464,11 @@ static int check_objects(const char* fname, hid_t fid; unsigned int i; trav_table_t *travt = NULL; - + /* nothing to do */ if(options->op_tbl->nelems == 0) return 0; - + /*------------------------------------------------------------------------- * open the file *------------------------------------------------------------------------- @@ -477,32 +477,32 @@ static int check_objects(const char* fname, printf("<%s>: %s\n", fname, H5FOPENERROR ); return -1; } - + /*------------------------------------------------------------------------- * get the list of objects in the file *------------------------------------------------------------------------- */ - + /* init table */ trav_table_init(&travt); - + /* get the list of objects in the file */ if(h5trav_gettable(fid, travt) < 0) goto out; - + /*------------------------------------------------------------------------- * compare with user supplied list *------------------------------------------------------------------------- */ - + if(options->verbose) printf("Opening file <%s>. Searching for objects to modify...\n", fname); - + for(i = 0; i < options->op_tbl->nelems; i++) { char* name=options->op_tbl->objs[i].path; if(options->verbose) printf(" <%s>",name); - + /* the input object names are present in the file and are valid */ if(h5trav_getindext(name, travt) < 0) { error_msg(progname, "%s Could not find <%s> in file <%s>. Exiting...\n", @@ -524,7 +524,7 @@ static int check_objects(const char* fname, int rank; hid_t did; hid_t sid; - + if(options->op_tbl->objs[i].chunk.rank > 0) { rank = options->op_tbl->objs[i].chunk.rank; for(j = 0; j < rank; j++) @@ -547,7 +547,7 @@ static int check_objects(const char* fname, if(H5Dclose(did) < 0) goto out; } - + if (csize < ppb ) { printf(" <warning: SZIP settins, chunk size is smaller than pixels per block>\n"); goto out; @@ -556,7 +556,7 @@ static int check_objects(const char* fname, break; } } /* i */ - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -564,7 +564,7 @@ static int check_objects(const char* fname, H5Fclose(fid); trav_table_free(travt); return 0; - + out: H5Fclose(fid); trav_table_free(travt); diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index a7b3fd9..a77a670 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -102,11 +102,11 @@ typedef struct { H5D_layout_t layout_g; /*global layout information for the ALL case */ int verbose; /*verbose mode */ hsize_t min_comp; /*minimum size to compress, in bytes */ - int use_native; /*use a native type in write */ + int use_native; /*use a native type in write */ int latest; /*pack file with the latest file format */ int grp_compact; /* Set the maximum number of links to store as header messages in the group */ int grp_indexed; /* Set the minimum number of links to store in the indexed format */ - int msg_size[8]; /* Minimum size of shared messages: dataspace, + int msg_size[8]; /* Minimum size of shared messages: dataspace, datatype, fill value, filter pipleline, attribute */ const char *ublock_filename; /* user block file name */ int ublock_size; /* user block size */ @@ -159,7 +159,7 @@ int copy_objects (const char* fnamein, int do_copy_refobjs(hid_t fidin, hid_t fidout, trav_table_t *travt, - pack_opt_t *options); + pack_opt_t *options); /*------------------------------------------------------------------------- * filters and verify module diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 7f43ad0..b0d475f 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -187,11 +187,11 @@ int copy_objects(const char* fnamein, } /* end if */ } /* end if */ } /* end if */ - - -#if defined (H5REPACK_DEBUG) + + +#if defined (H5REPACK_DEBUG) print_user_block(fnamein,fidin); #endif @@ -207,35 +207,35 @@ int copy_objects(const char* fnamein, if(fcpl != H5P_DEFAULT) { /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) + if(H5Pset_userblock(fcpl, options->ublock_size) < 0) { error_msg(progname, "failed to set userblock size\n"); goto out; - } - + } + } - + else { - + /* create a file creation property list */ - if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { error_msg(progname, "fail to create a file creation property list\n"); goto out; - } - + } + /* set user block size */ - if(H5Pset_userblock(fcpl, options->ublock_size) < 0) + if(H5Pset_userblock(fcpl, options->ublock_size) < 0) { error_msg(progname, "failed to set userblock size\n"); goto out; - } - + } + } - - - + + + } @@ -244,39 +244,39 @@ int copy_objects(const char* fnamein, *------------------------------------------------------------------------- */ - + if ( options->alignment > 0 ) { /* either use the FCPL already created or create a new one */ if (fapl != H5P_DEFAULT) { - + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { error_msg(progname, "failed to set alignment\n"); goto out; } - + } - + else { - + /* create a file access property list */ - if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { error_msg(progname, "Could not create file access property list\n"); goto out; - } - + } + if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0) { error_msg(progname, "failed to set alignment\n"); goto out; } - - } - + + } + } @@ -285,28 +285,28 @@ int copy_objects(const char* fnamein, *------------------------------------------------------------------------- */ - + if(options->verbose) printf("Making file <%s>...\n",fnameout); - - - if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) + + + if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0) { error_msg(progname, "<%s>: Could not create file\n", fnameout ); goto out; } /* end if */ - + /*------------------------------------------------------------------------- * write a new user block if requested *------------------------------------------------------------------------- */ if ( options->ublock_size > 0 ) - { + { copy_user_block( options->ublock_filename, fnameout, options->ublock_size); } - + /* init table */ trav_table_init(&travt); @@ -387,7 +387,7 @@ out: * * Date: October, 23, 2003 * - * Modifications: + * Modifications: * * July 2004: Introduced the extra EC or NN option for SZIP * @@ -399,47 +399,47 @@ out: * October 2006: Read by hyperslabs for big datasets. * * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done - * i.e., if the memory needed to read a dataset is greater than this limit, - * then hyperslab I/O is done instead of one operation I/O + * i.e., if the memory needed to read a dataset is greater than this limit, + * then hyperslab I/O is done instead of one operation I/O * For each dataset, the memory needed is calculated according to * * memory needed = number of elements * size of each element * - * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations + * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations * are done * * H5Dread( input_dataset1 ) * H5Dread( input_dataset2 ) * - * with all elements in the datasets selected. If the memory needed is greater than + * with all elements in the datasets selected. If the memory needed is greater than * H5TOOLS_MALLOCSIZE, then the following operations are done instead: * - * a strip mine is defined for each dimension k (a strip mine is defined as a + * a strip mine is defined for each dimension k (a strip mine is defined as a * hyperslab whose size is memory manageable) according to the formula * * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) * - * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures - * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip - * mine size k is simply defined as its dimension k, but for larger datasets the + * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures + * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip + * mine size k is simply defined as its dimension k, but for larger datasets the * hyperslab size is still memory manageable. - * a cycle is done until the number of elements in the dataset is reached. In each - * iteration, two parameters are defined for the function H5Sselect_hyperslab, + * a cycle is done until the number of elements in the dataset is reached. In each + * iteration, two parameters are defined for the function H5Sselect_hyperslab, * the start and size of each hyperslab, according to * * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) * - * where hyperslab_offset [k] is initially set to zero, and later incremented in - * hyperslab_size[k] offsets. The reason for the operation + * where hyperslab_offset [k] is initially set to zero, and later incremented in + * hyperslab_size[k] offsets. The reason for the operation * * dimension[k] - hyperslab_offset[k] * - * in (2) is that, when using the strip mine size, it assures that the "remaining" part + * in (2) is that, when using the strip mine size, it assures that the "remaining" part * of the dataset that does not fill an entire strip mine is processed. * - * November 2006: Use H5Ocopy in the copy of objects. The logic for using - * H5Ocopy or not is if a change of filters or layout is requested by the user - * then use read/write else use H5Ocopy. + * November 2006: Use H5Ocopy in the copy of objects. The logic for using + * H5Ocopy or not is if a change of filters or layout is requested by the user + * then use read/write else use H5Ocopy. * * May, 1, 2008: Add a printing of the compression ratio of old size / new size * @@ -518,7 +518,7 @@ int do_copy_objects(hid_t fidin, goto error; if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) - goto error; + goto error; } else { if((grp_out = H5Gcreate2(fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -565,7 +565,7 @@ int do_copy_objects(hid_t fidin, goto error; if(H5Dclose(dset_in) < 0) goto error; - + /*------------------------------------------------------------------------- * check if we should use H5Ocopy or not @@ -599,11 +599,11 @@ int do_copy_objects(hid_t fidin, if(options->use_native == 1) wtype_id = h5tools_get_native_type(ftype_id); else - wtype_id = H5Tcopy(ftype_id); + wtype_id = H5Tcopy(ftype_id); if((msize = H5Tget_size(wtype_id)) == 0) goto error; - + /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that * are not registered in the current configuration @@ -647,7 +647,7 @@ int do_copy_objects(hid_t fidin, dset_out = H5Dcreate2(fidout, travt->objs[i].name, wtype_id, f_space_id, H5P_DEFAULT, dcpl_out, H5P_DEFAULT); } H5E_END_TRY; - if(dset_out == FAIL) + if(dset_out == FAIL) { if(options->verbose) printf(" warning: could not create dataset <%s>. Applying original settings\n", @@ -674,7 +674,7 @@ int do_copy_objects(hid_t fidin, goto error; if (H5Dwrite(dset_out,wtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) goto error; - } + } else /* possibly not enough memory, read/write by hyperslabs */ { @@ -695,7 +695,7 @@ int do_copy_objects(hid_t fidin, hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ hsize_t hs_nelmts; /*elements in request */ hsize_t zero[8]; /*vector of zeros */ - int k; + int k; /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(wtype_id, H5T_VLEN) == TRUE) @@ -721,12 +721,12 @@ int do_copy_objects(hid_t fidin, memset(hs_offset, 0, sizeof hs_offset); memset(zero, 0, sizeof zero); - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ - if (rank > 0) + if (rank > 0) { - for (k = 0, hs_nelmts = 1; k < rank; k++) + for (k = 0, hs_nelmts = 1; k < rank; k++) { hs_size[k] = MIN(dims[k] - hs_offset[k], sm_size[k]); hs_nelmts *= hs_size[k]; @@ -736,8 +736,8 @@ int do_copy_objects(hid_t fidin, goto error; if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) goto error; - } - else + } + else { H5Sselect_all(f_space_id); H5Sselect_all(sm_space); @@ -745,9 +745,9 @@ int do_copy_objects(hid_t fidin, } /* rank */ /* read/write */ - if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + if (H5Dread(dset_in, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) goto error; - if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) + if (H5Dwrite(dset_out, wtype_id, sm_space, f_space_id, H5P_DEFAULT, sm_buf) < 0) goto error; /* reclaim any VL memory, if necessary */ @@ -755,7 +755,7 @@ int do_copy_objects(hid_t fidin, H5Dvlen_reclaim(wtype_id, sm_space, H5P_DEFAULT, sm_buf); /* calculate the next hyperslab offset */ - for (k = rank, carry = 1; k > 0 && carry; --k) + for (k = rank, carry = 1; k > 0 && carry; --k) { hs_offset[k - 1] += hs_size[k - 1]; if (hs_offset[k - 1] == dims[k - 1]) @@ -779,7 +779,7 @@ int do_copy_objects(hid_t fidin, * amount of compression used *------------------------------------------------------------------------- */ - if (options->verbose) + if (options->verbose) { double ratio=0; @@ -796,13 +796,13 @@ int do_copy_objects(hid_t fidin, a = dsize_in; b = dsize_out; if (b!=0) ratio = (double) a / (double) b; - + print_dataset_info(dcpl_out,travt->objs[i].name,ratio,1); } else print_dataset_info(dcpl_id,travt->objs[i].name,ratio,0); - /* print a message that the filter was not applied + /* print a message that the filter was not applied (in case there was a filter) */ if ( has_filter && apply_s == 0 ) @@ -853,16 +853,16 @@ int do_copy_objects(hid_t fidin, * we do not have request for filter/chunking use H5Ocopy instead *------------------------------------------------------------------------- */ - else + else { hid_t pid; /* create property to pass copy options */ - if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) + if ( (pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) goto error; /* set options for object copy */ - if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) + if(H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0) goto error; /*------------------------------------------------------------------------- @@ -875,7 +875,7 @@ int do_copy_objects(hid_t fidin, fidout, /* Destination file or group identifier */ travt->objs[i].name, /* Name of the destination object */ pid, /* Properties which apply to the copy */ - H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ + H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */ goto error; /* close property */ @@ -901,7 +901,7 @@ int do_copy_objects(hid_t fidin, if (options->verbose) printf(FORMAT_OBJ,"dset",travt->objs[i].name ); - + } /* end do we have request for filter/chunking */ @@ -938,7 +938,7 @@ int do_copy_objects(hid_t fidin, if(H5Tclose(type_out) < 0) goto error; - + break; @@ -1042,52 +1042,52 @@ int copy_attr(hid_t loc_in, H5O_info_t oinfo; /* object info */ int j; unsigned u; - + if(H5Oget_info(loc_in, &oinfo) < 0) goto error; - + /*------------------------------------------------------------------------- * copy all attributes *------------------------------------------------------------------------- */ - + for ( u = 0; u < (unsigned)oinfo.num_attrs; u++) { - + buf=NULL; - + /* open attribute */ if((attr_id = H5Aopen_by_idx(loc_in, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - + /* get name */ if (H5Aget_name( attr_id, (size_t)255, name ) < 0) goto error; - + /* get the file datatype */ if ((ftype_id = H5Aget_type( attr_id )) < 0 ) goto error; - + /* get the dataspace handle */ if ((space_id = H5Aget_space( attr_id )) < 0 ) goto error; - + /* get dimensions */ if ( (rank = H5Sget_simple_extent_dims(space_id, dims, NULL)) < 0 ) goto error; - + nelmts=1; for (j=0; j<rank; j++) nelmts*=dims[j]; - + if (options->use_native==1) wtype_id = h5tools_get_native_type(ftype_id); else - wtype_id = H5Tcopy(ftype_id); - + wtype_id = H5Tcopy(ftype_id); + if ((msize=H5Tget_size(wtype_id))==0) goto error; - + /*------------------------------------------------------------------------- * object references are a special case * we cannot just copy the buffers, but instead we recreate the reference @@ -1095,18 +1095,18 @@ int copy_attr(hid_t loc_in, * the referenced objects *------------------------------------------------------------------------- */ - + if (H5T_REFERENCE==H5Tget_class(wtype_id)) { ; } - else + else { /*------------------------------------------------------------------------- * read to memory *------------------------------------------------------------------------- */ - + buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { error_msg(progname, "cannot read into memory\n" ); @@ -1114,46 +1114,46 @@ int copy_attr(hid_t loc_in, } if(H5Aread(attr_id, wtype_id, buf) < 0) goto error; - + /*------------------------------------------------------------------------- * copy *------------------------------------------------------------------------- */ - + if((attr_out = H5Acreate2(loc_out, name, ftype_id, space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if(H5Awrite(attr_out, wtype_id, buf) < 0) goto error; - + /*close*/ if(H5Aclose(attr_out) < 0) goto error; - - + + if(buf) free(buf); - + } /*H5T_REFERENCE*/ - - + + if(options->verbose) printf(FORMAT_OBJ_ATTR, "attr", name); - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + if (H5Tclose(ftype_id) < 0) goto error; if (H5Tclose(wtype_id) < 0) goto error; if (H5Sclose(space_id) < 0) goto error; if (H5Aclose(attr_id) < 0) goto error; - + } /* u */ - - + + return 0; - + error: H5E_BEGIN_TRY { H5Tclose(ftype_id); @@ -1193,27 +1193,27 @@ static void print_dataset_info(hid_t dcpl_id, size_t cd_nelmts; /* filter client number of values */ char f_objname[256]; /* filter objname */ int i; - - + + strcpy(strfilter,"\0"); - + /* get information about input filters */ if((nfilters = H5Pget_nfilters(dcpl_id)) < 0) return; - + for(i = 0; i < nfilters; i++) { cd_nelmts = NELMTS(cd_values); - + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_objname), f_objname, NULL); - + switch(filtn) { default: break; - + case H5Z_FILTER_DEFLATE: strcat(strfilter,"GZIP "); - + #if defined (PRINT_DEBUG) { unsigned level=cd_values[0]; @@ -1222,10 +1222,10 @@ static void print_dataset_info(hid_t dcpl_id, } #endif break; - + case H5Z_FILTER_SZIP: strcat(strfilter,"SZIP "); - + #if defined (PRINT_DEBUG) { unsigned options_mask=cd_values[0]; /* from dcpl, not filt*/ @@ -1238,29 +1238,29 @@ static void print_dataset_info(hid_t dcpl_id, strcpy(temp,"NN) "); } strcat(strfilter,temp); - + #endif - + break; - + case H5Z_FILTER_SHUFFLE: strcat(strfilter,"SHUF "); break; - + case H5Z_FILTER_FLETCHER32: strcat(strfilter,"FLET "); break; - + case H5Z_FILTER_NBIT: strcat(strfilter,"NBIT "); break; - + case H5Z_FILTER_SCALEOFFSET: strcat(strfilter,"SCALEOFFSET "); break; } /* switch */ }/*i*/ - + if(!pr) printf(FORMAT_OBJ,"dset",objname ); else @@ -1275,13 +1275,13 @@ static void print_dataset_info(hid_t dcpl_id, } /*------------------------------------------------------------------------- - * Function: copy_user_block + * Function: copy_user_block * * Purpose: copy user block from one file to another * * Return: 0, ok, -1 no * - * Programmer: Peter Cao + * Programmer: Peter Cao * * Date: October, 25, 2007 * @@ -1355,25 +1355,25 @@ done: if(outfid > 0) HDclose(outfid); - return status; + return status; } /*------------------------------------------------------------------------- - * Function: print_user_block + * Function: print_user_block * * Purpose: print user block * * Return: 0, ok, -1 no * - * Programmer: Pedro Vicente + * Programmer: Pedro Vicente * * Date: August, 20, 2008 * *------------------------------------------------------------------------- */ -static +static void print_user_block(const char *filename, hid_t fid) { int fh; /* file handle */ @@ -1382,35 +1382,35 @@ void print_user_block(const char *filename, hid_t fid) hid_t fcpl; /* file creation property list ID for HDF5 file */ int i; - /* get user block size */ - if(( fcpl = H5Fget_create_plist(fid)) < 0) + /* get user block size */ + if(( fcpl = H5Fget_create_plist(fid)) < 0) { error_msg(progname, "failed to retrieve file creation property list\n"); goto done; - } - - if(H5Pget_userblock(fcpl, &ub_size) < 0) + } + + if(H5Pget_userblock(fcpl, &ub_size) < 0) { error_msg(progname, "failed to retrieve userblock size\n"); goto done; - } - - if(H5Pclose(fcpl) < 0) + } + + if(H5Pclose(fcpl) < 0) { error_msg(progname, "failed to close property list\n"); goto done; - } - + } + /* open file */ - if((fh = HDopen(filename, O_RDONLY, 0)) < 0) + if((fh = HDopen(filename, O_RDONLY, 0)) < 0) { goto done; } - + size = ub_size; /* read file */ - while(size > 0) + while(size > 0) { ssize_t nread; /* # of bytes read */ char rbuf[USERBLOCK_XFER_SIZE]; /* buffer for reading */ @@ -1421,7 +1421,7 @@ void print_user_block(const char *filename, hid_t fid) else nread = HDread(fh, rbuf, (size_t)size); - for(i = 0; i < nread; i++) + for(i = 0; i < nread; i++) { printf("%c ", rbuf[i]); @@ -1429,20 +1429,20 @@ void print_user_block(const char *filename, hid_t fid) } printf("\n"); - if(nread < 0) + if(nread < 0) { goto done; - } + } + - /* update size of userblock left to transfer */ size -= nread; - } + } done: if(fh > 0) HDclose(fh); - - return; + + return; } diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index 98ef07e..cd4693e 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -41,10 +41,10 @@ int aux_find_obj(const char* name, /* object name from traverse list */ *obj = options->op_tbl->objs[i]; return i; } - + pdest = strstr(name,options->op_tbl->objs[i].path); result = (int)(pdest - name); - + /* found at position 1, meaning without '/' */ if( pdest != NULL && result==1 ) { @@ -72,19 +72,19 @@ int aux_assign_obj(const char* name, /* object name from traverse lis pack_opt_t *options, /* repack options */ pack_info_t *obj /*OUT*/) /* info about object to filter */ { - + int idx, i; pack_info_t tmp; - + init_packobject(&tmp); - + idx = aux_find_obj(name,options,&tmp); - + /* name was on input */ if (idx>=0) { - - + + /* applying to all objects */ if (options->all_layout) { @@ -114,9 +114,9 @@ int aux_assign_obj(const char* name, /* object name from traverse lis default: break; }/*switch*/ - + } - + /* applying to all objects */ if (options->all_filter) { @@ -132,16 +132,16 @@ int aux_assign_obj(const char* name, /* object name from traverse lis tmp.filter[i] = options->op_tbl->objs[idx].filter[i]; } } - - + + } /* if idx */ - - + + /* no input name */ - + else { - + if (options->all_filter) { int k; @@ -167,11 +167,11 @@ int aux_assign_obj(const char* name, /* object name from traverse lis }/*switch*/ } } - + *obj = tmp; return 1; - -} + +} /*------------------------------------------------------------------------- @@ -206,40 +206,40 @@ int apply_filters(const char* name, /* object name from traverse list */ pack_info_t obj; *has_filter = 0; - + if (rank==0) /* scalar dataset, do not apply */ return 0; - + /*------------------------------------------------------------------------- * initialize the assigment object *------------------------------------------------------------------------- */ init_packobject(&obj); - + /*------------------------------------------------------------------------- * find options *------------------------------------------------------------------------- */ if (aux_assign_obj(name,options,&obj)==0) return 0; - + /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id))<0) return -1; - + /*------------------------------------------------------------------------- * check if we have filters in the pipeline * we want to replace them with the input filters * only remove if we are inserting new ones *------------------------------------------------------------------------- */ - if (nfilters && obj.nfilters ) + if (nfilters && obj.nfilters ) { *has_filter = 1; if (H5Premove_filter(dcpl_id,H5Z_FILTER_ALL)<0) return -1; } - + /*------------------------------------------------------------------------- * check if there is an existent chunk * read it only if there is not a requested layout @@ -249,7 +249,7 @@ int apply_filters(const char* name, /* object name from traverse list */ { if ((layout = H5Pget_layout(dcpl_id))<0) return -1; - + if (layout==H5D_CHUNKED) { if ((rank = H5Pget_chunk(dcpl_id,NELMTS(chsize),chsize/*out*/))<0) @@ -260,7 +260,7 @@ int apply_filters(const char* name, /* object name from traverse list */ obj.chunk.chunk_lengths[i] = chsize[i]; } } - + /*------------------------------------------------------------------------- * the type of filter and additional parameter * type can be one of the filters @@ -273,10 +273,10 @@ int apply_filters(const char* name, /* object name from traverse list */ * H5Z_FILTER_SCALEOFFSET 6 , scaleoffset compression *------------------------------------------------------------------------- */ - + if (obj.nfilters) { - + /*------------------------------------------------------------------------- * filters require CHUNK layout; if we do not have one define a default *------------------------------------------------------------------------- @@ -287,14 +287,14 @@ int apply_filters(const char* name, /* object name from traverse list */ for (i=0; i<rank; i++) obj.chunk.chunk_lengths[i] = dims[i]; } - + for ( i=0; i<obj.nfilters; i++) { switch (obj.filter[i].filtn) { default: break; - + /*------------------------------------------------------------------------- * H5Z_FILTER_DEFLATE 1 , deflation like gzip *------------------------------------------------------------------------- @@ -302,7 +302,7 @@ int apply_filters(const char* name, /* object name from traverse list */ case H5Z_FILTER_DEFLATE: { unsigned aggression; /* the deflate level */ - + aggression = obj.filter[i].cd_values[0]; /* set up for deflated data */ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) @@ -311,7 +311,7 @@ int apply_filters(const char* name, /* object name from traverse list */ return -1; } break; - + /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP 4 , szip compression *------------------------------------------------------------------------- @@ -320,19 +320,19 @@ int apply_filters(const char* name, /* object name from traverse list */ { unsigned options_mask; unsigned pixels_per_block; - + options_mask = obj.filter[i].cd_values[0]; pixels_per_block = obj.filter[i].cd_values[1]; - + /* set up for szip data */ if(H5Pset_chunk(dcpl_id,obj.chunk.rank,obj.chunk.chunk_lengths)<0) return -1; if (H5Pset_szip(dcpl_id,options_mask,pixels_per_block)<0) return -1; - + } break; - + /*------------------------------------------------------------------------- * H5Z_FILTER_SHUFFLE 2 , shuffle the data *------------------------------------------------------------------------- @@ -343,7 +343,7 @@ int apply_filters(const char* name, /* object name from traverse list */ if (H5Pset_shuffle(dcpl_id)<0) return -1; break; - + /*------------------------------------------------------------------------- * H5Z_FILTER_FLETCHER32 3 , fletcher32 checksum of EDC *------------------------------------------------------------------------- @@ -368,15 +368,15 @@ int apply_filters(const char* name, /* object name from traverse list */ * H5Z_FILTER_SCALEOFFSET , scale+offset compression *------------------------------------------------------------------------- */ - + case H5Z_FILTER_SCALEOFFSET: { H5Z_SO_scale_type_t scale_type; int scale_factor; - + scale_type = obj.filter[i].cd_values[0]; scale_factor = obj.filter[i].cd_values[1]; - + if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; if (H5Pset_scaleoffset(dcpl_id,scale_type,scale_factor)<0) @@ -385,21 +385,21 @@ int apply_filters(const char* name, /* object name from traverse list */ break; } /* switch */ }/*i*/ - + } /*obj.nfilters*/ - + /*------------------------------------------------------------------------- * layout *------------------------------------------------------------------------- */ - + if (obj.layout>=0) { /* a layout was defined */ if (H5Pset_layout(dcpl_id, obj.layout)<0) return -1; - + if (H5D_CHUNKED==obj.layout) { /* set up chunk */ if(H5Pset_chunk(dcpl_id, obj.chunk.rank, obj.chunk.chunk_lengths)<0) return -1; @@ -408,7 +408,7 @@ int apply_filters(const char* name, /* object name from traverse list */ if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY)<0) return -1; } - + } return 0; diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index f457f23..a2f4b14 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -74,9 +74,9 @@ static struct long_options l_opts[] = { * * Comments: * - * Modifications: + * Modifications: * July 2004: Introduced the extra EC or NN option for SZIP - * October 2006: Added a new switch -n, that allows to write the dataset + * October 2006: Added a new switch -n, that allows to write the dataset * using a native type. The default to write is the file type. * * Modification: @@ -87,11 +87,11 @@ static struct long_options l_opts[] = { * PVN, November 28, 2007 * added support for multiple global filters * PVN, May 16, 2008 - * added backward compatibility for -i infile -o outfile + * added backward compatibility for -i infile -o outfile * PVN, August 20, 2008 * add a user block to repacked file (switches -u -b) * PVN, August 28, 2008 - * add options to set alignment (H5Pset_alignment) (switches -t -a) + * add options to set alignment (H5Pset_alignment) (switches -t -a) *------------------------------------------------------------------------- */ int main(int argc, char **argv) @@ -101,15 +101,15 @@ int main(int argc, char **argv) pack_opt_t options; /*the global options */ int ret=-1; int i; - + /* initialize options */ h5repack_init (&options,0); /* detect -i or -o for file names */ for ( i = 1; i < argc; i++) { - - if (strcmp(argv[i], "-i") == 0) + + if (strcmp(argv[i], "-i") == 0) { has_i_o = 1; } @@ -121,104 +121,104 @@ int main(int argc, char **argv) if (has_i_o) { - + for ( i = 1; i < argc; i++) { - if (strcmp(argv[i], "-h") == 0) + if (strcmp(argv[i], "-h") == 0) { usage(progname); exit(0); } - if (strcmp(argv[i], "-i") == 0) + if (strcmp(argv[i], "-i") == 0) { infile = argv[++i]; } - else if (strcmp(argv[i], "-o") == 0) + else if (strcmp(argv[i], "-o") == 0) { outfile = argv[++i]; } - else if (strcmp(argv[i], "-v") == 0) + else if (strcmp(argv[i], "-v") == 0) { options.verbose = 1; } - else if (strcmp(argv[i], "-f") == 0) + else if (strcmp(argv[i], "-f") == 0) { - + /* add the -f filter option */ if (h5repack_addfilter(argv[i+1],&options)<0) { error_msg(progname, "in parsing filter\n"); exit(1); } - + /* jump to next */ ++i; } - else if (strcmp(argv[i], "-l") == 0) + else if (strcmp(argv[i], "-l") == 0) { - + /* parse the -l layout option */ if (h5repack_addlayout(argv[i+1],&options)<0) { error_msg(progname, "in parsing layout\n"); exit(1); } - + /* jump to next */ ++i; } - - else if (strcmp(argv[i], "-m") == 0) + + else if (strcmp(argv[i], "-m") == 0) { options.min_comp = parse_number(argv[i+1]); - if ((int)options.min_comp<=0) + if ((int)options.min_comp<=0) { error_msg(progname, "invalid minimum compress size <%s>\n",argv[i+1]); exit(1); } ++i; } - - else if (strcmp(argv[i], "-e") == 0) + + else if (strcmp(argv[i], "-e") == 0) { read_info(argv[++i],&options); } - else if (strcmp(argv[i], "-n") == 0) + else if (strcmp(argv[i], "-n") == 0) { options.use_native = 1; } - else if (strcmp(argv[i], "-L") == 0) + else if (strcmp(argv[i], "-L") == 0) { options.latest = 1; } - else if (strcmp(argv[i], "-c") == 0) + else if (strcmp(argv[i], "-c") == 0) { options.grp_compact = atoi( argv[++i] ); if (options.grp_compact>0) - options.latest = 1; /* must use latest format */ + options.latest = 1; /* must use latest format */ } - else if (strcmp(argv[i], "-d") == 0) + else if (strcmp(argv[i], "-d") == 0) { options.grp_indexed = atoi( argv[++i] ); if (options.grp_indexed>0) - options.latest = 1; /* must use latest format */ + options.latest = 1; /* must use latest format */ } - else if (strcmp(argv[i], "-s") == 0) + else if (strcmp(argv[i], "-s") == 0) { - + char *s = argv[++i]; int idx = 0; int ssize = 0; char *msgPtr = strchr( s, ':'); options.latest = 1; /* must use latest format */ - if (msgPtr == NULL) + if (msgPtr == NULL) { ssize = atoi( s ); for (idx=0; idx<5; idx++) - options.msg_size[idx] = ssize; + options.msg_size[idx] = ssize; } - else + else { char msgType[10]; strcpy(msgType, msgPtr+1); @@ -239,66 +239,66 @@ int main(int argc, char **argv) else if (strncmp(msgType, "attr",4) == 0) { options.msg_size[4] = ssize; } - } - + } + } - - + + else if (argv[i][0] == '-') { error_msg(progname, " - is not a valid argument\n"); usage(progname); exit(1); } } - + if (infile == NULL || outfile == NULL) { error_msg(progname, "file names missing\n"); usage(progname); exit(1); } - + } - + else - + { - + parse_command_line(argc, argv, &options); - - - - if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) + + + + if ( argv[ opt_ind ] != NULL && argv[ opt_ind + 1 ] != NULL ) { infile = argv[ opt_ind ]; outfile = argv[ opt_ind + 1 ]; - + if ( strcmp( infile, outfile ) == 0 ) { error_msg(progname, "file names cannot be the same\n"); usage(progname); exit(EXIT_FAILURE); - + } } - + else { error_msg(progname, "file names missing\n"); usage(progname); exit(EXIT_FAILURE); } - + } - + /* pack it */ ret=h5repack(infile,outfile,&options); - + /* free tables */ h5repack_end(&options); - + if (ret==-1) return 1; else @@ -338,7 +338,7 @@ static void usage(const char *prog) printf(" -a A, --alignment=A Alignment value for H5Pset_alignment\n"); printf(" -f FILT, --filter=FILT Filter type\n"); printf(" -l LAYT, --layout=LAYT Layout type\n"); - + printf("\n"); printf(" M - is an integer greater than 1, size of dataset in bytes \n"); @@ -432,13 +432,13 @@ static void usage(const char *prog) static void parse_command_line(int argc, const char* argv[], pack_opt_t* options) { - + int opt; - + /* 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) { case 'h': usage(progname); @@ -450,7 +450,7 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options options->verbose = 1; break; case 'f': - + /* parse the -f filter option */ if (h5repack_addfilter( opt_arg, options)<0) { @@ -459,7 +459,7 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options } break; case 'l': - + /* parse the -l layout option */ if (h5repack_addlayout( opt_arg, options)<0) { @@ -467,18 +467,18 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options exit(EXIT_FAILURE); } break; - + case 'm': options->min_comp = parse_number( opt_arg ); - if ((int)options->min_comp<=0) + if ((int)options->min_comp<=0) { error_msg(progname, "invalid minimum compress size <%s>\n", opt_arg ); exit(EXIT_FAILURE); } break; - + case 'e': read_info( opt_arg, options); break; @@ -486,19 +486,19 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options case 'n': options->use_native = 1; break; - + case 'L': - options->latest = 1; + options->latest = 1; break; - + case 'c': options->grp_compact = atoi( opt_arg ); if (options->grp_compact>0) options->latest = 1; /* must use latest format */ break; - - + + case 'd': options->grp_indexed = atoi( opt_arg ); @@ -509,18 +509,18 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options case 's': { - + int idx = 0; int ssize = 0; char *msgPtr = strchr( opt_arg, ':'); options->latest = 1; /* must use latest format */ - if (msgPtr == NULL) + if (msgPtr == NULL) { ssize = atoi( opt_arg ); for (idx=0; idx<5; idx++) - options->msg_size[idx] = ssize; + options->msg_size[idx] = ssize; } - else + else { char msgType[10]; strcpy(msgType, msgPtr+1); @@ -541,26 +541,26 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options else if (strncmp(msgType, "attr", 4) == 0) { options->msg_size[4] = ssize; } - } + } } - + break; - + case 'u': - + options->ublock_filename = opt_arg; break; - + case 'b': - + options->ublock_size = atoi( opt_arg ); break; case 't': - + options->threshold = atoi( opt_arg ); - if ( options->threshold < 0 ) + if ( options->threshold < 0 ) { error_msg(progname, "invalid threshold size\n", opt_arg ); exit(EXIT_FAILURE); @@ -568,9 +568,9 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options break; case 'a': - + options->alignment = atoi( opt_arg ); - if ( options->alignment < 1 ) + if ( options->alignment < 1 ) { error_msg(progname, "invalid alignment size\n", opt_arg ); exit(EXIT_FAILURE); @@ -578,21 +578,21 @@ static void parse_command_line(int argc, const char* argv[], pack_opt_t* options break; } /* switch */ - - + + } /* while */ - + /* 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(progname); exit(EXIT_FAILURE); } - - - + + + } /*------------------------------------------------------------------------- @@ -616,7 +616,7 @@ int parse_number(char *str) int n; char c; size_t len=strlen(str); - + for ( i=0; i<len; i++) { c = str[i]; @@ -648,7 +648,7 @@ static void read_info(const char *filename, pack_opt_t *options) { - + char stype[10]; char comp_info[1024]; FILE *fp; @@ -656,33 +656,33 @@ void read_info(const char *filename, int i, rc=1; char *srcdir = getenv("srcdir"); /* the source directory */ char data_file[512]=""; /* buffer to hold name of existing file */ - + /* compose the name of the file to open, using the srcdir, if appropriate */ if (srcdir){ strcpy(data_file,srcdir); strcat(data_file,"/"); } strcat(data_file,filename); - - + + if ((fp = fopen(data_file, "r")) == (FILE *)NULL) { error_msg(progname, "cannot open options file %s\n", filename); exit(1); } - + /* cycle until end of file reached */ while( 1 ) { rc=fscanf(fp, "%s", stype); if (rc==-1) break; - + /*------------------------------------------------------------------------- * filter *------------------------------------------------------------------------- */ if (strcmp(stype,"-f") == 0) { - + /* find begining of info */ i=0; c='0'; while( c!=' ' ) @@ -701,7 +701,7 @@ void read_info(const char *filename, if (c==10 /*eol*/) break; } comp_info[i-1]='\0'; /*cut the last " */ - + if (h5repack_addfilter(comp_info,options)==-1){ error_msg(progname, "could not add compression option\n"); exit(1); @@ -712,7 +712,7 @@ void read_info(const char *filename, *------------------------------------------------------------------------- */ else if (strcmp(stype,"-l") == 0) { - + /* find begining of info */ i=0; c='0'; while( c!=' ' ) @@ -731,7 +731,7 @@ void read_info(const char *filename, if (c==10 /*eol*/) break; } comp_info[i-1]='\0'; /*cut the last " */ - + if (h5repack_addlayout(comp_info,options)==-1){ error_msg(progname, "could not add chunck option\n"); exit(1); @@ -746,7 +746,7 @@ void read_info(const char *filename, exit(1); } } - + fclose(fp); return; } diff --git a/tools/h5repack/h5repack_opttable.c b/tools/h5repack/h5repack_opttable.c index 4fd450d..bdcae02 100644 --- a/tools/h5repack/h5repack_opttable.c +++ b/tools/h5repack/h5repack_opttable.c @@ -33,7 +33,7 @@ extern char *progname; void init_packobject(pack_info_t *obj) { int j, k; - + strcpy(obj->path,"\0"); for ( j=0; j<H5_REPACK_MAX_NFILTERS; j++) { @@ -87,7 +87,7 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, pack_info_t *pack) { int k; - + table->objs[I].layout = pack->layout; if (H5D_CHUNKED==pack->layout) { @@ -122,7 +122,7 @@ static void aux_tblinsert_layout(pack_opttbl_t *table, static int aux_inctable(pack_opttbl_t *table, int n_objs ) { unsigned int i; - + table->size += n_objs; table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t)); if (table->objs==NULL) { @@ -154,7 +154,7 @@ int options_table_init( pack_opttbl_t **tbl ) error_msg(progname, "not enough memory for options table\n"); return -1; } - + table->size = 30; table->nelems = 0; table->objs = (pack_info_t*) malloc(table->size * sizeof(pack_info_t)); @@ -162,12 +162,12 @@ int options_table_init( pack_opttbl_t **tbl ) error_msg(progname, "not enough memory for options table\n"); return -1; } - + for ( i=0; i<table->size; i++) { init_packobject(&table->objs[i]); } - + *tbl = table; return 0; } @@ -207,14 +207,14 @@ int options_add_layout( obj_list_t *obj_list, { unsigned int i, I; int j, added=0, found=0; - + /* increase the size of the collection by N_OBJS if necessary */ if (table->nelems+n_objs >= table->size) { if (aux_inctable(table,n_objs)<0) return -1; } - + /* search if this object is already in the table; "path" is the key */ if (table->nelems>0) { @@ -242,7 +242,7 @@ int options_add_layout( obj_list_t *obj_list, } } /* if */ } /* i */ - + if (found==0) { /* keep the grow in a temp var */ @@ -266,7 +266,7 @@ int options_add_layout( obj_list_t *obj_list, } } /* j */ } - + /* first time insertion */ else { @@ -277,12 +277,12 @@ int options_add_layout( obj_list_t *obj_list, added++; strcpy(table->objs[I].path,obj_list[j].obj); aux_tblinsert_layout(table,I,pack); - + } } - + table->nelems+= added; - + return 0; } @@ -303,17 +303,17 @@ int options_add_filter(obj_list_t *obj_list, filter_info_t filt, pack_opttbl_t *table ) { - + unsigned int i, I; int j, added=0, found=0; - + /* increase the size of the collection by N_OBJS if necessary */ if (table->nelems+n_objs >= table->size) { if (aux_inctable(table,n_objs)<0) return -1; } - + /* search if this object is already in the table; "path" is the key */ if (table->nelems>0) { @@ -332,7 +332,7 @@ int options_add_filter(obj_list_t *obj_list, break; } /* if */ } /* i */ - + if (found==0) { /* keep the grow in a temp var */ @@ -356,7 +356,7 @@ int options_add_filter(obj_list_t *obj_list, } } /* j */ } - + /* first time insertion */ else { @@ -369,9 +369,9 @@ int options_add_filter(obj_list_t *obj_list, aux_tblinsert_filter(table,I,filt); } } - + table->nelems+= added; - + return 0; } @@ -389,7 +389,7 @@ pack_info_t* options_get_object( const char *path, pack_opttbl_t *table ) { unsigned int i; - + for ( i = 0; i < table->nelems; i++) { /* found it */ @@ -398,7 +398,7 @@ pack_info_t* options_get_object( const char *path, return (&table->objs[i]); } } - + return NULL; } diff --git a/tools/h5repack/h5repack_parse.c b/tools/h5repack/h5repack_parse.c index 2475068..f7188bf 100644 --- a/tools/h5repack/h5repack_parse.c +++ b/tools/h5repack/h5repack_parse.c @@ -67,12 +67,12 @@ obj_list_t* parse_filter(const char *str, char smask[3]; obj_list_t* obj_list=NULL; unsigned pixels_per_block; - - + + /* initialize compression info */ memset(filt,0,sizeof(filter_info_t)); *is_glb = 0; - + /* check for the end of object list and number of objects */ for ( i = 0, n = 0; i < len; i++) { @@ -86,14 +86,14 @@ obj_list_t* parse_filter(const char *str, n++; } } - + if (end_obj==-1) /* missing : */ - { + { /* apply to all objects */ options->all_filter=1; *is_glb = 1; } - + n++; obj_list = malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) @@ -102,7 +102,7 @@ obj_list_t* parse_filter(const char *str, return NULL; } *n_objs=n; - + /* get object list */ for ( j = 0, k = 0, n = 0; j < end_obj; j++, k++) { @@ -124,8 +124,8 @@ obj_list_t* parse_filter(const char *str, error_msg(progname, "input Error: Invalid compression type in <%s>\n",str); exit(1); } - - + + /* get filter additional parameters */ m=0; for ( i=end_obj+1, k=0, j=0; i<len; i++,k++) @@ -135,9 +135,9 @@ obj_list_t* parse_filter(const char *str, if ( c=='=' || i==len-1) { if ( c=='=') /*one more parameter */ - { + { scomp[k]='\0'; /*cut space */ - + /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP * szip has the format SZIP=<pixels per block,coding> @@ -182,14 +182,14 @@ obj_list_t* parse_filter(const char *str, error_msg(progname, "szip mask must be 'NN' or 'EC' \n"); exit(1); } - - + + } } - + } /* u */ } /*if */ - + /*------------------------------------------------------------------------- * H5Z_FILTER_SCALEOFFSET * scaleoffset has the format SOFF=<scale_factor,scale_type> @@ -204,7 +204,7 @@ obj_list_t* parse_filter(const char *str, * SOFF=3,DF *------------------------------------------------------------------------- */ - + else if (strcmp(scomp,"SOFF")==0) { l=-1; /* mask index check */ @@ -242,19 +242,19 @@ obj_list_t* parse_filter(const char *str, error_msg(progname, "scale type must be 'IN' or 'DS' \n"); exit(1); } - + } } - + } /* u */ } /*if */ - - + + /*------------------------------------------------------------------------- * all other filters *------------------------------------------------------------------------- */ - + else { /* here we could have 1 or 2 digits */ @@ -268,16 +268,16 @@ obj_list_t* parse_filter(const char *str, } stype[m]=c; } /* u */ - + stype[m]='\0'; } /*if */ - - - + + + filt->cd_values[j++]=atoi(stype); i+=m; /* jump */ } - else if (i==len-1) + else if (i==len-1) { /*no more parameters */ scomp[k+1]='\0'; no_param=1; @@ -287,7 +287,7 @@ obj_list_t* parse_filter(const char *str, * translate from string to filter symbol *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * H5Z_FILTER_NONE *------------------------------------------------------------------------- @@ -297,7 +297,7 @@ obj_list_t* parse_filter(const char *str, filt->filtn=H5Z_FILTER_NONE; filt->cd_nelmts = 0; } - + /*------------------------------------------------------------------------- * H5Z_FILTER_DEFLATE *------------------------------------------------------------------------- @@ -306,14 +306,14 @@ obj_list_t* parse_filter(const char *str, { filt->filtn=H5Z_FILTER_DEFLATE; filt->cd_nelmts = 1; - if (no_param) + if (no_param) { /*no more parameters, GZIP must have parameter */ if (obj_list) free(obj_list); error_msg(progname, "missing compression parameter in <%s>\n",str); exit(1); } } - + /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP *------------------------------------------------------------------------- @@ -322,14 +322,14 @@ obj_list_t* parse_filter(const char *str, { filt->filtn=H5Z_FILTER_SZIP; filt->cd_nelmts = 2; - if (no_param) + if (no_param) { /*no more parameters, SZIP must have parameter */ if (obj_list) free(obj_list); error_msg(progname, "missing compression parameter in <%s>\n",str); exit(1); } } - + /*------------------------------------------------------------------------- * H5Z_FILTER_SHUFFLE *------------------------------------------------------------------------- @@ -383,7 +383,7 @@ obj_list_t* parse_filter(const char *str, { filt->filtn=H5Z_FILTER_SCALEOFFSET; filt->cd_nelmts = 2; - if (no_param) + if (no_param) { /*no more parameters, SOFF must have parameter */ if (obj_list) free(obj_list); error_msg(progname, "missing compression parameter in <%s>\n",str); @@ -397,12 +397,12 @@ obj_list_t* parse_filter(const char *str, } } } /*i*/ - + /*------------------------------------------------------------------------- * check valid parameters *------------------------------------------------------------------------- */ - + switch (filt->filtn) { @@ -410,7 +410,7 @@ obj_list_t* parse_filter(const char *str, * H5Z_FILTER_DEFLATE *------------------------------------------------------------------------- */ - + case H5Z_FILTER_DEFLATE: if (filt->cd_values[0]<0 || filt->cd_values[0]>9 ) { @@ -419,27 +419,27 @@ obj_list_t* parse_filter(const char *str, exit(1); } break; - + /*------------------------------------------------------------------------- * H5Z_FILTER_SZIP *------------------------------------------------------------------------- */ - + case H5Z_FILTER_SZIP: pixels_per_block=filt->cd_values[0]; - if ((pixels_per_block%2)==1) + if ((pixels_per_block%2)==1) { if (obj_list) free(obj_list); error_msg(progname, "pixels_per_block is not even in <%s>\n",str); exit(1); } - if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) + if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK) { if (obj_list) free(obj_list); error_msg(progname, "pixels_per_block is too large in <%s>\n",str); exit(1); } - if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) ) + if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) ) { if (obj_list) free(obj_list); error_msg(progname, "szip mask must be 'NN' or 'EC' \n"); @@ -461,7 +461,7 @@ obj_list_t* parse_filter(const char *str, } break; }; - + return obj_list; } @@ -501,12 +501,12 @@ obj_list_t* parse_layout(const char *str, char sobj[MAX_NC_NAME]; char sdim[10]; char slayout[10]; - - + + memset(sdim, '\0', sizeof(sdim)); memset(sobj, '\0', sizeof(sobj)); memset(slayout, '\0', sizeof(slayout)); - + /* check for the end of object list and number of objects */ for ( i=0, n=0; i<len; i++) { @@ -520,11 +520,11 @@ obj_list_t* parse_layout(const char *str, n++; } } - + if (end_obj==-1) { /* missing : chunk all */ options->all_layout=1; } - + n++; obj_list=malloc(n*sizeof(obj_list_t)); if (obj_list==NULL) @@ -533,7 +533,7 @@ obj_list_t* parse_layout(const char *str, return NULL; } *n_objs=n; - + /* get object list */ for ( j=0, k=0, n=0; j<end_obj; j++,k++) { @@ -548,7 +548,7 @@ obj_list_t* parse_layout(const char *str, k=-1; } } - + /* nothing after : */ if (end_obj+1==(int)len) { @@ -556,7 +556,7 @@ obj_list_t* parse_layout(const char *str, error_msg(progname, "in parse layout, no characters after : in <%s>\n",str); exit(1); } - + /* get layout info */ for ( j=end_obj+1, n=0; n<=5; j++,n++) { @@ -580,30 +580,30 @@ obj_list_t* parse_layout(const char *str, slayout[n]=c; } } /* j */ - - + + if ( pack->layout==H5D_CHUNKED ) { - + /*------------------------------------------------------------------------- * get chunk info *------------------------------------------------------------------------- */ k=0; - + if (j>(int)len) { if (obj_list) free(obj_list); error_msg(progname, "in parse layout, <%s> Chunk dimensions missing\n",str); exit(1); } - + for ( i=j, c_index=0; i<len; i++) { c = str[i]; sdim[k]=c; k++; /*increment sdim index */ - + if (!isdigit(c) && c!='x' && c!='N' && c!='O' && c!='N' && c!='E' ){ @@ -612,7 +612,7 @@ obj_list_t* parse_layout(const char *str, sdim,str); exit(1); } - + if ( c=='x' || i==len-1) { if ( c=='x') { @@ -648,11 +648,11 @@ obj_list_t* parse_layout(const char *str, } /*if */ } /*if c=='x' || i==len-1 */ } /*i*/ - - + + } /*H5D_CHUNKED*/ - - + + return obj_list; } diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index b0428bf..af29e87 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -193,7 +193,7 @@ int do_copy_refobjs(hid_t fidin, goto error; if(options->verbose) { - + printf(FORMAT_OBJ,"dset",travt->objs[i].name ); printf("object <%s> object reference created to <%s>\n", travt->objs[i].name, @@ -276,7 +276,7 @@ int do_copy_refobjs(hid_t fidin, goto error; if(options->verbose) { - + printf(FORMAT_OBJ,"dset",travt->objs[i].name ); printf("object <%s> region reference created to <%s>\n", travt->objs[i].name, diff --git a/tools/h5repack/h5repack_verify.c b/tools/h5repack/h5repack_verify.c index 465fdbf..fed4499 100644 --- a/tools/h5repack/h5repack_verify.c +++ b/tools/h5repack/h5repack_verify.c @@ -27,7 +27,7 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f * * Purpose: verify if filters and layout in the input file match the output file * - * Return: + * Return: * 1 match * 0 do not match * -1 error @@ -39,7 +39,7 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f * Separate into 3 cases * 1) no filter input, get all datasets and compare DCPLs. TO DO * 2) filter input on selected datasets, get each one trough OBJ and match - * 3) filter input on all datasets, get all objects and match + * 3) filter input on all datasets, get all objects and match * *------------------------------------------------------------------------- */ @@ -55,16 +55,16 @@ int h5repack_verify(const char *fname, unsigned int i; trav_table_t *travt = NULL; int ok = 1; - + /* open the file */ if((fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) return -1; - - for(i = 0; i < options->op_tbl->nelems; i++) + + for(i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; pack_info_t *obj = &options->op_tbl->objs[i]; - + /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- @@ -77,7 +77,7 @@ int h5repack_verify(const char *fname, goto error; if((tid = H5Dget_type(did)) < 0) goto error; - + /*------------------------------------------------------------------------- * filter check *------------------------------------------------------------------------- @@ -85,14 +85,14 @@ int h5repack_verify(const char *fname, if(has_filters(pid, tid, obj->nfilters, obj->filter) <= 0) ok = 0; - + /*------------------------------------------------------------------------- * layout check *------------------------------------------------------------------------- */ if((obj->layout != -1) && (has_layout(pid, obj) == 0)) ok = 0; - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -105,32 +105,32 @@ int h5repack_verify(const char *fname, goto error; if (H5Tclose(tid) < 0) goto error; - + } - - + + /*------------------------------------------------------------------------- * check for the "all" objects option *------------------------------------------------------------------------- */ - - if(options->all_filter == 1 || options->all_layout == 1) + + if(options->all_filter == 1 || options->all_layout == 1) { - + /* init table */ trav_table_init(&travt); - + /* get the list of objects in the file */ if(h5trav_gettable(fid, travt) < 0) goto error; - - for(i = 0; i < travt->nobjs; i++) + + for(i = 0; i < travt->nobjs; i++) { char *name = travt->objs[i].name; - - if(travt->objs[i].type == H5TRAV_TYPE_DATASET) + + if(travt->objs[i].type == H5TRAV_TYPE_DATASET) { - + /*------------------------------------------------------------------------- * open *------------------------------------------------------------------------- @@ -143,23 +143,23 @@ int h5repack_verify(const char *fname, goto error; if((tid = H5Dget_type(did)) < 0) goto error; - + /*------------------------------------------------------------------------- * filter check *------------------------------------------------------------------------- */ if(options->all_filter == 1) { - + if(has_filters(pid, tid, options->n_filter_g, options->filter_g) <= 0) ok = 0; } - + /*------------------------------------------------------------------------- * layout check *------------------------------------------------------------------------- */ - if(options->all_layout == 1) + if(options->all_layout == 1) { pack_info_t pack; init_packobject(&pack); @@ -168,8 +168,8 @@ int h5repack_verify(const char *fname, if(has_layout(pid, &pack) == 0) ok = 0; } - - + + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -183,23 +183,23 @@ int h5repack_verify(const char *fname, if (H5Tclose(tid) < 0) goto error; } /* if */ - + } /* i */ - + /* free table */ trav_table_free(travt); } - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + if (H5Fclose(fid) < 0) return -1; - + return ok; - + error: H5E_BEGIN_TRY { H5Pclose(pid); @@ -240,26 +240,26 @@ int has_layout(hid_t pid, int nfilters; /* number of filters */ int rank; /* rank */ int i; /* index */ - + /* if no information about the input layout is requested return exit */ if (obj==NULL) return 1; - + /* check if we have filters in the input object */ if ((nfilters = H5Pget_nfilters(pid)) < 0) return -1; - + /* a non chunked layout was requested on a filtered object; avoid the test */ if (nfilters && obj->layout!=H5D_CHUNKED) return 1; - + /* get layout */ if ((layout = H5Pget_layout(pid)) < 0) return -1; - + if (obj->layout != layout) return 0; - + if (layout==H5D_CHUNKED) { if ((rank = H5Pget_chunk(pid,NELMTS(chsize),chsize/*out*/)) < 0) @@ -270,7 +270,7 @@ int has_layout(hid_t pid, if (chsize[i] != obj->chunk.chunk_lengths[i]) return 0; } - + return 1; } @@ -301,16 +301,16 @@ int h5repack_cmpdcpl(const char *fname1, trav_table_t *travt2=NULL; int ret=1; unsigned int i; - + /*------------------------------------------------------------------------- - * open the files + * open the files *------------------------------------------------------------------------- */ - + /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { - + /* Open the files */ if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 ) { @@ -325,7 +325,7 @@ int h5repack_cmpdcpl(const char *fname1, } /* enable error reporting */ } H5E_END_TRY; - + /*------------------------------------------------------------------------- * get file table list of objects *------------------------------------------------------------------------- @@ -336,16 +336,16 @@ int h5repack_cmpdcpl(const char *fname1, goto error; if(h5trav_gettable(fid2, travt2) < 0) goto error; - - + + /*------------------------------------------------------------------------- * traverse the suppplied object list *------------------------------------------------------------------------- */ - - for(i = 0; i < travt1->nobjs; i++) + + for(i = 0; i < travt1->nobjs; i++) { - if(travt1->objs[i].type == H5TRAV_TYPE_DATASET) + if(travt1->objs[i].type == H5TRAV_TYPE_DATASET) { if((dset1 = H5Dopen2(fid1, travt1->objs[i].name, H5P_DEFAULT)) < 0) goto error; @@ -355,20 +355,20 @@ int h5repack_cmpdcpl(const char *fname1, goto error; if((dcpl2 = H5Dget_create_plist(dset2)) < 0) goto error; - + /*------------------------------------------------------------------------- * compare the property lists *------------------------------------------------------------------------- */ if((ret = H5Pequal(dcpl1, dcpl2)) < 0) goto error; - - if(ret == 0) + + if(ret == 0) { error_msg(progname, "property lists for <%s> are different\n",travt1->objs[i].name); goto error; } - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- @@ -383,31 +383,31 @@ int h5repack_cmpdcpl(const char *fname1, goto error; } /*if*/ } /*i*/ - + /*------------------------------------------------------------------------- * free *------------------------------------------------------------------------- */ - + trav_table_free(travt1); trav_table_free(travt2); - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + H5Fclose(fid1); H5Fclose(fid2); return ret; - + /*------------------------------------------------------------------------- * error *------------------------------------------------------------------------- */ - + error: - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl1); H5Pclose(dcpl2); @@ -419,7 +419,7 @@ error: trav_table_free(travt2); } H5E_END_TRY; return -1; - + } @@ -430,7 +430,7 @@ error: * from user input are present in the property list PID obtained from * the output file * - * Return: + * Return: * 1 match * 0 do not match * -1 error @@ -452,14 +452,14 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f char f_name[256]; /* filter name */ size_t size; /* type size */ unsigned i, j; /* index */ - + /* get information about filters */ if((nfilters_dcpl = H5Pget_nfilters(pid)) < 0) return -1; - + /* if we do not have filters and the requested filter is NONE, return 1 */ - if(!nfilters_dcpl && - nfilters == 1 && + if(!nfilters_dcpl && + nfilters == 1 && filter[0].filtn == H5Z_FILTER_NONE ) return 1; @@ -472,12 +472,12 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f *------------------------------------------------------------------------- */ - for( i = 0; i < nfilters_dcpl; i++) + for( i = 0; i < nfilters_dcpl; i++) { cd_nelmts = NELMTS(cd_values); filtn = H5Pget_filter2(pid, i, &filt_flags, &cd_nelmts, cd_values, sizeof(f_name), f_name, NULL); - + /* filter ID */ if (filtn != filter[i].filtn) return 0; @@ -485,24 +485,24 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f /* compare client data values. some filters do return local values */ switch (filtn) { - + case H5Z_FILTER_SHUFFLE: - + /* 1 private client value is returned by DCPL */ if ( cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS && filter[i].cd_nelmts != H5Z_SHUFFLE_USER_NPARMS ) return 0; - + /* get dataset's type size */ if((size = H5Tget_size(tid)) <= 0) return -1; - + /* the private client value holds the dataset's type size */ if ( size != cd_values[0] ) return 0; - - + + break; - + case H5Z_FILTER_SZIP: /* 4 private client values are returned by DCPL */ @@ -512,61 +512,61 @@ static int has_filters(hid_t pid, hid_t tid, unsigned nfilters, filter_info_t *f /* "User" parameter for pixels-per-block (index 1) */ if ( cd_values[H5Z_SZIP_PARM_PPB] != filter[i].cd_values[H5Z_SZIP_PARM_PPB] ) return 0; - - + + break; - + case H5Z_FILTER_NBIT: - + /* only client data values number of values checked */ if ( H5Z_NBIT_USER_NPARMS != filter[i].cd_nelmts) return 0; - - - + + + break; - + case H5Z_FILTER_SCALEOFFSET: /* only client data values checked */ - for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++) + for( j = 0; j < H5Z_SCALEOFFSET_USER_NPARMS; j++) { if (cd_values[j] != filter[i].cd_values[j]) { - return 0; + return 0; } - + } - - + + break; - + /* for these filters values must match, no local values set in DCPL */ case H5Z_FILTER_FLETCHER32: case H5Z_FILTER_DEFLATE: - + if ( cd_nelmts != filter[i].cd_nelmts) return 0; - - for( j = 0; j < cd_nelmts; j++) + + for( j = 0; j < cd_nelmts; j++) { if (cd_values[j] != filter[i].cd_values[j]) { - return 0; + return 0; } - + } - - - + + + break; - - - + + + } /* switch */ } - + return 1; } diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 75af4f1..1bb9db3 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -882,11 +882,11 @@ if (szip_can_encode) { /*------------------------------------------------------------------------- * the following tests assume the input files have filters - * FNAME7 - * FNAME8 - * FNAME9 - * FNAME10 - * FNAME11 + * FNAME7 + * FNAME8 + * FNAME9 + * FNAME10 + * FNAME11 *------------------------------------------------------------------------- */ @@ -1343,7 +1343,7 @@ if (szip_can_encode) { PASSED(); /*------------------------------------------------------------------------- - * test --latest options + * test --latest options *------------------------------------------------------------------------- */ TESTING(" latest file format options"); @@ -1375,7 +1375,7 @@ if (szip_can_encode) { TESTING(" several global filters"); -#if defined (H5_HAVE_FILTER_DEFLATE) && defined (H5_HAVE_FILTER_SHUFFLE) +#if defined (H5_HAVE_FILTER_DEFLATE) && defined (H5_HAVE_FILTER_SHUFFLE) if (h5repack_init (&pack_options, 0) < 0) GOERROR; @@ -1412,7 +1412,7 @@ if (szip_can_encode) { /* add the options for a user block size and user block filename */ pack_options.ublock_size = USERBLOCK_SIZE; pack_options.ublock_filename = FNAME_UB; - + if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) GOERROR; if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) @@ -1445,14 +1445,14 @@ if (szip_can_encode) { /* add the options for aligment */ pack_options.alignment = 1; pack_options.threshold = 1; - + if(h5repack(FNAME8, FNAME8OUT, &pack_options) < 0) GOERROR; if(h5diff(FNAME8, FNAME8OUT, NULL, NULL, &diff_options) > 0) GOERROR; if(h5repack_verify(FNAME8OUT, &pack_options) <= 0) GOERROR; - + /* verify aligment */ { @@ -1460,7 +1460,7 @@ if (szip_can_encode) { hsize_t alignment; hid_t fapl; hid_t fid; - + if (( fid = H5Fopen(FNAME8OUT, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0 ) GOERROR; if ((fapl = H5Fget_access_plist(fid)) < 0) @@ -1475,13 +1475,13 @@ if (szip_can_encode) { GOERROR; if (H5Fclose(fid) < 0) GOERROR; - + } if(h5repack_end(&pack_options) < 0) GOERROR; - + PASSED(); #else @@ -1498,12 +1498,12 @@ if (szip_can_encode) { */ { hid_t fapl; - + /* setup */ h5_reset(); fapl = h5_fileaccess(); - h5_cleanup(H5REPACK_FILENAMES, fapl); - + h5_cleanup(H5REPACK_FILENAMES, fapl); + } puts("All h5repack tests passed."); @@ -1699,7 +1699,7 @@ int make_testfiles(void) goto out; /*------------------------------------------------------------------------- - * create a userblock file + * create a userblock file *------------------------------------------------------------------------- */ if(make_userblock_file() < 0) @@ -2247,7 +2247,7 @@ int make_nbit(hid_t loc_id) #endif /*------------------------------------------------------------------------- - * close + * close *------------------------------------------------------------------------- */ if(H5Sclose(sid) < 0) @@ -2780,7 +2780,7 @@ out: } /*------------------------------------------------------------------------- - * Function: make_big + * Function: make_big * * Purpose: used in test read by hyperslabs. Creates a 128MB dataset. * Only 1 1024Kb hyperslab is written. @@ -2808,7 +2808,7 @@ int make_big(hid_t loc_id) hs_start[0] = 0; hs_size[0] = 1024; - /* create */ + /* create */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; if(H5Pset_fill_value(dcpl, H5T_NATIVE_SCHAR, &fillvalue) < 0) @@ -2819,19 +2819,19 @@ int make_big(hid_t loc_id) goto out; if((did = H5Dcreate2(loc_id, "dset", H5T_NATIVE_SCHAR, 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; - + /* initialize buffer to 0 */ buf=(signed char *) calloc( nelmts, size); - - 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; - if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) + if (H5Dwrite (did,H5T_NATIVE_SCHAR,m_sid,f_sid,H5P_DEFAULT,buf) < 0) goto out; free(buf); @@ -2862,7 +2862,7 @@ out: /*------------------------------------------------------------------------- - * Function: make_external + * Function: make_external * * Purpose: create a external dataset * @@ -2881,11 +2881,11 @@ int make_external(hid_t loc_id) cur_size[0] = max_size[0] = 2; size = max_size[0] * sizeof(int); - - /* create */ + + /* create */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto out; - if(H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0) + if(H5Pset_external(dcpl, H5REPACK_EXTFILE, (off_t)0, size) < 0) goto out; if((sid = H5Screate_simple(1,cur_size, max_size)) < 0) goto out; @@ -3081,12 +3081,12 @@ make_userblock_file(void) return 0; out: - + if(fd > 0) HDclose(fd); return -1; -} +} /*------------------------------------------------------------------------- * Function: write_dset_in @@ -4901,5 +4901,5 @@ out: return -1; } - + diff --git a/tools/h5stat/h5stat.c b/tools/h5stat/h5stat.c index f03efd7..5a9d3f1 100644 --- a/tools/h5stat/h5stat.c +++ b/tools/h5stat/h5stat.c @@ -309,14 +309,14 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi) * Programmer: Quincey Koziol * Tuesday, August 16, 2005 * - * Modifications: Refactored code from the walk_function - * EIP, Wednesday, August 16, 2006 + * Modifications: Refactored code from the walk_function + * EIP, Wednesday, August 16, 2006 * * Vailin Choi 12 July 2007 * 1. Gathered storage info for btree and heap * (groups and attributes) * 2. Gathered info for attributes - * + * * Vailin Choi 14 July 2007 * Cast "num_objs" and "num_attrs" to size_t * Due to the -Mbounds problem for the pgi-32 bit compiler on indexing @@ -389,8 +389,8 @@ group_stats(iter_t *iter, const char *name, const H5O_info_t *oi) * Programmer: Quincey Koziol * Tuesday, August 16, 2005 * - * Modifications: Refactored code from the walk_function - * EIP, Wednesday, August 16, 2006 + * Modifications: Refactored code from the walk_function + * EIP, Wednesday, August 16, 2006 * * Vailin Choi 12 July 2007 * 1. Gathered storage info for btree and heap @@ -813,7 +813,7 @@ print_file_info(const iter_t *iter) return 0; } - + /*------------------------------------------------------------------------- * Function: print_file_metadata @@ -841,9 +841,9 @@ static herr_t print_file_metadata(const iter_t *iter) { printf("Object header size: (total/unused)\n"); - HDfprintf(stdout, "\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size, + HDfprintf(stdout, "\tGroups: %Hu/%Hu\n", iter->group_ohdr_info.total_size, iter->group_ohdr_info.free_size); - HDfprintf(stdout, "\tDatasets: %Hu/%Hu\n", iter->dset_ohdr_info.total_size, + HDfprintf(stdout, "\tDatasets: %Hu/%Hu\n", iter->dset_ohdr_info.total_size, iter->dset_ohdr_info.free_size); printf("Storage information:\n"); @@ -911,7 +911,7 @@ print_group_info(const iter_t *iter) power = 1; for(u = 1; u < iter->group_nbins; u++) { if(iter->group_bins[u] > 0) { - printf("\t# of groups of size %lu - %lu: %lu\n", power, (power * 10) - 1, + printf("\t# of groups of size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->group_bins[u]); total += iter->group_bins[u]; } /* end if */ @@ -961,7 +961,7 @@ print_attr_info(const iter_t *iter) power = 1; for(u = 1; u < iter->attr_nbins; u++) { if(iter->attr_bins[u] > 0) { - printf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1, + printf("\t# of objects with %lu - %lu attributes: %lu\n", power, (power * 10) - 1, iter->attr_bins[u]); total += iter->attr_bins[u]; } /* end if */ @@ -1012,7 +1012,7 @@ print_dataset_info(const iter_t *iter) total = 0; for(u = 0; u < SIZE_SMALL_DSETS; u++) { if(iter->small_dset_dims[u] > 0) { - printf("\t\t# of dataset dimensions of size %u: %lu\n", u, + printf("\t\t# of dataset dimensions of size %u: %lu\n", u, iter->small_dset_dims[u]); total += iter->small_dset_dims[u]; } /* end if */ @@ -1030,7 +1030,7 @@ print_dataset_info(const iter_t *iter) power = 1; for(u = 1; u < iter->dset_dim_nbins; u++) { if(iter->dset_dim_bins[u] > 0) { - printf("\t\t# of datasets of size %lu - %lu: %lu\n", power, (power * 10) - 1, + printf("\t\t# of datasets of size %lu - %lu: %lu\n", power, (power * 10) - 1, iter->dset_dim_bins[u]); total += iter->dset_dim_bins[u]; } /* end if */ @@ -1067,7 +1067,7 @@ print_dataset_info(const iter_t *iter) H5Tencode(iter->dset_type_info[u].tid, NULL, &dtype_size); printf("\tDataset datatype #%u:\n", u); printf("\t\tCount (total/named) = (%lu/%lu)\n", iter->dset_type_info[u].count, iter->dset_type_info[u].named); - printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, + printf("\t\tSize (desc./elmt) = (%lu/%lu)\n", (unsigned long)dtype_size, (unsigned long)H5Tget_size(iter->dset_type_info[u].tid)); H5Tclose(iter->dset_type_info[u].tid); total += iter->dset_type_info[u].count; @@ -1143,7 +1143,7 @@ print_object_statistics(const char *name) /*------------------------------------------------------------------------- * Function: print_statistics * - * Purpose: Prints statistics + * Purpose: Prints statistics * * Return: Success: 0 * @@ -1159,7 +1159,7 @@ print_object_statistics(const char *name) static void print_statistics(const char *name, const iter_t *iter) { - if(display_object) + if(display_object) print_object_statistics(name); else print_file_statistics(iter); @@ -1199,7 +1199,7 @@ main(int argc, const char *argv[]) /* Initialize iter structure */ iter_init(&iter, fid); - + /* Get storge info for SOHM's btree/list/heap and superblock extension */ if(H5Fget_info(fid, &finfo) < 0) warn_msg(progname, "Unable to retrieve SOHM info\n"); diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c index ef644d8..250226e 100644 --- a/tools/h5stat/h5stat_gentest.c +++ b/tools/h5stat/h5stat_gentest.c @@ -32,7 +32,7 @@ #define NUM_GRPS 35000 #define NUM_ATTRS 100 -/* +/* * Generate 1.8 HDF5 file * with NUM_GRPS groups * with NUM_ATTRS attributes on the dataset diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 25e5f83..f0c6048 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -53,7 +53,7 @@ print_objname (diff_opt_t * options, hsize_t nfound) /*------------------------------------------------------------------------- * Function: do_print_objname * - * Purpose: print object name + * Purpose: print object name * *------------------------------------------------------------------------- */ @@ -195,7 +195,7 @@ hsize_t h5diff(const char *fname1, HDmemset(filenames, 0, 1024 * 2); - if(options->m_quiet && (options->m_verbose || options->m_report)) + if(options->m_quiet && (options->m_verbose || options->m_report)) { printf("Error: -q (quiet mode) cannot be added to verbose or report modes\n"); options->err_stat=1; @@ -208,10 +208,10 @@ hsize_t h5diff(const char *fname1, */ /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { /* open the files */ - if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((file1_id = H5Fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { printf("h5diff: <%s>: unable to open file\n", fname1); options->err_stat = 1; @@ -223,7 +223,7 @@ hsize_t h5diff(const char *fname1, #endif goto out; } /* end if */ - if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((file2_id = H5Fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) { printf("h5diff: <%s>: unable to open file\n", fname2); options->err_stat = 1; @@ -264,7 +264,7 @@ hsize_t h5diff(const char *fname1, * object name was supplied *------------------------------------------------------------------------- */ - if( objname1 ) + if( objname1 ) { #ifdef H5_HAVE_PARALLEL if(g_Parallel) @@ -273,13 +273,13 @@ hsize_t h5diff(const char *fname1, #endif assert(objname2); options->cmn_objs = 1; /* eliminate warning */ - nfound = diff_compare(file1_id, - fname1, - objname1, + nfound = diff_compare(file1_id, + fname1, + objname1, info1, - file2_id, - fname2, - objname2, + file2_id, + fname2, + objname2, info2, options); } /* end if */ @@ -289,14 +289,14 @@ hsize_t h5diff(const char *fname1, *------------------------------------------------------------------------- */ - else + else { #ifdef H5_HAVE_PARALLEL - if(g_Parallel) + if(g_Parallel) { int i; - if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) + if((HDstrlen(fname1) > 1024) || (HDstrlen(fname2) > 1024)) { fprintf(stderr, "The parallel diff only supports path names up to 1024 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); @@ -311,10 +311,10 @@ hsize_t h5diff(const char *fname1, } /* end if */ #endif - nfound = diff_match(file1_id, - info1, - file2_id, - info2, + nfound = diff_match(file1_id, + info1, + file2_id, + info2, options); } /* end else */ @@ -323,7 +323,7 @@ hsize_t h5diff(const char *fname1, out: /* close */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Fclose(file1_id); H5Fclose(file2_id); @@ -347,7 +347,7 @@ out: * * Date: May 9, 2003 * - * Modifications: + * Modifications: * * Jan 2005 Leon Arber, larber@uiuc.edu * Added support for parallel diffing @@ -355,7 +355,7 @@ out: * Aug 2008 Pedro Vicente, pvn@hdfgroup.org * 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) * *------------------------------------------------------------------------- @@ -381,7 +381,7 @@ hsize_t diff_match(hid_t file1_id, curr1 = 0; curr2 = 0; - while(curr1 < info1->nused && curr2 < info2->nused) + while(curr1 < info1->nused && curr2 < info2->nused) { /* criteria is string compare */ int cmp = HDstrcmp(info1->paths[curr1].path, info2->paths[curr2].path); @@ -394,14 +394,14 @@ hsize_t diff_match(hid_t file1_id, curr1++; curr2++; } /* end if */ - else if(cmp < 0) + else if(cmp < 0) { infile[0] = 1; infile[1] = 0; trav_table_addflags(infile, info1->paths[curr1].path, info1->paths[curr1].type, table); curr1++; } /* end else-if */ - else + else { infile[0] = 0; infile[1] = 1; @@ -413,7 +413,7 @@ hsize_t diff_match(hid_t file1_id, /* list1 did not end */ infile[0] = 1; infile[1] = 0; - while(curr1 < info1->nused) + while(curr1 < info1->nused) { trav_table_addflags(infile, info1->paths[curr1].path, info1->paths[curr1].type, table); curr1++; @@ -422,7 +422,7 @@ hsize_t diff_match(hid_t file1_id, /* list2 did not end */ infile[0] = 0; infile[1] = 1; - while(curr2 < info2->nused) + while(curr2 < info2->nused) { trav_table_addflags(infile, info2->paths[curr2].path, info2->paths[curr2].type, table); curr2++; @@ -432,7 +432,7 @@ hsize_t diff_match(hid_t file1_id, * print the list *------------------------------------------------------------------------- */ - if(options->m_verbose) + if(options->m_verbose) { printf("\n"); printf("file1 file2\n"); @@ -458,22 +458,22 @@ hsize_t diff_match(hid_t file1_id, { /* assume equal contents initially */ options->contents = 1; - + /* number of different objects */ if ( info1->nused != info2->nused ) { options->contents = 0; } - - - for( i = 0; i < table->nobjs; i++) + + + for( i = 0; i < table->nobjs; i++) { - if( table->objs[i].flags[0] != table->objs[i].flags[1] ) + if( table->objs[i].flags[0] != table->objs[i].flags[1] ) { options->contents = 0; } } - + } @@ -495,12 +495,12 @@ hsize_t diff_match(hid_t file1_id, HDmemset(workerTasks, 1, (g_nTasks - 1)); #endif - for(i = 0; i < table->nobjs; i++) + for(i = 0; i < table->nobjs; i++) { - if( table->objs[i].flags[0] && table->objs[i].flags[1]) + if( table->objs[i].flags[0] && table->objs[i].flags[1]) { options->cmn_objs = 1; - if(!g_Parallel) + if(!g_Parallel) { nfound += diff(file1_id, table->objs[i].name, @@ -508,7 +508,7 @@ hsize_t diff_match(hid_t file1_id, table->objs[i].name, options, table->objs[i].type); } /* end if */ #ifdef H5_HAVE_PARALLEL - else + else { int workerFound = 0; @@ -522,7 +522,7 @@ hsize_t diff_match(hid_t file1_id, */ /*Set up args to pass to worker task. */ - if(HDstrlen(table->objs[i].name) > 255) + if(HDstrlen(table->objs[i].name) > 255) { printf("The parallel diff only supports object names up to 255 characters\n"); MPI_Abort(MPI_COMM_WORLD, 0); @@ -534,7 +534,7 @@ hsize_t diff_match(hid_t file1_id, h5diffdebug2("busyTasks=%d\n", busyTasks); /* if there are any outstanding print requests, let's handle one. */ - if(busyTasks > 0) + if(busyTasks > 0) { int incomingMessage; @@ -542,7 +542,7 @@ hsize_t diff_match(hid_t file1_id, MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &incomingMessage, &Status); /* first block*/ - if(incomingMessage) + if(incomingMessage) { workerTasks[Status.MPI_SOURCE - 1] = 1; MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); @@ -552,7 +552,7 @@ hsize_t diff_match(hid_t file1_id, } /* end if */ /* check to see if the print token was returned. */ - if(!havePrintToken) + if(!havePrintToken) { /* If we don't have the token, someone is probably sending us output */ print_incoming_data(); @@ -572,11 +572,11 @@ hsize_t diff_match(hid_t file1_id, } /* end if */ /* check to see if anyone needs the print token. */ - if(havePrintToken) + if(havePrintToken) { /* check incoming queue for print token requests */ MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &incomingMessage, &Status); - if(incomingMessage) + if(incomingMessage) { MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD); @@ -588,9 +588,9 @@ hsize_t diff_match(hid_t file1_id, /* check array of tasks to see which ones are free. * Manager task never does work, so freeTasks[0] is really * worker task 0. */ - for(n = 1; (n < g_nTasks) && !workerFound; n++) + for(n = 1; (n < g_nTasks) && !workerFound; n++) { - if(workerTasks[n-1]) + if(workerTasks[n-1]) { /* send file id's and names to first free worker */ MPI_Send(&args, sizeof(args), MPI_BYTE, n, MPI_TAG_ARGS, MPI_COMM_WORLD); @@ -605,7 +605,7 @@ hsize_t diff_match(hid_t file1_id, } /* end for */ h5diffdebug2("workerfound is %d \n", workerFound); - if(!workerFound) + if(!workerFound) { /* if they were all busy, we've got to wait for one free up * before we can move on. If we don't have the token, some @@ -613,15 +613,15 @@ hsize_t diff_match(hid_t file1_id, * return it. */ - if(!havePrintToken) + if(!havePrintToken) { - while(!havePrintToken) + while(!havePrintToken) { int incomingMessage; print_incoming_data(); MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); - if(incomingMessage) + if(incomingMessage) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); havePrintToken = 1; @@ -633,26 +633,26 @@ hsize_t diff_match(hid_t file1_id, } /* end while */ } /* end if */ /* if we do have the token, check for task to free up, or wait for a task to request it */ - else + else { /* But first print all the data in our incoming queue */ print_incoming_data(); MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - if(Status.MPI_TAG == MPI_TAG_DONE) + if(Status.MPI_TAG == MPI_TAG_DONE) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD); } /* end if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) + else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) { int incomingMessage; MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); MPI_Send(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD); - do + do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); @@ -664,7 +664,7 @@ hsize_t diff_match(hid_t file1_id, options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; MPI_Send(&args, sizeof(args), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_ARGS, MPI_COMM_WORLD); } /* end else-if */ - else + else { printf("ERROR: Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); @@ -679,20 +679,20 @@ hsize_t diff_match(hid_t file1_id, h5diffdebug("done with for loop\n"); #ifdef H5_HAVE_PARALLEL - if(g_Parallel) + if(g_Parallel) { /* make sure all tasks are done */ - while(busyTasks > 0) + while(busyTasks > 0) { MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - if(Status.MPI_TAG == MPI_TAG_DONE) + if(Status.MPI_TAG == MPI_TAG_DONE) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; options->not_cmp = options->not_cmp | nFoundbyWorker.not_cmp; busyTasks--; } /* end if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) + else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_DONE, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; @@ -700,10 +700,10 @@ hsize_t diff_match(hid_t file1_id, busyTasks--; havePrintToken = 1; } /* end else-if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) + else if(Status.MPI_TAG == MPI_TAG_TOK_REQUEST) { MPI_Recv(NULL, 0, MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD, &Status); - if(havePrintToken) + if(havePrintToken) { int incomingMessage; @@ -721,12 +721,12 @@ hsize_t diff_match(hid_t file1_id, busyTasks--; } /* end if */ /* someone else must have it...wait for them to return it, then give it to the task that just asked for it. */ - else + else { int source = Status.MPI_SOURCE; int incomingMessage; - do + do { MPI_Iprobe(MPI_ANY_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &incomingMessage, &Status); @@ -741,7 +741,7 @@ hsize_t diff_match(hid_t file1_id, MPI_Send(NULL, 0, MPI_BYTE, source, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD); } /* end else */ } /* end else-if */ - else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) + else if(Status.MPI_TAG == MPI_TAG_TOK_RETURN) { MPI_Recv(&nFoundbyWorker, sizeof(nFoundbyWorker), MPI_BYTE, Status.MPI_SOURCE, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD, &Status); nfound += nFoundbyWorker.nfound; @@ -758,7 +758,7 @@ hsize_t diff_match(hid_t file1_id, printf("%s", data); } /* end else-if */ - else + else { printf("ph5diff-manager: ERROR!! Invalid tag (%d) received \n", Status.MPI_TAG); MPI_Abort(MPI_COMM_WORLD, 0); @@ -811,10 +811,10 @@ hsize_t diff_compare(hid_t file1_id, int f1 = 0; int f2 = 0; hsize_t nfound = 0; - + ssize_t i = h5trav_getindex (info1, obj1_name); ssize_t j = h5trav_getindex (info2, obj2_name); - + if (i == -1) { parallel_print ("Object <%s> could not be found in <%s>\n", obj1_name, @@ -832,11 +832,11 @@ hsize_t diff_compare(hid_t file1_id, options->err_stat = 1; return 0; } - + /* use the name with "/" first, as obtained by iterator function */ obj1_name = info1->paths[i].path; obj2_name = info2->paths[j].path; - + /* objects are not the same type */ if (info1->paths[i].type != info2->paths[j].type) { @@ -847,14 +847,14 @@ hsize_t diff_compare(hid_t file1_id, options->not_cmp=1; return 0; } - - nfound = diff(file1_id, - obj1_name, - file2_id, - obj2_name, - options, + + nfound = diff(file1_id, + obj1_name, + file2_id, + obj2_name, + options, info1->paths[i].type); - + return nfound; } @@ -880,9 +880,9 @@ hsize_t diff_compare(hid_t file1_id, hsize_t diff(hid_t file1_id, const char *path1, - hid_t file2_id, - const char *path2, - diff_opt_t * options, + hid_t file2_id, + const char *path2, + diff_opt_t * options, h5trav_type_t type) { hid_t type1_id = (-1); @@ -891,8 +891,8 @@ hsize_t diff(hid_t file1_id, hid_t grp2_id = (-1); int ret; hsize_t nfound = 0; - - switch(type) + + switch(type) { /*------------------------------------------------------------------------- * H5TRAV_TYPE_DATASET @@ -903,7 +903,7 @@ hsize_t diff(hid_t file1_id, * verbose, always print name *------------------------------------------------------------------------- */ - if(options->m_verbose) + if(options->m_verbose) { if(print_objname(options, (hsize_t)1)) do_print_objname("dataset", path1, path2); @@ -916,9 +916,9 @@ hsize_t diff(hid_t file1_id, * disabling quiet mode *------------------------------------------------------------------------- */ - else + else { - if(options->m_quiet == 0) + if(options->m_quiet == 0) { /* shut up temporarily */ options->m_quiet = 1; @@ -926,7 +926,7 @@ hsize_t diff(hid_t file1_id, /* print again */ options->m_quiet = 0; - if(nfound) + if(nfound) { if(print_objname(options,nfound)) do_print_objname("dataset", path1, path2); @@ -939,7 +939,7 @@ hsize_t diff(hid_t file1_id, nfound = diff_dataset(file1_id, file2_id, path1, path2, options); } /* end else */ break; - + /*------------------------------------------------------------------------- * H5TRAV_TYPE_NAMED_DATATYPE *------------------------------------------------------------------------- @@ -949,20 +949,20 @@ hsize_t diff(hid_t file1_id, goto out; if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0) goto out; - + if((ret = H5Tequal(type1_id, type2_id)) < 0) goto out; - + /* if H5Tequal is > 0 then the datatypes refer to the same datatype */ nfound = (ret > 0) ? 0 : 1; - + if(print_objname(options,nfound)) do_print_objname("datatype", path1, path2); /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - + /*------------------------------------------------------------------------- * compare attributes * the if condition refers to cases when the dataset is a referenced object @@ -970,30 +970,30 @@ hsize_t diff(hid_t file1_id, */ if(path1) nfound += diff_attr(type1_id, type2_id, path1, path2, options); - + if(H5Tclose(type1_id) < 0) goto out; if(H5Tclose(type2_id) < 0) goto out; break; - + /*------------------------------------------------------------------------- * H5TRAV_TYPE_GROUP *------------------------------------------------------------------------- */ case H5TRAV_TYPE_GROUP: ret = HDstrcmp(path1, path2); - + /* if "path1" != "path2" then the groups are "different" */ nfound = (ret != 0) ? 1 : 0; - + if(print_objname(options, nfound)) do_print_objname("group", path1, path2); /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - + if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0) goto out; if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0) @@ -1006,14 +1006,14 @@ hsize_t diff(hid_t file1_id, */ if(path1) nfound += diff_attr(grp1_id, grp2_id, path1, path2, options); - + if(H5Gclose(grp1_id) < 0) goto out; if(H5Gclose(grp2_id) < 0) goto out; break; - - + + /*------------------------------------------------------------------------- * H5TRAV_TYPE_LINK *------------------------------------------------------------------------- @@ -1022,37 +1022,37 @@ hsize_t diff(hid_t file1_id, { H5L_info_t li1, li2; char *buf1, *buf2; - + if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) goto out; if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) goto out; - + buf1 = HDmalloc(li1.u.val_size); buf2 = HDmalloc(li2.u.val_size); - + if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) goto out; if(H5Lget_val(file2_id, path2, buf2, li2.u.val_size, H5P_DEFAULT) < 0) goto out; - + ret = HDstrcmp(buf1, buf2); - + /* if "buf1" != "buf2" then the links are "different" */ nfound = (ret != 0) ? 1 : 0; - + if(print_objname(options, nfound)) do_print_objname("link", path1, path2); /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); - + HDfree(buf1); HDfree(buf2); } break; - + /*------------------------------------------------------------------------- * H5TRAV_TYPE_UDLINK *------------------------------------------------------------------------- @@ -1060,19 +1060,19 @@ hsize_t diff(hid_t file1_id, case H5TRAV_TYPE_UDLINK: { H5L_info_t li1, li2; - + if(H5Lget_info(file1_id, path1, &li1, H5P_DEFAULT) < 0) goto out; if(H5Lget_info(file1_id, path1, &li2, H5P_DEFAULT) < 0) goto out; - + /* Only external links will have a query function registered */ if(li1.type == H5L_TYPE_EXTERNAL && li2.type == H5L_TYPE_EXTERNAL) { char *buf1, *buf2; buf1 = HDmalloc(li1.u.val_size); buf2 = HDmalloc(li2.u.val_size); - + if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { HDfree(buf1); HDfree(buf2); @@ -1083,7 +1083,7 @@ hsize_t diff(hid_t file1_id, HDfree(buf2); goto out; } /* end if */ - + /* If the buffers are the same size, compare them */ if(li1.u.val_size == li2.u.val_size) { if(H5Lget_val(file1_id, path1, buf1, li1.u.val_size, H5P_DEFAULT) < 0) { @@ -1100,20 +1100,20 @@ hsize_t diff(hid_t file1_id, } else ret = 1; - + /* if "buf1" != "buf2" then the links are "different" */ nfound = (ret != 0) ? 1 : 0; - + if(print_objname(options, nfound)) do_print_objname("external link", path1, path2); - + HDfree(buf1); HDfree(buf2); } /* end if */ else { /* If one or both of these links isn't an external link, we can only * compare information from H5Lget_info since we don't have a query - * function registered for them. + * function registered for them. * * If the link classes or the buffer length are not the * same, the links are "different" @@ -1122,17 +1122,17 @@ hsize_t diff(hid_t file1_id, nfound = 1; else nfound = 0; - + if (print_objname (options, nfound)) do_print_objname ("user defined link", path1, path2); } /* end else */ - + /* always print the number of differences found in verbose mode */ if(options->m_verbose) print_found(nfound); } break; - + default: if(options->m_verbose) printf("Comparison not supported: <%s> and <%s> are of type %s\n", @@ -1140,9 +1140,9 @@ hsize_t diff(hid_t file1_id, options->not_cmp = 1; break; } - + return nfound; - + out: options->err_stat = 1; diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index c5646ed..5250c3c 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -71,9 +71,9 @@ /*------------------------------------------------------------------------- * -p relative error formula * - * We assume the true value of a quantity to be A (value in first dataset) - * and the measured or inferred value to be B (value in second dataset). - * The relative error is defined by + * We assume the true value of a quantity to be A (value in first dataset) + * and the measured or inferred value to be B (value in second dataset). + * The relative error is defined by * * B - A * -------- @@ -138,7 +138,7 @@ static int ull2float(unsigned long_long ull_value, float *f_value); * NaN detection *------------------------------------------------------------------------- */ -typedef enum dtype_t +typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE, #if H5_SIZEOF_LONG_DOUBLE !=0 @@ -187,7 +187,7 @@ void print_pos( int *ph, /* print header */ const char *obj2 ) { int i; - + /* print header */ if ( *ph==1 ) { @@ -198,7 +198,7 @@ void print_pos( int *ph, /* print header */ parallel_print("%-11s",""); print_dimensions (rank,dims); parallel_print("\n"); - + if (pp) { parallel_print("%-15s %-15s %-15s %-15s %-15s\n", @@ -219,14 +219,14 @@ void print_pos( int *ph, /* print header */ parallel_print("------------------------------------------------------------\n"); } } /* end print header */ - + for ( i = 0; i < rank; i++) { pos[i] = curr_pos/acc[i]; curr_pos -= acc[i]*pos[i]; } assert( curr_pos == 0 ); - + parallel_print("[ " ); for ( i = 0; i < rank; i++) { @@ -272,11 +272,11 @@ hsize_t diff_array( void *_mem1, int ph=1; /* print header */ hsize_t i; int j; - - + + /* get the size. */ size = H5Tget_size( m_type ); - + acc[rank-1]=1; for(j=(rank-2); j>=0; j--) { @@ -284,7 +284,7 @@ hsize_t diff_array( void *_mem1, } for ( j = 0; j < rank; j++) pos[j]=0; - + if(H5Tis_variable_str(m_type)) { for ( i = 0; i < nelmts; i++) @@ -308,7 +308,7 @@ hsize_t diff_array( void *_mem1, return nfound; } /* i */ } - + else { switch (H5Tget_class(m_type)) @@ -316,22 +316,22 @@ hsize_t diff_array( void *_mem1, default: assert(0); break; - + /*------------------------------------------------------------------------- * float and integer atomic types *------------------------------------------------------------------------- */ - + case H5T_FLOAT: - - if (H5Tequal(m_type, H5T_NATIVE_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)) nfound=diff_double(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); break; - + case H5T_INTEGER: - + if (H5Tequal(m_type, H5T_NATIVE_SCHAR)) nfound=diff_schar(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_UCHAR)) @@ -352,14 +352,14 @@ hsize_t diff_array( void *_mem1, nfound=diff_llong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) nfound=diff_ullong(mem1,mem2,nelmts,hyper_start,rank,dims,acc,pos,options,name1,name2,&ph); - + break; - + /*------------------------------------------------------------------------- * Other types than float and integer *------------------------------------------------------------------------- */ - + case H5T_COMPOUND: case H5T_STRING: case H5T_BITFIELD: @@ -368,7 +368,7 @@ hsize_t diff_array( void *_mem1, case H5T_ARRAY: case H5T_VLEN: case H5T_REFERENCE: - + for ( i = 0; i < nelmts; i++) { nfound+=diff_datum( @@ -391,7 +391,7 @@ hsize_t diff_array( void *_mem1, } /* i */ } /* switch */ } /* else */ - + return nfound; } @@ -467,9 +467,9 @@ hsize_t diff_datum(void *_mem1, float f1, f2; double per; int both_zero; - + type_size = H5Tget_size( m_type ); - + switch (H5Tget_class(m_type)) { default: @@ -478,7 +478,7 @@ hsize_t diff_datum(void *_mem1, case H5T_TIME: assert(0); break; - + /*------------------------------------------------------------------------- * H5T_COMPOUND *------------------------------------------------------------------------- @@ -509,7 +509,7 @@ hsize_t diff_datum(void *_mem1, H5Tclose(memb_type); } break; - + /*------------------------------------------------------------------------- * H5T_STRING *------------------------------------------------------------------------- @@ -519,7 +519,7 @@ hsize_t diff_datum(void *_mem1, { H5T_str_t pad; char *s; - + /* Get pointer to first string to compare */ s = (char *)mem1; @@ -530,9 +530,9 @@ hsize_t diff_datum(void *_mem1, size = HDstrlen(s); else size = H5Tget_size(m_type); - + pad = H5Tget_strpad(m_type); - + for (u=0; u<size && (s[u] || pad!=H5T_STR_NULLTERM); u++) nfound+=character_compare( mem1 + u, @@ -547,16 +547,16 @@ hsize_t diff_datum(void *_mem1, obj2, ph); } - + } break; - + /*------------------------------------------------------------------------- * H5T_BITFIELD *------------------------------------------------------------------------- */ case H5T_BITFIELD: - + /* byte-by-byte comparison */ for (u=0; u<type_size; u++) nfound+=character_compare_opt( @@ -571,15 +571,15 @@ hsize_t diff_datum(void *_mem1, obj1, obj2, ph); - + break; - + /*------------------------------------------------------------------------- * H5T_OPAQUE *------------------------------------------------------------------------- */ case H5T_OPAQUE: - + /* byte-by-byte comparison */ for (u=0; u<type_size; u++) nfound+=character_compare_opt( @@ -594,29 +594,29 @@ hsize_t diff_datum(void *_mem1, obj1, obj2, ph); - + break; - - + + /*------------------------------------------------------------------------- * H5T_ENUM *------------------------------------------------------------------------- */ case H5T_ENUM: - + /* For enumeration types we compare the names instead of the integer values. For each pair of elements being compared, we convert both bit patterns to their corresponding enumeration constant and do a string comparison */ - + { char enum_name1[1024]; char enum_name2[1024]; - + /* disable error reporting */ H5E_BEGIN_TRY { - + if ((H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1) >= 0) && (H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2) >= 0)) { @@ -650,10 +650,10 @@ hsize_t diff_datum(void *_mem1, /* enable error reporting */ } H5E_END_TRY; } - - + + break; - + /*------------------------------------------------------------------------- * H5T_ARRAY *------------------------------------------------------------------------- @@ -669,7 +669,7 @@ hsize_t diff_datum(void *_mem1, ndims = H5Tget_array_ndims(m_type); H5Tget_array_dims2(m_type, adims); assert(ndims >= 1 && ndims <= H5S_MAX_RANK); - + /* calculate the number of array elements */ for (u = 0, nelmts = 1; u <ndims; u++) nelmts *= adims[u]; @@ -692,15 +692,15 @@ hsize_t diff_datum(void *_mem1, H5Tclose(memb_type); } break; - - + + /*------------------------------------------------------------------------- * H5T_REFERENCE *------------------------------------------------------------------------- */ - + case H5T_REFERENCE: - + iszero1=all_zero(_mem1, H5Tget_size(m_type)); iszero2=all_zero(_mem2, H5Tget_size(m_type)); if (iszero1 != iszero2) @@ -709,18 +709,18 @@ hsize_t diff_datum(void *_mem1, } else if (!iszero1 && !iszero2) { - + /*------------------------------------------------------------------------- * H5T_STD_REF_DSETREG * Dataset region reference *------------------------------------------------------------------------- */ - + if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) { hid_t region1_id; hid_t region2_id; - + if ((obj1_id = H5Rdereference(container1_id, H5R_DATASET_REGION, _mem1))<0) ret= -1; if ((obj2_id = H5Rdereference(container2_id, H5R_DATASET_REGION, _mem2))<0) @@ -729,22 +729,22 @@ hsize_t diff_datum(void *_mem1, ret= -1; if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2))<0) ret= -1; - + if (ret==-1) { options->err_stat=1; return 0; } - + nfound = diff_region(obj1_id,obj2_id,region1_id,region2_id,options); - + H5Oclose(obj1_id); H5Oclose(obj2_id); H5Sclose(region1_id); H5Sclose(region2_id); - + }/*dataset reference*/ - - + + /*------------------------------------------------------------------------- * H5T_STD_REF_OBJ * Object references. get the type and OID of the referenced object @@ -754,7 +754,7 @@ hsize_t diff_datum(void *_mem1, { H5O_type_t obj1_type; H5O_type_t obj2_type; - + if(H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) ret = -1; if(H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) @@ -763,7 +763,7 @@ hsize_t diff_datum(void *_mem1, options->err_stat = 1; return 0; } /* end if */ - + /* check object type */ if(obj1_type != obj2_type) { @@ -771,7 +771,7 @@ hsize_t diff_datum(void *_mem1, options->not_cmp = 1; return 0; } - + if((obj1_id = H5Rdereference(container1_id, H5R_OBJECT, _mem1)) < 0) ret = -1; if((obj2_id = H5Rdereference(container2_id, H5R_OBJECT, _mem2)) < 0) @@ -780,7 +780,7 @@ hsize_t diff_datum(void *_mem1, options->err_stat = 1; return 0; } /* end if */ - + /* compare */ if(obj1_type == H5O_TYPE_DATASET) nfound = diff_datasetid(obj1_id, @@ -793,31 +793,31 @@ hsize_t diff_datum(void *_mem1, obj1, obj2); options->not_cmp = 1; } - + H5Oclose(obj1_id); H5Oclose(obj2_id); - + }/*object reference*/ - + }/*is zero*/ - - + + break; /*------------------------------------------------------------------------- * H5T_VLEN *------------------------------------------------------------------------- */ - + case H5T_VLEN: - + /* get the VL sequences's base datatype for each element */ memb_type = H5Tget_super(m_type); size = H5Tget_size(memb_type); - + /* get the number of sequence elements */ nelmts = ((hvl_t *)mem1)->len; - + for (j = 0; j < (int)nelmts; j++) nfound+=diff_datum( ((char *)(((hvl_t *)mem1)->p)) + j * size, @@ -834,21 +834,21 @@ hsize_t diff_datum(void *_mem1, container1_id, container2_id, ph); - + H5Tclose(memb_type); - + break; - - + + /*------------------------------------------------------------------------- * H5T_INTEGER *------------------------------------------------------------------------- - */ - + */ + case H5T_INTEGER: - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_SCHAR *------------------------------------------------------------------------- @@ -878,7 +878,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -890,9 +890,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -908,7 +908,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -920,9 +920,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) { if ( print_data(options) ) @@ -944,9 +944,9 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_SCHAR*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_UCHAR *------------------------------------------------------------------------- @@ -956,7 +956,7 @@ hsize_t diff_datum(void *_mem1, unsigned char temp1_uchar; unsigned char temp2_uchar; assert(type_size==sizeof(unsigned char)); - + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); /* -d and !-p */ @@ -977,7 +977,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -989,9 +989,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1007,7 +1007,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1019,9 +1019,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) { if ( print_data(options) ) @@ -1043,21 +1043,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_UCHAR*/ - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_SHORT *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_SHORT)) { short temp1_short; short temp2_short; assert(type_size==sizeof(short)); - + memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); /* -d and !-p */ @@ -1078,7 +1078,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1090,9 +1090,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1108,7 +1108,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1120,9 +1120,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) { if ( print_data(options) ) @@ -1144,21 +1144,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_SHORT*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_USHORT *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_USHORT)) { unsigned short temp1_ushort; unsigned short temp2_ushort; assert(type_size==sizeof(short)); - + memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); /* -d and !-p */ @@ -1166,7 +1166,7 @@ hsize_t diff_datum(void *_mem1, { if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) { - + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); @@ -1180,7 +1180,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1193,9 +1193,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1211,7 +1211,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1223,9 +1223,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) { if ( print_data(options) ) @@ -1248,19 +1248,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_USHORT*/ - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_INT *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_INT)) { int temp1_int; int temp2_int; assert(type_size==sizeof(int)); - + memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); /* -d and !-p */ @@ -1281,7 +1281,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1293,9 +1293,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1311,7 +1311,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1323,9 +1323,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) { if ( print_data(options) ) @@ -1348,19 +1348,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_INT*/ - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_UINT *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_UINT)) { unsigned int temp1_uint; unsigned int temp2_uint; assert(type_size==sizeof(int)); - + memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); /* -d and !-p */ @@ -1381,7 +1381,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1393,9 +1393,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1411,7 +1411,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed int,temp1_uint,temp2_uint); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1423,9 +1423,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) { if ( print_data(options) ) @@ -1448,19 +1448,19 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_UINT*/ - - + + /*------------------------------------------------------------------------- * H5T_NATIVE_LONG *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_LONG)) { long temp1_long; long temp2_long; assert(type_size==sizeof(long)); - + memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); /* -d and !-p */ @@ -1481,7 +1481,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1494,9 +1494,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1512,7 +1512,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1524,9 +1524,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) { if ( print_data(options) ) @@ -1551,18 +1551,18 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_LONG*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_ULONG *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_ULONG)) { unsigned long temp1_ulong; unsigned long temp2_ulong; assert(type_size==sizeof(unsigned long)); - + memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); /* -d and !-p */ @@ -1583,7 +1583,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1595,9 +1595,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1613,7 +1613,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER_UNSIGN(signed long,temp1_ulong,temp2_ulong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1625,9 +1625,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) { if ( print_data(options) ) @@ -1649,21 +1649,21 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - - + + } /*H5T_NATIVE_ULONG*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_LLONG *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_LLONG)) { long_long temp1_llong; long_long temp2_llong; assert(type_size==sizeof(long_long)); - + memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); /* -d and !-p */ @@ -1684,7 +1684,7 @@ hsize_t diff_datum(void *_mem1, else if (!options->d && options->p) { PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1696,9 +1696,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -1714,7 +1714,7 @@ hsize_t diff_datum(void *_mem1, else if ( options->d && options->p) { PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1726,9 +1726,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) { if ( print_data(options) ) @@ -1750,20 +1750,20 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_LLONG*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_ULLONG *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_ULLONG)) { unsigned long_long temp1_ullong; unsigned long_long temp2_ullong; assert(type_size==sizeof(unsigned long_long)); - + memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); /* -d and !-p */ @@ -1786,7 +1786,7 @@ hsize_t diff_datum(void *_mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1798,12 +1798,12 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { - + if ( print_data(options) ) { print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); @@ -1819,7 +1819,7 @@ hsize_t diff_datum(void *_mem1, ull2float(temp1_ullong,&f1); ull2float(temp2_ullong,&f2); PER(f1,f2); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1831,16 +1831,16 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; 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); } @@ -1857,22 +1857,22 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /*H5T_NATIVE_ULLONG*/ - - + + break; /* H5T_INTEGER class */ - + /*------------------------------------------------------------------------- * H5T_FLOAT *------------------------------------------------------------------------- */ - + case H5T_FLOAT: - - - + + + /*------------------------------------------------------------------------- * H5T_NATIVE_FLOAT *------------------------------------------------------------------------- @@ -1889,7 +1889,7 @@ hsize_t diff_datum(void *_mem1, memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - /* logic for detecting NaNs is different with options -d, -p and no options */ + /* logic for detecting NaNs is different with options -d, -p and no options */ /*------------------------------------------------------------------------- * -d and !-p @@ -1897,18 +1897,18 @@ hsize_t diff_datum(void *_mem1, */ if (options->d && !options->p) { - - + + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + if (ABS(temp1_float-temp2_float) > options->delta) { if ( print_data(options) ) @@ -1919,7 +1919,7 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } /*------------------------------------------------------------------------- @@ -1928,19 +1928,19 @@ hsize_t diff_datum(void *_mem1, */ else if (!options->d && options->p) { - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -1952,9 +1952,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta ) { if ( print_data(options) ) @@ -1967,7 +1967,7 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } @@ -1975,22 +1975,22 @@ hsize_t diff_datum(void *_mem1, * -d and -p *------------------------------------------------------------------------- */ - + else if ( options->d && options->p) { - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2003,9 +2003,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2013,22 +2013,22 @@ hsize_t diff_datum(void *_mem1, print_pos(ph,1,i,acc,pos,rank,dims,obj1,obj2); parallel_print(SPACES); parallel_print(F_FORMAT_P,temp1_float,temp2_float, - ABS(temp1_float-temp2_float), + ABS(temp1_float-temp2_float), ABS(1-temp2_float/temp1_float)); } nfound++; } - + } /* NaN */ } - + /*------------------------------------------------------------------------- * no -d and -p *------------------------------------------------------------------------- */ else if (equal_float(temp1_float,temp2_float)==FALSE) { - + if ( print_data(options) ) { print_pos(ph,0,i,acc,pos,rank,dims,obj1,obj2); @@ -2038,12 +2038,12 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_FLOAT*/ - + /*------------------------------------------------------------------------- * H5T_NATIVE_DOUBLE *------------------------------------------------------------------------- */ - + else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE)) { double temp1_double; @@ -2053,11 +2053,11 @@ hsize_t diff_datum(void *_mem1, assert(type_size==sizeof(double)); - + memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - /* logic for detecting NaNs is different with options -d, -p and no options */ + /* logic for detecting NaNs is different with options -d, -p and no options */ /*------------------------------------------------------------------------- * -d and !-p @@ -2072,10 +2072,10 @@ hsize_t diff_datum(void *_mem1, */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + if (ABS(temp1_double-temp2_double) > options->delta) { if ( print_data(options) ) @@ -2086,7 +2086,7 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } @@ -2103,12 +2103,12 @@ hsize_t diff_datum(void *_mem1, */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2121,9 +2121,9 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2136,12 +2136,12 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } - + /*------------------------------------------------------------------------- - * -d and -p + * -d and -p *------------------------------------------------------------------------- */ else if ( options->d && options->p) @@ -2153,12 +2153,12 @@ hsize_t diff_datum(void *_mem1, */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2171,10 +2171,10 @@ hsize_t diff_datum(void *_mem1, options->not_cmp=1; nfound++; } - + else - - if ( per > options->percent && + + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) { if ( print_data(options) ) @@ -2187,12 +2187,12 @@ hsize_t diff_datum(void *_mem1, } nfound++; } - + } /* NaN */ } - + /*------------------------------------------------------------------------- - * no -d and -p + * no -d and -p *------------------------------------------------------------------------- */ else if (equal_double(temp1_double,temp2_double)==FALSE) @@ -2206,12 +2206,12 @@ hsize_t diff_datum(void *_mem1, nfound++; } } /*H5T_NATIVE_DOUBLE*/ - - + + break; /* H5T_FLOAT class */ - + } /* switch */ - + return nfound; } @@ -2250,7 +2250,7 @@ static void print_region_block(int i, hsize_t *ptdata, int ndims) { int j; - + parallel_print(" "); for (j = 0; j < ndims; j++) parallel_print("%s%lu", j ? "," : " (", @@ -2259,7 +2259,7 @@ void print_region_block(int i, hsize_t *ptdata, int ndims) parallel_print("%s%lu", j ? "," : ")-(", (unsigned long)ptdata[i * 2 * ndims + j + ndims]); parallel_print(")"); - + } @@ -2277,13 +2277,13 @@ static void print_points(int i, hsize_t *ptdata, int ndims) { int j; - + parallel_print(" "); for (j = 0; j < ndims; j++) parallel_print("%s%lu", j ? "," : "(", (unsigned long)(ptdata[i * ndims + j])); parallel_print(")"); - + } /*------------------------------------------------------------------------- @@ -2492,10 +2492,10 @@ hsize_t character_compare(unsigned char *mem1, hsize_t nfound=0; /* differences found */ unsigned char temp1_uchar; unsigned char temp2_uchar; - + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (temp1_uchar != temp2_uchar) { if ( print_data(options) ) @@ -2506,7 +2506,7 @@ hsize_t character_compare(unsigned char *mem1, } nfound++; } - + return nfound; } @@ -2538,12 +2538,12 @@ hsize_t character_compare_opt(unsigned char *mem1, unsigned char temp2_uchar; double per; int both_zero; - + memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + /* -d and !-p */ - + if (options->d && !options->p) { if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) @@ -2597,9 +2597,9 @@ hsize_t character_compare_opt(unsigned char *mem1, } nfound++; } - + return nfound; - + } @@ -2634,13 +2634,13 @@ hsize_t diff_float(unsigned char *mem1, int both_zero; int isnan1; int isnan2; - + /*------------------------------------------------------------------------- - * -d and !-p + * -d and !-p *------------------------------------------------------------------------- */ - + if (options->d && !options->p) { for ( i = 0; i < nelmts; i++) @@ -2656,7 +2656,7 @@ hsize_t diff_float(unsigned char *mem1, isnan2 = my_isnan(FLT_FLOAT,&temp2_float); if ( !isnan1 && !isnan2) - { + { if (ABS(temp1_float-temp2_float) > options->delta) { if ( print_data(options) ) @@ -2676,7 +2676,7 @@ hsize_t diff_float(unsigned char *mem1, } /*------------------------------------------------------------------------- - * !-d and -p + * !-d and -p *------------------------------------------------------------------------- */ else if (!options->d && options->p) @@ -2685,19 +2685,19 @@ hsize_t diff_float(unsigned char *mem1, { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2710,9 +2710,9 @@ hsize_t diff_float(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2732,31 +2732,31 @@ hsize_t diff_float(unsigned char *mem1, return nfound; } /* i */ } - + /*------------------------------------------------------------------------- - * -d and -p + * -d and -p *------------------------------------------------------------------------- */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_FLOAT,&temp1_float); isnan2 = my_isnan(FLT_FLOAT,&temp2_float); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_float,temp2_float); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2769,9 +2769,9 @@ hsize_t diff_float(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_float-temp2_float) > options->delta ) { if ( print_data(options) ) @@ -2784,7 +2784,7 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - + } /* NaN */ mem1+=sizeof(float); mem2+=sizeof(float); @@ -2794,7 +2794,7 @@ hsize_t diff_float(unsigned char *mem1, } /*------------------------------------------------------------------------- - * no -d and -p + * no -d and -p *------------------------------------------------------------------------- */ else @@ -2814,13 +2814,13 @@ hsize_t diff_float(unsigned char *mem1, #endif #endif - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_float, mem1, sizeof(float)); memcpy(&temp2_float, mem2, sizeof(float)); - + if (equal_float(temp1_float,temp2_float)==FALSE) { if ( print_data(options) ) @@ -2831,7 +2831,7 @@ hsize_t diff_float(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(float); mem2+=sizeof(float); if (options->n && nfound>=options->count) @@ -2854,9 +2854,9 @@ hsize_t diff_float(unsigned char *mem1, #endif - + } - + return nfound; } @@ -2892,13 +2892,13 @@ hsize_t diff_double(unsigned char *mem1, int both_zero; int isnan1; int isnan2; - + /*------------------------------------------------------------------------- - * -d and !-p + * -d and !-p *------------------------------------------------------------------------- */ - + if (options->d && !options->p) { for ( i = 0; i < nelmts; i++) @@ -2914,7 +2914,7 @@ hsize_t diff_double(unsigned char *mem1, isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); if ( !isnan1 && !isnan2) - { + { if (ABS(temp1_double-temp2_double) > options->delta) { if ( print_data(options) ) @@ -2934,7 +2934,7 @@ hsize_t diff_double(unsigned char *mem1, } /*------------------------------------------------------------------------- - * !-d and -p + * !-d and -p *------------------------------------------------------------------------- */ else if (!options->d && options->p) @@ -2943,19 +2943,19 @@ hsize_t diff_double(unsigned char *mem1, { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -2968,9 +2968,9 @@ hsize_t diff_double(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -2990,31 +2990,31 @@ hsize_t diff_double(unsigned char *mem1, return nfound; } /* i */ } - + /*------------------------------------------------------------------------- - * -d and -p + * -d and -p *------------------------------------------------------------------------- */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + /*------------------------------------------------------------------------- * detect NaNs *------------------------------------------------------------------------- */ isnan1 = my_isnan(FLT_DOUBLE,&temp1_double); isnan2 = my_isnan(FLT_DOUBLE,&temp2_double); - + if ( !isnan1 && !isnan2) - { - + { + PER(temp1_double,temp2_double); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3027,9 +3027,9 @@ hsize_t diff_double(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_double-temp2_double) > options->delta ) { if ( print_data(options) ) @@ -3042,7 +3042,7 @@ hsize_t diff_double(unsigned char *mem1, } nfound++; } - + } /* NaN */ mem1+=sizeof(double); mem2+=sizeof(double); @@ -3052,17 +3052,17 @@ hsize_t diff_double(unsigned char *mem1, } /*------------------------------------------------------------------------- - * no -d and -p + * no -d and -p *------------------------------------------------------------------------- */ else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_double, mem1, sizeof(double)); memcpy(&temp2_double, mem2, sizeof(double)); - + if (equal_double(temp1_double,temp2_double)==FALSE) { if ( print_data(options) ) @@ -3073,15 +3073,15 @@ hsize_t diff_double(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(double); mem2+=sizeof(double); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3117,17 +3117,17 @@ hsize_t diff_schar(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (ABS(temp1_char-temp2_char) > options->delta) { if ( print_data(options) ) @@ -3144,18 +3144,18 @@ hsize_t diff_schar(unsigned char *mem1, return nfound; } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3168,9 +3168,9 @@ hsize_t diff_schar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3189,18 +3189,18 @@ hsize_t diff_schar(unsigned char *mem1, return nfound; } } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + PER(temp1_char,temp2_char); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3213,9 +3213,9 @@ hsize_t diff_schar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_char-temp2_char) > options->delta ) { if ( print_data(options) ) @@ -3233,16 +3233,16 @@ hsize_t diff_schar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_char, mem1, sizeof(char)); memcpy(&temp2_char, mem2, sizeof(char)); - + if (temp1_char != temp2_char) { if ( print_data(options) ) @@ -3253,15 +3253,15 @@ hsize_t diff_schar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(char); mem2+=sizeof(char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3296,17 +3296,17 @@ hsize_t diff_uchar(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if ( PDIFF(temp1_uchar,temp2_uchar) > options->delta) { if ( print_data(options) ) @@ -3322,20 +3322,20 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3348,9 +3348,9 @@ hsize_t diff_uchar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3369,18 +3369,18 @@ hsize_t diff_uchar(unsigned char *mem1, return nfound; } } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + PER_UNSIGN(signed char,temp1_uchar,temp2_uchar); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3393,9 +3393,9 @@ hsize_t diff_uchar(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uchar,temp2_uchar) > options->delta ) { if ( print_data(options) ) @@ -3413,16 +3413,16 @@ hsize_t diff_uchar(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uchar, mem1, sizeof(unsigned char)); memcpy(&temp2_uchar, mem2, sizeof(unsigned char)); - + if (temp1_uchar != temp2_uchar) { if ( print_data(options) ) @@ -3433,15 +3433,15 @@ hsize_t diff_uchar(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned char); mem2+=sizeof(unsigned char); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3474,16 +3474,16 @@ hsize_t diff_short(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (ABS(temp1_short-temp2_short) > options->delta) { if ( print_data(options) ) @@ -3499,20 +3499,20 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3525,9 +3525,9 @@ hsize_t diff_short(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3545,21 +3545,21 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + PER(temp1_short,temp2_short); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3572,9 +3572,9 @@ hsize_t diff_short(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_short-temp2_short) > options->delta ) { if ( print_data(options) ) @@ -3592,16 +3592,16 @@ hsize_t diff_short(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_short, mem1, sizeof(short)); memcpy(&temp2_short, mem2, sizeof(short)); - + if (temp1_short != temp2_short) { if ( print_data(options) ) @@ -3612,15 +3612,15 @@ hsize_t diff_short(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(short); mem2+=sizeof(short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3654,16 +3654,16 @@ hsize_t diff_ushort(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if ( PDIFF(temp1_ushort,temp2_ushort) > options->delta) { if ( print_data(options) ) @@ -3679,20 +3679,20 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3705,9 +3705,9 @@ hsize_t diff_ushort(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3725,21 +3725,21 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + PER_UNSIGN(signed short,temp1_ushort,temp2_ushort); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3752,9 +3752,9 @@ hsize_t diff_ushort(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ushort,temp2_ushort) > options->delta ) { if ( print_data(options) ) @@ -3772,16 +3772,16 @@ hsize_t diff_ushort(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ushort, mem1, sizeof(unsigned short)); memcpy(&temp2_ushort, mem2, sizeof(unsigned short)); - + if (temp1_ushort != temp2_ushort) { if ( print_data(options) ) @@ -3792,15 +3792,15 @@ hsize_t diff_ushort(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned short); mem2+=sizeof(unsigned short); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -3835,16 +3835,16 @@ hsize_t diff_int(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + if (ABS(temp1_int-temp2_int) > options->delta) { if ( print_data(options) ) @@ -3860,20 +3860,20 @@ hsize_t diff_int(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3886,9 +3886,9 @@ hsize_t diff_int(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -3906,21 +3906,21 @@ hsize_t diff_int(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + PER(temp1_int,temp2_int); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -3933,9 +3933,9 @@ hsize_t diff_int(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_int-temp2_int) > options->delta ) { if ( print_data(options) ) @@ -3953,16 +3953,16 @@ hsize_t diff_int(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_int, mem1, sizeof(int)); memcpy(&temp2_int, mem2, sizeof(int)); - + if (temp1_int != temp2_int) { if ( print_data(options) ) @@ -3973,15 +3973,15 @@ hsize_t diff_int(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(int); mem2+=sizeof(int); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4016,16 +4016,16 @@ hsize_t diff_uint(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + if ( PDIFF(temp1_uint,temp2_uint) > options->delta) { if ( print_data(options) ) @@ -4041,20 +4041,20 @@ hsize_t diff_uint(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&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) ) @@ -4066,9 +4066,9 @@ hsize_t diff_uint(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4086,21 +4086,21 @@ hsize_t diff_uint(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&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) ) @@ -4112,9 +4112,9 @@ hsize_t diff_uint(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_uint,temp2_uint) > options->delta ) { if ( print_data(options) ) @@ -4132,16 +4132,16 @@ hsize_t diff_uint(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_uint, mem1, sizeof(unsigned int)); memcpy(&temp2_uint, mem2, sizeof(unsigned int)); - + if (temp1_uint != temp2_uint) { if ( print_data(options) ) @@ -4152,15 +4152,15 @@ hsize_t diff_uint(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned int); mem2+=sizeof(unsigned int); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4195,19 +4195,19 @@ hsize_t diff_long(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (ABS(temp1_long-temp2_long) > options->delta) { if ( print_data(options) ) @@ -4225,18 +4225,18 @@ hsize_t diff_long(unsigned char *mem1, } } } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4249,9 +4249,9 @@ hsize_t diff_long(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4269,21 +4269,21 @@ hsize_t diff_long(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + PER(temp1_long,temp2_long); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4296,9 +4296,9 @@ hsize_t diff_long(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_long-temp2_long) > options->delta ) { if ( print_data(options) ) @@ -4316,16 +4316,16 @@ hsize_t diff_long(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - + if (temp1_long != temp2_long) { if ( print_data(options) ) @@ -4336,15 +4336,15 @@ hsize_t diff_long(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(long); mem2+=sizeof(long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4380,20 +4380,20 @@ hsize_t diff_ulong(unsigned char *mem1, hsize_t i; double per; int both_zero; - - + + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + if ( PDIFF(temp1_ulong,temp2_ulong) > options->delta) { if ( print_data(options) ) @@ -4409,22 +4409,22 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&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) ) @@ -4436,9 +4436,9 @@ hsize_t diff_ulong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4456,21 +4456,21 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&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) ) @@ -4482,9 +4482,9 @@ hsize_t diff_ulong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ulong,temp2_ulong) > options->delta ) { if ( print_data(options) ) @@ -4502,16 +4502,16 @@ hsize_t diff_ulong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - + if (temp1_ulong != temp2_ulong) { if ( print_data(options) ) @@ -4522,15 +4522,15 @@ hsize_t diff_ulong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned long); mem2+=sizeof(unsigned long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4565,16 +4565,16 @@ hsize_t diff_llong(unsigned char *mem1, hsize_t i; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + if (ABS( temp1_llong-temp2_llong) > options->delta) { if ( print_data(options) ) @@ -4590,20 +4590,20 @@ hsize_t diff_llong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4615,9 +4615,9 @@ hsize_t diff_llong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4633,21 +4633,21 @@ hsize_t diff_llong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + PER(temp1_llong,temp2_llong); - + if (not_comparable && !both_zero) /* not comparable */ { if ( print_data(options) ) @@ -4659,9 +4659,9 @@ hsize_t diff_llong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && ABS(temp1_llong-temp2_llong) > options->delta ) { if ( print_data(options) ) @@ -4677,16 +4677,16 @@ hsize_t diff_llong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_llong, mem1, sizeof(long_long)); memcpy(&temp2_llong, mem2, sizeof(long_long)); - + if (temp1_llong != temp2_llong) { if ( print_data(options) ) @@ -4697,15 +4697,15 @@ hsize_t diff_llong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(long_long); mem2+=sizeof(long_long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4741,16 +4741,16 @@ hsize_t diff_ullong(unsigned char *mem1, float f1, f2; double per; int both_zero; - + /* -d and !-p */ if (options->d && !options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + if ( PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long) options->delta) { if ( print_data(options) ) @@ -4766,22 +4766,22 @@ hsize_t diff_ullong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } - + /* !-d and -p */ else if (!options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&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) ) @@ -4793,9 +4793,9 @@ hsize_t diff_ullong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent ) { if ( print_data(options) ) @@ -4811,23 +4811,23 @@ hsize_t diff_ullong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - - + + } - + /* -d and -p */ else if ( options->d && options->p) { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&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) ) @@ -4839,9 +4839,9 @@ hsize_t diff_ullong(unsigned char *mem1, options->not_cmp=1; nfound++; } - + else - + if ( per > options->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long_long)options->delta ) { if ( print_data(options) ) @@ -4857,16 +4857,16 @@ hsize_t diff_ullong(unsigned char *mem1, if (options->n && nfound>=options->count) return nfound; } - + } else { - + for ( i = 0; i < nelmts; i++) { memcpy(&temp1_ullong, mem1, sizeof(unsigned long_long)); memcpy(&temp2_ullong, mem2, sizeof(unsigned long_long)); - + if (temp1_ullong != temp2_ullong) { if ( print_data(options) ) @@ -4877,15 +4877,15 @@ hsize_t diff_ullong(unsigned char *mem1, } nfound++; } - + mem1+=sizeof(unsigned long_long); mem2+=sizeof(unsigned long_long); if (options->n && nfound>=options->count) return nfound; } /* nelmts */ - + } - + return nfound; } @@ -4945,8 +4945,8 @@ error: /*------------------------------------------------------------------------- * Function: equal_double * - * Purpose: use a relative error formula to deal with floating point - * uncertainty + * Purpose: use a relative error formula to deal with floating point + * uncertainty * * Programmer: pvn * October 24, 2006 @@ -4956,8 +4956,8 @@ error: * *------------------------------------------------------------------------- */ -static -hbool_t equal_double(double value, double expected) +static +hbool_t equal_double(double value, double expected) { int both_zero; int is_zero; @@ -4972,7 +4972,7 @@ hbool_t equal_double(double value, double expected) int isnan2 = my_isnan(FLT_DOUBLE,&expected); /*------------------------------------------------------------------------- - * we consider NaN == NaN to be true + * we consider NaN == NaN to be true *------------------------------------------------------------------------- */ if ( isnan1 && isnan2 ) @@ -5008,14 +5008,14 @@ hbool_t equal_double(double value, double expected) return TRUE; else return FALSE; - + } /*------------------------------------------------------------------------- * Function: equal_float * - * Purpose: use a relative error formula to deal with floating point - * uncertainty + * Purpose: use a relative error formula to deal with floating point + * uncertainty * * Programmer: pvn * October 24, 2006 @@ -5025,8 +5025,8 @@ hbool_t equal_double(double value, double expected) * *------------------------------------------------------------------------- */ -static -hbool_t equal_float(float value, float expected) +static +hbool_t equal_float(float value, float expected) { int both_zero; int is_zero; @@ -5041,7 +5041,7 @@ hbool_t equal_float(float value, float expected) int isnan2 = my_isnan(FLT_FLOAT,&expected); /*------------------------------------------------------------------------- - * we consider NaN == NaN to be true + * we consider NaN == NaN to be true *------------------------------------------------------------------------- */ if ( isnan1 && isnan2 ) @@ -5064,7 +5064,7 @@ hbool_t equal_float(float value, float expected) */ #endif - + BOTH_ZERO(value,expected) if (both_zero) return TRUE; @@ -5077,7 +5077,7 @@ hbool_t equal_float(float value, float expected) return TRUE; else return FALSE; - + } @@ -5103,73 +5103,73 @@ my_isnan(dtype_t type, void *val) { int retval = 0; char s[256]; - - if (FLT_FLOAT==type) + + if (FLT_FLOAT==type) { float x; HDmemcpy(&x, val, sizeof(float)); retval = (x!=x); - - } - else if (FLT_DOUBLE==type) + + } + else if (FLT_DOUBLE==type) { double x; HDmemcpy(&x, val, sizeof(double)); retval = (x!=x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 - } - else if (FLT_LDOUBLE==type) + } + else if (FLT_LDOUBLE==type) { long double x; HDmemcpy(&x, val, sizeof(long double)); retval = (x!=x); #endif - } - else + } + else { return 0; } - + /* * Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if * the result contains a NaN string. */ - if (!retval) + if (!retval) { - if (FLT_FLOAT==type) + if (FLT_FLOAT==type) { float x; HDmemcpy(&x, val, sizeof(float)); sprintf(s, "%g", x); - } - else if (FLT_DOUBLE==type) + } + else if (FLT_DOUBLE==type) { double x; HDmemcpy(&x, val, sizeof(double)); sprintf(s, "%g", x); #if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0 - } - else if (FLT_LDOUBLE==type) + } + else if (FLT_LDOUBLE==type) { long double x; HDmemcpy(&x, val, sizeof(long double)); sprintf(s, "%Lg", x); #endif - } - else + } + else { return 0; } - - if ( HDstrstr(s, "NaN") || - HDstrstr(s, "NAN") || - HDstrstr(s, "nan") || - HDstrstr(s, "-1.#IND") /* WIN32 */ + + if ( HDstrstr(s, "NaN") || + HDstrstr(s, "NAN") || + HDstrstr(s, "nan") || + HDstrstr(s, "-1.#IND") /* WIN32 */ ) { @@ -5180,13 +5180,13 @@ my_isnan(dtype_t type, void *val) } - + #ifdef H5_VMS /* For "float" and "double" on OpenVMS/Alpha, NaN is * actually a valid value of maximal value.*/ - if(!retval) + if(!retval) { - if (FLT_FLOAT==type) + if (FLT_FLOAT==type) { float x; HDmemcpy(&x, val, sizeof(float)); @@ -5195,17 +5195,17 @@ my_isnan(dtype_t type, void *val) double x; HDmemcpy(&x, val, sizeof(double)); retval = (x==DBL_MAX || x==-DBL_MAX); - } else + } else { return 0; } } #endif /*H5_VMS*/ - + return retval; } - + diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index d6c1c48..6dec22b 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -70,39 +70,39 @@ hsize_t diff_attr(hid_t loc1_id, hsize_t nfound = 0; hsize_t nfound_total = 0; int j; - + if(H5Oget_info(loc1_id, &oinfo1) < 0) goto error; if(H5Oget_info(loc2_id, &oinfo2) < 0) goto error; - + if(oinfo1.num_attrs != oinfo2.num_attrs) return 1; - + for( u = 0; u < (unsigned)oinfo1.num_attrs; u++) { /* reset buffers for every attribute, we might goto out and call free */ buf1 = NULL; buf2 = NULL; - + /* open attribute */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; /* get name */ if(H5Aget_name(attr1_id, 255, name1) < 0) goto error; - + /* use the name on the first file to open the second file */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { if((attr2_id = H5Aopen(loc2_id, name1, H5P_DEFAULT)) < 0) goto error; } H5E_END_TRY; - + /* get name */ if(H5Aget_name(attr2_id, 255, name2) < 0) goto error; - + /* get the datatypes */ if ((ftype1_id = H5Aget_type(attr1_id)) < 0) goto error; @@ -115,28 +115,28 @@ hsize_t diff_attr(hid_t loc1_id, if ((msize1 = H5Tget_size(mtype1_id))==0) goto error; if ((msize2 = H5Tget_size(mtype2_id))==0) - goto error; - + goto error; + /* get the dataspace */ if ((space1_id = H5Aget_space(attr1_id)) < 0) goto error; if ((space2_id = H5Aget_space(attr2_id)) < 0) goto error; - + /* get dimensions */ if ( (rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0 ) goto error; if ( (rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0 ) goto error; - - + + /*------------------------------------------------------------------------- * check for comparable TYPE and SPACE *------------------------------------------------------------------------- */ - + if ( msize1 != msize2 - || + || diff_can_type(ftype1_id, ftype2_id, rank1, @@ -149,44 +149,44 @@ hsize_t diff_attr(hid_t loc1_id, name2, options)!=1) { - + if (options->m_verbose) printf("Comparison not possible for attribute <%s>\n", name1); - + options->not_cmp=1; - - if (H5Tclose(ftype1_id)<0) + + if (H5Tclose(ftype1_id)<0) goto error; - if (H5Tclose(ftype2_id)<0) + if (H5Tclose(ftype2_id)<0) goto error; - if (H5Sclose(space1_id)<0) + if (H5Sclose(space1_id)<0) goto error; - if (H5Sclose(space2_id)<0) + if (H5Sclose(space2_id)<0) goto error; - if (H5Aclose(attr1_id)<0) + if (H5Aclose(attr1_id)<0) goto error; - if (H5Aclose(attr2_id)<0) + if (H5Aclose(attr2_id)<0) goto error; - if (H5Tclose(mtype1_id)<0) + if (H5Tclose(mtype1_id)<0) goto error; - if (H5Tclose(mtype2_id)<0) + if (H5Tclose(mtype2_id)<0) goto error; continue; - - + + } - - + + /*------------------------------------------------------------------------- - * read + * read *------------------------------------------------------------------------- */ nelmts1=1; for (j=0; j<rank1; j++) nelmts1*=dims1[j]; - + buf1=(void *) HDmalloc((unsigned)(nelmts1*msize1)); buf2=(void *) HDmalloc((unsigned)(nelmts1*msize2)); if ( buf1==NULL || buf2==NULL){ @@ -197,16 +197,16 @@ hsize_t diff_attr(hid_t loc1_id, goto error; if (H5Aread(attr2_id,mtype2_id,buf2)<0) goto error; - + /* format output string */ sprintf(np1,"%s of <%s>",name1,path1); sprintf(np2,"%s of <%s>",name2,path2); - + /*------------------------------------------------------------------------- * array compare *------------------------------------------------------------------------- */ - + /* always print name */ if (options->m_verbose) { @@ -224,7 +224,7 @@ hsize_t diff_attr(hid_t loc1_id, attr1_id, attr2_id); print_found(nfound); - + } /* check first if we have differences */ else @@ -282,40 +282,40 @@ hsize_t diff_attr(hid_t loc1_id, attr2_id); } /*else quiet */ } /*else verbose */ - - + + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - - if (H5Tclose(ftype1_id)<0) + + if (H5Tclose(ftype1_id)<0) goto error; - if (H5Tclose(ftype2_id)<0) + if (H5Tclose(ftype2_id)<0) goto error; - if (H5Sclose(space1_id)<0) + if (H5Sclose(space1_id)<0) goto error; - if (H5Sclose(space2_id)<0) + if (H5Sclose(space2_id)<0) goto error; - if (H5Aclose(attr1_id)<0) + if (H5Aclose(attr1_id)<0) goto error; - if (H5Aclose(attr2_id)<0) + if (H5Aclose(attr2_id)<0) goto error; - if (H5Tclose(mtype1_id)<0) + if (H5Tclose(mtype1_id)<0) goto error; - if (H5Tclose(mtype2_id)<0) + if (H5Tclose(mtype2_id)<0) goto error; - + if (buf1) HDfree(buf1); if (buf2) HDfree(buf2); - + nfound_total += nfound; } /* u */ - + return nfound_total; - + error: H5E_BEGIN_TRY { H5Tclose(ftype1_id); @@ -331,7 +331,7 @@ error: if (buf2) HDfree(buf2); } H5E_END_TRY; - + options->err_stat=1; return nfound_total; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 3f4e6a3..6048796 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -43,35 +43,35 @@ hsize_t diff_dataset( hid_t file1_id, hid_t dcpl1 = -1; hid_t dcpl2 = -1; hsize_t nfound = 0; - + /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- */ /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { /* open the datasets */ - if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) + if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { printf("Cannot open dataset <%s>\n", obj1_name); goto error; } - - if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) + + if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { printf("Cannot open dataset <%s>\n", obj2_name); goto error; } /* enable error reporting */ } H5E_END_TRY; - - + + if ((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; if ((dcpl2 = H5Dget_create_plist(did2)) < 0) goto error; - + /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that * are not registered in the current configuration @@ -93,7 +93,7 @@ hsize_t diff_dataset( hid_t file1_id, *------------------------------------------------------------------------- */ /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl1); H5Pclose(dcpl2); @@ -101,13 +101,13 @@ hsize_t diff_dataset( hid_t file1_id, H5Dclose(did2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; - + error: options->err_stat=1; /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Pclose(dcpl1); H5Pclose(dcpl2); @@ -115,7 +115,7 @@ error: H5Dclose(did2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -131,47 +131,47 @@ error: * * Date: May 9, 2003 * - * Modifications: + * Modifications: * * October 2006: Read by hyperslabs for big datasets. * * A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done - * i.e., if the memory needed to read a dataset is greater than this limit, - * then hyperslab I/O is done instead of one operation I/O + * i.e., if the memory needed to read a dataset is greater than this limit, + * then hyperslab I/O is done instead of one operation I/O * For each dataset, the memory needed is calculated according to * * memory needed = number of elements * size of each element * - * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations + * if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations * are done * * H5Dread( input_dataset1 ) * H5Dread( input_dataset2 ) * - * with all elements in the datasets selected. If the memory needed is greater than + * with all elements in the datasets selected. If the memory needed is greater than * H5TOOLS_MALLOCSIZE, then the following operations are done instead: * - * a strip mine is defined for each dimension k (a strip mine is defined as a + * a strip mine is defined for each dimension k (a strip mine is defined as a * hyperslab whose size is memory manageable) according to the formula * * (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type) * - * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures - * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip - * mine size k is simply defined as its dimension k, but for larger datasets the + * where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures + * that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip + * mine size k is simply defined as its dimension k, but for larger datasets the * hyperslab size is still memory manageable. - * a cycle is done until the number of elements in the dataset is reached. In each - * iteration, two parameters are defined for the function H5Sselect_hyperslab, + * a cycle is done until the number of elements in the dataset is reached. In each + * iteration, two parameters are defined for the function H5Sselect_hyperslab, * the start and size of each hyperslab, according to * * (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k]) * - * where hyperslab_offset [k] is initially set to zero, and later incremented in - * hyperslab_size[k] offsets. The reason for the operation + * where hyperslab_offset [k] is initially set to zero, and later incremented in + * hyperslab_size[k] offsets. The reason for the operation * * dimension[k] - hyperslab_offset[k] * - * in (2) is that, when using the strip mine size, it assures that the "remaining" part + * in (2) is that, when using the strip mine size, it assures that the "remaining" part * of the dataset that does not fill an entire strip mine is processed. * *------------------------------------------------------------------------- @@ -185,13 +185,13 @@ hsize_t diff_datasetid( hid_t did1, hid_t sid1=-1; hid_t sid2=-1; hid_t f_tid1=-1; - hid_t f_tid2=-1; + hid_t f_tid2=-1; hid_t m_tid1=-1; - hid_t m_tid2=-1; + hid_t m_tid2=-1; size_t m_size1; - size_t m_size2; + size_t m_size2; H5T_sign_t sign1; - H5T_sign_t sign2; + H5T_sign_t sign2; int rank1; int rank2; hsize_t nelmts1; @@ -206,60 +206,60 @@ hsize_t diff_datasetid( hid_t did1, hsize_t storage_size2; hsize_t nfound=0; /* number of differences found */ int cmp=1; /* do diff or not */ - void *buf1=NULL; - void *buf2=NULL; - void *sm_buf1=NULL; + void *buf1=NULL; + void *buf2=NULL; + void *sm_buf1=NULL; void *sm_buf2=NULL; size_t need; /* bytes needed for malloc */ int i; - + /* get the dataspace handle */ if ( (sid1 = H5Dget_space(did1)) < 0 ) goto error; - + /* get rank */ if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 ) goto error; - + /* get the dataspace handle */ if ( (sid2 = H5Dget_space(did2)) < 0 ) goto error; - + /* get rank */ if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 ) goto error; - + /* get dimensions */ if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 ) goto error; - + /* get dimensions */ if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 ) goto error; - + /*------------------------------------------------------------------------- * get the file data type *------------------------------------------------------------------------- */ - + /* get the data type */ if ( (f_tid1 = H5Dget_type(did1)) < 0 ) goto error; - + /* get the data type */ if ( (f_tid2 = H5Dget_type(did2)) < 0 ) goto error; - + /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- */ - + storage_size1=H5Dget_storage_size(did1); storage_size2=H5Dget_storage_size(did2); if (storage_size1<0 || storage_size2<0) goto error; - + if (storage_size1==0 || storage_size2==0) { if (options->m_verbose && obj1_name && obj2_name) @@ -267,12 +267,12 @@ hsize_t diff_datasetid( hid_t did1, cmp=0; options->not_cmp=1; } - + /*------------------------------------------------------------------------- * check for comparable TYPE and SPACE *------------------------------------------------------------------------- */ - + if (diff_can_type(f_tid1, f_tid2, rank1, @@ -288,46 +288,46 @@ hsize_t diff_datasetid( hid_t did1, cmp=0; options->not_cmp=1; } - + /*------------------------------------------------------------------------- * memory type and sizes *------------------------------------------------------------------------- */ if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0) goto error; - + if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0) goto error; - + m_size1 = H5Tget_size( m_tid1 ); m_size2 = H5Tget_size( m_tid2 ); - + /*------------------------------------------------------------------------- * check for different signed/unsigned types *------------------------------------------------------------------------- */ - + sign1=H5Tget_sign(m_tid1); sign2=H5Tget_sign(m_tid2); if ( sign1 != sign2 ) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { parallel_print("Comparison not supported: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - + cmp=0; options->not_cmp=1; } - + /*------------------------------------------------------------------------- * only attempt to compare if possible *------------------------------------------------------------------------- */ if (cmp) { - + /*------------------------------------------------------------------------- * get number of elements *------------------------------------------------------------------------- @@ -337,43 +337,43 @@ hsize_t diff_datasetid( hid_t did1, { nelmts1 *= dims1[i]; } - + nelmts2 = 1; for (i = 0; i < rank2; i++) { nelmts2 *= dims2[i]; } - + assert(nelmts1==nelmts2); - + /*------------------------------------------------------------------------- * "upgrade" the smaller memory size *------------------------------------------------------------------------- */ - + if ( m_size1 != m_size2 ) { if ( m_size1 < m_size2 ) { H5Tclose(m_tid1); - + if ((m_tid1=h5tools_get_native_type(f_tid2)) < 0) goto error; - + m_size1 = H5Tget_size( m_tid1 ); } else { H5Tclose(m_tid2); - + if ((m_tid2=h5tools_get_native_type(f_tid1)) < 0) goto error; - + m_size2 = H5Tget_size( m_tid2 ); } } assert(m_size1==m_size2); - + /* print names */ if (obj1_name) { name1=diff_basename(obj1_name); @@ -381,27 +381,27 @@ hsize_t diff_datasetid( hid_t did1, if (obj2_name) { name2=diff_basename(obj2_name); } - - + + /*------------------------------------------------------------------------- * read/compare *------------------------------------------------------------------------- */ - + need = (size_t)(nelmts1*m_size1); /* bytes needed */ if ( need < H5TOOLS_MALLOCSIZE) { buf1 = HDmalloc(need); buf2 = HDmalloc(need); } - + if ( buf1!=NULL && buf2!=NULL) { if ( H5Dread(did1,m_tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf1) < 0 ) goto error; if ( H5Dread(did2,m_tid2,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf2) < 0 ) goto error; - + /* array diff */ nfound = diff_array(buf1, buf2, @@ -416,61 +416,61 @@ hsize_t diff_datasetid( hid_t did1, did1, did2); } - + else /* possibly not enough memory, read/compare by hyperslabs */ - + { size_t p_type_nbytes = m_size1; /*size of memory type */ hsize_t p_nelmts = nelmts1; /*total selected elmts */ hsize_t elmtno; /*counter */ int carry; /*counter carry value */ unsigned int vl_data = 0; /*contains VL datatypes */ - + /* stripmine info */ hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */ hsize_t sm_nbytes; /*bytes per stripmine */ hsize_t sm_nelmts; /*elements per stripmine*/ hid_t sm_space; /*stripmine data space */ - + /* hyperslab info */ hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */ hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ hsize_t hs_nelmts; /*elements in request */ hsize_t zero[8]; /*vector of zeros */ - + /* check if we have VL data in the dataset's datatype */ if (H5Tdetect_class(m_tid1, H5T_VLEN) == TRUE) vl_data = TRUE; - + /* * determine the strip mine size and allocate a buffer. The strip mine is * a hyperslab whose size is manageable. */ sm_nbytes = p_type_nbytes; - - for (i = rank1; i > 0; --i) + + for (i = rank1; i > 0; --i) { sm_size[i - 1] = MIN(dims1[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } - + sm_buf1 = malloc((size_t)sm_nbytes); sm_buf2 = malloc((size_t)sm_nbytes); - + sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - + /* the stripmine loop */ memset(hs_offset, 0, sizeof hs_offset); memset(zero, 0, sizeof zero); - - for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { /* calculate the hyperslab size */ - if (rank1 > 0) + if (rank1 > 0) { - for (i = 0, hs_nelmts = 1; i < rank1; i++) + for (i = 0, hs_nelmts = 1; i < rank1; i++) { hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]); hs_nelmts *= hs_size[i]; @@ -481,22 +481,22 @@ hsize_t diff_datasetid( hid_t did1, goto error; if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) goto error; - } - else + } + else { H5Sselect_all(sid1); H5Sselect_all(sid2); H5Sselect_all(sm_space); hs_nelmts = 1; } /* rank */ - + if ( H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0 ) goto error; if ( H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0 ) goto error; - - /* get array differences. in the case of hyperslab read, increment the - number of differences found in each hyperslab and pass the + + /* get array differences. in the case of hyperslab read, increment the + number of differences found in each hyperslab and pass the position at the beggining for printing */ nfound += diff_array(sm_buf1, @@ -511,16 +511,16 @@ hsize_t diff_datasetid( hid_t did1, m_tid1, did1, did2); - + /* reclaim any VL memory, if necessary */ if(vl_data) { H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1); H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2); } - + /* calculate the next hyperslab offset */ - for (i = rank1, carry = 1; i > 0 && carry; --i) + for (i = rank1, carry = 1; i > 0 && carry; --i) { hs_offset[i - 1] += hs_size[i - 1]; if (hs_offset[i - 1] == dims1[i - 1]) @@ -529,7 +529,7 @@ hsize_t diff_datasetid( hid_t did1, carry = 0; } /* i */ } /* elmtno */ - + H5Sclose(sm_space); /* free */ if (sm_buf1!=NULL) @@ -542,24 +542,24 @@ hsize_t diff_datasetid( hid_t did1, free(sm_buf2); sm_buf2=NULL; } - + } /* hyperslab read */ }/*cmp*/ - + /*------------------------------------------------------------------------- * compare attributes * the if condition refers to cases when the dataset is a referenced object *------------------------------------------------------------------------- */ - + if (obj1_name) nfound += diff_attr(did1,did2,obj1_name,obj2_name,options); - + /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - + /* free */ if (buf1!=NULL) { @@ -581,8 +581,8 @@ hsize_t diff_datasetid( hid_t did1, free(sm_buf2); sm_buf2=NULL; } - - H5E_BEGIN_TRY + + H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); @@ -591,12 +591,12 @@ hsize_t diff_datasetid( hid_t did1, H5Tclose(m_tid1); H5Tclose(m_tid2); } H5E_END_TRY; - + return nfound; - + error: options->err_stat=1; - + /* free */ if (buf1!=NULL) { @@ -618,9 +618,9 @@ error: free(sm_buf2); sm_buf2=NULL; } - + /* disable error reporting */ - H5E_BEGIN_TRY + H5E_BEGIN_TRY { H5Sclose(sid1); H5Sclose(sid2); @@ -630,7 +630,7 @@ error: H5Tclose(m_tid2); /* enable error reporting */ } H5E_END_TRY; - + return nfound; } @@ -668,21 +668,21 @@ int diff_can_type( hid_t f_tid1, /* file data type */ int maxdim_diff=0; /* maximum dimensions are different */ int dim_diff=0; /* current dimensions are different */ int i; - + /*------------------------------------------------------------------------- * check for the same class *------------------------------------------------------------------------- */ - + if ((tclass1=H5Tget_class(f_tid1)) < 0) return -1; - + if ((tclass2=H5Tget_class(f_tid2)) < 0) return -1; - + if ( tclass1 != tclass2 ) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { printf("Comparison not possible: <%s> is of class %s and <%s> is of class %s\n", obj1_name, get_class(tclass1), @@ -690,12 +690,12 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } return 0; } - + /*------------------------------------------------------------------------- * check for non supported classes *------------------------------------------------------------------------- */ - + assert(tclass1==tclass2); switch (tclass1) { @@ -709,21 +709,21 @@ int diff_can_type( hid_t f_tid1, /* file data type */ case H5T_ENUM: case H5T_VLEN: case H5T_REFERENCE: - + break; - + default: /*H5T_TIME */ if (options->m_verbose && obj1_name ) printf("Comparison not supported: <%s> and <%s> are of class %s\n", obj1_name,obj2_name,get_class(tclass2) ); return 0; } - + /*------------------------------------------------------------------------- * check for equal file datatype; warning only *------------------------------------------------------------------------- */ - + if ( (H5Tequal(f_tid1, f_tid2)==0) && options->m_verbose && obj1_name) { printf("Warning: different storage datatype\n"); @@ -734,15 +734,15 @@ int diff_can_type( hid_t f_tid1, /* file data type */ print_type(f_tid2); printf("\n"); } - + /*------------------------------------------------------------------------- * check for the same rank *------------------------------------------------------------------------- */ - + if ( rank1 != rank2 ) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); @@ -756,12 +756,12 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } return 0; } - + /*------------------------------------------------------------------------- * check for different dimensions *------------------------------------------------------------------------- */ - + assert(rank1==rank2); for ( i=0; i<rank1; i++) { @@ -773,19 +773,19 @@ int diff_can_type( hid_t f_tid1, /* file data type */ if ( dims1[i] != dims2[i] ) dim_diff=1; } - + /*------------------------------------------------------------------------- * current dimensions *------------------------------------------------------------------------- */ - + if (dim_diff==1) { - if (options->m_verbose && obj1_name) + if (options->m_verbose && obj1_name) { printf("Comparison not supported: <%s> has rank %d, dimensions ", obj1_name, rank1); print_dimensions(rank1,dims1); - if (maxdim1 && maxdim2) + if (maxdim1 && maxdim2) { printf(", max dimensions "); print_dimensions(rank1,maxdim1); @@ -798,14 +798,14 @@ int diff_can_type( hid_t f_tid1, /* file data type */ } return 0; } - + /*------------------------------------------------------------------------- * maximum dimensions; just give a warning *------------------------------------------------------------------------- */ if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name ) { - if (options->m_verbose) + if (options->m_verbose) { printf( "Warning: different maximum dimensions\n"); printf("<%s> has max dimensions ", obj1_name); @@ -816,7 +816,7 @@ int diff_can_type( hid_t f_tid1, /* file data type */ printf("\n"); } } - + return 1; } @@ -878,7 +878,7 @@ void print_sizes( const char *obj1, /*------------------------------------------------------------------------- * Function: print_size * - * Purpose: print dimensions + * Purpose: print dimensions * *------------------------------------------------------------------------- */ @@ -896,7 +896,7 @@ print_size (int rank, hsize_t *dims) } parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]); parallel_print("]\n" ); - + } #endif /* H5DIFF_DEBUG */ diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index 4cddbfb..f1e5f54 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -93,7 +93,7 @@ void parallel_print(const char* format, ...) /*------------------------------------------------------------------------- * Function: print_dimensions * - * Purpose: print dimensions + * Purpose: print dimensions * *------------------------------------------------------------------------- */ @@ -110,7 +110,7 @@ print_dimensions (int rank, hsize_t *dims) } parallel_print("%"H5_PRINTF_LL_WIDTH"u", (unsigned long_long)dims[rank-1]); parallel_print("]" ); - + } @@ -192,7 +192,7 @@ void print_type(hid_t type) printf("undefined integer"); } break; - + case H5T_FLOAT: if (H5Tequal(type, H5T_IEEE_F32BE)) { printf("H5T_IEEE_F32BE"); @@ -214,7 +214,7 @@ void print_type(hid_t type) printf("undefined float"); } break; - + }/*switch*/ } @@ -233,19 +233,19 @@ const char* diff_basename(const char *name) { size_t i; - + if (name==NULL) return NULL; - + /* Find the end of the base name */ i = strlen(name); while (i>0 && '/'==name[i-1]) --i; - + /* Skip backward over base name */ while (i>0 && '/'!=name[i-1]) --i; - + return(name+i); } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 120d433..71a2449 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -556,11 +556,11 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai *to the ctx->size_last_dim. */ /* binary dump */ - if(bin_output) + if(bin_output) { do_bin_output(stream, nelmts, type, _mem); } /* end if */ - else + else { /* setup */ HDmemset(&buffer, 0, sizeof(h5tools_str_t)); @@ -712,7 +712,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * * Select a hyperslab from the dataset DSET using the parameters * specified in SSET. Dump this out to STREAM. - * + * * Hyperslabs select "count" blocks of size "block", spaced "stride" elements * from each other, starting at coordinate "start". * @@ -727,22 +727,22 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai * * Algorithm * - * In a inner loop, the parameters from SSET are translated into temporary - * variables so that 1 row is printed at a time (getting the coordinate indices + * In a inner loop, the parameters from SSET are translated into temporary + * variables so that 1 row is printed at a time (getting the coordinate indices * at each row). - * We define the stride, count and block to be 1 in the row dimension to achieve - * this and advance until all points are printed. - * An outer loop for cases where dimensionality is greater than 2D is made. - * In each iteration, the 2D block is displayed in the inner loop. The remaining + * We define the stride, count and block to be 1 in the row dimension to achieve + * this and advance until all points are printed. + * An outer loop for cases where dimensionality is greater than 2D is made. + * In each iteration, the 2D block is displayed in the inner loop. The remaining * slower dimensions above the first 2 are incremented one at a time in the outer loop * * The element position is obtained from the matrix according to: - * Given an index I(z,y,x) its position from the beginning of an array + * Given an index I(z,y,x) its position from the beginning of an array * of sizes A(size_z, size_y,size_x) is given by - * Position of I(z,y,x) = index_z * size_y * size_x + * Position of I(z,y,x) = index_z * size_y * size_x * + index_y * size_x * + index_x - * + * *------------------------------------------------------------------------- */ static herr_t @@ -784,14 +784,14 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset hsize_t total_points = 1; /* to print */ hsize_t printed_points = 0; /* printed */ #endif - + ret = FAIL; /* be pessimistic */ f_space = H5Dget_space(dset); - + if (f_space == FAIL) goto done; - + /* * check that everything looks okay. the dimensionality must not be too * great and the dimensionality of the items selected for printing must @@ -838,7 +838,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset total_points *= sset->count[ i ] * sset->block[ i ];; } #endif - + /* initialize temporary start, count and maximum start */ @@ -857,55 +857,55 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset { max_start[ i ] = temp_start[ i ] + sset->count[ i ]; temp_count[ i ] = 1; - + } } - + /* offset loop */ for (n = 0; n < outer_count; n++) { - hsize_t row_counter = 0; + hsize_t row_counter = 0; /* number of read iterations in inner loop, read by rows, to match 2D display */ if (ctx.ndims > 1) { - + /* count is the number of iterations to display all the rows, the block size count times */ count = sset->count[ row_dim ] * sset->block[ row_dim ]; - + /* always 1 row_counter at a time, that is a block of size 1, 1 time */ - temp_count[ row_dim ] = 1; - temp_block[ row_dim ] = 1; - + temp_count[ row_dim ] = 1; + temp_block[ row_dim ] = 1; + /* advance 1 row_counter at a time */ if (sset->block[ row_dim ] > 1 ) temp_stride[ row_dim ] = 1; - - + + } /* for the 1D case */ else { count = 1; } - - + + size_row_block = sset->block[ row_dim ]; - + /* display loop */ - for (; count > 0; + for (; count > 0; temp_start[ row_dim ] += temp_stride[ row_dim ], count--) { - + /* jump rows if size of block exceeded cases where block > 1 only and stride > block */ - if ( size_row_block > 1 && + if ( size_row_block > 1 && row_counter == size_row_block && sset->stride[ row_dim ] > sset->block[ row_dim ] ) @@ -917,7 +917,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset temp_start[ row_dim ] += increase_rows; row_counter = 0; - + } row_counter++; @@ -930,32 +930,32 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset temp_count, temp_block); sm_nelmts = H5Sget_select_npoints(f_space); - + if (sm_nelmts == 0) { /* nothing to print */ ret = SUCCEED; goto done_close; } - + /* * determine the strip mine size and allocate a buffer. the strip mine is * a hyperslab whose size is manageable. */ sm_nbytes = p_type_nbytes = H5Tget_size(p_type); - + if (ctx.ndims > 0) for (i = ctx.ndims; i > 0; --i) { sm_size[i - 1] = MIN(total_size[i - 1], H5TOOLS_BUFSIZE / sm_nbytes); sm_nbytes *= sm_size[i - 1]; assert(sm_nbytes > 0); } - + assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ sm_buf = malloc((size_t)sm_nelmts * p_type_nbytes); sm_space = H5Screate_simple(1, &sm_nelmts, NULL); - + H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, &zero, NULL, &sm_nelmts, NULL); - + /* read the data */ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) { H5Sclose(f_space); @@ -963,43 +963,43 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset free(sm_buf); return FAIL; } - + /* print the data */ flags = START_OF_DATA; - + if (count == 1) flags |= END_OF_DATA; - + for (i = 0; i < ctx.ndims; i++) ctx.p_max_idx[i] = ctx.p_min_idx[i] + MIN(total_size[i], sm_size[i]); - + /* print array indices. get the lower bound of the hyperslab and calulate the element position at the start of hyperslab */ H5Sget_select_bounds(f_space,low,high); elmtno=0; - for (i = 0; i < (size_t)ctx.ndims-1; i++) + for (i = 0; i < (size_t)ctx.ndims-1; i++) { hsize_t offset = 1; /* accumulation of the previous dimensions */ - for (j = i+1; j < (size_t)ctx.ndims; j++) + for (j = i+1; j < (size_t)ctx.ndims; j++) offset *= total_size[j]; elmtno+= low[i] * offset; } elmtno+= low[ctx.ndims - 1]; - + /* initialize the current stripmine position; this is necessary to print the array indices */ ctx.sm_pos = elmtno; - + h5tools_dump_simple_data(stream, info, dset, &ctx, flags, sm_nelmts, p_type, sm_buf); free(sm_buf); - + /* we need to jump to next line and update the index */ ctx.need_prefix = 1; - + ctx.continuation++; - - + + #if defined (SANITY_CHECK) printed_points += sm_nelmts; #endif @@ -1011,14 +1011,14 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset { /* dimension for start */ current_outer_dim = (ctx.ndims - 2) -1; - + /* set start to original from current_outer_dim up */ for (i = current_outer_dim + 1; i < ctx.ndims; i++) { temp_start[ i ] = sset->start[ i ]; } - + /* increment start dimension */ do { @@ -1037,9 +1037,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset } } while (current_outer_dim >= 0 && reset_dim); - + } /* ctx.ndims > 1 */ - + } /* outer_count */ #if defined (SANITY_CHECK) @@ -1053,9 +1053,9 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset putc('\n', stream); fputs(OPT(info->line_sep, ""), stream); } - + ret = SUCCEED; - + done_close: H5Sclose(f_space); done: @@ -1128,7 +1128,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, hid_t dset, ctx.indent_level = indentlevel; ctx.need_prefix = 1; ctx.ndims = H5Sget_simple_extent_ndims(f_space); - + if ((size_t)ctx.ndims > NELMTS(sm_size)) { H5Sclose(f_space); return FAIL; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index dad73e7..fb24f76 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -40,7 +40,7 @@ #define H5TOOLS_BUFSIZE (1024 * 1024) #else #define H5TOOLS_BUFSIZE (1024) -#endif +#endif /* * Maximum size used in a call to malloc diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index 80839ce..5d42307 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -338,7 +338,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)ctx->pos[i]); - + } } else { /* Scalar */ @@ -851,7 +851,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai obj = H5Rdereference(container, H5R_DATASET_REGION, vp); region = H5Rget_region(container, H5R_DATASET_REGION, vp); - + /* get name of the dataset the region reference points to using H5Rget_name */ H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*)ref_name, 1024); h5tools_str_append(str, info->dset_format, ref_name); diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index b4e6d08..bbd1b8d 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -75,7 +75,7 @@ h5tools_get_little_endian_type(hid_t tid) size = H5Tget_size(tid); sign = H5Tget_sign(tid); - switch( type_class ) + switch( type_class ) { case H5T_INTEGER: { @@ -88,7 +88,7 @@ h5tools_get_little_endian_type(hid_t tid) else if ( size == 8 && sign == H5T_SGN_2) p_type=H5Tcopy(H5T_STD_I64LE); else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8LE); + p_type=H5Tcopy(H5T_STD_U8LE); else if ( size == 2 && sign == H5T_SGN_NONE) p_type=H5Tcopy(H5T_STD_U16LE); else if ( size == 4 && sign == H5T_SGN_NONE) @@ -97,14 +97,14 @@ h5tools_get_little_endian_type(hid_t tid) p_type=H5Tcopy(H5T_STD_U64LE); } break; - + case H5T_FLOAT: if ( size == 4) p_type=H5Tcopy(H5T_IEEE_F32LE); else if ( size == 8) p_type=H5Tcopy(H5T_IEEE_F64LE); break; - + case H5T_TIME: case H5T_BITFIELD: case H5T_OPAQUE: @@ -115,10 +115,10 @@ h5tools_get_little_endian_type(hid_t tid) case H5T_VLEN: case H5T_ARRAY: break; - + default: break; - + } return(p_type); @@ -152,7 +152,7 @@ h5tools_get_big_endian_type(hid_t tid) size = H5Tget_size(tid); sign = H5Tget_sign(tid); - switch( type_class ) + switch( type_class ) { case H5T_INTEGER: { @@ -165,7 +165,7 @@ h5tools_get_big_endian_type(hid_t tid) else if ( size == 8 && sign == H5T_SGN_2) p_type=H5Tcopy(H5T_STD_I64BE); else if ( size == 1 && sign == H5T_SGN_NONE) - p_type=H5Tcopy(H5T_STD_U8BE); + p_type=H5Tcopy(H5T_STD_U8BE); else if ( size == 2 && sign == H5T_SGN_NONE) p_type=H5Tcopy(H5T_STD_U16BE); else if ( size == 4 && sign == H5T_SGN_NONE) @@ -174,14 +174,14 @@ h5tools_get_big_endian_type(hid_t tid) p_type=H5Tcopy(H5T_STD_U64BE); } break; - + case H5T_FLOAT: if ( size == 4) p_type=H5Tcopy(H5T_IEEE_F32BE); else if ( size == 8) p_type=H5Tcopy(H5T_IEEE_F64BE); break; - + case H5T_TIME: case H5T_BITFIELD: case H5T_OPAQUE: @@ -192,13 +192,13 @@ h5tools_get_big_endian_type(hid_t tid) case H5T_VLEN: case H5T_ARRAY: break; - + default: break; - + } - + return(p_type); } diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index fbb6163..1452a64 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -303,22 +303,22 @@ main(int argc, const char *argv[]) error_msg(progname, "Could not close link creation property list\n"); leave(EXIT_FAILURE); } /* end if */ - + /* Close file */ if(H5Fclose(fid) < 0) { error_msg(progname, "Could not close output file '%s'??\n", params.fname); leave(EXIT_FAILURE); } /* end if */ - + /* Close file access property list */ if(H5Pclose(fapl_id) < 0) { error_msg(progname, "Could not close file access property list\n"); leave(EXIT_FAILURE); } /* end if */ - + /* Shut down h5tools lib */ h5tools_close(); - + return 0; } /* end main() */ |